aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-15 01:44:51 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-15 01:44:51 -0400
commit43d2548bb2ef7e6d753f91468a746784041e522d (patch)
tree77d13fcd48fd998393abb825ec36e2b732684a73 /arch
parent585583d95c5660973bc0cf64add517b040acd8a4 (diff)
parent85082fd7cbe3173198aac0eb5e85ab1edcc6352c (diff)
Merge commit '85082fd7cbe3173198aac0eb5e85ab1edcc6352c' into test-build
Manual fixup of: arch/powerpc/Kconfig
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig90
-rw-r--r--arch/arm/Makefile8
-rw-r--r--arch/arm/boot/compressed/Makefile6
-rw-r--r--arch/arm/boot/compressed/head.S4
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/rtctime.c434
-rw-r--r--arch/arm/common/sharpsl_pm.c3
-rw-r--r--arch/arm/configs/at91cap9adk_defconfig82
-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_defconfig (renamed from arch/arm/configs/em_x270_defconfig)647
-rw-r--r--arch/arm/configs/at91sam9rlek_defconfig1
-rw-r--r--arch/arm/configs/ateb9200_defconfig1
-rw-r--r--arch/arm/configs/collie_defconfig1
-rw-r--r--arch/arm/configs/corgi_defconfig1
-rw-r--r--arch/arm/configs/ecbat91_defconfig1
-rw-r--r--arch/arm/configs/ep93xx_defconfig1
-rw-r--r--arch/arm/configs/eseries_pxa_defconfig1
-rw-r--r--arch/arm/configs/imx27ads_defconfig826
-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_defconfig9
-rw-r--r--arch/arm/configs/kafa_defconfig1
-rw-r--r--arch/arm/configs/kb9202_defconfig1
-rw-r--r--arch/arm/configs/kirkwood_defconfig1426
-rw-r--r--arch/arm/configs/ks8695_defconfig1
-rw-r--r--arch/arm/configs/loki_defconfig1147
-rw-r--r--arch/arm/configs/lpd270_defconfig1
-rw-r--r--arch/arm/configs/lpd7a404_defconfig1
-rw-r--r--arch/arm/configs/mv78xx0_defconfig1445
-rw-r--r--arch/arm/configs/mx31ads_defconfig839
-rw-r--r--arch/arm/configs/mx31litekit_defconfig1100
-rw-r--r--arch/arm/configs/netx_defconfig1
-rw-r--r--arch/arm/configs/onearm_defconfig1
-rw-r--r--arch/arm/configs/orion5x_defconfig319
-rw-r--r--arch/arm/configs/pcm037_defconfig748
-rw-r--r--arch/arm/configs/pcm038_defconfig1008
-rw-r--r--arch/arm/configs/picotux200_defconfig1
-rw-r--r--arch/arm/configs/pnx4008_defconfig1
-rw-r--r--arch/arm/configs/qil-a9260_defconfig1256
-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/s3c2410_defconfig1043
-rw-r--r--arch/arm/configs/sam9_l9260_defconfig1
-rw-r--r--arch/arm/configs/spitz_defconfig1
-rw-r--r--arch/arm/configs/tct_hammer_defconfig1
-rw-r--r--arch/arm/configs/trizeps4_defconfig1
-rw-r--r--arch/arm/configs/usb-a9260_defconfig1142
-rw-r--r--arch/arm/configs/usb-a9263_defconfig1134
-rw-r--r--arch/arm/configs/versatile_defconfig1
-rw-r--r--arch/arm/configs/xm_x270_defconfig (renamed from arch/arm/configs/cm_x270_defconfig)861
-rw-r--r--arch/arm/kernel/Makefile5
-rw-r--r--arch/arm/kernel/armksyms.c5
-rw-r--r--arch/arm/kernel/atags.c83
-rw-r--r--arch/arm/kernel/ecard.c13
-rw-r--r--arch/arm/kernel/ecard.h13
-rw-r--r--arch/arm/kernel/entry-common.S51
-rw-r--r--arch/arm/kernel/ftrace.c116
-rw-r--r--arch/arm/kernel/kprobes.c2
-rw-r--r--arch/arm/kernel/process.c4
-rw-r--r--arch/arm/kernel/stacktrace.c34
-rw-r--r--arch/arm/kernel/time.c120
-rw-r--r--arch/arm/lib/copy_template.S12
-rw-r--r--arch/arm/lib/memmove.S14
-rw-r--r--arch/arm/lib/memset.S46
-rw-r--r--arch/arm/lib/memzero.S44
-rw-r--r--arch/arm/mach-at91/Kconfig56
-rw-r--r--arch/arm/mach-at91/Makefile8
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c99
-rw-r--r--arch/arm/mach-at91/at91sam9260.c16
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c44
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c12
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c4
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c107
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c9
-rw-r--r--arch/arm/mach-at91/board-carmeva.c23
-rw-r--r--arch/arm/mach-at91/board-csb637.c4
-rw-r--r--arch/arm/mach-at91/board-dk.c25
-rw-r--r--arch/arm/mach-at91/board-eb9200.c26
-rw-r--r--arch/arm/mach-at91/board-ek.c25
-rw-r--r--arch/arm/mach-at91/board-kb9202.c29
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c255
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c218
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c10
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c215
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c230
-rwxr-xr-xarch/arm/mach-at91/board-yl-9200.c853
-rw-r--r--arch/arm/mach-at91/clock.c64
-rw-r--r--arch/arm/mach-at91/pm.c2
-rw-r--r--arch/arm/mach-ep93xx/clock.c5
-rw-r--r--arch/arm/mach-footbridge/Makefile2
-rw-r--r--arch/arm/mach-footbridge/co285.c39
-rw-r--r--arch/arm/mach-footbridge/common.c21
-rw-r--r--arch/arm/mach-footbridge/ebsa285-leds.c2
-rw-r--r--arch/arm/mach-footbridge/time.c3
-rw-r--r--arch/arm/mach-imx/Makefile2
-rw-r--r--arch/arm/mach-imx/clock.c205
-rw-r--r--arch/arm/mach-imx/cpufreq.c20
-rw-r--r--arch/arm/mach-imx/dma.c13
-rw-r--r--arch/arm/mach-imx/generic.c76
-rw-r--r--arch/arm/mach-imx/mx1ads.c10
-rw-r--r--arch/arm/mach-imx/time.c23
-rw-r--r--arch/arm/mach-integrator/Makefile2
-rw-r--r--arch/arm/mach-integrator/time.c223
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig9
-rw-r--r--arch/arm/mach-ixp4xx/Makefile2
-rw-r--r--arch/arm/mach-ixp4xx/common.c4
-rw-r--r--arch/arm/mach-ixp4xx/fsg-pci.c71
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c276
-rw-r--r--arch/arm/mach-kirkwood/Kconfig25
-rw-r--r--arch/arm/mach-kirkwood/Makefile5
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot3
-rw-r--r--arch/arm/mach-kirkwood/addr-map.c139
-rw-r--r--arch/arm/mach-kirkwood/common.c331
-rw-r--r--arch/arm/mach-kirkwood/common.h42
-rw-r--r--arch/arm/mach-kirkwood/db88f6281-bp-setup.c68
-rw-r--r--arch/arm/mach-kirkwood/irq.c22
-rw-r--r--arch/arm/mach-kirkwood/pcie.c180
-rw-r--r--arch/arm/mach-kirkwood/rd88f6192-nas-setup.c69
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c113
-rw-r--r--arch/arm/mach-loki/Kconfig13
-rw-r--r--arch/arm/mach-loki/Makefile3
-rw-r--r--arch/arm/mach-loki/Makefile.boot3
-rw-r--r--arch/arm/mach-loki/addr-map.c121
-rw-r--r--arch/arm/mach-loki/common.c305
-rw-r--r--arch/arm/mach-loki/common.h36
-rw-r--r--arch/arm/mach-loki/irq.c21
-rw-r--r--arch/arm/mach-loki/lb88rc8480-setup.c100
-rw-r--r--arch/arm/mach-mv78xx0/Kconfig13
-rw-r--r--arch/arm/mach-mv78xx0/Makefile2
-rw-r--r--arch/arm/mach-mv78xx0/Makefile.boot3
-rw-r--r--arch/arm/mach-mv78xx0/addr-map.c156
-rw-r--r--arch/arm/mach-mv78xx0/common.c754
-rw-r--r--arch/arm/mach-mv78xx0/common.h49
-rw-r--r--arch/arm/mach-mv78xx0/db78x00-bp-setup.c94
-rw-r--r--arch/arm/mach-mv78xx0/irq.c22
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c312
-rw-r--r--arch/arm/mach-mx2/Kconfig39
-rw-r--r--arch/arm/mach-mx2/Makefile14
-rw-r--r--arch/arm/mach-mx2/Makefile.boot3
-rw-r--r--arch/arm/mach-mx2/clock_imx27.c1626
-rw-r--r--arch/arm/mach-mx2/cpu_imx27.c63
-rw-r--r--arch/arm/mach-mx2/crm_regs.h273
-rw-r--r--arch/arm/mach-mx2/devices.c231
-rw-r--r--arch/arm/mach-mx2/generic.c74
-rw-r--r--arch/arm/mach-mx2/mx27ads.c304
-rw-r--r--arch/arm/mach-mx2/pcm038.c204
-rw-r--r--arch/arm/mach-mx2/pcm970-baseboard.c32
-rw-r--r--arch/arm/mach-mx2/serial.c177
-rw-r--r--arch/arm/mach-mx2/system.c63
-rw-r--r--arch/arm/mach-mx3/Kconfig13
-rw-r--r--arch/arm/mach-mx3/Makefile4
-rw-r--r--arch/arm/mach-mx3/clock.c1147
-rw-r--r--arch/arm/mach-mx3/crm_regs.h401
-rw-r--r--arch/arm/mach-mx3/devices.c180
-rw-r--r--arch/arm/mach-mx3/iomux.c111
-rw-r--r--arch/arm/mach-mx3/mx31ads.c14
-rw-r--r--arch/arm/mach-mx3/mx31lite.c107
-rw-r--r--arch/arm/mach-mx3/pcm037.c130
-rw-r--r--arch/arm/mach-mx3/time.c148
-rw-r--r--arch/arm/mach-omap1/Makefile4
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c17
-rw-r--r--arch/arm/mach-omap1/board-osk.c18
-rw-r--r--arch/arm/mach-omap1/fpga.c10
-rw-r--r--arch/arm/mach-omap1/mcbsp.c280
-rw-r--r--arch/arm/mach-omap1/pm.c7
-rw-r--r--arch/arm/mach-omap1/sram.S (renamed from arch/arm/plat-omap/sram-fn.S)6
-rw-r--r--arch/arm/mach-omap2/Makefile8
-rw-r--r--arch/arm/mach-omap2/clock.c201
-rw-r--r--arch/arm/mach-omap2/clock.h6
-rw-r--r--arch/arm/mach-omap2/clock24xx.c12
-rw-r--r--arch/arm/mach-omap2/clock24xx.h47
-rw-r--r--arch/arm/mach-omap2/clock34xx.c299
-rw-r--r--arch/arm/mach-omap2/clock34xx.h147
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h18
-rw-r--r--arch/arm/mach-omap2/cm.h15
-rw-r--r--arch/arm/mach-omap2/control.c24
-rw-r--r--arch/arm/mach-omap2/id.c195
-rw-r--r--arch/arm/mach-omap2/mcbsp.c208
-rw-r--r--arch/arm/mach-omap2/memory.c11
-rw-r--r--arch/arm/mach-omap2/mux.c2
-rw-r--r--arch/arm/mach-omap2/pm.c7
-rw-r--r--arch/arm/mach-omap2/prcm-common.h1
-rw-r--r--arch/arm/mach-omap2/prcm.c98
-rw-r--r--arch/arm/mach-omap2/prm.h30
-rw-r--r--arch/arm/mach-omap2/sdrc.h10
-rw-r--r--arch/arm/mach-omap2/sram242x.S (renamed from arch/arm/mach-omap2/sram-fn.S)105
-rw-r--r--arch/arm/mach-omap2/sram243x.S321
-rw-r--r--arch/arm/mach-omap2/timer-gp.c9
-rw-r--r--arch/arm/mach-orion5x/Kconfig48
-rw-r--r--arch/arm/mach-orion5x/Makefile12
-rw-r--r--arch/arm/mach-orion5x/addr-map.c45
-rw-r--r--arch/arm/mach-orion5x/common.c307
-rw-r--r--arch/arm/mach-orion5x/common.h38
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c82
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c125
-rw-r--r--arch/arm/mach-orion5x/gpio.c47
-rw-r--r--arch/arm/mach-orion5x/irq.c18
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c224
-rw-r--r--arch/arm/mach-orion5x/mpp.c163
-rw-r--r--arch/arm/mach-orion5x/mpp.h74
-rw-r--r--arch/arm/mach-orion5x/mss2-setup.c270
-rw-r--r--arch/arm/mach-orion5x/mv2120-setup.c239
-rw-r--r--arch/arm/mach-orion5x/pci.c86
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c161
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c172
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c79
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c299
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c273
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c277
-rw-r--r--arch/arm/mach-orion5x/tsx09-common.c133
-rw-r--r--arch/arm/mach-orion5x/tsx09-common.h20
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c164
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c173
-rw-r--r--arch/arm/mach-pxa/Kconfig59
-rw-r--r--arch/arm/mach-pxa/Makefile5
-rw-r--r--arch/arm/mach-pxa/clock.c5
-rw-r--r--arch/arm/mach-pxa/clock.h12
-rw-r--r--arch/arm/mach-pxa/cm-x270-pci.c26
-rw-r--r--arch/arm/mach-pxa/cm-x270.c9
-rw-r--r--arch/arm/mach-pxa/corgi.c1
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c7
-rw-r--r--arch/arm/mach-pxa/devices.c116
-rw-r--r--arch/arm/mach-pxa/devices.h9
-rw-r--r--arch/arm/mach-pxa/em-x270.c10
-rw-r--r--arch/arm/mach-pxa/generic.c17
-rw-r--r--arch/arm/mach-pxa/irq.c1
-rw-r--r--arch/arm/mach-pxa/lpd270.c55
-rw-r--r--arch/arm/mach-pxa/lubbock.c8
-rw-r--r--arch/arm/mach-pxa/magician.c69
-rw-r--r--arch/arm/mach-pxa/mainstone.c71
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c1
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c131
-rw-r--r--arch/arm/mach-pxa/poodle.c1
-rw-r--r--arch/arm/mach-pxa/pwm.c319
-rw-r--r--arch/arm/mach-pxa/pxa25x.c19
-rw-r--r--arch/arm/mach-pxa/pxa27x.c12
-rw-r--r--arch/arm/mach-pxa/pxa2xx.c46
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c8
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c7
-rw-r--r--arch/arm/mach-pxa/standby.S83
-rw-r--r--arch/arm/mach-pxa/trizeps4.c12
-rw-r--r--arch/arm/mach-pxa/zylonite.c28
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c4
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c2
-rw-r--r--arch/arm/mach-s3c2410/Kconfig21
-rw-r--r--arch/arm/mach-s3c2410/Makefile8
-rw-r--r--arch/arm/mach-s3c2410/bast-ide.c112
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c59
-rw-r--r--arch/arm/mach-s3c2410/mach-n30.c474
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c72
-rw-r--r--arch/arm/mach-s3c2410/nor-simtec.c86
-rw-r--r--arch/arm/mach-s3c2410/nor-simtec.h14
-rw-r--r--arch/arm/mach-s3c2412/Kconfig10
-rw-r--r--arch/arm/mach-s3c2412/Makefile1
-rw-r--r--arch/arm/mach-s3c2412/clock.c13
-rw-r--r--arch/arm/mach-s3c2412/mach-jive.c687
-rw-r--r--arch/arm/mach-s3c2440/Kconfig6
-rw-r--r--arch/arm/mach-s3c2440/Makefile1
-rw-r--r--arch/arm/mach-s3c2440/mach-anubis.c41
-rw-r--r--arch/arm/mach-s3c2440/mach-at2440evb.c198
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c15
-rw-r--r--arch/arm/mach-s3c2443/clock.c91
-rw-r--r--arch/arm/mm/Kconfig34
-rw-r--r--arch/arm/mm/Makefile2
-rw-r--r--arch/arm/mm/cache-feroceon-l2.c318
-rw-r--r--arch/arm/mm/fault-armv.c4
-rw-r--r--arch/arm/mm/flush.c2
-rw-r--r--arch/arm/mm/proc-feroceon.S242
-rw-r--r--arch/arm/plat-iop/gpio.c43
-rw-r--r--arch/arm/plat-mxc/Kconfig8
-rw-r--r--arch/arm/plat-mxc/Makefile4
-rw-r--r--arch/arm/plat-mxc/clock.c331
-rw-r--r--arch/arm/plat-mxc/gpio.c253
-rw-r--r--arch/arm/plat-mxc/iomux-mx1-mx2.c156
-rw-r--r--arch/arm/plat-mxc/irq.c70
-rw-r--r--arch/arm/plat-mxc/time.c228
-rw-r--r--arch/arm/plat-omap/Makefile2
-rw-r--r--arch/arm/plat-omap/clock.c128
-rw-r--r--arch/arm/plat-omap/common.c59
-rw-r--r--arch/arm/plat-omap/devices.c48
-rw-r--r--arch/arm/plat-omap/dma.c764
-rw-r--r--arch/arm/plat-omap/dmtimer.c212
-rw-r--r--arch/arm/plat-omap/mcbsp.c767
-rw-r--r--arch/arm/plat-omap/sram.c211
-rw-r--r--arch/arm/plat-omap/usb.c131
-rw-r--r--arch/arm/plat-orion/irq.c3
-rw-r--r--arch/arm/plat-orion/pcie.c6
-rw-r--r--arch/arm/plat-orion/time.c6
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig8
-rw-r--r--arch/arm/plat-s3c24xx/Makefile3
-rw-r--r--arch/arm/plat-s3c24xx/devs.c100
-rw-r--r--arch/arm/plat-s3c24xx/gpiolib.c259
-rw-r--r--arch/arm/plat-s3c24xx/pwm-clock.c437
-rw-r--r--arch/arm/plat-s3c24xx/pwm.c402
-rw-r--r--arch/arm/tools/mach-types126
-rw-r--r--arch/avr32/Kconfig9
-rw-r--r--arch/avr32/boards/atngw100/setup.c29
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c8
-rw-r--r--arch/avr32/boards/atstk1000/atstk1003.c7
-rw-r--r--arch/avr32/boards/atstk1000/atstk1004.c9
-rw-r--r--arch/avr32/kernel/entry-avr32b.S88
-rw-r--r--arch/avr32/kernel/signal.c3
-rw-r--r--arch/avr32/kernel/time.c14
-rw-r--r--arch/avr32/kernel/vmlinux.lds.S14
-rw-r--r--arch/avr32/lib/io-readsb.S2
-rw-r--r--arch/avr32/mach-at32ap/Makefile7
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c252
-rw-r--r--arch/avr32/mach-at32ap/intc.c80
-rw-r--r--arch/avr32/mach-at32ap/pdc.c (renamed from arch/avr32/mach-at32ap/at32ap.c)8
-rw-r--r--arch/avr32/mach-at32ap/pio.c2
-rw-r--r--arch/avr32/mach-at32ap/pio.h2
-rw-r--r--arch/avr32/mach-at32ap/pm-at32ap700x.S108
-rw-r--r--arch/avr32/mach-at32ap/pm.c245
-rw-r--r--arch/avr32/mach-at32ap/sdramc.h76
-rw-r--r--arch/avr32/mm/init.c22
-rw-r--r--arch/avr32/mm/tlb.c175
-rw-r--r--arch/blackfin/mach-bf561/coreb.c1
-rw-r--r--arch/cris/arch-v10/drivers/eeprom.c4
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c3
-rw-r--r--arch/cris/arch-v10/drivers/i2c.c2
-rw-r--r--arch/cris/arch-v10/drivers/sync_serial.c34
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c3
-rw-r--r--arch/cris/arch-v32/drivers/i2c.c2
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/gpio.c4
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/gpio.c5
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c33
-rw-r--r--arch/m68k/bvme6000/rtc.c7
-rw-r--r--arch/m68k/mvme16x/rtc.c4
-rw-r--r--arch/mips/basler/excite/excite_iodev.c9
-rw-r--r--arch/mips/kernel/rtlx.c7
-rw-r--r--arch/mips/kernel/vpe.c12
-rw-r--r--arch/mips/sibyte/common/sb_tbprof.c25
-rw-r--r--arch/parisc/kernel/perf.c4
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S1
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/kernel/Makefile14
-rw-r--r--arch/powerpc/kernel/entry_32.S127
-rw-r--r--arch/powerpc/kernel/entry_64.S65
-rw-r--r--arch/powerpc/kernel/ftrace.c154
-rw-r--r--arch/powerpc/kernel/io.c3
-rw-r--r--arch/powerpc/kernel/irq.c6
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c5
-rw-r--r--arch/powerpc/kernel/setup_32.c6
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S2
-rw-r--r--arch/powerpc/platforms/powermac/Makefile5
-rw-r--r--arch/s390/Kconfig21
-rw-r--r--arch/s390/appldata/appldata.h10
-rw-r--r--arch/s390/appldata/appldata_base.c41
-rw-r--r--arch/s390/appldata/appldata_mem.c43
-rw-r--r--arch/s390/appldata/appldata_net_sum.c39
-rw-r--r--arch/s390/appldata/appldata_os.c57
-rw-r--r--arch/s390/crypto/crypt_s390.h4
-rw-r--r--arch/s390/crypto/prng.c7
-rw-r--r--arch/s390/hypfs/inode.c29
-rw-r--r--arch/s390/kernel/Makefile9
-rw-r--r--arch/s390/kernel/binfmt_elf32.c214
-rw-r--r--arch/s390/kernel/compat_ptrace.h4
-rw-r--r--arch/s390/kernel/debug.c9
-rw-r--r--arch/s390/kernel/early.c211
-rw-r--r--arch/s390/kernel/ipl.c462
-rw-r--r--arch/s390/kernel/kprobes.c4
-rw-r--r--arch/s390/kernel/machine_kexec.c1
-rw-r--r--arch/s390/kernel/mem_detect.c100
-rw-r--r--arch/s390/kernel/process.c32
-rw-r--r--arch/s390/kernel/ptrace.c363
-rw-r--r--arch/s390/kernel/setup.c51
-rw-r--r--arch/s390/kernel/time.c634
-rw-r--r--arch/s390/kernel/topology.c2
-rw-r--r--arch/s390/kernel/vmlinux.lds.S1
-rw-r--r--arch/s390/kernel/vtime.c81
-rw-r--r--arch/s390/mm/init.c19
-rw-r--r--arch/sh/boards/landisk/gio.c10
-rw-r--r--arch/sh/configs/landisk_defconfig1
-rw-r--r--arch/sh/configs/lboxre2_defconfig1
-rw-r--r--arch/sh/configs/se7705_defconfig1
-rw-r--r--arch/sh/configs/se7712_defconfig1
-rw-r--r--arch/sh/configs/se7750_defconfig1
-rw-r--r--arch/sh/kernel/vmlinux_32.lds.S1
-rw-r--r--arch/sh/kernel/vmlinux_64.lds.S1
-rw-r--r--arch/sparc/kernel/apc.c2
-rw-r--r--arch/sparc64/Kconfig2
-rw-r--r--arch/sparc64/Kconfig.debug2
-rw-r--r--arch/sparc64/kernel/Makefile1
-rw-r--r--arch/sparc64/kernel/ftrace.c94
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c4
-rw-r--r--arch/sparc64/kernel/time.c7
-rw-r--r--arch/sparc64/lib/mcount.S58
-rw-r--r--arch/um/drivers/harddog_kern.c3
-rw-r--r--arch/um/drivers/mmapper_kern.c2
-rw-r--r--arch/um/drivers/random.c3
-rw-r--r--arch/x86/Kconfig282
-rw-r--r--arch/x86/Kconfig.cpu6
-rw-r--r--arch/x86/Kconfig.debug46
-rw-r--r--arch/x86/Makefile27
-rw-r--r--arch/x86/boot/a20.c5
-rw-r--r--arch/x86/boot/compressed/head_64.S5
-rw-r--r--arch/x86/boot/compressed/misc.c59
-rw-r--r--arch/x86/boot/compressed/relocs.c198
-rw-r--r--arch/x86/boot/cpu.c2
-rw-r--r--arch/x86/boot/main.c4
-rw-r--r--arch/x86/boot/memory.c3
-rw-r--r--arch/x86/boot/pmjump.S4
-rw-r--r--arch/x86/boot/video-vga.c3
-rw-r--r--arch/x86/configs/i386_defconfig1711
-rw-r--r--arch/x86/configs/x86_64_defconfig1735
-rw-r--r--arch/x86/ia32/ia32entry.S68
-rw-r--r--arch/x86/kernel/Makefile29
-rw-r--r--arch/x86/kernel/acpi/boot.c442
-rw-r--r--arch/x86/kernel/acpi/sleep.c4
-rw-r--r--arch/x86/kernel/alternative.c22
-rw-r--r--arch/x86/kernel/amd_iommu.c962
-rw-r--r--arch/x86/kernel/amd_iommu_init.c875
-rw-r--r--arch/x86/kernel/aperture_64.c313
-rw-r--r--arch/x86/kernel/apic_32.c123
-rw-r--r--arch/x86/kernel/apic_64.c68
-rw-r--r--arch/x86/kernel/apm_32.c29
-rw-r--r--arch/x86/kernel/asm-offsets_32.c2
-rw-r--r--arch/x86/kernel/asm-offsets_64.c7
-rw-r--r--arch/x86/kernel/cpu/Makefile4
-rw-r--r--arch/x86/kernel/cpu/addon_cpuid_features.c17
-rw-r--r--arch/x86/kernel/cpu/amd.c42
-rw-r--r--arch/x86/kernel/cpu/amd_64.c222
-rw-r--r--arch/x86/kernel/cpu/bugs.c27
-rw-r--r--arch/x86/kernel/cpu/bugs_64.c (renamed from arch/x86/kernel/bugs_64.c)0
-rw-r--r--arch/x86/kernel/cpu/centaur_64.c35
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/cpu/common_64.c681
-rw-r--r--arch/x86/kernel/cpu/cpu.h5
-rw-r--r--arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c44
-rw-r--r--arch/x86/kernel/cpu/intel.c4
-rw-r--r--arch/x86/kernel/cpu/intel_64.c95
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c1
-rw-r--r--arch/x86/kernel/cpu/mcheck/k7.c36
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c28
-rw-r--r--arch/x86/kernel/cpu/mcheck/p4.c90
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c38
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c901
-rw-r--r--arch/x86/kernel/cpu/mtrr/mtrr.h3
-rw-r--r--arch/x86/kernel/cpu/perfctr-watchdog.c206
-rw-r--r--arch/x86/kernel/cpuid.c25
-rw-r--r--arch/x86/kernel/e820.c1390
-rw-r--r--arch/x86/kernel/e820_32.c775
-rw-r--r--arch/x86/kernel/e820_64.c952
-rw-r--r--arch/x86/kernel/early-quirks.c15
-rw-r--r--arch/x86/kernel/early_printk.c2
-rw-r--r--arch/x86/kernel/efi.c67
-rw-r--r--arch/x86/kernel/efi_64.c8
-rw-r--r--arch/x86/kernel/entry_32.S83
-rw-r--r--arch/x86/kernel/entry_64.S167
-rw-r--r--arch/x86/kernel/ftrace.c141
-rw-r--r--arch/x86/kernel/genapic_64.c2
-rw-r--r--arch/x86/kernel/genx2apic_uv_x.c214
-rw-r--r--arch/x86/kernel/head.c55
-rw-r--r--arch/x86/kernel/head32.c27
-rw-r--r--arch/x86/kernel/head64.c96
-rw-r--r--arch/x86/kernel/head_32.S13
-rw-r--r--arch/x86/kernel/head_64.S99
-rw-r--r--arch/x86/kernel/hpet.c63
-rw-r--r--arch/x86/kernel/i386_ksyms_32.c9
-rw-r--r--arch/x86/kernel/i387.c4
-rw-r--r--arch/x86/kernel/i8259.c (renamed from arch/x86/kernel/i8259_32.c)136
-rw-r--r--arch/x86/kernel/i8259_64.c512
-rw-r--r--arch/x86/kernel/io_apic_32.c676
-rw-r--r--arch/x86/kernel/io_apic_64.c280
-rw-r--r--arch/x86/kernel/ipi.c1
-rw-r--r--arch/x86/kernel/irq_32.c254
-rw-r--r--arch/x86/kernel/irq_64.c28
-rw-r--r--arch/x86/kernel/irqinit_32.c114
-rw-r--r--arch/x86/kernel/irqinit_64.c217
-rw-r--r--arch/x86/kernel/ldt.c6
-rw-r--r--arch/x86/kernel/machine_kexec_32.c8
-rw-r--r--arch/x86/kernel/machine_kexec_64.c6
-rw-r--r--arch/x86/kernel/microcode.c31
-rw-r--r--arch/x86/kernel/mmconf-fam10h_64.c1
-rw-r--r--arch/x86/kernel/mpparse.c847
-rw-r--r--arch/x86/kernel/msr.c16
-rw-r--r--arch/x86/kernel/nmi.c (renamed from arch/x86/kernel/nmi_32.c)227
-rw-r--r--arch/x86/kernel/nmi_64.c482
-rw-r--r--arch/x86/kernel/numaq_32.c32
-rw-r--r--arch/x86/kernel/paravirt.c36
-rw-r--r--arch/x86/kernel/paravirt_patch_32.c4
-rw-r--r--arch/x86/kernel/paravirt_patch_64.c9
-rw-r--r--arch/x86/kernel/pci-calgary_64.c4
-rw-r--r--arch/x86/kernel/pci-dma.c22
-rw-r--r--arch/x86/kernel/pci-gart_64.c95
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c2
-rw-r--r--arch/x86/kernel/probe_roms_32.c166
-rw-r--r--arch/x86/kernel/process.c190
-rw-r--r--arch/x86/kernel/process_32.c68
-rw-r--r--arch/x86/kernel/process_64.c88
-rw-r--r--arch/x86/kernel/ptrace.c4
-rw-r--r--arch/x86/kernel/quirks.c58
-rw-r--r--arch/x86/kernel/reboot.c18
-rw-r--r--arch/x86/kernel/reboot_fixups_32.c4
-rw-r--r--arch/x86/kernel/setup.c924
-rw-r--r--arch/x86/kernel/setup64.c287
-rw-r--r--arch/x86/kernel/setup_32.c964
-rw-r--r--arch/x86/kernel/setup_64.c1194
-rw-r--r--arch/x86/kernel/setup_percpu.c399
-rw-r--r--arch/x86/kernel/smpboot.c212
-rw-r--r--arch/x86/kernel/summit_32.c2
-rw-r--r--arch/x86/kernel/sys_i386_32.c64
-rw-r--r--arch/x86/kernel/time_32.c6
-rw-r--r--arch/x86/kernel/time_64.c16
-rw-r--r--arch/x86/kernel/tlb_64.c5
-rw-r--r--arch/x86/kernel/tlb_uv.c792
-rw-r--r--arch/x86/kernel/trampoline.c2
-rw-r--r--arch/x86/kernel/traps_32.c190
-rw-r--r--arch/x86/kernel/traps_64.c541
-rw-r--r--arch/x86/kernel/tsc.c533
-rw-r--r--arch/x86/kernel/tsc_32.c451
-rw-r--r--arch/x86/kernel/tsc_64.c357
-rw-r--r--arch/x86/kernel/visws_quirks.c709
-rw-r--r--arch/x86/kernel/vmi_32.c6
-rw-r--r--arch/x86/kernel/vmiclock_32.c7
-rw-r--r--arch/x86/kernel/vmlinux_32.lds.S15
-rw-r--r--arch/x86/kernel/vmlinux_64.lds.S18
-rw-r--r--arch/x86/kernel/vsmp_64.c3
-rw-r--r--arch/x86/kernel/vsyscall_64.c15
-rw-r--r--arch/x86/kernel/x8664_ksyms_64.c16
-rw-r--r--arch/x86/lguest/Kconfig2
-rw-r--r--arch/x86/lguest/boot.c11
-rw-r--r--arch/x86/lib/Makefile5
-rw-r--r--arch/x86/lib/copy_user_64.S429
-rw-r--r--arch/x86/lib/copy_user_nocache_64.S283
-rw-r--r--arch/x86/lib/delay.c (renamed from arch/x86/lib/delay_32.c)38
-rw-r--r--arch/x86/lib/delay_64.c85
-rw-r--r--arch/x86/lib/getuser.S (renamed from arch/x86/lib/getuser_64.S)87
-rw-r--r--arch/x86/lib/getuser_32.S78
-rw-r--r--arch/x86/lib/putuser.S (renamed from arch/x86/lib/putuser_32.S)73
-rw-r--r--arch/x86/lib/putuser_64.S106
-rw-r--r--arch/x86/lib/thunk_32.S47
-rw-r--r--arch/x86/lib/thunk_64.S19
-rw-r--r--arch/x86/lib/usercopy_64.c23
-rw-r--r--arch/x86/mach-default/setup.c74
-rw-r--r--arch/x86/mach-es7000/Makefile1
-rw-r--r--arch/x86/mach-es7000/es7000plat.c49
-rw-r--r--arch/x86/mach-generic/Makefile10
-rw-r--r--arch/x86/mach-generic/bigsmp.c4
-rw-r--r--arch/x86/mach-generic/numaq.c41
-rw-r--r--arch/x86/mach-generic/probe.c15
-rw-r--r--arch/x86/mach-visws/Makefile8
-rw-r--r--arch/x86/mach-visws/mpparse.c88
-rw-r--r--arch/x86/mach-visws/reboot.c55
-rw-r--r--arch/x86/mach-visws/setup.c183
-rw-r--r--arch/x86/mach-visws/traps.c69
-rw-r--r--arch/x86/mach-visws/visws_apic.c297
-rw-r--r--arch/x86/mach-voyager/setup.c37
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c14
-rw-r--r--arch/x86/math-emu/reg_constant.c8
-rw-r--r--arch/x86/mm/Makefile8
-rw-r--r--arch/x86/mm/discontig_32.c285
-rw-r--r--arch/x86/mm/dump_pagetables.c2
-rw-r--r--arch/x86/mm/fault.c110
-rw-r--r--arch/x86/mm/init_32.c527
-rw-r--r--arch/x86/mm/init_64.c562
-rw-r--r--arch/x86/mm/ioremap.c37
-rw-r--r--arch/x86/mm/k8topology_64.c21
-rw-r--r--arch/x86/mm/kmmio.c510
-rw-r--r--arch/x86/mm/mmio-mod.c515
-rw-r--r--arch/x86/mm/numa_64.c93
-rw-r--r--arch/x86/mm/pageattr-test.c21
-rw-r--r--arch/x86/mm/pageattr.c63
-rw-r--r--arch/x86/mm/pat.c378
-rw-r--r--arch/x86/mm/pf_in.c489
-rw-r--r--arch/x86/mm/pf_in.h39
-rw-r--r--arch/x86/mm/pgtable.c190
-rw-r--r--arch/x86/mm/pgtable_32.c56
-rw-r--r--arch/x86/mm/srat_32.c (renamed from arch/x86/kernel/srat_32.c)222
-rw-r--r--arch/x86/mm/srat_64.c21
-rw-r--r--arch/x86/mm/testmmiotrace.c71
-rw-r--r--arch/x86/oprofile/nmi_int.c3
-rw-r--r--arch/x86/pci/Makefile22
-rw-r--r--arch/x86/pci/Makefile_3224
-rw-r--r--arch/x86/pci/Makefile_6417
-rw-r--r--arch/x86/pci/acpi.c21
-rw-r--r--arch/x86/pci/amd_bus.c (renamed from arch/x86/pci/k8-bus_64.c)108
-rw-r--r--arch/x86/pci/common.c4
-rw-r--r--arch/x86/pci/direct.c25
-rw-r--r--arch/x86/pci/i386.c8
-rw-r--r--arch/x86/pci/init.c4
-rw-r--r--arch/x86/pci/irq.c266
-rw-r--r--arch/x86/pci/legacy.c16
-rw-r--r--arch/x86/pci/mmconfig-shared.c2
-rw-r--r--arch/x86/pci/mp_bus_to_node.c23
-rw-r--r--arch/x86/pci/numa.c33
-rw-r--r--arch/x86/pci/pci.h13
-rw-r--r--arch/x86/pci/visws.c28
-rw-r--r--arch/x86/power/hibernate_64.c2
-rw-r--r--arch/x86/vdso/vclock_gettime.c15
-rw-r--r--arch/x86/vdso/vdso32-setup.c11
-rw-r--r--arch/x86/vdso/vgetcpu.c3
-rw-r--r--arch/x86/vdso/vma.c2
-rw-r--r--arch/x86/xen/Kconfig10
-rw-r--r--arch/x86/xen/Makefile2
-rw-r--r--arch/x86/xen/enlighten.c176
-rw-r--r--arch/x86/xen/manage.c143
-rw-r--r--arch/x86/xen/mmu.c270
-rw-r--r--arch/x86/xen/mmu.h12
-rw-r--r--arch/x86/xen/multicalls.c40
-rw-r--r--arch/x86/xen/multicalls.h12
-rw-r--r--arch/x86/xen/setup.c30
-rw-r--r--arch/x86/xen/smp.c8
-rw-r--r--arch/x86/xen/suspend.c45
-rw-r--r--arch/x86/xen/time.c17
-rw-r--r--arch/x86/xen/xen-head.S5
-rw-r--r--arch/x86/xen/xen-ops.h13
615 files changed, 60409 insertions, 19881 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b786e68914d4..258f1369fb0c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,8 @@ config ARM
14 select HAVE_OPROFILE 14 select HAVE_OPROFILE
15 select HAVE_KPROBES if (!XIP_KERNEL) 15 select HAVE_KPROBES if (!XIP_KERNEL)
16 select HAVE_KRETPROBES if (HAVE_KPROBES) 16 select HAVE_KRETPROBES if (HAVE_KPROBES)
17 select HAVE_FTRACE if (!XIP_KERNEL)
18 select HAVE_DYNAMIC_FTRACE if (HAVE_FTRACE)
17 help 19 help
18 The ARM series is a line of low-power-consumption RISC chip designs 20 The ARM series is a line of low-power-consumption RISC chip designs
19 licensed by ARM Ltd and targeted at embedded applications and 21 licensed by ARM Ltd and targeted at embedded applications and
@@ -22,6 +24,9 @@ config ARM
22 Europe. There is an ARM Linux project with a web page at 24 Europe. There is an ARM Linux project with a web page at
23 <http://www.arm.linux.org.uk/>. 25 <http://www.arm.linux.org.uk/>.
24 26
27config HAVE_PWM
28 bool
29
25config SYS_SUPPORTS_APM_EMULATION 30config SYS_SUPPORTS_APM_EMULATION
26 bool 31 bool
27 32
@@ -84,6 +89,11 @@ config STACKTRACE_SUPPORT
84 bool 89 bool
85 default y 90 default y
86 91
92config HAVE_LATENCYTOP_SUPPORT
93 bool
94 depends on !SMP
95 default y
96
87config LOCKDEP_SUPPORT 97config LOCKDEP_SUPPORT
88 bool 98 bool
89 default y 99 default y
@@ -147,6 +157,10 @@ config FIQ
147config ARCH_MTD_XIP 157config ARCH_MTD_XIP
148 bool 158 bool
149 159
160config GENERIC_HARDIRQS_NO__DO_IRQ
161 bool
162 def_bool y
163
150if OPROFILE 164if OPROFILE
151 165
152config OPROFILE_ARMV6 166config OPROFILE_ARMV6
@@ -232,13 +246,6 @@ config ARCH_CLPS711X
232 help 246 help
233 Support for Cirrus Logic 711x/721x based boards. 247 Support for Cirrus Logic 711x/721x based boards.
234 248
235config ARCH_CO285
236 bool "Co-EBSA285"
237 select FOOTBRIDGE
238 select FOOTBRIDGE_ADDIN
239 help
240 Support for Intel's EBSA285 companion chip.
241
242config ARCH_EBSA110 249config ARCH_EBSA110
243 bool "EBSA-110" 250 bool "EBSA-110"
244 select ISA 251 select ISA
@@ -299,6 +306,8 @@ config ARCH_IOP32X
299 depends on MMU 306 depends on MMU
300 select PLAT_IOP 307 select PLAT_IOP
301 select PCI 308 select PCI
309 select GENERIC_GPIO
310 select HAVE_GPIO_LIB
302 help 311 help
303 Support for Intel's 80219 and IOP32X (XScale) family of 312 Support for Intel's 80219 and IOP32X (XScale) family of
304 processors. 313 processors.
@@ -308,6 +317,8 @@ config ARCH_IOP33X
308 depends on MMU 317 depends on MMU
309 select PLAT_IOP 318 select PLAT_IOP
310 select PCI 319 select PCI
320 select GENERIC_GPIO
321 select HAVE_GPIO_LIB
311 help 322 help
312 Support for Intel's IOP33X (XScale) family of processors. 323 Support for Intel's IOP33X (XScale) family of processors.
313 324
@@ -347,6 +358,16 @@ config ARCH_L7200
347 If you have any questions or comments about the Linux kernel port 358 If you have any questions or comments about the Linux kernel port
348 to this board, send e-mail to <sjhill@cotw.com>. 359 to this board, send e-mail to <sjhill@cotw.com>.
349 360
361config ARCH_KIRKWOOD
362 bool "Marvell Kirkwood"
363 select PCI
364 select GENERIC_TIME
365 select GENERIC_CLOCKEVENTS
366 select PLAT_ORION
367 help
368 Support for the following Marvell Kirkwood series SoCs:
369 88F6180, 88F6192 and 88F6281.
370
350config ARCH_KS8695 371config ARCH_KS8695
351 bool "Micrel/Kendin KS8695" 372 bool "Micrel/Kendin KS8695"
352 select GENERIC_GPIO 373 select GENERIC_GPIO
@@ -365,9 +386,31 @@ config ARCH_NS9XXX
365 386
366 <http://www.digi.com/products/microprocessors/index.jsp> 387 <http://www.digi.com/products/microprocessors/index.jsp>
367 388
389config ARCH_LOKI
390 bool "Marvell Loki (88RC8480)"
391 select GENERIC_TIME
392 select GENERIC_CLOCKEVENTS
393 select PLAT_ORION
394 help
395 Support for the Marvell Loki (88RC8480) SoC.
396
397config ARCH_MV78XX0
398 bool "Marvell MV78xx0"
399 select PCI
400 select GENERIC_TIME
401 select GENERIC_CLOCKEVENTS
402 select PLAT_ORION
403 help
404 Support for the following Marvell MV78xx0 series SoCs:
405 MV781x0, MV782x0.
406
368config ARCH_MXC 407config ARCH_MXC
369 bool "Freescale MXC/iMX-based" 408 bool "Freescale MXC/iMX-based"
409 select GENERIC_TIME
410 select GENERIC_CLOCKEVENTS
370 select ARCH_MTD_XIP 411 select ARCH_MTD_XIP
412 select GENERIC_GPIO
413 select HAVE_GPIO_LIB
371 help 414 help
372 Support for Freescale MXC/iMX-based family of processors 415 Support for Freescale MXC/iMX-based family of processors
373 416
@@ -381,7 +424,8 @@ config ARCH_ORION5X
381 select PLAT_ORION 424 select PLAT_ORION
382 help 425 help
383 Support for the following Marvell Orion 5x series SoCs: 426 Support for the following Marvell Orion 5x series SoCs:
384 Orion-1 (5181), Orion-NAS (5182), Orion-2 (5281.) 427 Orion-1 (5181), Orion-VoIP (5181L), Orion-NAS (5182),
428 Orion-2 (5281).
385 429
386config ARCH_PNX4008 430config ARCH_PNX4008
387 bool "Philips Nexperia PNX4008 Mobile" 431 bool "Philips Nexperia PNX4008 Mobile"
@@ -406,6 +450,7 @@ config ARCH_RPC
406 select FIQ 450 select FIQ
407 select TIMER_ACORN 451 select TIMER_ACORN
408 select ARCH_MAY_HAVE_PC_FDC 452 select ARCH_MAY_HAVE_PC_FDC
453 select HAVE_PATA_PLATFORM
409 select ISA_DMA_API 454 select ISA_DMA_API
410 select NO_IOPORT 455 select NO_IOPORT
411 help 456 help
@@ -502,6 +547,10 @@ source "arch/arm/mach-ixp2000/Kconfig"
502 547
503source "arch/arm/mach-ixp23xx/Kconfig" 548source "arch/arm/mach-ixp23xx/Kconfig"
504 549
550source "arch/arm/mach-loki/Kconfig"
551
552source "arch/arm/mach-mv78xx0/Kconfig"
553
505source "arch/arm/mach-pxa/Kconfig" 554source "arch/arm/mach-pxa/Kconfig"
506 555
507source "arch/arm/mach-sa1100/Kconfig" 556source "arch/arm/mach-sa1100/Kconfig"
@@ -514,6 +563,8 @@ source "arch/arm/mach-omap2/Kconfig"
514 563
515source "arch/arm/mach-orion5x/Kconfig" 564source "arch/arm/mach-orion5x/Kconfig"
516 565
566source "arch/arm/mach-kirkwood/Kconfig"
567
517source "arch/arm/plat-s3c24xx/Kconfig" 568source "arch/arm/plat-s3c24xx/Kconfig"
518source "arch/arm/plat-s3c/Kconfig" 569source "arch/arm/plat-s3c/Kconfig"
519 570
@@ -703,27 +754,6 @@ config PREEMPT
703 Say Y here if you are building a kernel for a desktop, embedded 754 Say Y here if you are building a kernel for a desktop, embedded
704 or real-time system. Say N if you are unsure. 755 or real-time system. Say N if you are unsure.
705 756
706config NO_IDLE_HZ
707 bool "Dynamic tick timer"
708 depends on !GENERIC_CLOCKEVENTS
709 help
710 Select this option if you want to disable continuous timer ticks
711 and have them programmed to occur as required. This option saves
712 power as the system can remain in idle state for longer.
713
714 By default dynamic tick is disabled during the boot, and can be
715 manually enabled with:
716
717 echo 1 > /sys/devices/system/timer/timer0/dyn_tick
718
719 Alternatively, if you want dynamic tick automatically enabled
720 during boot, pass "dyntick=enable" via the kernel command string.
721
722 Please note that dynamic tick may affect the accuracy of
723 timekeeping on some platforms depending on the implementation.
724 Currently at least OMAP, PXA2xx and SA11x0 platforms are known
725 to have accurate timekeeping with dynamic tick.
726
727config HZ 757config HZ
728 int 758 int
729 default 128 if ARCH_L7200 759 default 128 if ARCH_L7200
@@ -789,7 +819,7 @@ source "mm/Kconfig"
789 819
790config LEDS 820config LEDS
791 bool "Timer and CPU usage LEDs" 821 bool "Timer and CPU usage LEDs"
792 depends on ARCH_CDB89712 || ARCH_CO285 || ARCH_EBSA110 || \ 822 depends on ARCH_CDB89712 || ARCH_EBSA110 || \
793 ARCH_EBSA285 || ARCH_IMX || ARCH_INTEGRATOR || \ 823 ARCH_EBSA285 || ARCH_IMX || ARCH_INTEGRATOR || \
794 ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \ 824 ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \
795 ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \ 825 ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index e72db27e0ba0..b20995a82e04 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -100,8 +100,6 @@ textofs-y := 0x00008000
100 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500 100 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500
101 machine-$(CONFIG_FOOTBRIDGE) := footbridge 101 machine-$(CONFIG_FOOTBRIDGE) := footbridge
102 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285 102 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285
103 machine-$(CONFIG_ARCH_CO285) := footbridge
104 incdir-$(CONFIG_ARCH_CO285) := ebsa285
105 machine-$(CONFIG_ARCH_SHARK) := shark 103 machine-$(CONFIG_ARCH_SHARK) := shark
106 machine-$(CONFIG_ARCH_SA1100) := sa1100 104 machine-$(CONFIG_ARCH_SA1100) := sa1100
107ifeq ($(CONFIG_ARCH_SA1100),y) 105ifeq ($(CONFIG_ARCH_SA1100),y)
@@ -135,11 +133,15 @@ endif
135 machine-$(CONFIG_ARCH_NETX) := netx 133 machine-$(CONFIG_ARCH_NETX) := netx
136 machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx 134 machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx
137 machine-$(CONFIG_ARCH_DAVINCI) := davinci 135 machine-$(CONFIG_ARCH_DAVINCI) := davinci
136 machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood
138 machine-$(CONFIG_ARCH_KS8695) := ks8695 137 machine-$(CONFIG_ARCH_KS8695) := ks8695
139 incdir-$(CONFIG_ARCH_MXC) := mxc 138 incdir-$(CONFIG_ARCH_MXC) := mxc
139 machine-$(CONFIG_ARCH_MX2) := mx2
140 machine-$(CONFIG_ARCH_MX3) := mx3 140 machine-$(CONFIG_ARCH_MX3) := mx3
141 machine-$(CONFIG_ARCH_ORION5X) := orion5x 141 machine-$(CONFIG_ARCH_ORION5X) := orion5x
142 machine-$(CONFIG_ARCH_MSM7X00A) := msm 142 machine-$(CONFIG_ARCH_MSM7X00A) := msm
143 machine-$(CONFIG_ARCH_LOKI) := loki
144 machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0
143 145
144ifeq ($(CONFIG_ARCH_EBSA110),y) 146ifeq ($(CONFIG_ARCH_EBSA110),y)
145# This is what happens if you forget the IOCS16 line. 147# This is what happens if you forget the IOCS16 line.
@@ -190,8 +192,6 @@ core-$(CONFIG_PLAT_S3C24XX) += arch/arm/plat-s3c24xx/
190core-$(CONFIG_ARCH_MXC) += arch/arm/plat-mxc/ 192core-$(CONFIG_ARCH_MXC) += arch/arm/plat-mxc/
191 193
192drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ 194drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
193drivers-$(CONFIG_ARCH_CLPS7500) += drivers/acorn/char/
194drivers-$(CONFIG_ARCH_L7200) += drivers/acorn/char/
195 195
196libs-y := arch/arm/lib/ $(libs-y) 196libs-y := arch/arm/lib/ $(libs-y)
197 197
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index de9d9ee50958..95baac4939e0 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -69,6 +69,12 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
69 69
70targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ 70targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \
71 head.o misc.o $(OBJS) 71 head.o misc.o $(OBJS)
72
73ifeq ($(CONFIG_FTRACE),y)
74ORIG_CFLAGS := $(KBUILD_CFLAGS)
75KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
76endif
77
72EXTRA_CFLAGS := -fpic -fno-builtin 78EXTRA_CFLAGS := -fpic -fno-builtin
73EXTRA_AFLAGS := 79EXTRA_AFLAGS :=
74 80
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 3c2c8f2a1dc4..de41daeab5e9 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -623,8 +623,8 @@ proc_types:
623 b __armv4_mmu_cache_off 623 b __armv4_mmu_cache_off
624 b __armv4_mmu_cache_flush 624 b __armv4_mmu_cache_flush
625 625
626 .word 0x56055310 @ Feroceon 626 .word 0x56050000 @ Feroceon
627 .word 0xfffffff0 627 .word 0xff0f0000
628 b __armv4_mmu_cache_on 628 b __armv4_mmu_cache_on
629 b __armv4_mmu_cache_off 629 b __armv4_mmu_cache_off
630 b __armv5tej_mmu_cache_flush 630 b __armv5tej_mmu_cache_flush
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 3d0b9fa42f84..325e4b6a6afb 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -2,7 +2,6 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y += rtctime.o
6obj-$(CONFIG_ARM_GIC) += gic.o 5obj-$(CONFIG_ARM_GIC) += gic.o
7obj-$(CONFIG_ARM_VIC) += vic.o 6obj-$(CONFIG_ARM_VIC) += vic.o
8obj-$(CONFIG_ICST525) += icst525.o 7obj-$(CONFIG_ICST525) += icst525.o
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
deleted file mode 100644
index aa8f7739c822..000000000000
--- a/arch/arm/common/rtctime.c
+++ /dev/null
@@ -1,434 +0,0 @@
1/*
2 * linux/arch/arm/common/rtctime.c
3 *
4 * Copyright (C) 2003 Deep Blue Solutions Ltd.
5 * Based on sa1100-rtc.c, Nils Faerber, CIH, Nicolas Pitre.
6 * Based on rtc.c by Paul Gortmaker
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#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/time.h>
15#include <linux/rtc.h>
16#include <linux/poll.h>
17#include <linux/proc_fs.h>
18#include <linux/miscdevice.h>
19#include <linux/spinlock.h>
20#include <linux/capability.h>
21#include <linux/device.h>
22#include <linux/mutex.h>
23
24#include <asm/rtc.h>
25
26static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
27static struct fasync_struct *rtc_async_queue;
28
29/*
30 * rtc_lock protects rtc_irq_data
31 */
32static DEFINE_SPINLOCK(rtc_lock);
33static unsigned long rtc_irq_data;
34
35/*
36 * rtc_sem protects rtc_inuse and rtc_ops
37 */
38static DEFINE_MUTEX(rtc_mutex);
39static unsigned long rtc_inuse;
40static struct rtc_ops *rtc_ops;
41
42#define rtc_epoch 1900UL
43
44/*
45 * Calculate the next alarm time given the requested alarm time mask
46 * and the current time.
47 */
48void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc_time *alrm)
49{
50 unsigned long next_time;
51 unsigned long now_time;
52
53 next->tm_year = now->tm_year;
54 next->tm_mon = now->tm_mon;
55 next->tm_mday = now->tm_mday;
56 next->tm_hour = alrm->tm_hour;
57 next->tm_min = alrm->tm_min;
58 next->tm_sec = alrm->tm_sec;
59
60 rtc_tm_to_time(now, &now_time);
61 rtc_tm_to_time(next, &next_time);
62
63 if (next_time < now_time) {
64 /* Advance one day */
65 next_time += 60 * 60 * 24;
66 rtc_time_to_tm(next_time, next);
67 }
68}
69EXPORT_SYMBOL(rtc_next_alarm_time);
70
71static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm)
72{
73 memset(tm, 0, sizeof(struct rtc_time));
74 return ops->read_time(tm);
75}
76
77static inline int rtc_arm_set_time(struct rtc_ops *ops, struct rtc_time *tm)
78{
79 int ret;
80
81 ret = rtc_valid_tm(tm);
82 if (ret == 0)
83 ret = ops->set_time(tm);
84
85 return ret;
86}
87
88static inline int rtc_arm_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
89{
90 int ret = -EINVAL;
91 if (ops->read_alarm) {
92 memset(alrm, 0, sizeof(struct rtc_wkalrm));
93 ret = ops->read_alarm(alrm);
94 }
95 return ret;
96}
97
98static inline int rtc_arm_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
99{
100 int ret = -EINVAL;
101 if (ops->set_alarm)
102 ret = ops->set_alarm(alrm);
103 return ret;
104}
105
106void rtc_update(unsigned long num, unsigned long events)
107{
108 spin_lock(&rtc_lock);
109 rtc_irq_data = (rtc_irq_data + (num << 8)) | events;
110 spin_unlock(&rtc_lock);
111
112 wake_up_interruptible(&rtc_wait);
113 kill_fasync(&rtc_async_queue, SIGIO, POLL_IN);
114}
115EXPORT_SYMBOL(rtc_update);
116
117
118static ssize_t
119rtc_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
120{
121 DECLARE_WAITQUEUE(wait, current);
122 unsigned long data;
123 ssize_t ret;
124
125 if (count < sizeof(unsigned long))
126 return -EINVAL;
127
128 add_wait_queue(&rtc_wait, &wait);
129 do {
130 __set_current_state(TASK_INTERRUPTIBLE);
131
132 spin_lock_irq(&rtc_lock);
133 data = rtc_irq_data;
134 rtc_irq_data = 0;
135 spin_unlock_irq(&rtc_lock);
136
137 if (data != 0) {
138 ret = 0;
139 break;
140 }
141 if (file->f_flags & O_NONBLOCK) {
142 ret = -EAGAIN;
143 break;
144 }
145 if (signal_pending(current)) {
146 ret = -ERESTARTSYS;
147 break;
148 }
149 schedule();
150 } while (1);
151 set_current_state(TASK_RUNNING);
152 remove_wait_queue(&rtc_wait, &wait);
153
154 if (ret == 0) {
155 ret = put_user(data, (unsigned long __user *)buf);
156 if (ret == 0)
157 ret = sizeof(unsigned long);
158 }
159 return ret;
160}
161
162static unsigned int rtc_poll(struct file *file, poll_table *wait)
163{
164 unsigned long data;
165
166 poll_wait(file, &rtc_wait, wait);
167
168 spin_lock_irq(&rtc_lock);
169 data = rtc_irq_data;
170 spin_unlock_irq(&rtc_lock);
171
172 return data != 0 ? POLLIN | POLLRDNORM : 0;
173}
174
175static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
176 unsigned long arg)
177{
178 struct rtc_ops *ops = file->private_data;
179 struct rtc_time tm;
180 struct rtc_wkalrm alrm;
181 void __user *uarg = (void __user *)arg;
182 int ret = -EINVAL;
183
184 switch (cmd) {
185 case RTC_ALM_READ:
186 ret = rtc_arm_read_alarm(ops, &alrm);
187 if (ret)
188 break;
189 ret = copy_to_user(uarg, &alrm.time, sizeof(tm));
190 if (ret)
191 ret = -EFAULT;
192 break;
193
194 case RTC_ALM_SET:
195 ret = copy_from_user(&alrm.time, uarg, sizeof(tm));
196 if (ret) {
197 ret = -EFAULT;
198 break;
199 }
200 alrm.enabled = 0;
201 alrm.pending = 0;
202 alrm.time.tm_mday = -1;
203 alrm.time.tm_mon = -1;
204 alrm.time.tm_year = -1;
205 alrm.time.tm_wday = -1;
206 alrm.time.tm_yday = -1;
207 alrm.time.tm_isdst = -1;
208 ret = rtc_arm_set_alarm(ops, &alrm);
209 break;
210
211 case RTC_RD_TIME:
212 ret = rtc_arm_read_time(ops, &tm);
213 if (ret)
214 break;
215 ret = copy_to_user(uarg, &tm, sizeof(tm));
216 if (ret)
217 ret = -EFAULT;
218 break;
219
220 case RTC_SET_TIME:
221 if (!capable(CAP_SYS_TIME)) {
222 ret = -EACCES;
223 break;
224 }
225 ret = copy_from_user(&tm, uarg, sizeof(tm));
226 if (ret) {
227 ret = -EFAULT;
228 break;
229 }
230 ret = rtc_arm_set_time(ops, &tm);
231 break;
232
233 case RTC_EPOCH_SET:
234#ifndef rtc_epoch
235 /*
236 * There were no RTC clocks before 1900.
237 */
238 if (arg < 1900) {
239 ret = -EINVAL;
240 break;
241 }
242 if (!capable(CAP_SYS_TIME)) {
243 ret = -EACCES;
244 break;
245 }
246 rtc_epoch = arg;
247 ret = 0;
248#endif
249 break;
250
251 case RTC_EPOCH_READ:
252 ret = put_user(rtc_epoch, (unsigned long __user *)uarg);
253 break;
254
255 case RTC_WKALM_SET:
256 ret = copy_from_user(&alrm, uarg, sizeof(alrm));
257 if (ret) {
258 ret = -EFAULT;
259 break;
260 }
261 ret = rtc_arm_set_alarm(ops, &alrm);
262 break;
263
264 case RTC_WKALM_RD:
265 ret = rtc_arm_read_alarm(ops, &alrm);
266 if (ret)
267 break;
268 ret = copy_to_user(uarg, &alrm, sizeof(alrm));
269 if (ret)
270 ret = -EFAULT;
271 break;
272
273 default:
274 if (ops->ioctl)
275 ret = ops->ioctl(cmd, arg);
276 break;
277 }
278 return ret;
279}
280
281static int rtc_open(struct inode *inode, struct file *file)
282{
283 int ret;
284
285 mutex_lock(&rtc_mutex);
286
287 if (rtc_inuse) {
288 ret = -EBUSY;
289 } else if (!rtc_ops || !try_module_get(rtc_ops->owner)) {
290 ret = -ENODEV;
291 } else {
292 file->private_data = rtc_ops;
293
294 ret = rtc_ops->open ? rtc_ops->open() : 0;
295 if (ret == 0) {
296 spin_lock_irq(&rtc_lock);
297 rtc_irq_data = 0;
298 spin_unlock_irq(&rtc_lock);
299
300 rtc_inuse = 1;
301 }
302 }
303 mutex_unlock(&rtc_mutex);
304
305 return ret;
306}
307
308static int rtc_release(struct inode *inode, struct file *file)
309{
310 struct rtc_ops *ops = file->private_data;
311
312 if (ops->release)
313 ops->release();
314
315 spin_lock_irq(&rtc_lock);
316 rtc_irq_data = 0;
317 spin_unlock_irq(&rtc_lock);
318
319 module_put(rtc_ops->owner);
320 rtc_inuse = 0;
321
322 return 0;
323}
324
325static int rtc_fasync(int fd, struct file *file, int on)
326{
327 return fasync_helper(fd, file, on, &rtc_async_queue);
328}
329
330static const struct file_operations rtc_fops = {
331 .owner = THIS_MODULE,
332 .llseek = no_llseek,
333 .read = rtc_read,
334 .poll = rtc_poll,
335 .ioctl = rtc_ioctl,
336 .open = rtc_open,
337 .release = rtc_release,
338 .fasync = rtc_fasync,
339};
340
341static struct miscdevice rtc_miscdev = {
342 .minor = RTC_MINOR,
343 .name = "rtc",
344 .fops = &rtc_fops,
345};
346
347
348static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data)
349{
350 struct rtc_ops *ops = data;
351 struct rtc_wkalrm alrm;
352 struct rtc_time tm;
353 char *p = page;
354
355 if (rtc_arm_read_time(ops, &tm) == 0) {
356 p += sprintf(p,
357 "rtc_time\t: %02d:%02d:%02d\n"
358 "rtc_date\t: %04d-%02d-%02d\n"
359 "rtc_epoch\t: %04lu\n",
360 tm.tm_hour, tm.tm_min, tm.tm_sec,
361 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
362 rtc_epoch);
363 }
364
365 if (rtc_arm_read_alarm(ops, &alrm) == 0) {
366 p += sprintf(p, "alrm_time\t: ");
367 if ((unsigned int)alrm.time.tm_hour <= 24)
368 p += sprintf(p, "%02d:", alrm.time.tm_hour);
369 else
370 p += sprintf(p, "**:");
371 if ((unsigned int)alrm.time.tm_min <= 59)
372 p += sprintf(p, "%02d:", alrm.time.tm_min);
373 else
374 p += sprintf(p, "**:");
375 if ((unsigned int)alrm.time.tm_sec <= 59)
376 p += sprintf(p, "%02d\n", alrm.time.tm_sec);
377 else
378 p += sprintf(p, "**\n");
379
380 p += sprintf(p, "alrm_date\t: ");
381 if ((unsigned int)alrm.time.tm_year <= 200)
382 p += sprintf(p, "%04d-", alrm.time.tm_year + 1900);
383 else
384 p += sprintf(p, "****-");
385 if ((unsigned int)alrm.time.tm_mon <= 11)
386 p += sprintf(p, "%02d-", alrm.time.tm_mon + 1);
387 else
388 p += sprintf(p, "**-");
389 if ((unsigned int)alrm.time.tm_mday <= 31)
390 p += sprintf(p, "%02d\n", alrm.time.tm_mday);
391 else
392 p += sprintf(p, "**\n");
393 p += sprintf(p, "alrm_wakeup\t: %s\n",
394 alrm.enabled ? "yes" : "no");
395 p += sprintf(p, "alrm_pending\t: %s\n",
396 alrm.pending ? "yes" : "no");
397 }
398
399 if (ops->proc)
400 p += ops->proc(p);
401
402 return p - page;
403}
404
405int register_rtc(struct rtc_ops *ops)
406{
407 int ret = -EBUSY;
408
409 mutex_lock(&rtc_mutex);
410 if (rtc_ops == NULL) {
411 rtc_ops = ops;
412
413 ret = misc_register(&rtc_miscdev);
414 if (ret == 0)
415 create_proc_read_entry("driver/rtc", 0, NULL,
416 rtc_read_proc, ops);
417 }
418 mutex_unlock(&rtc_mutex);
419
420 return ret;
421}
422EXPORT_SYMBOL(register_rtc);
423
424void unregister_rtc(struct rtc_ops *rtc)
425{
426 mutex_lock(&rtc_mutex);
427 if (rtc == rtc_ops) {
428 remove_proc_entry("driver/rtc", NULL);
429 misc_deregister(&rtc_miscdev);
430 rtc_ops = NULL;
431 }
432 mutex_unlock(&rtc_mutex);
433}
434EXPORT_SYMBOL(unregister_rtc);
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index 5bba5255b119..8822b684d474 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -31,6 +31,7 @@
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/arch/pm.h> 32#include <asm/arch/pm.h>
33#include <asm/arch/pxa-regs.h> 33#include <asm/arch/pxa-regs.h>
34#include <asm/arch/pxa2xx-regs.h>
34#include <asm/arch/sharpsl.h> 35#include <asm/arch/sharpsl.h>
35#include <asm/hardware/sharpsl_pm.h> 36#include <asm/hardware/sharpsl_pm.h>
36 37
@@ -157,6 +158,7 @@ static void sharpsl_battery_thread(struct work_struct *private_)
157 dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %ld\n", voltage, 158 dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %ld\n", voltage,
158 sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies); 159 sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies);
159 160
161#ifdef CONFIG_BACKLIGHT_CORGI
160 /* If battery is low. limit backlight intensity to save power. */ 162 /* If battery is low. limit backlight intensity to save power. */
161 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE) 163 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
162 && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) || 164 && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) ||
@@ -169,6 +171,7 @@ static void sharpsl_battery_thread(struct work_struct *private_)
169 sharpsl_pm.machinfo->backlight_limit(0); 171 sharpsl_pm.machinfo->backlight_limit(0);
170 sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT; 172 sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT;
171 } 173 }
174#endif
172 175
173 /* Suspend if critical battery level */ 176 /* Suspend if critical battery level */
174 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE) 177 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
diff --git a/arch/arm/configs/at91cap9adk_defconfig b/arch/arm/configs/at91cap9adk_defconfig
index e32e73648129..be2b2f38fd94 100644
--- a/arch/arm/configs/at91cap9adk_defconfig
+++ b/arch/arm/configs/at91cap9adk_defconfig
@@ -213,7 +213,6 @@ CONFIG_CPU_CP15_MMU=y
213# 213#
214# CONFIG_TICK_ONESHOT is not set 214# CONFIG_TICK_ONESHOT is not set
215# CONFIG_PREEMPT is not set 215# CONFIG_PREEMPT is not set
216# CONFIG_NO_IDLE_HZ is not set
217CONFIG_HZ=100 216CONFIG_HZ=100
218CONFIG_AEABI=y 217CONFIG_AEABI=y
219CONFIG_OABI_COMPAT=y 218CONFIG_OABI_COMPAT=y
@@ -907,7 +906,32 @@ CONFIG_USB_MON=y
907# 906#
908# USB Gadget Support 907# USB Gadget Support
909# 908#
910# CONFIG_USB_GADGET is not set 909CONFIG_USB_GADGET=y
910# CONFIG_USB_GADGET_DEBUG is not set
911# CONFIG_USB_GADGET_DEBUG_FILES is not set
912CONFIG_USB_GADGET_SELECTED=y
913# CONFIG_USB_GADGET_AMD5536UDC is not set
914CONFIG_USB_GADGET_ATMEL_USBA=y
915CONFIG_USB_ATMEL_USBA=y
916# CONFIG_USB_GADGET_FSL_USB2 is not set
917# CONFIG_USB_GADGET_NET2280 is not set
918# CONFIG_USB_GADGET_PXA2XX is not set
919# CONFIG_USB_GADGET_M66592 is not set
920# CONFIG_USB_GADGET_GOKU is not set
921# CONFIG_USB_GADGET_LH7A40X is not set
922# CONFIG_USB_GADGET_OMAP is not set
923# CONFIG_USB_GADGET_S3C2410 is not set
924# CONFIG_USB_GADGET_AT91 is not set
925# CONFIG_USB_GADGET_DUMMY_HCD is not set
926CONFIG_USB_GADGET_DUALSPEED=y
927# CONFIG_USB_ZERO is not set
928CONFIG_USB_ETH=m
929CONFIG_USB_ETH_RNDIS=y
930# CONFIG_USB_GADGETFS is not set
931CONFIG_USB_FILE_STORAGE=m
932# CONFIG_USB_FILE_STORAGE_TEST is not set
933# CONFIG_USB_G_SERIAL is not set
934# CONFIG_USB_MIDI_GADGET is not set
911CONFIG_MMC=y 935CONFIG_MMC=y
912# CONFIG_MMC_DEBUG is not set 936# CONFIG_MMC_DEBUG is not set
913# CONFIG_MMC_UNSAFE_RESUME is not set 937# CONFIG_MMC_UNSAFE_RESUME is not set
@@ -926,7 +950,59 @@ CONFIG_MMC_AT91=y
926# CONFIG_MMC_SPI is not set 950# CONFIG_MMC_SPI is not set
927# CONFIG_NEW_LEDS is not set 951# CONFIG_NEW_LEDS is not set
928CONFIG_RTC_LIB=y 952CONFIG_RTC_LIB=y
929# CONFIG_RTC_CLASS is not set 953CONFIG_RTC_CLASS=y
954CONFIG_RTC_HCTOSYS=y
955CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
956# CONFIG_RTC_DEBUG is not set
957
958#
959# RTC interfaces
960#
961CONFIG_RTC_INTF_SYSFS=y
962CONFIG_RTC_INTF_PROC=y
963CONFIG_RTC_INTF_DEV=y
964# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
965# CONFIG_RTC_DRV_TEST is not set
966
967#
968# I2C RTC drivers
969#
970# CONFIG_RTC_DRV_DS1307 is not set
971# CONFIG_RTC_DRV_DS1374 is not set
972# CONFIG_RTC_DRV_DS1672 is not set
973# CONFIG_RTC_DRV_MAX6900 is not set
974# CONFIG_RTC_DRV_RS5C372 is not set
975# CONFIG_RTC_DRV_ISL1208 is not set
976# CONFIG_RTC_DRV_X1205 is not set
977# CONFIG_RTC_DRV_PCF8563 is not set
978# CONFIG_RTC_DRV_PCF8583 is not set
979# CONFIG_RTC_DRV_M41T80 is not set
980
981#
982# SPI RTC drivers
983#
984# CONFIG_RTC_DRV_MAX6902 is not set
985# CONFIG_RTC_DRV_R9701 is not set
986# CONFIG_RTC_DRV_RS5C348 is not set
987
988#
989# Platform RTC drivers
990#
991# CONFIG_RTC_DRV_CMOS is not set
992# CONFIG_RTC_DRV_DS1511 is not set
993# CONFIG_RTC_DRV_DS1553 is not set
994# CONFIG_RTC_DRV_DS1742 is not set
995# CONFIG_RTC_DRV_STK17TA8 is not set
996# CONFIG_RTC_DRV_M48T86 is not set
997# CONFIG_RTC_DRV_M48T59 is not set
998# CONFIG_RTC_DRV_V3020 is not set
999
1000#
1001# on-CPU RTC drivers
1002#
1003CONFIG_RTC_DRV_AT91SAM9=y
1004CONFIG_RTC_DRV_AT91SAM9_RTT=0
1005CONFIG_RTC_DRV_AT91SAM9_GPBR=0
930 1006
931# 1007#
932# File systems 1008# File systems
diff --git a/arch/arm/configs/at91rm9200dk_defconfig b/arch/arm/configs/at91rm9200dk_defconfig
index 2dbbbc3d4ac3..868fb7b9530b 100644
--- a/arch/arm/configs/at91rm9200dk_defconfig
+++ b/arch/arm/configs/at91rm9200dk_defconfig
@@ -169,7 +169,6 @@ CONFIG_AT91_CF=y
169# Kernel Features 169# Kernel Features
170# 170#
171# CONFIG_PREEMPT is not set 171# CONFIG_PREEMPT is not set
172# CONFIG_NO_IDLE_HZ is not set
173# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 172# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
174CONFIG_SELECT_MEMORY_MODEL=y 173CONFIG_SELECT_MEMORY_MODEL=y
175CONFIG_FLATMEM_MANUAL=y 174CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/arm/configs/at91rm9200ek_defconfig b/arch/arm/configs/at91rm9200ek_defconfig
index 6e994f7820c6..de43fc675616 100644
--- a/arch/arm/configs/at91rm9200ek_defconfig
+++ b/arch/arm/configs/at91rm9200ek_defconfig
@@ -160,7 +160,6 @@ CONFIG_ISA_DMA_API=y
160# Kernel Features 160# Kernel Features
161# 161#
162# CONFIG_PREEMPT is not set 162# CONFIG_PREEMPT is not set
163# CONFIG_NO_IDLE_HZ is not set
164# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 163# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
165CONFIG_SELECT_MEMORY_MODEL=y 164CONFIG_SELECT_MEMORY_MODEL=y
166CONFIG_FLATMEM_MANUAL=y 165CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index f659c938473f..2011adfa6758 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -220,7 +220,6 @@ CONFIG_CPU_CP15_MMU=y
220# 220#
221# CONFIG_TICK_ONESHOT is not set 221# CONFIG_TICK_ONESHOT is not set
222# CONFIG_PREEMPT is not set 222# CONFIG_PREEMPT is not set
223# CONFIG_NO_IDLE_HZ is not set
224CONFIG_HZ=100 223CONFIG_HZ=100
225# CONFIG_AEABI is not set 224# CONFIG_AEABI is not set
226# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 225# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 3802e85f7483..4049768962d2 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -213,7 +213,6 @@ CONFIG_CPU_CP15_MMU=y
213# 213#
214# CONFIG_TICK_ONESHOT is not set 214# CONFIG_TICK_ONESHOT is not set
215# CONFIG_PREEMPT is not set 215# CONFIG_PREEMPT is not set
216# CONFIG_NO_IDLE_HZ is not set
217CONFIG_HZ=100 216CONFIG_HZ=100
218# CONFIG_AEABI is not set 217# CONFIG_AEABI is not set
219# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 218# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index 32a0d74e0c89..fa1c5aecb5a8 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -213,7 +213,6 @@ CONFIG_CPU_CP15_MMU=y
213# 213#
214# CONFIG_TICK_ONESHOT is not set 214# CONFIG_TICK_ONESHOT is not set
215# CONFIG_PREEMPT is not set 215# CONFIG_PREEMPT is not set
216# CONFIG_NO_IDLE_HZ is not set
217CONFIG_HZ=100 216CONFIG_HZ=100
218# CONFIG_AEABI is not set 217# CONFIG_AEABI is not set
219# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 218# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/em_x270_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index 6bea0901bdf0..c06863847364 100644
--- a/arch/arm/configs/em_x270_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -1,13 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22 3# Linux kernel version: 2.6.24
4# Mon Jul 9 15:18:20 2007 4# Tue Jun 10 15:51:52 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y 8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y 9CONFIG_GENERIC_TIME=y
10# CONFIG_GENERIC_CLOCKEVENTS is not set 10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y 11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set 12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
@@ -22,45 +22,40 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
22CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y 24CONFIG_ZONE_DMA=y
25CONFIG_ARCH_MTD_XIP=y
26CONFIG_VECTORS_BASE=0xffff0000 25CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28 27
29# 28#
30# Code maturity level options 29# General setup
31# 30#
32CONFIG_EXPERIMENTAL=y 31CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y 32CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32 33CONFIG_INIT_ENV_ARG_LIMIT=32
35 34CONFIG_LOCALVERSION=""
36#
37# General setup
38#
39CONFIG_LOCALVERSION="-em-x270"
40# CONFIG_LOCALVERSION_AUTO is not set 35# CONFIG_LOCALVERSION_AUTO is not set
41CONFIG_SWAP=y 36# CONFIG_SWAP is not set
42CONFIG_SYSVIPC=y 37CONFIG_SYSVIPC=y
43# CONFIG_IPC_NS is not set
44CONFIG_SYSVIPC_SYSCTL=y 38CONFIG_SYSVIPC_SYSCTL=y
45# CONFIG_POSIX_MQUEUE is not set 39# CONFIG_POSIX_MQUEUE is not set
46# CONFIG_BSD_PROCESS_ACCT is not set 40# CONFIG_BSD_PROCESS_ACCT is not set
47# CONFIG_TASKSTATS is not set 41# CONFIG_TASKSTATS is not set
48# CONFIG_UTS_NS is not set 42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
49# CONFIG_AUDIT is not set 44# CONFIG_AUDIT is not set
50CONFIG_IKCONFIG=y 45# CONFIG_IKCONFIG is not set
51CONFIG_IKCONFIG_PROC=y 46CONFIG_LOG_BUF_SHIFT=14
52CONFIG_LOG_BUF_SHIFT=17 47# CONFIG_CGROUPS is not set
48# CONFIG_FAIR_GROUP_SCHED is not set
53CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
54# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
55CONFIG_BLK_DEV_INITRD=y 51CONFIG_BLK_DEV_INITRD=y
56CONFIG_INITRAMFS_SOURCE="" 52CONFIG_INITRAMFS_SOURCE=""
57CONFIG_CC_OPTIMIZE_FOR_SIZE=y 53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
58CONFIG_SYSCTL=y 54CONFIG_SYSCTL=y
59CONFIG_EMBEDDED=y 55# CONFIG_EMBEDDED is not set
60CONFIG_UID16=y 56CONFIG_UID16=y
61CONFIG_SYSCTL_SYSCALL=y 57CONFIG_SYSCTL_SYSCALL=y
62CONFIG_KALLSYMS=y 58CONFIG_KALLSYMS=y
63# CONFIG_KALLSYMS_ALL is not set
64# CONFIG_KALLSYMS_EXTRA_PASS is not set 59# CONFIG_KALLSYMS_EXTRA_PASS is not set
65CONFIG_HOTPLUG=y 60CONFIG_HOTPLUG=y
66CONFIG_PRINTK=y 61CONFIG_PRINTK=y
@@ -71,42 +66,35 @@ CONFIG_FUTEX=y
71CONFIG_ANON_INODES=y 66CONFIG_ANON_INODES=y
72CONFIG_EPOLL=y 67CONFIG_EPOLL=y
73CONFIG_SIGNALFD=y 68CONFIG_SIGNALFD=y
74CONFIG_TIMERFD=y
75CONFIG_EVENTFD=y 69CONFIG_EVENTFD=y
76CONFIG_SHMEM=y 70CONFIG_SHMEM=y
77CONFIG_VM_EVENT_COUNTERS=y 71CONFIG_VM_EVENT_COUNTERS=y
78CONFIG_SLAB=y 72CONFIG_SLAB=y
79# CONFIG_SLUB is not set 73# CONFIG_SLUB is not set
80# CONFIG_SLOB is not set 74# CONFIG_SLOB is not set
75CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y 76CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set 77# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0 78CONFIG_BASE_SMALL=0
84
85#
86# Loadable module support
87#
88CONFIG_MODULES=y 79CONFIG_MODULES=y
89CONFIG_MODULE_UNLOAD=y 80CONFIG_MODULE_UNLOAD=y
90CONFIG_MODULE_FORCE_UNLOAD=y 81# CONFIG_MODULE_FORCE_UNLOAD is not set
91# CONFIG_MODVERSIONS is not set 82# CONFIG_MODVERSIONS is not set
92# CONFIG_MODULE_SRCVERSION_ALL is not set 83# CONFIG_MODULE_SRCVERSION_ALL is not set
93CONFIG_KMOD=y 84CONFIG_KMOD=y
94
95#
96# Block layer
97#
98CONFIG_BLOCK=y 85CONFIG_BLOCK=y
99# CONFIG_LBD is not set 86# CONFIG_LBD is not set
100# CONFIG_BLK_DEV_IO_TRACE is not set 87# CONFIG_BLK_DEV_IO_TRACE is not set
101# CONFIG_LSF is not set 88# CONFIG_LSF is not set
89# CONFIG_BLK_DEV_BSG is not set
102 90
103# 91#
104# IO Schedulers 92# IO Schedulers
105# 93#
106CONFIG_IOSCHED_NOOP=y 94CONFIG_IOSCHED_NOOP=y
107CONFIG_IOSCHED_AS=y 95CONFIG_IOSCHED_AS=y
108CONFIG_IOSCHED_DEADLINE=y 96# CONFIG_IOSCHED_DEADLINE is not set
109CONFIG_IOSCHED_CFQ=y 97# CONFIG_IOSCHED_CFQ is not set
110CONFIG_DEFAULT_AS=y 98CONFIG_DEFAULT_AS=y
111# CONFIG_DEFAULT_DEADLINE is not set 99# CONFIG_DEFAULT_DEADLINE is not set
112# CONFIG_DEFAULT_CFQ is not set 100# CONFIG_DEFAULT_CFQ is not set
@@ -120,7 +108,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
120# CONFIG_ARCH_INTEGRATOR is not set 108# CONFIG_ARCH_INTEGRATOR is not set
121# CONFIG_ARCH_REALVIEW is not set 109# CONFIG_ARCH_REALVIEW is not set
122# CONFIG_ARCH_VERSATILE is not set 110# CONFIG_ARCH_VERSATILE is not set
123# CONFIG_ARCH_AT91 is not set 111CONFIG_ARCH_AT91=y
124# CONFIG_ARCH_CLPS7500 is not set 112# CONFIG_ARCH_CLPS7500 is not set
125# CONFIG_ARCH_CLPS711X is not set 113# CONFIG_ARCH_CLPS711X is not set
126# CONFIG_ARCH_CO285 is not set 114# CONFIG_ARCH_CO285 is not set
@@ -139,8 +127,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
139# CONFIG_ARCH_L7200 is not set 127# CONFIG_ARCH_L7200 is not set
140# CONFIG_ARCH_KS8695 is not set 128# CONFIG_ARCH_KS8695 is not set
141# CONFIG_ARCH_NS9XXX is not set 129# CONFIG_ARCH_NS9XXX is not set
130# CONFIG_ARCH_MXC is not set
142# CONFIG_ARCH_PNX4008 is not set 131# CONFIG_ARCH_PNX4008 is not set
143CONFIG_ARCH_PXA=y 132# CONFIG_ARCH_PXA is not set
144# CONFIG_ARCH_RPC is not set 133# CONFIG_ARCH_RPC is not set
145# CONFIG_ARCH_SA1100 is not set 134# CONFIG_ARCH_SA1100 is not set
146# CONFIG_ARCH_S3C2410 is not set 135# CONFIG_ARCH_S3C2410 is not set
@@ -150,25 +139,60 @@ CONFIG_ARCH_PXA=y
150# CONFIG_ARCH_OMAP is not set 139# CONFIG_ARCH_OMAP is not set
151 140
152# 141#
153# Intel PXA2xx Implementations 142# Boot options
143#
144
145#
146# Power management
154# 147#
155# CONFIG_ARCH_LUBBOCK is not set 148
156# CONFIG_MACH_LOGICPD_PXA270 is not set 149#
157# CONFIG_MACH_MAINSTONE is not set 150# Atmel AT91 System-on-Chip
158# CONFIG_ARCH_PXA_IDP is not set 151#
159# CONFIG_PXA_SHARPSL is not set 152# CONFIG_ARCH_AT91RM9200 is not set
160# CONFIG_MACH_TRIZEPS4 is not set 153# CONFIG_ARCH_AT91SAM9260 is not set
161CONFIG_MACH_EM_X270=y 154# CONFIG_ARCH_AT91SAM9261 is not set
162CONFIG_PXA27x=y 155# CONFIG_ARCH_AT91SAM9263 is not set
156# CONFIG_ARCH_AT91SAM9RL is not set
157CONFIG_ARCH_AT91SAM9G20=y
158# CONFIG_ARCH_AT91CAP9 is not set
159# CONFIG_ARCH_AT91X40 is not set
160CONFIG_AT91_PMC_UNIT=y
161
162#
163# AT91SAM9G20 Board Type
164#
165CONFIG_MACH_AT91SAM9G20EK=y
166
167#
168# AT91 Board Options
169#
170# CONFIG_MTD_AT91_DATAFLASH_CARD is not set
171# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set
172
173#
174# AT91 Feature Selections
175#
176CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
177# CONFIG_AT91_SLOW_CLOCK is not set
178CONFIG_AT91_TIMER_HZ=100
179CONFIG_AT91_EARLY_DBGU=y
180# CONFIG_AT91_EARLY_USART0 is not set
181# CONFIG_AT91_EARLY_USART1 is not set
182# CONFIG_AT91_EARLY_USART2 is not set
183# CONFIG_AT91_EARLY_USART3 is not set
184# CONFIG_AT91_EARLY_USART4 is not set
185# CONFIG_AT91_EARLY_USART5 is not set
163 186
164# 187#
165# Processor Type 188# Processor Type
166# 189#
167CONFIG_CPU_32=y 190CONFIG_CPU_32=y
168CONFIG_CPU_XSCALE=y 191CONFIG_CPU_ARM926T=y
169CONFIG_CPU_32v5=y 192CONFIG_CPU_32v5=y
170CONFIG_CPU_ABRT_EV5T=y 193CONFIG_CPU_ABRT_EV5TJ=y
171CONFIG_CPU_CACHE_VIVT=y 194CONFIG_CPU_CACHE_VIVT=y
195CONFIG_CPU_COPY_V4WB=y
172CONFIG_CPU_TLB_V4WBI=y 196CONFIG_CPU_TLB_V4WBI=y
173CONFIG_CPU_CP15=y 197CONFIG_CPU_CP15=y
174CONFIG_CPU_CP15_MMU=y 198CONFIG_CPU_CP15_MMU=y
@@ -176,28 +200,28 @@ CONFIG_CPU_CP15_MMU=y
176# 200#
177# Processor Features 201# Processor Features
178# 202#
179CONFIG_ARM_THUMB=y 203# CONFIG_ARM_THUMB is not set
204# CONFIG_CPU_ICACHE_DISABLE is not set
180# CONFIG_CPU_DCACHE_DISABLE is not set 205# CONFIG_CPU_DCACHE_DISABLE is not set
206# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
207# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
181# CONFIG_OUTER_CACHE is not set 208# CONFIG_OUTER_CACHE is not set
182CONFIG_IWMMXT=y
183CONFIG_XSCALE_PMU=y
184 209
185# 210#
186# Bus support 211# Bus support
187# 212#
213# CONFIG_PCI_SYSCALL is not set
188# CONFIG_ARCH_SUPPORTS_MSI is not set 214# CONFIG_ARCH_SUPPORTS_MSI is not set
189
190#
191# PCCARD (PCMCIA/CardBus) support
192#
193# CONFIG_PCCARD is not set 215# CONFIG_PCCARD is not set
194 216
195# 217#
196# Kernel Features 218# Kernel Features
197# 219#
198# CONFIG_TICK_ONESHOT is not set 220# CONFIG_TICK_ONESHOT is not set
221# CONFIG_NO_HZ is not set
222# CONFIG_HIGH_RES_TIMERS is not set
223CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
199# CONFIG_PREEMPT is not set 224# CONFIG_PREEMPT is not set
200# CONFIG_NO_IDLE_HZ is not set
201CONFIG_HZ=100 225CONFIG_HZ=100
202CONFIG_AEABI=y 226CONFIG_AEABI=y
203CONFIG_OABI_COMPAT=y 227CONFIG_OABI_COMPAT=y
@@ -209,9 +233,14 @@ CONFIG_FLATMEM_MANUAL=y
209CONFIG_FLATMEM=y 233CONFIG_FLATMEM=y
210CONFIG_FLAT_NODE_MEM_MAP=y 234CONFIG_FLAT_NODE_MEM_MAP=y
211# CONFIG_SPARSEMEM_STATIC is not set 235# CONFIG_SPARSEMEM_STATIC is not set
236# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
212CONFIG_SPLIT_PTLOCK_CPUS=4096 237CONFIG_SPLIT_PTLOCK_CPUS=4096
213# CONFIG_RESOURCES_64BIT is not set 238# CONFIG_RESOURCES_64BIT is not set
214CONFIG_ZONE_DMA_FLAG=1 239CONFIG_ZONE_DMA_FLAG=1
240CONFIG_BOUNCE=y
241CONFIG_VIRT_TO_BUS=y
242CONFIG_LEDS=y
243CONFIG_LEDS_CPU=y
215CONFIG_ALIGNMENT_TRAP=y 244CONFIG_ALIGNMENT_TRAP=y
216 245
217# 246#
@@ -219,7 +248,7 @@ CONFIG_ALIGNMENT_TRAP=y
219# 248#
220CONFIG_ZBOOT_ROM_TEXT=0x0 249CONFIG_ZBOOT_ROM_TEXT=0x0
221CONFIG_ZBOOT_ROM_BSS=0x0 250CONFIG_ZBOOT_ROM_BSS=0x0
222CONFIG_CMDLINE="" 251CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
223# CONFIG_XIP_KERNEL is not set 252# CONFIG_XIP_KERNEL is not set
224# CONFIG_KEXEC is not set 253# CONFIG_KEXEC is not set
225 254
@@ -233,6 +262,7 @@ CONFIG_CMDLINE=""
233CONFIG_FPE_NWFPE=y 262CONFIG_FPE_NWFPE=y
234# CONFIG_FPE_NWFPE_XP is not set 263# CONFIG_FPE_NWFPE_XP is not set
235# CONFIG_FPE_FASTFPE is not set 264# CONFIG_FPE_FASTFPE is not set
265# CONFIG_VFP is not set
236 266
237# 267#
238# Userspace binary formats 268# Userspace binary formats
@@ -245,10 +275,12 @@ CONFIG_BINFMT_ELF=y
245# Power management options 275# Power management options
246# 276#
247CONFIG_PM=y 277CONFIG_PM=y
248CONFIG_PM_LEGACY=y 278# CONFIG_PM_LEGACY is not set
249# CONFIG_PM_DEBUG is not set 279# CONFIG_PM_DEBUG is not set
250# CONFIG_PM_SYSFS_DEPRECATED is not set 280CONFIG_PM_SLEEP=y
251CONFIG_APM_EMULATION=m 281CONFIG_SUSPEND_UP_POSSIBLE=y
282CONFIG_SUSPEND=y
283# CONFIG_APM_EMULATION is not set
252 284
253# 285#
254# Networking 286# Networking
@@ -261,17 +293,13 @@ CONFIG_NET=y
261CONFIG_PACKET=y 293CONFIG_PACKET=y
262# CONFIG_PACKET_MMAP is not set 294# CONFIG_PACKET_MMAP is not set
263CONFIG_UNIX=y 295CONFIG_UNIX=y
264CONFIG_XFRM=y
265# CONFIG_XFRM_USER is not set
266# CONFIG_XFRM_SUB_POLICY is not set
267# CONFIG_XFRM_MIGRATE is not set
268# CONFIG_NET_KEY is not set 296# CONFIG_NET_KEY is not set
269CONFIG_INET=y 297CONFIG_INET=y
270# CONFIG_IP_MULTICAST is not set 298# CONFIG_IP_MULTICAST is not set
271# CONFIG_IP_ADVANCED_ROUTER is not set 299# CONFIG_IP_ADVANCED_ROUTER is not set
272CONFIG_IP_FIB_HASH=y 300CONFIG_IP_FIB_HASH=y
273CONFIG_IP_PNP=y 301CONFIG_IP_PNP=y
274CONFIG_IP_PNP_DHCP=y 302# CONFIG_IP_PNP_DHCP is not set
275CONFIG_IP_PNP_BOOTP=y 303CONFIG_IP_PNP_BOOTP=y
276# CONFIG_IP_PNP_RARP is not set 304# CONFIG_IP_PNP_RARP is not set
277# CONFIG_NET_IPIP is not set 305# CONFIG_NET_IPIP is not set
@@ -283,9 +311,10 @@ CONFIG_IP_PNP_BOOTP=y
283# CONFIG_INET_IPCOMP is not set 311# CONFIG_INET_IPCOMP is not set
284# CONFIG_INET_XFRM_TUNNEL is not set 312# CONFIG_INET_XFRM_TUNNEL is not set
285# CONFIG_INET_TUNNEL is not set 313# CONFIG_INET_TUNNEL is not set
286CONFIG_INET_XFRM_MODE_TRANSPORT=y 314# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
287CONFIG_INET_XFRM_MODE_TUNNEL=y 315# CONFIG_INET_XFRM_MODE_TUNNEL is not set
288CONFIG_INET_XFRM_MODE_BEET=y 316# CONFIG_INET_XFRM_MODE_BEET is not set
317# CONFIG_INET_LRO is not set
289CONFIG_INET_DIAG=y 318CONFIG_INET_DIAG=y
290CONFIG_INET_TCP_DIAG=y 319CONFIG_INET_TCP_DIAG=y
291# CONFIG_TCP_CONG_ADVANCED is not set 320# CONFIG_TCP_CONG_ADVANCED is not set
@@ -311,10 +340,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
311# CONFIG_LAPB is not set 340# CONFIG_LAPB is not set
312# CONFIG_ECONET is not set 341# CONFIG_ECONET is not set
313# CONFIG_WAN_ROUTER is not set 342# CONFIG_WAN_ROUTER is not set
314
315#
316# QoS and/or fair queueing
317#
318# CONFIG_NET_SCHED is not set 343# CONFIG_NET_SCHED is not set
319 344
320# 345#
@@ -323,28 +348,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
323# CONFIG_NET_PKTGEN is not set 348# CONFIG_NET_PKTGEN is not set
324# CONFIG_HAMRADIO is not set 349# CONFIG_HAMRADIO is not set
325# CONFIG_IRDA is not set 350# CONFIG_IRDA is not set
326CONFIG_BT=m 351# CONFIG_BT is not set
327CONFIG_BT_L2CAP=m
328CONFIG_BT_SCO=m
329CONFIG_BT_RFCOMM=m
330# CONFIG_BT_RFCOMM_TTY is not set
331CONFIG_BT_BNEP=m
332# CONFIG_BT_BNEP_MC_FILTER is not set
333# CONFIG_BT_BNEP_PROTO_FILTER is not set
334CONFIG_BT_HIDP=m
335
336#
337# Bluetooth device drivers
338#
339CONFIG_BT_HCIUSB=m
340# CONFIG_BT_HCIUSB_SCO is not set
341CONFIG_BT_HCIUART=m
342# CONFIG_BT_HCIUART_H4 is not set
343# CONFIG_BT_HCIUART_BCSP is not set
344CONFIG_BT_HCIBCM203X=m
345CONFIG_BT_HCIBPA10X=m
346CONFIG_BT_HCIBFUSB=m
347# CONFIG_BT_HCIVHCI is not set
348# CONFIG_AF_RXRPC is not set 352# CONFIG_AF_RXRPC is not set
349 353
350# 354#
@@ -353,13 +357,9 @@ CONFIG_BT_HCIBFUSB=m
353# CONFIG_CFG80211 is not set 357# CONFIG_CFG80211 is not set
354# CONFIG_WIRELESS_EXT is not set 358# CONFIG_WIRELESS_EXT is not set
355# CONFIG_MAC80211 is not set 359# CONFIG_MAC80211 is not set
356CONFIG_IEEE80211=m 360# CONFIG_IEEE80211 is not set
357# CONFIG_IEEE80211_DEBUG is not set
358CONFIG_IEEE80211_CRYPT_WEP=m
359CONFIG_IEEE80211_CRYPT_CCMP=m
360# CONFIG_IEEE80211_CRYPT_TKIP is not set
361# CONFIG_IEEE80211_SOFTMAC is not set
362# CONFIG_RFKILL is not set 361# CONFIG_RFKILL is not set
362# CONFIG_NET_9P is not set
363 363
364# 364#
365# Device Drivers 365# Device Drivers
@@ -368,23 +368,18 @@ CONFIG_IEEE80211_CRYPT_CCMP=m
368# 368#
369# Generic Driver Options 369# Generic Driver Options
370# 370#
371CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
371CONFIG_STANDALONE=y 372CONFIG_STANDALONE=y
372CONFIG_PREVENT_FIRMWARE_BUILD=y 373CONFIG_PREVENT_FIRMWARE_BUILD=y
373CONFIG_FW_LOADER=y 374# CONFIG_FW_LOADER is not set
374# CONFIG_DEBUG_DRIVER is not set
375# CONFIG_DEBUG_DEVRES is not set
376# CONFIG_SYS_HYPERVISOR is not set 375# CONFIG_SYS_HYPERVISOR is not set
377
378#
379# Connector - unified userspace <-> kernelspace linker
380#
381# CONFIG_CONNECTOR is not set 376# CONFIG_CONNECTOR is not set
382CONFIG_MTD=y 377CONFIG_MTD=y
383# CONFIG_MTD_DEBUG is not set 378# CONFIG_MTD_DEBUG is not set
384CONFIG_MTD_CONCAT=y 379CONFIG_MTD_CONCAT=y
385CONFIG_MTD_PARTITIONS=y 380CONFIG_MTD_PARTITIONS=y
386# CONFIG_MTD_REDBOOT_PARTS is not set 381# CONFIG_MTD_REDBOOT_PARTS is not set
387# CONFIG_MTD_CMDLINE_PARTS is not set 382CONFIG_MTD_CMDLINE_PARTS=y
388# CONFIG_MTD_AFS_PARTS is not set 383# CONFIG_MTD_AFS_PARTS is not set
389 384
390# 385#
@@ -398,15 +393,13 @@ CONFIG_MTD_BLOCK=y
398# CONFIG_INFTL is not set 393# CONFIG_INFTL is not set
399# CONFIG_RFD_FTL is not set 394# CONFIG_RFD_FTL is not set
400# CONFIG_SSFDC is not set 395# CONFIG_SSFDC is not set
396# CONFIG_MTD_OOPS is not set
401 397
402# 398#
403# RAM/ROM/Flash chip drivers 399# RAM/ROM/Flash chip drivers
404# 400#
405# CONFIG_MTD_CFI is not set 401# CONFIG_MTD_CFI is not set
406# CONFIG_MTD_JEDECPROBE is not set 402# CONFIG_MTD_JEDECPROBE is not set
407# CONFIG_MTD_CFI_NOSWAP is not set
408# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
409# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
410CONFIG_MTD_MAP_BANK_WIDTH_1=y 403CONFIG_MTD_MAP_BANK_WIDTH_1=y
411CONFIG_MTD_MAP_BANK_WIDTH_2=y 404CONFIG_MTD_MAP_BANK_WIDTH_2=y
412CONFIG_MTD_MAP_BANK_WIDTH_4=y 405CONFIG_MTD_MAP_BANK_WIDTH_4=y
@@ -425,12 +418,13 @@ CONFIG_MTD_CFI_I2=y
425# Mapping drivers for chip access 418# Mapping drivers for chip access
426# 419#
427# CONFIG_MTD_COMPLEX_MAPPINGS is not set 420# CONFIG_MTD_COMPLEX_MAPPINGS is not set
428# CONFIG_MTD_SHARP_SL is not set
429# CONFIG_MTD_PLATRAM is not set 421# CONFIG_MTD_PLATRAM is not set
430 422
431# 423#
432# Self-contained MTD device drivers 424# Self-contained MTD device drivers
433# 425#
426CONFIG_MTD_DATAFLASH=y
427# CONFIG_MTD_M25P80 is not set
434# CONFIG_MTD_SLRAM is not set 428# CONFIG_MTD_SLRAM is not set
435# CONFIG_MTD_PHRAM is not set 429# CONFIG_MTD_PHRAM is not set
436# CONFIG_MTD_MTDRAM is not set 430# CONFIG_MTD_MTDRAM is not set
@@ -446,32 +440,23 @@ CONFIG_MTD_NAND=y
446# CONFIG_MTD_NAND_VERIFY_WRITE is not set 440# CONFIG_MTD_NAND_VERIFY_WRITE is not set
447# CONFIG_MTD_NAND_ECC_SMC is not set 441# CONFIG_MTD_NAND_ECC_SMC is not set
448# CONFIG_MTD_NAND_MUSEUM_IDS is not set 442# CONFIG_MTD_NAND_MUSEUM_IDS is not set
449# CONFIG_MTD_NAND_H1900 is not set
450CONFIG_MTD_NAND_IDS=y 443CONFIG_MTD_NAND_IDS=y
451# CONFIG_MTD_NAND_DISKONCHIP is not set 444# CONFIG_MTD_NAND_DISKONCHIP is not set
452# CONFIG_MTD_NAND_SHARPSL is not set 445CONFIG_MTD_NAND_AT91=y
446CONFIG_MTD_NAND_AT91_ECC_SOFT=y
447# CONFIG_MTD_NAND_AT91_ECC_HW is not set
448# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
453# CONFIG_MTD_NAND_NANDSIM is not set 449# CONFIG_MTD_NAND_NANDSIM is not set
454CONFIG_MTD_NAND_PLATFORM=y 450# CONFIG_MTD_NAND_PLATFORM is not set
451# CONFIG_MTD_ALAUDA is not set
455# CONFIG_MTD_ONENAND is not set 452# CONFIG_MTD_ONENAND is not set
456 453
457# 454#
458# UBI - Unsorted block images 455# UBI - Unsorted block images
459# 456#
460# CONFIG_MTD_UBI is not set 457# CONFIG_MTD_UBI is not set
461
462#
463# Parallel port support
464#
465# CONFIG_PARPORT is not set 458# CONFIG_PARPORT is not set
466 459CONFIG_BLK_DEV=y
467#
468# Plug and Play support
469#
470# CONFIG_PNPACPI is not set
471
472#
473# Block devices
474#
475# CONFIG_BLK_DEV_COW_COMMON is not set 460# CONFIG_BLK_DEV_COW_COMMON is not set
476CONFIG_BLK_DEV_LOOP=y 461CONFIG_BLK_DEV_LOOP=y
477# CONFIG_BLK_DEV_CRYPTOLOOP is not set 462# CONFIG_BLK_DEV_CRYPTOLOOP is not set
@@ -479,20 +464,24 @@ CONFIG_BLK_DEV_LOOP=y
479# CONFIG_BLK_DEV_UB is not set 464# CONFIG_BLK_DEV_UB is not set
480CONFIG_BLK_DEV_RAM=y 465CONFIG_BLK_DEV_RAM=y
481CONFIG_BLK_DEV_RAM_COUNT=16 466CONFIG_BLK_DEV_RAM_COUNT=16
482CONFIG_BLK_DEV_RAM_SIZE=12000 467CONFIG_BLK_DEV_RAM_SIZE=8192
483CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 468CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
484# CONFIG_CDROM_PKTCDVD is not set 469# CONFIG_CDROM_PKTCDVD is not set
485# CONFIG_ATA_OVER_ETH is not set 470# CONFIG_ATA_OVER_ETH is not set
486# CONFIG_IDE is not set 471CONFIG_MISC_DEVICES=y
472CONFIG_ATMEL_PWM=y
473# CONFIG_EEPROM_93CX6 is not set
474CONFIG_ATMEL_SSC=y
487 475
488# 476#
489# SCSI device support 477# SCSI device support
490# 478#
491# CONFIG_RAID_ATTRS is not set 479# CONFIG_RAID_ATTRS is not set
492CONFIG_SCSI=y 480CONFIG_SCSI=y
481CONFIG_SCSI_DMA=y
493# CONFIG_SCSI_TGT is not set 482# CONFIG_SCSI_TGT is not set
494# CONFIG_SCSI_NETLINK is not set 483# CONFIG_SCSI_NETLINK is not set
495# CONFIG_SCSI_PROC_FS is not set 484CONFIG_SCSI_PROC_FS=y
496 485
497# 486#
498# SCSI support type (disk, tape, CD-ROM) 487# SCSI support type (disk, tape, CD-ROM)
@@ -507,7 +496,7 @@ CONFIG_BLK_DEV_SD=y
507# 496#
508# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 497# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
509# 498#
510# CONFIG_SCSI_MULTI_LUN is not set 499CONFIG_SCSI_MULTI_LUN=y
511# CONFIG_SCSI_CONSTANTS is not set 500# CONFIG_SCSI_CONSTANTS is not set
512# CONFIG_SCSI_LOGGING is not set 501# CONFIG_SCSI_LOGGING is not set
513# CONFIG_SCSI_SCAN_ASYNC is not set 502# CONFIG_SCSI_SCAN_ASYNC is not set
@@ -519,39 +508,46 @@ CONFIG_SCSI_WAIT_SCAN=m
519# CONFIG_SCSI_SPI_ATTRS is not set 508# CONFIG_SCSI_SPI_ATTRS is not set
520# CONFIG_SCSI_FC_ATTRS is not set 509# CONFIG_SCSI_FC_ATTRS is not set
521# CONFIG_SCSI_ISCSI_ATTRS is not set 510# CONFIG_SCSI_ISCSI_ATTRS is not set
522# CONFIG_SCSI_SAS_ATTRS is not set
523# CONFIG_SCSI_SAS_LIBSAS is not set 511# CONFIG_SCSI_SAS_LIBSAS is not set
524 512# CONFIG_SCSI_SRP_ATTRS is not set
525# 513# CONFIG_SCSI_LOWLEVEL is not set
526# SCSI low-level drivers
527#
528# CONFIG_ISCSI_TCP is not set
529# CONFIG_SCSI_DEBUG is not set
530# CONFIG_ATA is not set 514# CONFIG_ATA is not set
531
532#
533# Multi-device support (RAID and LVM)
534#
535# CONFIG_MD is not set 515# CONFIG_MD is not set
536
537#
538# Network device support
539#
540CONFIG_NETDEVICES=y 516CONFIG_NETDEVICES=y
517# CONFIG_NETDEVICES_MULTIQUEUE is not set
541# CONFIG_DUMMY is not set 518# CONFIG_DUMMY is not set
542# CONFIG_BONDING is not set 519# CONFIG_BONDING is not set
520# CONFIG_MACVLAN is not set
543# CONFIG_EQUALIZER is not set 521# CONFIG_EQUALIZER is not set
544# CONFIG_TUN is not set 522# CONFIG_TUN is not set
545# CONFIG_PHYLIB is not set 523# CONFIG_VETH is not set
546 524CONFIG_PHYLIB=y
547# 525
548# Ethernet (10 or 100Mbit) 526#
549# 527# MII PHY device drivers
528#
529# CONFIG_MARVELL_PHY is not set
530# CONFIG_DAVICOM_PHY is not set
531# CONFIG_QSEMI_PHY is not set
532# CONFIG_LXT_PHY is not set
533# CONFIG_CICADA_PHY is not set
534# CONFIG_VITESSE_PHY is not set
535# CONFIG_SMSC_PHY is not set
536# CONFIG_BROADCOM_PHY is not set
537# CONFIG_ICPLUS_PHY is not set
538# CONFIG_FIXED_PHY is not set
539# CONFIG_MDIO_BITBANG is not set
550CONFIG_NET_ETHERNET=y 540CONFIG_NET_ETHERNET=y
551CONFIG_MII=y 541CONFIG_MII=y
542CONFIG_MACB=y
543# CONFIG_AX88796 is not set
552# CONFIG_SMC91X is not set 544# CONFIG_SMC91X is not set
553CONFIG_DM9000=y 545# CONFIG_DM9000 is not set
554# CONFIG_SMC911X is not set 546# CONFIG_IBM_NEW_EMAC_ZMII is not set
547# CONFIG_IBM_NEW_EMAC_RGMII is not set
548# CONFIG_IBM_NEW_EMAC_TAH is not set
549# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
550# CONFIG_B44 is not set
555# CONFIG_NETDEV_1000 is not set 551# CONFIG_NETDEV_1000 is not set
556# CONFIG_NETDEV_10000 is not set 552# CONFIG_NETDEV_10000 is not set
557 553
@@ -568,7 +564,6 @@ CONFIG_DM9000=y
568# CONFIG_USB_KAWETH is not set 564# CONFIG_USB_KAWETH is not set
569# CONFIG_USB_PEGASUS is not set 565# CONFIG_USB_PEGASUS is not set
570# CONFIG_USB_RTL8150 is not set 566# CONFIG_USB_RTL8150 is not set
571# CONFIG_USB_USBNET_MII is not set
572# CONFIG_USB_USBNET is not set 567# CONFIG_USB_USBNET is not set
573# CONFIG_WAN is not set 568# CONFIG_WAN is not set
574# CONFIG_PPP is not set 569# CONFIG_PPP is not set
@@ -577,10 +572,6 @@ CONFIG_DM9000=y
577# CONFIG_NETCONSOLE is not set 572# CONFIG_NETCONSOLE is not set
578# CONFIG_NETPOLL is not set 573# CONFIG_NETPOLL is not set
579# CONFIG_NET_POLL_CONTROLLER is not set 574# CONFIG_NET_POLL_CONTROLLER is not set
580
581#
582# ISDN subsystem
583#
584# CONFIG_ISDN is not set 575# CONFIG_ISDN is not set
585 576
586# 577#
@@ -595,10 +586,9 @@ CONFIG_INPUT=y
595# 586#
596CONFIG_INPUT_MOUSEDEV=y 587CONFIG_INPUT_MOUSEDEV=y
597# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 588# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
598CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 589CONFIG_INPUT_MOUSEDEV_SCREEN_X=320
599CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 590CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240
600# CONFIG_INPUT_JOYDEV is not set 591# CONFIG_INPUT_JOYDEV is not set
601# CONFIG_INPUT_TSDEV is not set
602CONFIG_INPUT_EVDEV=y 592CONFIG_INPUT_EVDEV=y
603# CONFIG_INPUT_EVBUG is not set 593# CONFIG_INPUT_EVBUG is not set
604 594
@@ -612,29 +602,18 @@ CONFIG_INPUT_KEYBOARD=y
612# CONFIG_KEYBOARD_XTKBD is not set 602# CONFIG_KEYBOARD_XTKBD is not set
613# CONFIG_KEYBOARD_NEWTON is not set 603# CONFIG_KEYBOARD_NEWTON is not set
614# CONFIG_KEYBOARD_STOWAWAY is not set 604# CONFIG_KEYBOARD_STOWAWAY is not set
615CONFIG_KEYBOARD_PXA27x=m 605CONFIG_KEYBOARD_GPIO=y
616# CONFIG_KEYBOARD_GPIO is not set
617# CONFIG_INPUT_MOUSE is not set 606# CONFIG_INPUT_MOUSE is not set
618# CONFIG_INPUT_JOYSTICK is not set 607# CONFIG_INPUT_JOYSTICK is not set
619# CONFIG_INPUT_TABLET is not set 608# CONFIG_INPUT_TABLET is not set
620CONFIG_INPUT_TOUCHSCREEN=y 609# CONFIG_INPUT_TOUCHSCREEN is not set
621# CONFIG_TOUCHSCREEN_GUNZE is not set
622# CONFIG_TOUCHSCREEN_ELO is not set
623# CONFIG_TOUCHSCREEN_MTOUCH is not set
624# CONFIG_TOUCHSCREEN_MK712 is not set
625# CONFIG_TOUCHSCREEN_PENMOUNT is not set
626# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
627# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
628# CONFIG_TOUCHSCREEN_UCB1400 is not set
629# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
630# CONFIG_INPUT_MISC is not set 610# CONFIG_INPUT_MISC is not set
631 611
632# 612#
633# Hardware I/O ports 613# Hardware I/O ports
634# 614#
635CONFIG_SERIO=y 615CONFIG_SERIO=y
636# CONFIG_SERIO_SERPORT is not set 616CONFIG_SERIO_SERPORT=y
637CONFIG_SERIO_LIBPS2=y
638# CONFIG_SERIO_RAW is not set 617# CONFIG_SERIO_RAW is not set
639# CONFIG_GAMEPORT is not set 618# CONFIG_GAMEPORT is not set
640 619
@@ -655,45 +634,50 @@ CONFIG_HW_CONSOLE=y
655# 634#
656# Non-8250 serial port support 635# Non-8250 serial port support
657# 636#
658CONFIG_SERIAL_PXA=y 637CONFIG_SERIAL_ATMEL=y
659CONFIG_SERIAL_PXA_CONSOLE=y 638CONFIG_SERIAL_ATMEL_CONSOLE=y
639# CONFIG_SERIAL_ATMEL_TTYAT is not set
660CONFIG_SERIAL_CORE=y 640CONFIG_SERIAL_CORE=y
661CONFIG_SERIAL_CORE_CONSOLE=y 641CONFIG_SERIAL_CORE_CONSOLE=y
662CONFIG_UNIX98_PTYS=y 642CONFIG_UNIX98_PTYS=y
663CONFIG_LEGACY_PTYS=y 643CONFIG_LEGACY_PTYS=y
664CONFIG_LEGACY_PTY_COUNT=256 644CONFIG_LEGACY_PTY_COUNT=16
665
666#
667# IPMI
668#
669# CONFIG_IPMI_HANDLER is not set 645# CONFIG_IPMI_HANDLER is not set
670# CONFIG_WATCHDOG is not set 646CONFIG_HW_RANDOM=y
671CONFIG_HW_RANDOM=m
672# CONFIG_NVRAM is not set 647# CONFIG_NVRAM is not set
673# CONFIG_R3964 is not set 648# CONFIG_R3964 is not set
674# CONFIG_RAW_DRIVER is not set 649# CONFIG_RAW_DRIVER is not set
675
676#
677# TPM devices
678#
679# CONFIG_TCG_TPM is not set 650# CONFIG_TCG_TPM is not set
680# CONFIG_I2C is not set 651# CONFIG_I2C is not set
681 652
682# 653#
683# SPI support 654# SPI support
684# 655#
685# CONFIG_SPI is not set 656CONFIG_SPI=y
686# CONFIG_SPI_MASTER is not set 657CONFIG_SPI_MASTER=y
687 658
688# 659#
689# Dallas's 1-wire bus 660# SPI Master Controller Drivers
690# 661#
662CONFIG_SPI_ATMEL=y
663# CONFIG_SPI_BITBANG is not set
664
665#
666# SPI Protocol Masters
667#
668# CONFIG_SPI_AT25 is not set
669CONFIG_SPI_SPIDEV=y
670# CONFIG_SPI_TLE62X0 is not set
691# CONFIG_W1 is not set 671# CONFIG_W1 is not set
672# CONFIG_POWER_SUPPLY is not set
692# CONFIG_HWMON is not set 673# CONFIG_HWMON is not set
674# CONFIG_WATCHDOG is not set
693 675
694# 676#
695# Misc devices 677# Sonics Silicon Backplane
696# 678#
679CONFIG_SSB_POSSIBLE=y
680# CONFIG_SSB is not set
697 681
698# 682#
699# Multifunction device drivers 683# Multifunction device drivers
@@ -701,19 +685,6 @@ CONFIG_HW_RANDOM=m
701# CONFIG_MFD_SM501 is not set 685# CONFIG_MFD_SM501 is not set
702 686
703# 687#
704# LED devices
705#
706# CONFIG_NEW_LEDS is not set
707
708#
709# LED drivers
710#
711
712#
713# LED Triggers
714#
715
716#
717# Multimedia devices 688# Multimedia devices
718# 689#
719# CONFIG_VIDEO_DEV is not set 690# CONFIG_VIDEO_DEV is not set
@@ -723,81 +694,51 @@ CONFIG_HW_RANDOM=m
723# 694#
724# Graphics support 695# Graphics support
725# 696#
697# CONFIG_VGASTATE is not set
698# CONFIG_VIDEO_OUTPUT_CONTROL is not set
699# CONFIG_FB is not set
726# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 700# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
727 701
728# 702#
729# Display device support 703# Display device support
730# 704#
731# CONFIG_DISPLAY_SUPPORT is not set 705# CONFIG_DISPLAY_SUPPORT is not set
732# CONFIG_VGASTATE is not set
733CONFIG_FB=y
734# CONFIG_FIRMWARE_EDID is not set
735# CONFIG_FB_DDC is not set
736CONFIG_FB_CFB_FILLRECT=y
737CONFIG_FB_CFB_COPYAREA=y
738CONFIG_FB_CFB_IMAGEBLIT=y
739# CONFIG_FB_SYS_FILLRECT is not set
740# CONFIG_FB_SYS_COPYAREA is not set
741# CONFIG_FB_SYS_IMAGEBLIT is not set
742# CONFIG_FB_SYS_FOPS is not set
743CONFIG_FB_DEFERRED_IO=y
744# CONFIG_FB_SVGALIB is not set
745# CONFIG_FB_MACMODES is not set
746# CONFIG_FB_BACKLIGHT is not set
747# CONFIG_FB_MODE_HELPERS is not set
748# CONFIG_FB_TILEBLITTING is not set
749
750#
751# Frame buffer hardware drivers
752#
753# CONFIG_FB_S1D13XXX is not set
754CONFIG_FB_PXA=y
755# CONFIG_FB_PXA_PARAMETERS is not set
756# CONFIG_FB_MBX is not set
757# CONFIG_FB_VIRTUAL is not set
758 706
759# 707#
760# Console display driver support 708# Console display driver support
761# 709#
762# CONFIG_VGA_CONSOLE is not set 710# CONFIG_VGA_CONSOLE is not set
763CONFIG_DUMMY_CONSOLE=y 711CONFIG_DUMMY_CONSOLE=y
764CONFIG_FRAMEBUFFER_CONSOLE=y
765# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
766# CONFIG_FONTS is not set
767CONFIG_FONT_8x8=y
768CONFIG_FONT_8x16=y
769CONFIG_LOGO=y
770CONFIG_LOGO_LINUX_MONO=y
771CONFIG_LOGO_LINUX_VGA16=y
772CONFIG_LOGO_LINUX_CLUT224=y
773 712
774# 713#
775# Sound 714# Sound
776# 715#
777CONFIG_SOUND=m 716CONFIG_SOUND=y
778 717
779# 718#
780# Advanced Linux Sound Architecture 719# Advanced Linux Sound Architecture
781# 720#
782CONFIG_SND=m 721CONFIG_SND=y
783CONFIG_SND_TIMER=m 722CONFIG_SND_TIMER=y
784CONFIG_SND_PCM=m 723CONFIG_SND_PCM=y
785# CONFIG_SND_SEQUENCER is not set 724CONFIG_SND_SEQUENCER=y
725# CONFIG_SND_SEQ_DUMMY is not set
786CONFIG_SND_OSSEMUL=y 726CONFIG_SND_OSSEMUL=y
787CONFIG_SND_MIXER_OSS=m 727CONFIG_SND_MIXER_OSS=y
788CONFIG_SND_PCM_OSS=m 728CONFIG_SND_PCM_OSS=y
789CONFIG_SND_PCM_OSS_PLUGINS=y 729CONFIG_SND_PCM_OSS_PLUGINS=y
730CONFIG_SND_SEQUENCER_OSS=y
790# CONFIG_SND_DYNAMIC_MINORS is not set 731# CONFIG_SND_DYNAMIC_MINORS is not set
791CONFIG_SND_SUPPORT_OLD_API=y 732CONFIG_SND_SUPPORT_OLD_API=y
792CONFIG_SND_VERBOSE_PROCFS=y 733# CONFIG_SND_VERBOSE_PROCFS is not set
793# CONFIG_SND_VERBOSE_PRINTK is not set 734# CONFIG_SND_VERBOSE_PRINTK is not set
794# CONFIG_SND_DEBUG is not set 735# CONFIG_SND_DEBUG is not set
795 736
796# 737#
797# Generic devices 738# Generic devices
798# 739#
799CONFIG_SND_AC97_CODEC=m
800# CONFIG_SND_DUMMY is not set 740# CONFIG_SND_DUMMY is not set
741# CONFIG_SND_VIRMIDI is not set
801# CONFIG_SND_MTPAV is not set 742# CONFIG_SND_MTPAV is not set
802# CONFIG_SND_SERIAL_U16550 is not set 743# CONFIG_SND_SERIAL_U16550 is not set
803# CONFIG_SND_MPU401 is not set 744# CONFIG_SND_MPU401 is not set
@@ -805,8 +746,13 @@ CONFIG_SND_AC97_CODEC=m
805# 746#
806# ALSA ARM devices 747# ALSA ARM devices
807# 748#
808CONFIG_SND_PXA2XX_PCM=m 749# CONFIG_SND_AT91_AC97 is not set
809CONFIG_SND_PXA2XX_AC97=m 750
751#
752# SPI devices
753#
754CONFIG_SND_AT73C213=y
755CONFIG_SND_AT73C213_TARGET_BITRATE=48000
810 756
811# 757#
812# USB devices 758# USB devices
@@ -820,16 +766,17 @@ CONFIG_SND_PXA2XX_AC97=m
820# CONFIG_SND_SOC is not set 766# CONFIG_SND_SOC is not set
821 767
822# 768#
823# Open Sound System 769# SoC Audio support for SuperH
824# 770#
825# CONFIG_SOUND_PRIME is not set
826CONFIG_AC97_BUS=m
827 771
828# 772#
829# HID Devices 773# Open Sound System
830# 774#
775# CONFIG_SOUND_PRIME is not set
776CONFIG_HID_SUPPORT=y
831CONFIG_HID=y 777CONFIG_HID=y
832# CONFIG_HID_DEBUG is not set 778# CONFIG_HID_DEBUG is not set
779# CONFIG_HIDRAW is not set
833 780
834# 781#
835# USB Input Devices 782# USB Input Devices
@@ -838,10 +785,7 @@ CONFIG_USB_HID=y
838# CONFIG_USB_HIDINPUT_POWERBOOK is not set 785# CONFIG_USB_HIDINPUT_POWERBOOK is not set
839# CONFIG_HID_FF is not set 786# CONFIG_HID_FF is not set
840# CONFIG_USB_HIDDEV is not set 787# CONFIG_USB_HIDDEV is not set
841 788CONFIG_USB_SUPPORT=y
842#
843# USB support
844#
845CONFIG_USB_ARCH_HAS_HCD=y 789CONFIG_USB_ARCH_HAS_HCD=y
846CONFIG_USB_ARCH_HAS_OHCI=y 790CONFIG_USB_ARCH_HAS_OHCI=y
847# CONFIG_USB_ARCH_HAS_EHCI is not set 791# CONFIG_USB_ARCH_HAS_EHCI is not set
@@ -855,6 +799,7 @@ CONFIG_USB_DEVICEFS=y
855# CONFIG_USB_DEVICE_CLASS is not set 799# CONFIG_USB_DEVICE_CLASS is not set
856# CONFIG_USB_DYNAMIC_MINORS is not set 800# CONFIG_USB_DYNAMIC_MINORS is not set
857# CONFIG_USB_SUSPEND is not set 801# CONFIG_USB_SUSPEND is not set
802# CONFIG_USB_PERSIST is not set
858# CONFIG_USB_OTG is not set 803# CONFIG_USB_OTG is not set
859 804
860# 805#
@@ -866,6 +811,7 @@ CONFIG_USB_OHCI_HCD=y
866# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 811# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
867CONFIG_USB_OHCI_LITTLE_ENDIAN=y 812CONFIG_USB_OHCI_LITTLE_ENDIAN=y
868# CONFIG_USB_SL811_HCD is not set 813# CONFIG_USB_SL811_HCD is not set
814# CONFIG_USB_R8A66597_HCD is not set
869 815
870# 816#
871# USB Device Class drivers 817# USB Device Class drivers
@@ -884,6 +830,7 @@ CONFIG_USB_STORAGE=y
884# CONFIG_USB_STORAGE_DEBUG is not set 830# CONFIG_USB_STORAGE_DEBUG is not set
885# CONFIG_USB_STORAGE_DATAFAB is not set 831# CONFIG_USB_STORAGE_DATAFAB is not set
886# CONFIG_USB_STORAGE_FREECOM is not set 832# CONFIG_USB_STORAGE_FREECOM is not set
833# CONFIG_USB_STORAGE_ISD200 is not set
887# CONFIG_USB_STORAGE_DPCM is not set 834# CONFIG_USB_STORAGE_DPCM is not set
888# CONFIG_USB_STORAGE_USBAT is not set 835# CONFIG_USB_STORAGE_USBAT is not set
889# CONFIG_USB_STORAGE_SDDR09 is not set 836# CONFIG_USB_STORAGE_SDDR09 is not set
@@ -898,7 +845,7 @@ CONFIG_USB_STORAGE=y
898# 845#
899# CONFIG_USB_MDC800 is not set 846# CONFIG_USB_MDC800 is not set
900# CONFIG_USB_MICROTEK is not set 847# CONFIG_USB_MICROTEK is not set
901# CONFIG_USB_MON is not set 848CONFIG_USB_MON=y
902 849
903# 850#
904# USB port drivers 851# USB port drivers
@@ -939,26 +886,66 @@ CONFIG_USB_STORAGE=y
939# 886#
940# USB Gadget Support 887# USB Gadget Support
941# 888#
942# CONFIG_USB_GADGET is not set 889CONFIG_USB_GADGET=y
943CONFIG_MMC=m 890# CONFIG_USB_GADGET_DEBUG_FILES is not set
891CONFIG_USB_GADGET_SELECTED=y
892# CONFIG_USB_GADGET_AMD5536UDC is not set
893# CONFIG_USB_GADGET_ATMEL_USBA is not set
894# CONFIG_USB_GADGET_FSL_USB2 is not set
895# CONFIG_USB_GADGET_NET2280 is not set
896# CONFIG_USB_GADGET_PXA2XX is not set
897# CONFIG_USB_GADGET_M66592 is not set
898# CONFIG_USB_GADGET_GOKU is not set
899# CONFIG_USB_GADGET_LH7A40X is not set
900# CONFIG_USB_GADGET_OMAP is not set
901# CONFIG_USB_GADGET_S3C2410 is not set
902CONFIG_USB_GADGET_AT91=y
903CONFIG_USB_AT91=y
904# CONFIG_USB_GADGET_DUMMY_HCD is not set
905# CONFIG_USB_GADGET_DUALSPEED is not set
906CONFIG_USB_ZERO=m
907# CONFIG_USB_ETH is not set
908CONFIG_USB_GADGETFS=m
909CONFIG_USB_FILE_STORAGE=m
910# CONFIG_USB_FILE_STORAGE_TEST is not set
911CONFIG_USB_G_SERIAL=m
912# CONFIG_USB_MIDI_GADGET is not set
913CONFIG_MMC=y
944# CONFIG_MMC_DEBUG is not set 914# CONFIG_MMC_DEBUG is not set
945# CONFIG_MMC_UNSAFE_RESUME is not set 915# CONFIG_MMC_UNSAFE_RESUME is not set
946 916
947# 917#
948# MMC/SD Card Drivers 918# MMC/SD Card Drivers
949# 919#
950CONFIG_MMC_BLOCK=m 920CONFIG_MMC_BLOCK=y
921CONFIG_MMC_BLOCK_BOUNCE=y
922# CONFIG_SDIO_UART is not set
951 923
952# 924#
953# MMC/SD Host Controller Drivers 925# MMC/SD Host Controller Drivers
954# 926#
955CONFIG_MMC_PXA=m 927CONFIG_MMC_AT91=y
928# CONFIG_MMC_SPI is not set
929CONFIG_NEW_LEDS=y
930CONFIG_LEDS_CLASS=y
956 931
957# 932#
958# Real Time Clock 933# LED drivers
959# 934#
935CONFIG_LEDS_ATMEL_PWM=y
936CONFIG_LEDS_GPIO=y
937
938#
939# LED Triggers
940#
941CONFIG_LEDS_TRIGGERS=y
942CONFIG_LEDS_TRIGGER_TIMER=y
943CONFIG_LEDS_TRIGGER_HEARTBEAT=y
960CONFIG_RTC_LIB=y 944CONFIG_RTC_LIB=y
961CONFIG_RTC_CLASS=m 945CONFIG_RTC_CLASS=y
946CONFIG_RTC_HCTOSYS=y
947CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
948# CONFIG_RTC_DEBUG is not set
962 949
963# 950#
964# RTC interfaces 951# RTC interfaces
@@ -970,26 +957,28 @@ CONFIG_RTC_INTF_DEV=y
970# CONFIG_RTC_DRV_TEST is not set 957# CONFIG_RTC_DRV_TEST is not set
971 958
972# 959#
973# I2C RTC drivers
974#
975
976#
977# SPI RTC drivers 960# SPI RTC drivers
978# 961#
962# CONFIG_RTC_DRV_RS5C348 is not set
963# CONFIG_RTC_DRV_MAX6902 is not set
979 964
980# 965#
981# Platform RTC drivers 966# Platform RTC drivers
982# 967#
983# CONFIG_RTC_DRV_CMOS is not set 968# CONFIG_RTC_DRV_CMOS is not set
984# CONFIG_RTC_DRV_DS1553 is not set 969# CONFIG_RTC_DRV_DS1553 is not set
970# CONFIG_RTC_DRV_STK17TA8 is not set
985# CONFIG_RTC_DRV_DS1742 is not set 971# CONFIG_RTC_DRV_DS1742 is not set
986# CONFIG_RTC_DRV_M48T86 is not set 972# CONFIG_RTC_DRV_M48T86 is not set
987CONFIG_RTC_DRV_V3020=m 973# CONFIG_RTC_DRV_M48T59 is not set
974# CONFIG_RTC_DRV_V3020 is not set
988 975
989# 976#
990# on-CPU RTC drivers 977# on-CPU RTC drivers
991# 978#
992CONFIG_RTC_DRV_SA1100=m 979CONFIG_RTC_DRV_AT91SAM9=y
980CONFIG_RTC_DRV_AT91SAM9_RTT=0
981CONFIG_RTC_DRV_AT91SAM9_GPBR=0
993 982
994# 983#
995# File systems 984# File systems
@@ -997,14 +986,8 @@ CONFIG_RTC_DRV_SA1100=m
997CONFIG_EXT2_FS=y 986CONFIG_EXT2_FS=y
998# CONFIG_EXT2_FS_XATTR is not set 987# CONFIG_EXT2_FS_XATTR is not set
999# CONFIG_EXT2_FS_XIP is not set 988# CONFIG_EXT2_FS_XIP is not set
1000CONFIG_EXT3_FS=y 989# CONFIG_EXT3_FS is not set
1001CONFIG_EXT3_FS_XATTR=y
1002# CONFIG_EXT3_FS_POSIX_ACL is not set
1003# CONFIG_EXT3_FS_SECURITY is not set
1004# CONFIG_EXT4DEV_FS is not set 990# CONFIG_EXT4DEV_FS is not set
1005CONFIG_JBD=y
1006# CONFIG_JBD_DEBUG is not set
1007CONFIG_FS_MBCACHE=y
1008# CONFIG_REISERFS_FS is not set 991# CONFIG_REISERFS_FS is not set
1009# CONFIG_JFS_FS is not set 992# CONFIG_JFS_FS is not set
1010# CONFIG_FS_POSIX_ACL is not set 993# CONFIG_FS_POSIX_ACL is not set
@@ -1046,7 +1029,6 @@ CONFIG_SYSFS=y
1046CONFIG_TMPFS=y 1029CONFIG_TMPFS=y
1047# CONFIG_TMPFS_POSIX_ACL is not set 1030# CONFIG_TMPFS_POSIX_ACL is not set
1048# CONFIG_HUGETLB_PAGE is not set 1031# CONFIG_HUGETLB_PAGE is not set
1049CONFIG_RAMFS=y
1050# CONFIG_CONFIGFS_FS is not set 1032# CONFIG_CONFIGFS_FS is not set
1051 1033
1052# 1034#
@@ -1062,22 +1044,21 @@ CONFIG_RAMFS=y
1062CONFIG_JFFS2_FS=y 1044CONFIG_JFFS2_FS=y
1063CONFIG_JFFS2_FS_DEBUG=0 1045CONFIG_JFFS2_FS_DEBUG=0
1064CONFIG_JFFS2_FS_WRITEBUFFER=y 1046CONFIG_JFFS2_FS_WRITEBUFFER=y
1047# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1065CONFIG_JFFS2_SUMMARY=y 1048CONFIG_JFFS2_SUMMARY=y
1066# CONFIG_JFFS2_FS_XATTR is not set 1049# CONFIG_JFFS2_FS_XATTR is not set
1067# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1050# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1068CONFIG_JFFS2_ZLIB=y 1051CONFIG_JFFS2_ZLIB=y
1052# CONFIG_JFFS2_LZO is not set
1069CONFIG_JFFS2_RTIME=y 1053CONFIG_JFFS2_RTIME=y
1070# CONFIG_JFFS2_RUBIN is not set 1054# CONFIG_JFFS2_RUBIN is not set
1071# CONFIG_CRAMFS is not set 1055CONFIG_CRAMFS=y
1072# CONFIG_VXFS_FS is not set 1056# CONFIG_VXFS_FS is not set
1073# CONFIG_HPFS_FS is not set 1057# CONFIG_HPFS_FS is not set
1074# CONFIG_QNX4FS_FS is not set 1058# CONFIG_QNX4FS_FS is not set
1075# CONFIG_SYSV_FS is not set 1059# CONFIG_SYSV_FS is not set
1076# CONFIG_UFS_FS is not set 1060# CONFIG_UFS_FS is not set
1077 1061CONFIG_NETWORK_FILESYSTEMS=y
1078#
1079# Network File Systems
1080#
1081CONFIG_NFS_FS=y 1062CONFIG_NFS_FS=y
1082CONFIG_NFS_V3=y 1063CONFIG_NFS_V3=y
1083# CONFIG_NFS_V3_ACL is not set 1064# CONFIG_NFS_V3_ACL is not set
@@ -1092,29 +1073,23 @@ CONFIG_SUNRPC=y
1092# CONFIG_SUNRPC_BIND34 is not set 1073# CONFIG_SUNRPC_BIND34 is not set
1093# CONFIG_RPCSEC_GSS_KRB5 is not set 1074# CONFIG_RPCSEC_GSS_KRB5 is not set
1094# CONFIG_RPCSEC_GSS_SPKM3 is not set 1075# CONFIG_RPCSEC_GSS_SPKM3 is not set
1095CONFIG_SMB_FS=y 1076# CONFIG_SMB_FS is not set
1096# CONFIG_SMB_NLS_DEFAULT is not set
1097# CONFIG_CIFS is not set 1077# CONFIG_CIFS is not set
1098# CONFIG_NCP_FS is not set 1078# CONFIG_NCP_FS is not set
1099# CONFIG_CODA_FS is not set 1079# CONFIG_CODA_FS is not set
1100# CONFIG_AFS_FS is not set 1080# CONFIG_AFS_FS is not set
1101# CONFIG_9P_FS is not set
1102 1081
1103# 1082#
1104# Partition Types 1083# Partition Types
1105# 1084#
1106# CONFIG_PARTITION_ADVANCED is not set 1085# CONFIG_PARTITION_ADVANCED is not set
1107CONFIG_MSDOS_PARTITION=y 1086CONFIG_MSDOS_PARTITION=y
1108
1109#
1110# Native Language Support
1111#
1112CONFIG_NLS=y 1087CONFIG_NLS=y
1113CONFIG_NLS_DEFAULT="iso8859-1" 1088CONFIG_NLS_DEFAULT="iso8859-1"
1114CONFIG_NLS_CODEPAGE_437=y 1089CONFIG_NLS_CODEPAGE_437=y
1115# CONFIG_NLS_CODEPAGE_737 is not set 1090# CONFIG_NLS_CODEPAGE_737 is not set
1116# CONFIG_NLS_CODEPAGE_775 is not set 1091# CONFIG_NLS_CODEPAGE_775 is not set
1117# CONFIG_NLS_CODEPAGE_850 is not set 1092CONFIG_NLS_CODEPAGE_850=y
1118# CONFIG_NLS_CODEPAGE_852 is not set 1093# CONFIG_NLS_CODEPAGE_852 is not set
1119# CONFIG_NLS_CODEPAGE_855 is not set 1094# CONFIG_NLS_CODEPAGE_855 is not set
1120# CONFIG_NLS_CODEPAGE_857 is not set 1095# CONFIG_NLS_CODEPAGE_857 is not set
@@ -1145,108 +1120,36 @@ CONFIG_NLS_ISO8859_1=y
1145# CONFIG_NLS_ISO8859_9 is not set 1120# CONFIG_NLS_ISO8859_9 is not set
1146# CONFIG_NLS_ISO8859_13 is not set 1121# CONFIG_NLS_ISO8859_13 is not set
1147# CONFIG_NLS_ISO8859_14 is not set 1122# CONFIG_NLS_ISO8859_14 is not set
1148# CONFIG_NLS_ISO8859_15 is not set 1123CONFIG_NLS_ISO8859_15=y
1149# CONFIG_NLS_KOI8_R is not set 1124# CONFIG_NLS_KOI8_R is not set
1150# CONFIG_NLS_KOI8_U is not set 1125# CONFIG_NLS_KOI8_U is not set
1151CONFIG_NLS_UTF8=y 1126CONFIG_NLS_UTF8=y
1152
1153#
1154# Distributed Lock Manager
1155#
1156# CONFIG_DLM is not set 1127# CONFIG_DLM is not set
1157 1128# CONFIG_INSTRUMENTATION is not set
1158#
1159# Profiling support
1160#
1161# CONFIG_PROFILING is not set
1162 1129
1163# 1130#
1164# Kernel hacking 1131# Kernel hacking
1165# 1132#
1166# CONFIG_PRINTK_TIME is not set 1133# CONFIG_PRINTK_TIME is not set
1134# CONFIG_ENABLE_WARN_DEPRECATED is not set
1167CONFIG_ENABLE_MUST_CHECK=y 1135CONFIG_ENABLE_MUST_CHECK=y
1168CONFIG_MAGIC_SYSRQ=y 1136# CONFIG_MAGIC_SYSRQ is not set
1169# CONFIG_UNUSED_SYMBOLS is not set 1137# CONFIG_UNUSED_SYMBOLS is not set
1170# CONFIG_DEBUG_FS is not set 1138# CONFIG_DEBUG_FS is not set
1171# CONFIG_HEADERS_CHECK is not set 1139# CONFIG_HEADERS_CHECK is not set
1172CONFIG_DEBUG_KERNEL=y 1140# CONFIG_DEBUG_KERNEL is not set
1173# CONFIG_DEBUG_SHIRQ is not set 1141CONFIG_DEBUG_BUGVERBOSE=y
1174# CONFIG_DETECT_SOFTLOCKUP is not set
1175# CONFIG_SCHEDSTATS is not set
1176# CONFIG_TIMER_STATS is not set
1177# CONFIG_DEBUG_SLAB is not set
1178# CONFIG_DEBUG_RT_MUTEXES is not set
1179# CONFIG_RT_MUTEX_TESTER is not set
1180# CONFIG_DEBUG_SPINLOCK is not set
1181# CONFIG_DEBUG_MUTEXES is not set
1182# CONFIG_DEBUG_LOCK_ALLOC is not set
1183# CONFIG_PROVE_LOCKING is not set
1184# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1185# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1186# CONFIG_DEBUG_KOBJECT is not set
1187# CONFIG_DEBUG_BUGVERBOSE is not set
1188CONFIG_DEBUG_INFO=y
1189# CONFIG_DEBUG_VM is not set
1190# CONFIG_DEBUG_LIST is not set
1191CONFIG_FRAME_POINTER=y 1142CONFIG_FRAME_POINTER=y
1192CONFIG_FORCED_INLINING=y 1143# CONFIG_SAMPLES is not set
1193# CONFIG_RCU_TORTURE_TEST is not set 1144# CONFIG_DEBUG_USER is not set
1194# CONFIG_FAULT_INJECTION is not set
1195CONFIG_DEBUG_USER=y
1196CONFIG_DEBUG_ERRORS=y
1197CONFIG_DEBUG_LL=y
1198# CONFIG_DEBUG_ICEDCC is not set
1199 1145
1200# 1146#
1201# Security options 1147# Security options
1202# 1148#
1203# CONFIG_KEYS is not set 1149# CONFIG_KEYS is not set
1204# CONFIG_SECURITY is not set 1150# CONFIG_SECURITY is not set
1205 1151# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1206# 1152# CONFIG_CRYPTO is not set
1207# Cryptographic options
1208#
1209CONFIG_CRYPTO=y
1210CONFIG_CRYPTO_ALGAPI=m
1211CONFIG_CRYPTO_BLKCIPHER=m
1212CONFIG_CRYPTO_MANAGER=m
1213# CONFIG_CRYPTO_HMAC is not set
1214# CONFIG_CRYPTO_XCBC is not set
1215# CONFIG_CRYPTO_NULL is not set
1216# CONFIG_CRYPTO_MD4 is not set
1217# CONFIG_CRYPTO_MD5 is not set
1218# CONFIG_CRYPTO_SHA1 is not set
1219# CONFIG_CRYPTO_SHA256 is not set
1220# CONFIG_CRYPTO_SHA512 is not set
1221# CONFIG_CRYPTO_WP512 is not set
1222# CONFIG_CRYPTO_TGR192 is not set
1223# CONFIG_CRYPTO_GF128MUL is not set
1224CONFIG_CRYPTO_ECB=m
1225CONFIG_CRYPTO_CBC=m
1226CONFIG_CRYPTO_PCBC=m
1227# CONFIG_CRYPTO_LRW is not set
1228# CONFIG_CRYPTO_CRYPTD is not set
1229# CONFIG_CRYPTO_DES is not set
1230# CONFIG_CRYPTO_FCRYPT is not set
1231# CONFIG_CRYPTO_BLOWFISH is not set
1232# CONFIG_CRYPTO_TWOFISH is not set
1233# CONFIG_CRYPTO_SERPENT is not set
1234CONFIG_CRYPTO_AES=m
1235# CONFIG_CRYPTO_CAST5 is not set
1236# CONFIG_CRYPTO_CAST6 is not set
1237# CONFIG_CRYPTO_TEA is not set
1238CONFIG_CRYPTO_ARC4=m
1239# CONFIG_CRYPTO_KHAZAD is not set
1240# CONFIG_CRYPTO_ANUBIS is not set
1241# CONFIG_CRYPTO_DEFLATE is not set
1242# CONFIG_CRYPTO_MICHAEL_MIC is not set
1243# CONFIG_CRYPTO_CRC32C is not set
1244# CONFIG_CRYPTO_CAMELLIA is not set
1245# CONFIG_CRYPTO_TEST is not set
1246
1247#
1248# Hardware crypto devices
1249#
1250 1153
1251# 1154#
1252# Library routines 1155# Library routines
@@ -1256,10 +1159,10 @@ CONFIG_BITREVERSE=y
1256# CONFIG_CRC16 is not set 1159# CONFIG_CRC16 is not set
1257# CONFIG_CRC_ITU_T is not set 1160# CONFIG_CRC_ITU_T is not set
1258CONFIG_CRC32=y 1161CONFIG_CRC32=y
1162# CONFIG_CRC7 is not set
1259# CONFIG_LIBCRC32C is not set 1163# CONFIG_LIBCRC32C is not set
1260CONFIG_ZLIB_INFLATE=y 1164CONFIG_ZLIB_INFLATE=y
1261CONFIG_ZLIB_DEFLATE=y 1165CONFIG_ZLIB_DEFLATE=y
1262CONFIG_PLIST=y 1166CONFIG_PLIST=y
1263CONFIG_HAS_IOMEM=y 1167CONFIG_HAS_IOMEM=y
1264CONFIG_HAS_IOPORT=y 1168CONFIG_HAS_IOPORT=y
1265CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/at91sam9rlek_defconfig b/arch/arm/configs/at91sam9rlek_defconfig
index 98e6746d02be..d8ec5f9ca6ec 100644
--- a/arch/arm/configs/at91sam9rlek_defconfig
+++ b/arch/arm/configs/at91sam9rlek_defconfig
@@ -211,7 +211,6 @@ CONFIG_CPU_CP15_MMU=y
211# 211#
212# CONFIG_TICK_ONESHOT is not set 212# CONFIG_TICK_ONESHOT is not set
213# CONFIG_PREEMPT is not set 213# CONFIG_PREEMPT is not set
214# CONFIG_NO_IDLE_HZ is not set
215CONFIG_HZ=100 214CONFIG_HZ=100
216# CONFIG_AEABI is not set 215# CONFIG_AEABI is not set
217# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 216# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ateb9200_defconfig b/arch/arm/configs/ateb9200_defconfig
index d846a492e5ce..85c80f723d8e 100644
--- a/arch/arm/configs/ateb9200_defconfig
+++ b/arch/arm/configs/ateb9200_defconfig
@@ -171,7 +171,6 @@ CONFIG_AT91_CF=m
171# Kernel Features 171# Kernel Features
172# 172#
173CONFIG_PREEMPT=y 173CONFIG_PREEMPT=y
174CONFIG_NO_IDLE_HZ=y
175CONFIG_HZ=100 174CONFIG_HZ=100
176# CONFIG_AEABI is not set 175# CONFIG_AEABI is not set
177# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 176# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/collie_defconfig b/arch/arm/configs/collie_defconfig
index 4264e273202d..f7622e658163 100644
--- a/arch/arm/configs/collie_defconfig
+++ b/arch/arm/configs/collie_defconfig
@@ -166,7 +166,6 @@ CONFIG_PCMCIA_SA1100=y
166# Kernel Features 166# Kernel Features
167# 167#
168# CONFIG_PREEMPT is not set 168# CONFIG_PREEMPT is not set
169# CONFIG_NO_IDLE_HZ is not set
170CONFIG_HZ=100 169CONFIG_HZ=100
171# CONFIG_AEABI is not set 170# CONFIG_AEABI is not set
172CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 171CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
index e8980a9bb893..9b8748a8d9dd 100644
--- a/arch/arm/configs/corgi_defconfig
+++ b/arch/arm/configs/corgi_defconfig
@@ -165,7 +165,6 @@ CONFIG_PCMCIA_PXA2XX=y
165# Kernel Features 165# Kernel Features
166# 166#
167CONFIG_PREEMPT=y 167CONFIG_PREEMPT=y
168# CONFIG_NO_IDLE_HZ is not set
169# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 168# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
170CONFIG_SELECT_MEMORY_MODEL=y 169CONFIG_SELECT_MEMORY_MODEL=y
171CONFIG_FLATMEM_MANUAL=y 170CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/arm/configs/ecbat91_defconfig b/arch/arm/configs/ecbat91_defconfig
index 90ed214e3673..cfeb817ad21a 100644
--- a/arch/arm/configs/ecbat91_defconfig
+++ b/arch/arm/configs/ecbat91_defconfig
@@ -230,7 +230,6 @@ CONFIG_AT91_CF=y
230# 230#
231# CONFIG_TICK_ONESHOT is not set 231# CONFIG_TICK_ONESHOT is not set
232CONFIG_PREEMPT=y 232CONFIG_PREEMPT=y
233# CONFIG_NO_IDLE_HZ is not set
234CONFIG_HZ=100 233CONFIG_HZ=100
235# CONFIG_AEABI is not set 234# CONFIG_AEABI is not set
236# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 235# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig
index 24a701ab33e5..21aa013793c6 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -184,7 +184,6 @@ CONFIG_ARM_AMBA=y
184# Kernel Features 184# Kernel Features
185# 185#
186# CONFIG_PREEMPT is not set 186# CONFIG_PREEMPT is not set
187# CONFIG_NO_IDLE_HZ is not set
188CONFIG_HZ=100 187CONFIG_HZ=100
189# CONFIG_AEABI is not set 188# CONFIG_AEABI is not set
190# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 189# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/eseries_pxa_defconfig b/arch/arm/configs/eseries_pxa_defconfig
index ed487b90dbed..493ecee24f94 100644
--- a/arch/arm/configs/eseries_pxa_defconfig
+++ b/arch/arm/configs/eseries_pxa_defconfig
@@ -251,7 +251,6 @@ CONFIG_PCMCIA_PXA2XX=m
251# Kernel Features 251# Kernel Features
252# 252#
253# CONFIG_PREEMPT is not set 253# CONFIG_PREEMPT is not set
254# CONFIG_NO_IDLE_HZ is not set
255CONFIG_HZ=100 254CONFIG_HZ=100
256CONFIG_AEABI=y 255CONFIG_AEABI=y
257CONFIG_OABI_COMPAT=y 256CONFIG_OABI_COMPAT=y
diff --git a/arch/arm/configs/imx27ads_defconfig b/arch/arm/configs/imx27ads_defconfig
new file mode 100644
index 000000000000..bcd95b8dd2df
--- /dev/null
+++ b/arch/arm/configs/imx27ads_defconfig
@@ -0,0 +1,826 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc6
4# Fri Jun 20 16:29:34 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_ZONE_DMA=y
26CONFIG_ARCH_MTD_XIP=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39# CONFIG_SWAP is not set
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42CONFIG_POSIX_MQUEUE=y
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49# CONFIG_GROUP_SCHED is not set
50CONFIG_SYSFS_DEPRECATED=y
51CONFIG_SYSFS_DEPRECATED_V2=y
52# CONFIG_RELAY is not set
53# CONFIG_NAMESPACES is not set
54# CONFIG_BLK_DEV_INITRD is not set
55# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
56CONFIG_SYSCTL=y
57CONFIG_EMBEDDED=y
58CONFIG_UID16=y
59CONFIG_SYSCTL_SYSCALL=y
60CONFIG_SYSCTL_SYSCALL_CHECK=y
61CONFIG_KALLSYMS=y
62CONFIG_KALLSYMS_EXTRA_PASS=y
63CONFIG_HOTPLUG=y
64CONFIG_PRINTK=y
65CONFIG_BUG=y
66CONFIG_ELF_CORE=y
67CONFIG_COMPAT_BRK=y
68CONFIG_BASE_FULL=y
69CONFIG_FUTEX=y
70CONFIG_ANON_INODES=y
71CONFIG_EPOLL=y
72CONFIG_SIGNALFD=y
73CONFIG_TIMERFD=y
74CONFIG_EVENTFD=y
75CONFIG_SHMEM=y
76CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_SLAB=y
78# CONFIG_SLUB is not set
79# CONFIG_SLOB is not set
80# CONFIG_PROFILING is not set
81# CONFIG_MARKERS is not set
82CONFIG_HAVE_OPROFILE=y
83# CONFIG_KPROBES is not set
84CONFIG_HAVE_KPROBES=y
85CONFIG_HAVE_KRETPROBES=y
86# CONFIG_HAVE_DMA_ATTRS is not set
87CONFIG_PROC_PAGE_MONITOR=y
88CONFIG_SLABINFO=y
89CONFIG_RT_MUTEXES=y
90# CONFIG_TINY_SHMEM is not set
91CONFIG_BASE_SMALL=0
92CONFIG_MODULES=y
93# CONFIG_MODULE_FORCE_LOAD is not set
94CONFIG_MODULE_UNLOAD=y
95# CONFIG_MODULE_FORCE_UNLOAD is not set
96# CONFIG_MODVERSIONS is not set
97# CONFIG_MODULE_SRCVERSION_ALL is not set
98# CONFIG_KMOD is not set
99CONFIG_BLOCK=y
100# CONFIG_LBD is not set
101# CONFIG_BLK_DEV_IO_TRACE is not set
102# CONFIG_LSF is not set
103# CONFIG_BLK_DEV_BSG is not set
104
105#
106# IO Schedulers
107#
108CONFIG_IOSCHED_NOOP=y
109# CONFIG_IOSCHED_AS is not set
110# CONFIG_IOSCHED_DEADLINE is not set
111# CONFIG_IOSCHED_CFQ is not set
112# CONFIG_DEFAULT_AS is not set
113# CONFIG_DEFAULT_DEADLINE is not set
114# CONFIG_DEFAULT_CFQ is not set
115CONFIG_DEFAULT_NOOP=y
116CONFIG_DEFAULT_IOSCHED="noop"
117CONFIG_CLASSIC_RCU=y
118
119#
120# System Type
121#
122# CONFIG_ARCH_AAEC2000 is not set
123# CONFIG_ARCH_INTEGRATOR is not set
124# CONFIG_ARCH_REALVIEW is not set
125# CONFIG_ARCH_VERSATILE is not set
126# CONFIG_ARCH_AT91 is not set
127# CONFIG_ARCH_CLPS7500 is not set
128# CONFIG_ARCH_CLPS711X is not set
129# CONFIG_ARCH_CO285 is not set
130# CONFIG_ARCH_EBSA110 is not set
131# CONFIG_ARCH_EP93XX is not set
132# CONFIG_ARCH_FOOTBRIDGE is not set
133# CONFIG_ARCH_NETX is not set
134# CONFIG_ARCH_H720X is not set
135# CONFIG_ARCH_IMX is not set
136# CONFIG_ARCH_IOP13XX is not set
137# CONFIG_ARCH_IOP32X is not set
138# CONFIG_ARCH_IOP33X is not set
139# CONFIG_ARCH_IXP23XX is not set
140# CONFIG_ARCH_IXP2000 is not set
141# CONFIG_ARCH_IXP4XX is not set
142# CONFIG_ARCH_L7200 is not set
143# CONFIG_ARCH_KS8695 is not set
144# CONFIG_ARCH_NS9XXX is not set
145CONFIG_ARCH_MXC=y
146# CONFIG_ARCH_ORION5X is not set
147# CONFIG_ARCH_PNX4008 is not set
148# CONFIG_ARCH_PXA is not set
149# CONFIG_ARCH_RPC is not set
150# CONFIG_ARCH_SA1100 is not set
151# CONFIG_ARCH_S3C2410 is not set
152# CONFIG_ARCH_SHARK is not set
153# CONFIG_ARCH_LH7A40X is not set
154# CONFIG_ARCH_DAVINCI is not set
155# CONFIG_ARCH_OMAP is not set
156# CONFIG_ARCH_MSM7X00A is not set
157
158#
159# Boot options
160#
161
162#
163# Power management
164#
165
166#
167# Freescale MXC Implementations
168#
169CONFIG_ARCH_MX2=y
170# CONFIG_ARCH_MX3 is not set
171
172#
173# MX2 family CPU support
174#
175CONFIG_MACH_MX27=y
176
177#
178# MX2 Platforms
179#
180CONFIG_MACH_MX27ADS=y
181# CONFIG_MACH_PCM038 is not set
182
183#
184# Processor Type
185#
186CONFIG_CPU_32=y
187CONFIG_CPU_ARM926T=y
188CONFIG_CPU_32v5=y
189CONFIG_CPU_ABRT_EV5TJ=y
190CONFIG_CPU_PABRT_NOIFAR=y
191CONFIG_CPU_CACHE_VIVT=y
192CONFIG_CPU_COPY_V4WB=y
193CONFIG_CPU_TLB_V4WBI=y
194CONFIG_CPU_CP15=y
195CONFIG_CPU_CP15_MMU=y
196
197#
198# Processor Features
199#
200CONFIG_ARM_THUMB=y
201# CONFIG_CPU_ICACHE_DISABLE is not set
202# CONFIG_CPU_DCACHE_DISABLE is not set
203# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
204# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
205# CONFIG_OUTER_CACHE is not set
206
207#
208# Bus support
209#
210# CONFIG_PCI_SYSCALL is not set
211# CONFIG_ARCH_SUPPORTS_MSI is not set
212# CONFIG_PCCARD is not set
213
214#
215# Kernel Features
216#
217CONFIG_TICK_ONESHOT=y
218CONFIG_NO_HZ=y
219CONFIG_HIGH_RES_TIMERS=y
220CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
221CONFIG_PREEMPT=y
222CONFIG_HZ=100
223CONFIG_AEABI=y
224# CONFIG_OABI_COMPAT is not set
225# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
226CONFIG_SELECT_MEMORY_MODEL=y
227CONFIG_FLATMEM_MANUAL=y
228# CONFIG_DISCONTIGMEM_MANUAL is not set
229# CONFIG_SPARSEMEM_MANUAL is not set
230CONFIG_FLATMEM=y
231CONFIG_FLAT_NODE_MEM_MAP=y
232# CONFIG_SPARSEMEM_STATIC is not set
233# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
234CONFIG_PAGEFLAGS_EXTENDED=y
235CONFIG_SPLIT_PTLOCK_CPUS=4096
236# CONFIG_RESOURCES_64BIT is not set
237CONFIG_ZONE_DMA_FLAG=1
238CONFIG_BOUNCE=y
239CONFIG_VIRT_TO_BUS=y
240CONFIG_ALIGNMENT_TRAP=y
241
242#
243# Boot options
244#
245CONFIG_ZBOOT_ROM_TEXT=0x0
246CONFIG_ZBOOT_ROM_BSS=0x0
247CONFIG_CMDLINE=""
248# CONFIG_XIP_KERNEL is not set
249# CONFIG_KEXEC is not set
250
251#
252# Floating point emulation
253#
254
255#
256# At least one emulation must be selected
257#
258# CONFIG_VFP is not set
259
260#
261# Userspace binary formats
262#
263CONFIG_BINFMT_ELF=y
264# CONFIG_BINFMT_AOUT is not set
265# CONFIG_BINFMT_MISC is not set
266
267#
268# Power management options
269#
270# CONFIG_PM is not set
271CONFIG_ARCH_SUSPEND_POSSIBLE=y
272
273#
274# Networking
275#
276CONFIG_NET=y
277
278#
279# Networking options
280#
281CONFIG_PACKET=y
282CONFIG_PACKET_MMAP=y
283CONFIG_UNIX=y
284# CONFIG_NET_KEY is not set
285CONFIG_INET=y
286CONFIG_IP_MULTICAST=y
287# CONFIG_IP_ADVANCED_ROUTER is not set
288CONFIG_IP_FIB_HASH=y
289CONFIG_IP_PNP=y
290# CONFIG_IP_PNP_DHCP is not set
291# CONFIG_IP_PNP_BOOTP is not set
292# CONFIG_IP_PNP_RARP is not set
293# CONFIG_NET_IPIP is not set
294# CONFIG_NET_IPGRE is not set
295# CONFIG_IP_MROUTE is not set
296# CONFIG_ARPD is not set
297# CONFIG_SYN_COOKIES is not set
298# CONFIG_INET_AH is not set
299# CONFIG_INET_ESP is not set
300# CONFIG_INET_IPCOMP is not set
301# CONFIG_INET_XFRM_TUNNEL is not set
302# CONFIG_INET_TUNNEL is not set
303# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
304# CONFIG_INET_XFRM_MODE_TUNNEL is not set
305# CONFIG_INET_XFRM_MODE_BEET is not set
306# CONFIG_INET_LRO is not set
307# CONFIG_INET_DIAG is not set
308# CONFIG_TCP_CONG_ADVANCED is not set
309CONFIG_TCP_CONG_CUBIC=y
310CONFIG_DEFAULT_TCP_CONG="cubic"
311# CONFIG_TCP_MD5SIG is not set
312# CONFIG_IPV6 is not set
313# CONFIG_NETWORK_SECMARK is not set
314# CONFIG_NETFILTER is not set
315# CONFIG_IP_DCCP is not set
316# CONFIG_IP_SCTP is not set
317# CONFIG_TIPC is not set
318# CONFIG_ATM is not set
319# CONFIG_BRIDGE is not set
320# CONFIG_VLAN_8021Q is not set
321# CONFIG_DECNET is not set
322# CONFIG_LLC2 is not set
323# CONFIG_IPX is not set
324# CONFIG_ATALK is not set
325# CONFIG_X25 is not set
326# CONFIG_LAPB is not set
327# CONFIG_ECONET is not set
328# CONFIG_WAN_ROUTER is not set
329# CONFIG_NET_SCHED is not set
330
331#
332# Network testing
333#
334# CONFIG_NET_PKTGEN is not set
335# CONFIG_HAMRADIO is not set
336# CONFIG_CAN is not set
337# CONFIG_IRDA is not set
338# CONFIG_BT is not set
339# CONFIG_AF_RXRPC is not set
340
341#
342# Wireless
343#
344# CONFIG_CFG80211 is not set
345# CONFIG_WIRELESS_EXT is not set
346# CONFIG_MAC80211 is not set
347# CONFIG_IEEE80211 is not set
348# CONFIG_RFKILL is not set
349# CONFIG_NET_9P is not set
350
351#
352# Device Drivers
353#
354
355#
356# Generic Driver Options
357#
358CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
359CONFIG_STANDALONE=y
360CONFIG_PREVENT_FIRMWARE_BUILD=y
361# CONFIG_FW_LOADER is not set
362# CONFIG_SYS_HYPERVISOR is not set
363# CONFIG_CONNECTOR is not set
364CONFIG_MTD=y
365# CONFIG_MTD_DEBUG is not set
366# CONFIG_MTD_CONCAT is not set
367CONFIG_MTD_PARTITIONS=y
368# CONFIG_MTD_REDBOOT_PARTS is not set
369CONFIG_MTD_CMDLINE_PARTS=y
370# CONFIG_MTD_AFS_PARTS is not set
371# CONFIG_MTD_AR7_PARTS is not set
372
373#
374# User Modules And Translation Layers
375#
376CONFIG_MTD_CHAR=y
377CONFIG_MTD_BLKDEVS=y
378CONFIG_MTD_BLOCK=y
379# CONFIG_FTL is not set
380# CONFIG_NFTL is not set
381# CONFIG_INFTL is not set
382# CONFIG_RFD_FTL is not set
383# CONFIG_SSFDC is not set
384# CONFIG_MTD_OOPS is not set
385
386#
387# RAM/ROM/Flash chip drivers
388#
389CONFIG_MTD_CFI=y
390# CONFIG_MTD_JEDECPROBE is not set
391CONFIG_MTD_GEN_PROBE=y
392CONFIG_MTD_CFI_ADV_OPTIONS=y
393CONFIG_MTD_CFI_NOSWAP=y
394# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
395# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
396CONFIG_MTD_CFI_GEOMETRY=y
397# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
398CONFIG_MTD_MAP_BANK_WIDTH_2=y
399# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
400# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
401# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
402# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
403CONFIG_MTD_CFI_I1=y
404# CONFIG_MTD_CFI_I2 is not set
405# CONFIG_MTD_CFI_I4 is not set
406# CONFIG_MTD_CFI_I8 is not set
407# CONFIG_MTD_OTP is not set
408CONFIG_MTD_CFI_INTELEXT=y
409# CONFIG_MTD_CFI_AMDSTD is not set
410# CONFIG_MTD_CFI_STAA is not set
411CONFIG_MTD_CFI_UTIL=y
412# CONFIG_MTD_RAM is not set
413# CONFIG_MTD_ROM is not set
414# CONFIG_MTD_ABSENT is not set
415# CONFIG_MTD_XIP is not set
416
417#
418# Mapping drivers for chip access
419#
420# CONFIG_MTD_COMPLEX_MAPPINGS is not set
421CONFIG_MTD_PHYSMAP=y
422CONFIG_MTD_PHYSMAP_START=0x00000000
423CONFIG_MTD_PHYSMAP_LEN=0x0
424CONFIG_MTD_PHYSMAP_BANKWIDTH=2
425# CONFIG_MTD_ARM_INTEGRATOR is not set
426# CONFIG_MTD_PLATRAM is not set
427
428#
429# Self-contained MTD device drivers
430#
431# CONFIG_MTD_SLRAM is not set
432# CONFIG_MTD_PHRAM is not set
433# CONFIG_MTD_MTDRAM is not set
434# CONFIG_MTD_BLOCK2MTD is not set
435
436#
437# Disk-On-Chip Device Drivers
438#
439# CONFIG_MTD_DOC2000 is not set
440# CONFIG_MTD_DOC2001 is not set
441# CONFIG_MTD_DOC2001PLUS is not set
442# CONFIG_MTD_NAND is not set
443# CONFIG_MTD_ONENAND is not set
444
445#
446# UBI - Unsorted block images
447#
448# CONFIG_MTD_UBI is not set
449# CONFIG_PARPORT is not set
450CONFIG_BLK_DEV=y
451# CONFIG_BLK_DEV_COW_COMMON is not set
452# CONFIG_BLK_DEV_LOOP is not set
453# CONFIG_BLK_DEV_NBD is not set
454# CONFIG_BLK_DEV_RAM is not set
455# CONFIG_CDROM_PKTCDVD is not set
456# CONFIG_ATA_OVER_ETH is not set
457# CONFIG_MISC_DEVICES is not set
458CONFIG_HAVE_IDE=y
459# CONFIG_IDE is not set
460
461#
462# SCSI device support
463#
464# CONFIG_RAID_ATTRS is not set
465# CONFIG_SCSI is not set
466# CONFIG_SCSI_DMA is not set
467# CONFIG_SCSI_NETLINK is not set
468# CONFIG_ATA is not set
469# CONFIG_MD is not set
470CONFIG_NETDEVICES=y
471# CONFIG_NETDEVICES_MULTIQUEUE is not set
472# CONFIG_DUMMY is not set
473# CONFIG_BONDING is not set
474# CONFIG_MACVLAN is not set
475# CONFIG_EQUALIZER is not set
476# CONFIG_TUN is not set
477# CONFIG_VETH is not set
478# CONFIG_PHYLIB is not set
479CONFIG_NET_ETHERNET=y
480# CONFIG_MII is not set
481# CONFIG_AX88796 is not set
482# CONFIG_SMC91X is not set
483# CONFIG_DM9000 is not set
484# CONFIG_IBM_NEW_EMAC_ZMII is not set
485# CONFIG_IBM_NEW_EMAC_RGMII is not set
486# CONFIG_IBM_NEW_EMAC_TAH is not set
487# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
488# CONFIG_B44 is not set
489# CONFIG_FEC_OLD is not set
490# CONFIG_NETDEV_1000 is not set
491# CONFIG_NETDEV_10000 is not set
492
493#
494# Wireless LAN
495#
496# CONFIG_WLAN_PRE80211 is not set
497# CONFIG_WLAN_80211 is not set
498# CONFIG_IWLWIFI_LEDS is not set
499# CONFIG_WAN is not set
500# CONFIG_PPP is not set
501# CONFIG_SLIP is not set
502# CONFIG_NETCONSOLE is not set
503# CONFIG_NETPOLL is not set
504# CONFIG_NET_POLL_CONTROLLER is not set
505# CONFIG_ISDN is not set
506
507#
508# Input device support
509#
510CONFIG_INPUT=y
511# CONFIG_INPUT_FF_MEMLESS is not set
512# CONFIG_INPUT_POLLDEV is not set
513
514#
515# Userland interfaces
516#
517# CONFIG_INPUT_MOUSEDEV is not set
518# CONFIG_INPUT_JOYDEV is not set
519CONFIG_INPUT_EVDEV=y
520# CONFIG_INPUT_EVBUG is not set
521
522#
523# Input Device Drivers
524#
525# CONFIG_INPUT_KEYBOARD is not set
526# CONFIG_INPUT_MOUSE is not set
527# CONFIG_INPUT_JOYSTICK is not set
528# CONFIG_INPUT_TABLET is not set
529CONFIG_INPUT_TOUCHSCREEN=y
530# CONFIG_TOUCHSCREEN_FUJITSU is not set
531# CONFIG_TOUCHSCREEN_GUNZE is not set
532# CONFIG_TOUCHSCREEN_ELO is not set
533# CONFIG_TOUCHSCREEN_MTOUCH is not set
534# CONFIG_TOUCHSCREEN_MK712 is not set
535# CONFIG_TOUCHSCREEN_PENMOUNT is not set
536# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
537# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
538# CONFIG_TOUCHSCREEN_UCB1400 is not set
539# CONFIG_INPUT_MISC is not set
540
541#
542# Hardware I/O ports
543#
544# CONFIG_SERIO is not set
545# CONFIG_GAMEPORT is not set
546
547#
548# Character devices
549#
550# CONFIG_VT is not set
551CONFIG_DEVKMEM=y
552# CONFIG_SERIAL_NONSTANDARD is not set
553
554#
555# Serial drivers
556#
557# CONFIG_SERIAL_8250 is not set
558
559#
560# Non-8250 serial port support
561#
562# CONFIG_SERIAL_IMX is not set
563CONFIG_UNIX98_PTYS=y
564# CONFIG_LEGACY_PTYS is not set
565# CONFIG_IPMI_HANDLER is not set
566# CONFIG_HW_RANDOM is not set
567# CONFIG_NVRAM is not set
568# CONFIG_R3964 is not set
569# CONFIG_RAW_DRIVER is not set
570# CONFIG_TCG_TPM is not set
571# CONFIG_I2C is not set
572# CONFIG_SPI is not set
573CONFIG_HAVE_GPIO_LIB=y
574
575#
576# GPIO Support
577#
578
579#
580# I2C GPIO expanders:
581#
582
583#
584# SPI GPIO expanders:
585#
586# CONFIG_W1 is not set
587# CONFIG_POWER_SUPPLY is not set
588# CONFIG_HWMON is not set
589# CONFIG_WATCHDOG is not set
590
591#
592# Sonics Silicon Backplane
593#
594CONFIG_SSB_POSSIBLE=y
595# CONFIG_SSB is not set
596
597#
598# Multifunction device drivers
599#
600# CONFIG_MFD_SM501 is not set
601# CONFIG_MFD_ASIC3 is not set
602# CONFIG_HTC_EGPIO is not set
603# CONFIG_HTC_PASIC3 is not set
604
605#
606# Multimedia devices
607#
608
609#
610# Multimedia core support
611#
612# CONFIG_VIDEO_DEV is not set
613# CONFIG_DVB_CORE is not set
614# CONFIG_VIDEO_MEDIA is not set
615
616#
617# Multimedia drivers
618#
619# CONFIG_DAB is not set
620
621#
622# Graphics support
623#
624# CONFIG_VGASTATE is not set
625# CONFIG_VIDEO_OUTPUT_CONTROL is not set
626# CONFIG_FB is not set
627# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
628
629#
630# Display device support
631#
632# CONFIG_DISPLAY_SUPPORT is not set
633
634#
635# Sound
636#
637# CONFIG_SOUND is not set
638# CONFIG_HID_SUPPORT is not set
639# CONFIG_USB_SUPPORT is not set
640# CONFIG_MMC is not set
641# CONFIG_NEW_LEDS is not set
642CONFIG_RTC_LIB=y
643# CONFIG_RTC_CLASS is not set
644# CONFIG_UIO is not set
645
646#
647# File systems
648#
649# CONFIG_EXT2_FS is not set
650# CONFIG_EXT3_FS is not set
651# CONFIG_EXT4DEV_FS is not set
652# CONFIG_REISERFS_FS is not set
653# CONFIG_JFS_FS is not set
654# CONFIG_FS_POSIX_ACL is not set
655# CONFIG_XFS_FS is not set
656# CONFIG_OCFS2_FS is not set
657# CONFIG_DNOTIFY is not set
658# CONFIG_INOTIFY is not set
659# CONFIG_QUOTA is not set
660# CONFIG_AUTOFS_FS is not set
661# CONFIG_AUTOFS4_FS is not set
662# CONFIG_FUSE_FS is not set
663
664#
665# CD-ROM/DVD Filesystems
666#
667# CONFIG_ISO9660_FS is not set
668# CONFIG_UDF_FS is not set
669
670#
671# DOS/FAT/NT Filesystems
672#
673# CONFIG_MSDOS_FS is not set
674# CONFIG_VFAT_FS is not set
675# CONFIG_NTFS_FS is not set
676
677#
678# Pseudo filesystems
679#
680CONFIG_PROC_FS=y
681CONFIG_PROC_SYSCTL=y
682CONFIG_SYSFS=y
683CONFIG_TMPFS=y
684# CONFIG_TMPFS_POSIX_ACL is not set
685# CONFIG_HUGETLB_PAGE is not set
686# CONFIG_CONFIGFS_FS is not set
687
688#
689# Miscellaneous filesystems
690#
691# CONFIG_ADFS_FS is not set
692# CONFIG_AFFS_FS is not set
693# CONFIG_HFS_FS is not set
694# CONFIG_HFSPLUS_FS is not set
695# CONFIG_BEFS_FS is not set
696# CONFIG_BFS_FS is not set
697# CONFIG_EFS_FS is not set
698CONFIG_JFFS2_FS=y
699CONFIG_JFFS2_FS_DEBUG=0
700CONFIG_JFFS2_FS_WRITEBUFFER=y
701# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
702# CONFIG_JFFS2_SUMMARY is not set
703# CONFIG_JFFS2_FS_XATTR is not set
704# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
705CONFIG_JFFS2_ZLIB=y
706# CONFIG_JFFS2_LZO is not set
707CONFIG_JFFS2_RTIME=y
708# CONFIG_JFFS2_RUBIN is not set
709# CONFIG_CRAMFS is not set
710# CONFIG_VXFS_FS is not set
711# CONFIG_MINIX_FS is not set
712# CONFIG_HPFS_FS is not set
713# CONFIG_QNX4FS_FS is not set
714# CONFIG_ROMFS_FS is not set
715# CONFIG_SYSV_FS is not set
716# CONFIG_UFS_FS is not set
717CONFIG_NETWORK_FILESYSTEMS=y
718CONFIG_NFS_FS=y
719CONFIG_NFS_V3=y
720# CONFIG_NFS_V3_ACL is not set
721# CONFIG_NFS_V4 is not set
722# CONFIG_NFSD is not set
723CONFIG_ROOT_NFS=y
724CONFIG_LOCKD=y
725CONFIG_LOCKD_V4=y
726CONFIG_NFS_COMMON=y
727CONFIG_SUNRPC=y
728# CONFIG_SUNRPC_BIND34 is not set
729# CONFIG_RPCSEC_GSS_KRB5 is not set
730# CONFIG_RPCSEC_GSS_SPKM3 is not set
731# CONFIG_SMB_FS is not set
732# CONFIG_CIFS is not set
733# CONFIG_NCP_FS is not set
734# CONFIG_CODA_FS is not set
735# CONFIG_AFS_FS is not set
736
737#
738# Partition Types
739#
740# CONFIG_PARTITION_ADVANCED is not set
741CONFIG_MSDOS_PARTITION=y
742CONFIG_NLS=y
743CONFIG_NLS_DEFAULT="iso8859-1"
744CONFIG_NLS_CODEPAGE_437=m
745# CONFIG_NLS_CODEPAGE_737 is not set
746# CONFIG_NLS_CODEPAGE_775 is not set
747CONFIG_NLS_CODEPAGE_850=m
748# CONFIG_NLS_CODEPAGE_852 is not set
749# CONFIG_NLS_CODEPAGE_855 is not set
750# CONFIG_NLS_CODEPAGE_857 is not set
751# CONFIG_NLS_CODEPAGE_860 is not set
752# CONFIG_NLS_CODEPAGE_861 is not set
753# CONFIG_NLS_CODEPAGE_862 is not set
754# CONFIG_NLS_CODEPAGE_863 is not set
755# CONFIG_NLS_CODEPAGE_864 is not set
756# CONFIG_NLS_CODEPAGE_865 is not set
757# CONFIG_NLS_CODEPAGE_866 is not set
758# CONFIG_NLS_CODEPAGE_869 is not set
759# CONFIG_NLS_CODEPAGE_936 is not set
760# CONFIG_NLS_CODEPAGE_950 is not set
761# CONFIG_NLS_CODEPAGE_932 is not set
762# CONFIG_NLS_CODEPAGE_949 is not set
763# CONFIG_NLS_CODEPAGE_874 is not set
764# CONFIG_NLS_ISO8859_8 is not set
765# CONFIG_NLS_CODEPAGE_1250 is not set
766# CONFIG_NLS_CODEPAGE_1251 is not set
767# CONFIG_NLS_ASCII is not set
768CONFIG_NLS_ISO8859_1=y
769# CONFIG_NLS_ISO8859_2 is not set
770# CONFIG_NLS_ISO8859_3 is not set
771# CONFIG_NLS_ISO8859_4 is not set
772# CONFIG_NLS_ISO8859_5 is not set
773# CONFIG_NLS_ISO8859_6 is not set
774# CONFIG_NLS_ISO8859_7 is not set
775# CONFIG_NLS_ISO8859_9 is not set
776# CONFIG_NLS_ISO8859_13 is not set
777# CONFIG_NLS_ISO8859_14 is not set
778CONFIG_NLS_ISO8859_15=m
779# CONFIG_NLS_KOI8_R is not set
780# CONFIG_NLS_KOI8_U is not set
781# CONFIG_NLS_UTF8 is not set
782# CONFIG_DLM is not set
783
784#
785# Kernel hacking
786#
787# CONFIG_PRINTK_TIME is not set
788CONFIG_ENABLE_WARN_DEPRECATED=y
789CONFIG_ENABLE_MUST_CHECK=y
790CONFIG_FRAME_WARN=1024
791# CONFIG_MAGIC_SYSRQ is not set
792# CONFIG_UNUSED_SYMBOLS is not set
793# CONFIG_DEBUG_FS is not set
794# CONFIG_HEADERS_CHECK is not set
795# CONFIG_DEBUG_KERNEL is not set
796# CONFIG_DEBUG_BUGVERBOSE is not set
797CONFIG_FRAME_POINTER=y
798# CONFIG_SAMPLES is not set
799# CONFIG_DEBUG_USER is not set
800
801#
802# Security options
803#
804# CONFIG_KEYS is not set
805# CONFIG_SECURITY is not set
806# CONFIG_SECURITY_FILE_CAPABILITIES is not set
807# CONFIG_CRYPTO is not set
808
809#
810# Library routines
811#
812CONFIG_BITREVERSE=y
813# CONFIG_GENERIC_FIND_FIRST_BIT is not set
814# CONFIG_GENERIC_FIND_NEXT_BIT is not set
815# CONFIG_CRC_CCITT is not set
816# CONFIG_CRC16 is not set
817# CONFIG_CRC_ITU_T is not set
818CONFIG_CRC32=y
819# CONFIG_CRC7 is not set
820# CONFIG_LIBCRC32C is not set
821CONFIG_ZLIB_INFLATE=y
822CONFIG_ZLIB_DEFLATE=y
823CONFIG_PLIST=y
824CONFIG_HAS_IOMEM=y
825CONFIG_HAS_IOPORT=y
826CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/iop13xx_defconfig b/arch/arm/configs/iop13xx_defconfig
index 988b4d13e76f..482e57061053 100644
--- a/arch/arm/configs/iop13xx_defconfig
+++ b/arch/arm/configs/iop13xx_defconfig
@@ -197,7 +197,6 @@ CONFIG_PCI_LEGACY=y
197# 197#
198# CONFIG_TICK_ONESHOT is not set 198# CONFIG_TICK_ONESHOT is not set
199# CONFIG_PREEMPT is not set 199# CONFIG_PREEMPT is not set
200# CONFIG_NO_IDLE_HZ is not set
201CONFIG_HZ=100 200CONFIG_HZ=100
202# CONFIG_AEABI is not set 201# CONFIG_AEABI is not set
203# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 202# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/iop32x_defconfig b/arch/arm/configs/iop32x_defconfig
index 83f40d4041a6..8612f58e1056 100644
--- a/arch/arm/configs/iop32x_defconfig
+++ b/arch/arm/configs/iop32x_defconfig
@@ -201,7 +201,6 @@ CONFIG_PCI_LEGACY=y
201# 201#
202# CONFIG_TICK_ONESHOT is not set 202# CONFIG_TICK_ONESHOT is not set
203# CONFIG_PREEMPT is not set 203# CONFIG_PREEMPT is not set
204# CONFIG_NO_IDLE_HZ is not set
205CONFIG_HZ=100 204CONFIG_HZ=100
206# CONFIG_AEABI is not set 205# CONFIG_AEABI is not set
207# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 206# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/iop33x_defconfig b/arch/arm/configs/iop33x_defconfig
index 917afb5ccfac..8b0098d19d08 100644
--- a/arch/arm/configs/iop33x_defconfig
+++ b/arch/arm/configs/iop33x_defconfig
@@ -197,7 +197,6 @@ CONFIG_PCI_LEGACY=y
197# 197#
198# CONFIG_TICK_ONESHOT is not set 198# CONFIG_TICK_ONESHOT is not set
199# CONFIG_PREEMPT is not set 199# CONFIG_PREEMPT is not set
200# CONFIG_NO_IDLE_HZ is not set
201CONFIG_HZ=100 200CONFIG_HZ=100
202# CONFIG_AEABI is not set 201# CONFIG_AEABI is not set
203# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 202# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ixp2000_defconfig b/arch/arm/configs/ixp2000_defconfig
index f8f9793b526f..84680db6c615 100644
--- a/arch/arm/configs/ixp2000_defconfig
+++ b/arch/arm/configs/ixp2000_defconfig
@@ -184,7 +184,6 @@ CONFIG_PCI=y
184# Kernel Features 184# Kernel Features
185# 185#
186# CONFIG_PREEMPT is not set 186# CONFIG_PREEMPT is not set
187# CONFIG_NO_IDLE_HZ is not set
188CONFIG_HZ=100 187CONFIG_HZ=100
189# CONFIG_AEABI is not set 188# CONFIG_AEABI is not set
190# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 189# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig
index 27cf022dd807..4a2f7b2372db 100644
--- a/arch/arm/configs/ixp23xx_defconfig
+++ b/arch/arm/configs/ixp23xx_defconfig
@@ -180,7 +180,6 @@ CONFIG_PCI=y
180# Kernel Features 180# Kernel Features
181# 181#
182# CONFIG_PREEMPT is not set 182# CONFIG_PREEMPT is not set
183# CONFIG_NO_IDLE_HZ is not set
184CONFIG_HZ=100 183CONFIG_HZ=100
185# CONFIG_AEABI is not set 184# CONFIG_AEABI is not set
186# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 185# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
index efa0485d2f7e..fc14932e3abd 100644
--- a/arch/arm/configs/ixp4xx_defconfig
+++ b/arch/arm/configs/ixp4xx_defconfig
@@ -165,6 +165,7 @@ CONFIG_ARCH_PRPMC1100=y
165CONFIG_MACH_NAS100D=y 165CONFIG_MACH_NAS100D=y
166CONFIG_MACH_DSMG600=y 166CONFIG_MACH_DSMG600=y
167CONFIG_ARCH_IXDP4XX=y 167CONFIG_ARCH_IXDP4XX=y
168CONFIG_MACH_FSG=y
168CONFIG_CPU_IXP46X=y 169CONFIG_CPU_IXP46X=y
169CONFIG_CPU_IXP43X=y 170CONFIG_CPU_IXP43X=y
170CONFIG_MACH_GTWX5715=y 171CONFIG_MACH_GTWX5715=y
@@ -770,7 +771,7 @@ CONFIG_ATA=y
770# CONFIG_SATA_SIL24 is not set 771# CONFIG_SATA_SIL24 is not set
771# CONFIG_SATA_SIS is not set 772# CONFIG_SATA_SIS is not set
772# CONFIG_SATA_ULI is not set 773# CONFIG_SATA_ULI is not set
773# CONFIG_SATA_VIA is not set 774CONFIG_SATA_VIA=y
774# CONFIG_SATA_VITESSE is not set 775# CONFIG_SATA_VITESSE is not set
775# CONFIG_SATA_INIC162X is not set 776# CONFIG_SATA_INIC162X is not set
776# CONFIG_PATA_ALI is not set 777# CONFIG_PATA_ALI is not set
@@ -1143,7 +1144,7 @@ CONFIG_HWMON=y
1143# CONFIG_SENSORS_VIA686A is not set 1144# CONFIG_SENSORS_VIA686A is not set
1144# CONFIG_SENSORS_VT1211 is not set 1145# CONFIG_SENSORS_VT1211 is not set
1145# CONFIG_SENSORS_VT8231 is not set 1146# CONFIG_SENSORS_VT8231 is not set
1146# CONFIG_SENSORS_W83781D is not set 1147CONFIG_SENSORS_W83781D=y
1147# CONFIG_SENSORS_W83791D is not set 1148# CONFIG_SENSORS_W83791D is not set
1148# CONFIG_SENSORS_W83792D is not set 1149# CONFIG_SENSORS_W83792D is not set
1149# CONFIG_SENSORS_W83793 is not set 1150# CONFIG_SENSORS_W83793 is not set
@@ -1334,8 +1335,8 @@ CONFIG_LEDS_CLASS=y
1334# 1335#
1335# LED drivers 1336# LED drivers
1336# 1337#
1337# CONFIG_LEDS_IXP4XX is not set
1338CONFIG_LEDS_GPIO=y 1338CONFIG_LEDS_GPIO=y
1339CONFIG_LEDS_FSG=y
1339 1340
1340# 1341#
1341# LED Triggers 1342# LED Triggers
@@ -1367,7 +1368,7 @@ CONFIG_RTC_INTF_DEV=y
1367# CONFIG_RTC_DRV_DS1672 is not set 1368# CONFIG_RTC_DRV_DS1672 is not set
1368# CONFIG_RTC_DRV_MAX6900 is not set 1369# CONFIG_RTC_DRV_MAX6900 is not set
1369# CONFIG_RTC_DRV_RS5C372 is not set 1370# CONFIG_RTC_DRV_RS5C372 is not set
1370# CONFIG_RTC_DRV_ISL1208 is not set 1371CONFIG_RTC_DRV_ISL1208=y
1371CONFIG_RTC_DRV_X1205=y 1372CONFIG_RTC_DRV_X1205=y
1372CONFIG_RTC_DRV_PCF8563=y 1373CONFIG_RTC_DRV_PCF8563=y
1373# CONFIG_RTC_DRV_PCF8583 is not set 1374# CONFIG_RTC_DRV_PCF8583 is not set
diff --git a/arch/arm/configs/kafa_defconfig b/arch/arm/configs/kafa_defconfig
index ae51a40db6f9..6dd95a2c8d5d 100644
--- a/arch/arm/configs/kafa_defconfig
+++ b/arch/arm/configs/kafa_defconfig
@@ -162,7 +162,6 @@ CONFIG_CPU_TLB_V4WBI=y
162# Kernel Features 162# Kernel Features
163# 163#
164CONFIG_PREEMPT=y 164CONFIG_PREEMPT=y
165# CONFIG_NO_IDLE_HZ is not set
166CONFIG_HZ=100 165CONFIG_HZ=100
167# CONFIG_AEABI is not set 166# CONFIG_AEABI is not set
168# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 167# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/kb9202_defconfig b/arch/arm/configs/kb9202_defconfig
index c16537d9d67a..8e74c66f239d 100644
--- a/arch/arm/configs/kb9202_defconfig
+++ b/arch/arm/configs/kb9202_defconfig
@@ -126,7 +126,6 @@ CONFIG_ISA_DMA_API=y
126# 126#
127# Kernel Features 127# Kernel Features
128# 128#
129# CONFIG_NO_IDLE_HZ is not set
130# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 129# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
131CONFIG_FLATMEM=y 130CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 131CONFIG_FLAT_NODE_MEM_MAP=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
new file mode 100644
index 000000000000..e3357ba10f1f
--- /dev/null
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -0,0 +1,1426 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5
4# Sun Jun 22 15:51:25 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_ZONE_DMA=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49# CONFIG_GROUP_SCHED is not set
50# CONFIG_SYSFS_DEPRECATED_V2 is not set
51# CONFIG_RELAY is not set
52# CONFIG_NAMESPACES is not set
53# CONFIG_BLK_DEV_INITRD is not set
54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
55CONFIG_SYSCTL=y
56CONFIG_EMBEDDED=y
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_SYSCTL_SYSCALL_CHECK=y
60CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_ALL is not set
62# CONFIG_KALLSYMS_EXTRA_PASS is not set
63CONFIG_HOTPLUG=y
64CONFIG_PRINTK=y
65CONFIG_BUG=y
66CONFIG_ELF_CORE=y
67CONFIG_COMPAT_BRK=y
68CONFIG_BASE_FULL=y
69CONFIG_FUTEX=y
70CONFIG_ANON_INODES=y
71CONFIG_EPOLL=y
72CONFIG_SIGNALFD=y
73CONFIG_TIMERFD=y
74CONFIG_EVENTFD=y
75CONFIG_SHMEM=y
76CONFIG_VM_EVENT_COUNTERS=y
77CONFIG_SLAB=y
78# CONFIG_SLUB is not set
79# CONFIG_SLOB is not set
80CONFIG_PROFILING=y
81# CONFIG_MARKERS is not set
82CONFIG_OPROFILE=y
83CONFIG_HAVE_OPROFILE=y
84CONFIG_KPROBES=y
85CONFIG_KRETPROBES=y
86CONFIG_HAVE_KPROBES=y
87CONFIG_HAVE_KRETPROBES=y
88# CONFIG_HAVE_DMA_ATTRS is not set
89CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_SLABINFO=y
91CONFIG_RT_MUTEXES=y
92# CONFIG_TINY_SHMEM is not set
93CONFIG_BASE_SMALL=0
94CONFIG_MODULES=y
95# CONFIG_MODULE_FORCE_LOAD is not set
96CONFIG_MODULE_UNLOAD=y
97# CONFIG_MODULE_FORCE_UNLOAD is not set
98# CONFIG_MODVERSIONS is not set
99# CONFIG_MODULE_SRCVERSION_ALL is not set
100# CONFIG_KMOD is not set
101CONFIG_BLOCK=y
102# CONFIG_LBD is not set
103# CONFIG_BLK_DEV_IO_TRACE is not set
104# CONFIG_LSF is not set
105# CONFIG_BLK_DEV_BSG is not set
106
107#
108# IO Schedulers
109#
110CONFIG_IOSCHED_NOOP=y
111CONFIG_IOSCHED_AS=y
112CONFIG_IOSCHED_DEADLINE=y
113CONFIG_IOSCHED_CFQ=y
114# CONFIG_DEFAULT_AS is not set
115# CONFIG_DEFAULT_DEADLINE is not set
116CONFIG_DEFAULT_CFQ=y
117# CONFIG_DEFAULT_NOOP is not set
118CONFIG_DEFAULT_IOSCHED="cfq"
119CONFIG_CLASSIC_RCU=y
120
121#
122# System Type
123#
124# CONFIG_ARCH_AAEC2000 is not set
125# CONFIG_ARCH_INTEGRATOR is not set
126# CONFIG_ARCH_REALVIEW is not set
127# CONFIG_ARCH_VERSATILE is not set
128# CONFIG_ARCH_AT91 is not set
129# CONFIG_ARCH_CLPS7500 is not set
130# CONFIG_ARCH_CLPS711X is not set
131# CONFIG_ARCH_CO285 is not set
132# CONFIG_ARCH_EBSA110 is not set
133# CONFIG_ARCH_EP93XX is not set
134# CONFIG_ARCH_FOOTBRIDGE is not set
135# CONFIG_ARCH_NETX is not set
136# CONFIG_ARCH_H720X is not set
137# CONFIG_ARCH_IMX is not set
138# CONFIG_ARCH_IOP13XX is not set
139# CONFIG_ARCH_IOP32X is not set
140# CONFIG_ARCH_IOP33X is not set
141# CONFIG_ARCH_IXP23XX is not set
142# CONFIG_ARCH_IXP2000 is not set
143# CONFIG_ARCH_IXP4XX is not set
144# CONFIG_ARCH_L7200 is not set
145CONFIG_ARCH_KIRKWOOD=y
146# CONFIG_ARCH_KS8695 is not set
147# CONFIG_ARCH_NS9XXX is not set
148# CONFIG_ARCH_LOKI is not set
149# CONFIG_ARCH_MV78XX0 is not set
150# CONFIG_ARCH_MXC is not set
151# CONFIG_ARCH_ORION5X is not set
152# CONFIG_ARCH_PNX4008 is not set
153# CONFIG_ARCH_PXA is not set
154# CONFIG_ARCH_RPC is not set
155# CONFIG_ARCH_SA1100 is not set
156# CONFIG_ARCH_S3C2410 is not set
157# CONFIG_ARCH_SHARK is not set
158# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set
160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
162
163#
164# Marvell Kirkwood Implementations
165#
166CONFIG_MACH_DB88F6281_BP=y
167CONFIG_MACH_RD88F6192_NAS=y
168CONFIG_MACH_RD88F6281=y
169
170#
171# Boot options
172#
173
174#
175# Power management
176#
177CONFIG_PLAT_ORION=y
178
179#
180# Processor Type
181#
182CONFIG_CPU_32=y
183CONFIG_CPU_FEROCEON=y
184# CONFIG_CPU_FEROCEON_OLD_ID is not set
185CONFIG_CPU_32v5=y
186CONFIG_CPU_ABRT_EV5T=y
187CONFIG_CPU_PABRT_NOIFAR=y
188CONFIG_CPU_CACHE_VIVT=y
189CONFIG_CPU_COPY_FEROCEON=y
190CONFIG_CPU_TLB_FEROCEON=y
191CONFIG_CPU_CP15=y
192CONFIG_CPU_CP15_MMU=y
193
194#
195# Processor Features
196#
197CONFIG_ARM_THUMB=y
198# CONFIG_CPU_ICACHE_DISABLE is not set
199# CONFIG_CPU_DCACHE_DISABLE is not set
200CONFIG_OUTER_CACHE=y
201CONFIG_CACHE_FEROCEON_L2=y
202
203#
204# Bus support
205#
206CONFIG_PCI=y
207CONFIG_PCI_SYSCALL=y
208# CONFIG_ARCH_SUPPORTS_MSI is not set
209CONFIG_PCI_LEGACY=y
210# CONFIG_PCI_DEBUG is not set
211# CONFIG_PCCARD is not set
212
213#
214# Kernel Features
215#
216CONFIG_TICK_ONESHOT=y
217CONFIG_NO_HZ=y
218CONFIG_HIGH_RES_TIMERS=y
219CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
220CONFIG_PREEMPT=y
221CONFIG_HZ=100
222CONFIG_AEABI=y
223# CONFIG_OABI_COMPAT is not set
224# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
225CONFIG_SELECT_MEMORY_MODEL=y
226CONFIG_FLATMEM_MANUAL=y
227# CONFIG_DISCONTIGMEM_MANUAL is not set
228# CONFIG_SPARSEMEM_MANUAL is not set
229CONFIG_FLATMEM=y
230CONFIG_FLAT_NODE_MEM_MAP=y
231# CONFIG_SPARSEMEM_STATIC is not set
232# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
233CONFIG_PAGEFLAGS_EXTENDED=y
234CONFIG_SPLIT_PTLOCK_CPUS=4096
235# CONFIG_RESOURCES_64BIT is not set
236CONFIG_ZONE_DMA_FLAG=1
237CONFIG_BOUNCE=y
238CONFIG_VIRT_TO_BUS=y
239CONFIG_ALIGNMENT_TRAP=y
240
241#
242# Boot options
243#
244CONFIG_ZBOOT_ROM_TEXT=0x0
245CONFIG_ZBOOT_ROM_BSS=0x0
246CONFIG_CMDLINE=""
247# CONFIG_XIP_KERNEL is not set
248# CONFIG_KEXEC is not set
249
250#
251# Floating point emulation
252#
253
254#
255# At least one emulation must be selected
256#
257# CONFIG_VFP is not set
258
259#
260# Userspace binary formats
261#
262CONFIG_BINFMT_ELF=y
263# CONFIG_BINFMT_AOUT is not set
264# CONFIG_BINFMT_MISC is not set
265
266#
267# Power management options
268#
269# CONFIG_PM is not set
270CONFIG_ARCH_SUSPEND_POSSIBLE=y
271
272#
273# Networking
274#
275CONFIG_NET=y
276
277#
278# Networking options
279#
280CONFIG_PACKET=y
281CONFIG_PACKET_MMAP=y
282CONFIG_UNIX=y
283CONFIG_XFRM=y
284# CONFIG_XFRM_USER is not set
285# CONFIG_XFRM_SUB_POLICY is not set
286# CONFIG_XFRM_MIGRATE is not set
287# CONFIG_XFRM_STATISTICS is not set
288# CONFIG_NET_KEY is not set
289CONFIG_INET=y
290CONFIG_IP_MULTICAST=y
291# CONFIG_IP_ADVANCED_ROUTER is not set
292CONFIG_IP_FIB_HASH=y
293CONFIG_IP_PNP=y
294CONFIG_IP_PNP_DHCP=y
295CONFIG_IP_PNP_BOOTP=y
296# CONFIG_IP_PNP_RARP is not set
297# CONFIG_NET_IPIP is not set
298# CONFIG_NET_IPGRE is not set
299# CONFIG_IP_MROUTE is not set
300# CONFIG_ARPD is not set
301# CONFIG_SYN_COOKIES is not set
302# CONFIG_INET_AH is not set
303# CONFIG_INET_ESP is not set
304# CONFIG_INET_IPCOMP is not set
305# CONFIG_INET_XFRM_TUNNEL is not set
306# CONFIG_INET_TUNNEL is not set
307CONFIG_INET_XFRM_MODE_TRANSPORT=y
308CONFIG_INET_XFRM_MODE_TUNNEL=y
309CONFIG_INET_XFRM_MODE_BEET=y
310# CONFIG_INET_LRO is not set
311CONFIG_INET_DIAG=y
312CONFIG_INET_TCP_DIAG=y
313# CONFIG_TCP_CONG_ADVANCED is not set
314CONFIG_TCP_CONG_CUBIC=y
315CONFIG_DEFAULT_TCP_CONG="cubic"
316# CONFIG_TCP_MD5SIG is not set
317# CONFIG_IPV6 is not set
318# CONFIG_NETWORK_SECMARK is not set
319# CONFIG_NETFILTER is not set
320# CONFIG_IP_DCCP is not set
321# CONFIG_IP_SCTP is not set
322# CONFIG_TIPC is not set
323# CONFIG_ATM is not set
324# CONFIG_BRIDGE is not set
325# CONFIG_VLAN_8021Q is not set
326# CONFIG_DECNET is not set
327# CONFIG_LLC2 is not set
328# CONFIG_IPX is not set
329# CONFIG_ATALK is not set
330# CONFIG_X25 is not set
331# CONFIG_LAPB is not set
332# CONFIG_ECONET is not set
333# CONFIG_WAN_ROUTER is not set
334# CONFIG_NET_SCHED is not set
335
336#
337# Network testing
338#
339CONFIG_NET_PKTGEN=m
340# CONFIG_NET_TCPPROBE is not set
341# CONFIG_HAMRADIO is not set
342# CONFIG_CAN is not set
343# CONFIG_IRDA is not set
344# CONFIG_BT is not set
345# CONFIG_AF_RXRPC is not set
346
347#
348# Wireless
349#
350# CONFIG_CFG80211 is not set
351CONFIG_WIRELESS_EXT=y
352# CONFIG_MAC80211 is not set
353# CONFIG_IEEE80211 is not set
354# CONFIG_RFKILL is not set
355# CONFIG_NET_9P is not set
356
357#
358# Device Drivers
359#
360
361#
362# Generic Driver Options
363#
364CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
365CONFIG_STANDALONE=y
366CONFIG_PREVENT_FIRMWARE_BUILD=y
367CONFIG_FW_LOADER=y
368# CONFIG_DEBUG_DRIVER is not set
369# CONFIG_DEBUG_DEVRES is not set
370# CONFIG_SYS_HYPERVISOR is not set
371# CONFIG_CONNECTOR is not set
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
377CONFIG_MTD_CMDLINE_PARTS=y
378# CONFIG_MTD_AFS_PARTS is not set
379# CONFIG_MTD_AR7_PARTS is not set
380
381#
382# User Modules And Translation Layers
383#
384CONFIG_MTD_CHAR=y
385CONFIG_MTD_BLKDEVS=y
386CONFIG_MTD_BLOCK=y
387# CONFIG_FTL is not set
388# CONFIG_NFTL is not set
389# CONFIG_INFTL is not set
390# CONFIG_RFD_FTL is not set
391# CONFIG_SSFDC is not set
392# CONFIG_MTD_OOPS is not set
393
394#
395# RAM/ROM/Flash chip drivers
396#
397CONFIG_MTD_CFI=y
398CONFIG_MTD_JEDECPROBE=y
399CONFIG_MTD_GEN_PROBE=y
400CONFIG_MTD_CFI_ADV_OPTIONS=y
401CONFIG_MTD_CFI_NOSWAP=y
402# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
403# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
404CONFIG_MTD_CFI_GEOMETRY=y
405CONFIG_MTD_MAP_BANK_WIDTH_1=y
406CONFIG_MTD_MAP_BANK_WIDTH_2=y
407# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
408# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
409# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
410# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
411CONFIG_MTD_CFI_I1=y
412CONFIG_MTD_CFI_I2=y
413# CONFIG_MTD_CFI_I4 is not set
414# CONFIG_MTD_CFI_I8 is not set
415# CONFIG_MTD_OTP is not set
416CONFIG_MTD_CFI_INTELEXT=y
417# CONFIG_MTD_CFI_AMDSTD is not set
418CONFIG_MTD_CFI_STAA=y
419CONFIG_MTD_CFI_UTIL=y
420# CONFIG_MTD_RAM is not set
421# CONFIG_MTD_ROM is not set
422# CONFIG_MTD_ABSENT is not set
423
424#
425# Mapping drivers for chip access
426#
427# CONFIG_MTD_COMPLEX_MAPPINGS is not set
428CONFIG_MTD_PHYSMAP=y
429CONFIG_MTD_PHYSMAP_START=0x0
430CONFIG_MTD_PHYSMAP_LEN=0x0
431CONFIG_MTD_PHYSMAP_BANKWIDTH=0
432# CONFIG_MTD_ARM_INTEGRATOR is not set
433# CONFIG_MTD_IMPA7 is not set
434# CONFIG_MTD_INTEL_VR_NOR is not set
435# CONFIG_MTD_PLATRAM is not set
436
437#
438# Self-contained MTD device drivers
439#
440# CONFIG_MTD_PMC551 is not set
441# CONFIG_MTD_DATAFLASH is not set
442CONFIG_MTD_M25P80=y
443CONFIG_M25PXX_USE_FAST_READ=y
444# CONFIG_MTD_SLRAM is not set
445# CONFIG_MTD_PHRAM is not set
446# CONFIG_MTD_MTDRAM is not set
447# CONFIG_MTD_BLOCK2MTD is not set
448
449#
450# Disk-On-Chip Device Drivers
451#
452# CONFIG_MTD_DOC2000 is not set
453# CONFIG_MTD_DOC2001 is not set
454# CONFIG_MTD_DOC2001PLUS is not set
455CONFIG_MTD_NAND=y
456CONFIG_MTD_NAND_VERIFY_WRITE=y
457# CONFIG_MTD_NAND_ECC_SMC is not set
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y
460# CONFIG_MTD_NAND_DISKONCHIP is not set
461# CONFIG_MTD_NAND_CAFE is not set
462# CONFIG_MTD_NAND_NANDSIM is not set
463# CONFIG_MTD_NAND_PLATFORM is not set
464# CONFIG_MTD_ALAUDA is not set
465CONFIG_MTD_NAND_ORION=y
466# CONFIG_MTD_ONENAND is not set
467
468#
469# UBI - Unsorted block images
470#
471# CONFIG_MTD_UBI is not set
472# CONFIG_PARPORT is not set
473CONFIG_BLK_DEV=y
474# CONFIG_BLK_CPQ_DA is not set
475# CONFIG_BLK_CPQ_CISS_DA is not set
476# CONFIG_BLK_DEV_DAC960 is not set
477# CONFIG_BLK_DEV_UMEM is not set
478# CONFIG_BLK_DEV_COW_COMMON is not set
479CONFIG_BLK_DEV_LOOP=y
480# CONFIG_BLK_DEV_CRYPTOLOOP is not set
481# CONFIG_BLK_DEV_NBD is not set
482# CONFIG_BLK_DEV_SX8 is not set
483# CONFIG_BLK_DEV_UB is not set
484# CONFIG_BLK_DEV_RAM is not set
485# CONFIG_CDROM_PKTCDVD is not set
486# CONFIG_ATA_OVER_ETH is not set
487# CONFIG_MISC_DEVICES is not set
488CONFIG_HAVE_IDE=y
489# CONFIG_IDE is not set
490
491#
492# SCSI device support
493#
494# CONFIG_RAID_ATTRS is not set
495CONFIG_SCSI=y
496CONFIG_SCSI_DMA=y
497# CONFIG_SCSI_TGT is not set
498# CONFIG_SCSI_NETLINK is not set
499# CONFIG_SCSI_PROC_FS is not set
500
501#
502# SCSI support type (disk, tape, CD-ROM)
503#
504CONFIG_BLK_DEV_SD=y
505# CONFIG_CHR_DEV_ST is not set
506# CONFIG_CHR_DEV_OSST is not set
507CONFIG_BLK_DEV_SR=m
508# CONFIG_BLK_DEV_SR_VENDOR is not set
509CONFIG_CHR_DEV_SG=m
510# CONFIG_CHR_DEV_SCH is not set
511
512#
513# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
514#
515# CONFIG_SCSI_MULTI_LUN is not set
516# CONFIG_SCSI_CONSTANTS is not set
517# CONFIG_SCSI_LOGGING is not set
518# CONFIG_SCSI_SCAN_ASYNC is not set
519CONFIG_SCSI_WAIT_SCAN=m
520
521#
522# SCSI Transports
523#
524# CONFIG_SCSI_SPI_ATTRS is not set
525# CONFIG_SCSI_FC_ATTRS is not set
526# CONFIG_SCSI_ISCSI_ATTRS is not set
527# CONFIG_SCSI_SAS_LIBSAS is not set
528# CONFIG_SCSI_SRP_ATTRS is not set
529CONFIG_SCSI_LOWLEVEL=y
530# CONFIG_ISCSI_TCP is not set
531# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
532# CONFIG_SCSI_3W_9XXX is not set
533# CONFIG_SCSI_ACARD is not set
534# CONFIG_SCSI_AACRAID is not set
535# CONFIG_SCSI_AIC7XXX is not set
536# CONFIG_SCSI_AIC7XXX_OLD is not set
537# CONFIG_SCSI_AIC79XX is not set
538# CONFIG_SCSI_AIC94XX is not set
539# CONFIG_SCSI_DPT_I2O is not set
540# CONFIG_SCSI_ADVANSYS is not set
541# CONFIG_SCSI_ARCMSR is not set
542# CONFIG_MEGARAID_NEWGEN is not set
543# CONFIG_MEGARAID_LEGACY is not set
544# CONFIG_MEGARAID_SAS is not set
545# CONFIG_SCSI_HPTIOP is not set
546# CONFIG_SCSI_DMX3191D is not set
547# CONFIG_SCSI_FUTURE_DOMAIN is not set
548# CONFIG_SCSI_IPS is not set
549# CONFIG_SCSI_INITIO is not set
550# CONFIG_SCSI_INIA100 is not set
551# CONFIG_SCSI_MVSAS is not set
552# CONFIG_SCSI_STEX is not set
553# CONFIG_SCSI_SYM53C8XX_2 is not set
554# CONFIG_SCSI_IPR is not set
555# CONFIG_SCSI_QLOGIC_1280 is not set
556# CONFIG_SCSI_QLA_FC is not set
557# CONFIG_SCSI_QLA_ISCSI is not set
558# CONFIG_SCSI_LPFC is not set
559# CONFIG_SCSI_DC395x is not set
560# CONFIG_SCSI_DC390T is not set
561# CONFIG_SCSI_NSP32 is not set
562# CONFIG_SCSI_DEBUG is not set
563# CONFIG_SCSI_SRP is not set
564CONFIG_ATA=y
565# CONFIG_ATA_NONSTANDARD is not set
566CONFIG_SATA_PMP=y
567# CONFIG_SATA_AHCI is not set
568# CONFIG_SATA_SIL24 is not set
569CONFIG_ATA_SFF=y
570# CONFIG_SATA_SVW is not set
571# CONFIG_ATA_PIIX is not set
572CONFIG_SATA_MV=y
573# CONFIG_SATA_NV is not set
574# CONFIG_PDC_ADMA is not set
575# CONFIG_SATA_QSTOR is not set
576# CONFIG_SATA_PROMISE is not set
577# CONFIG_SATA_SX4 is not set
578# CONFIG_SATA_SIL is not set
579# CONFIG_SATA_SIS is not set
580# CONFIG_SATA_ULI is not set
581# CONFIG_SATA_VIA is not set
582# CONFIG_SATA_VITESSE is not set
583# CONFIG_SATA_INIC162X is not set
584# CONFIG_PATA_ALI is not set
585# CONFIG_PATA_AMD is not set
586# CONFIG_PATA_ARTOP is not set
587# CONFIG_PATA_ATIIXP is not set
588# CONFIG_PATA_CMD640_PCI is not set
589# CONFIG_PATA_CMD64X is not set
590# CONFIG_PATA_CS5520 is not set
591# CONFIG_PATA_CS5530 is not set
592# CONFIG_PATA_CYPRESS is not set
593# CONFIG_PATA_EFAR is not set
594# CONFIG_ATA_GENERIC is not set
595# CONFIG_PATA_HPT366 is not set
596# CONFIG_PATA_HPT37X is not set
597# CONFIG_PATA_HPT3X2N is not set
598# CONFIG_PATA_HPT3X3 is not set
599# CONFIG_PATA_IT821X is not set
600# CONFIG_PATA_IT8213 is not set
601# CONFIG_PATA_JMICRON is not set
602# CONFIG_PATA_TRIFLEX is not set
603# CONFIG_PATA_MARVELL is not set
604# CONFIG_PATA_MPIIX is not set
605# CONFIG_PATA_OLDPIIX is not set
606# CONFIG_PATA_NETCELL is not set
607# CONFIG_PATA_NINJA32 is not set
608# CONFIG_PATA_NS87410 is not set
609# CONFIG_PATA_NS87415 is not set
610# CONFIG_PATA_OPTI is not set
611# CONFIG_PATA_OPTIDMA is not set
612# CONFIG_PATA_PDC_OLD is not set
613# CONFIG_PATA_RADISYS is not set
614# CONFIG_PATA_RZ1000 is not set
615# CONFIG_PATA_SC1200 is not set
616# CONFIG_PATA_SERVERWORKS is not set
617# CONFIG_PATA_PDC2027X is not set
618# CONFIG_PATA_SIL680 is not set
619# CONFIG_PATA_SIS is not set
620# CONFIG_PATA_VIA is not set
621# CONFIG_PATA_WINBOND is not set
622# CONFIG_PATA_PLATFORM is not set
623# CONFIG_PATA_SCH is not set
624# CONFIG_MD is not set
625# CONFIG_FUSION is not set
626
627#
628# IEEE 1394 (FireWire) support
629#
630# CONFIG_FIREWIRE is not set
631# CONFIG_IEEE1394 is not set
632# CONFIG_I2O is not set
633CONFIG_NETDEVICES=y
634# CONFIG_NETDEVICES_MULTIQUEUE is not set
635# CONFIG_DUMMY is not set
636# CONFIG_BONDING is not set
637# CONFIG_MACVLAN is not set
638# CONFIG_EQUALIZER is not set
639# CONFIG_TUN is not set
640# CONFIG_VETH is not set
641# CONFIG_ARCNET is not set
642# CONFIG_PHYLIB is not set
643CONFIG_NET_ETHERNET=y
644CONFIG_MII=y
645# CONFIG_AX88796 is not set
646# CONFIG_HAPPYMEAL is not set
647# CONFIG_SUNGEM is not set
648# CONFIG_CASSINI is not set
649# CONFIG_NET_VENDOR_3COM is not set
650# CONFIG_SMC91X is not set
651# CONFIG_DM9000 is not set
652# CONFIG_ENC28J60 is not set
653# CONFIG_NET_TULIP is not set
654# CONFIG_HP100 is not set
655# CONFIG_IBM_NEW_EMAC_ZMII is not set
656# CONFIG_IBM_NEW_EMAC_RGMII is not set
657# CONFIG_IBM_NEW_EMAC_TAH is not set
658# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
659CONFIG_NET_PCI=y
660# CONFIG_PCNET32 is not set
661# CONFIG_AMD8111_ETH is not set
662# CONFIG_ADAPTEC_STARFIRE is not set
663# CONFIG_B44 is not set
664# CONFIG_FORCEDETH is not set
665# CONFIG_EEPRO100 is not set
666# CONFIG_E100 is not set
667# CONFIG_FEALNX is not set
668# CONFIG_NATSEMI is not set
669# CONFIG_NE2K_PCI is not set
670# CONFIG_8139CP is not set
671# CONFIG_8139TOO is not set
672# CONFIG_R6040 is not set
673# CONFIG_SIS900 is not set
674# CONFIG_EPIC100 is not set
675# CONFIG_SUNDANCE is not set
676# CONFIG_TLAN is not set
677# CONFIG_VIA_RHINE is not set
678# CONFIG_SC92031 is not set
679CONFIG_NETDEV_1000=y
680# CONFIG_ACENIC is not set
681# CONFIG_DL2K is not set
682CONFIG_E1000=y
683CONFIG_E1000_NAPI=y
684# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
685# CONFIG_E1000E is not set
686# CONFIG_E1000E_ENABLED is not set
687# CONFIG_IP1000 is not set
688# CONFIG_IGB is not set
689# CONFIG_NS83820 is not set
690# CONFIG_HAMACHI is not set
691# CONFIG_YELLOWFIN is not set
692# CONFIG_R8169 is not set
693# CONFIG_SIS190 is not set
694# CONFIG_SKGE is not set
695# CONFIG_SKY2 is not set
696# CONFIG_VIA_VELOCITY is not set
697# CONFIG_TIGON3 is not set
698# CONFIG_BNX2 is not set
699CONFIG_MV643XX_ETH=y
700# CONFIG_QLA3XXX is not set
701# CONFIG_ATL1 is not set
702# CONFIG_NETDEV_10000 is not set
703# CONFIG_TR is not set
704
705#
706# Wireless LAN
707#
708# CONFIG_WLAN_PRE80211 is not set
709# CONFIG_WLAN_80211 is not set
710# CONFIG_IWLWIFI_LEDS is not set
711
712#
713# USB Network Adapters
714#
715# CONFIG_USB_CATC is not set
716# CONFIG_USB_KAWETH is not set
717# CONFIG_USB_PEGASUS is not set
718# CONFIG_USB_RTL8150 is not set
719# CONFIG_USB_USBNET is not set
720# CONFIG_WAN is not set
721# CONFIG_FDDI is not set
722# CONFIG_HIPPI is not set
723# CONFIG_PPP is not set
724# CONFIG_SLIP is not set
725# CONFIG_NET_FC is not set
726# CONFIG_NETCONSOLE is not set
727# CONFIG_NETPOLL is not set
728# CONFIG_NET_POLL_CONTROLLER is not set
729# CONFIG_ISDN is not set
730
731#
732# Input device support
733#
734CONFIG_INPUT=y
735# CONFIG_INPUT_FF_MEMLESS is not set
736# CONFIG_INPUT_POLLDEV is not set
737
738#
739# Userland interfaces
740#
741CONFIG_INPUT_MOUSEDEV=y
742CONFIG_INPUT_MOUSEDEV_PSAUX=y
743CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
744CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
745# CONFIG_INPUT_JOYDEV is not set
746# CONFIG_INPUT_EVDEV is not set
747# CONFIG_INPUT_EVBUG is not set
748
749#
750# Input Device Drivers
751#
752# CONFIG_INPUT_KEYBOARD is not set
753# CONFIG_INPUT_MOUSE is not set
754# CONFIG_INPUT_JOYSTICK is not set
755# CONFIG_INPUT_TABLET is not set
756# CONFIG_INPUT_TOUCHSCREEN is not set
757# CONFIG_INPUT_MISC is not set
758
759#
760# Hardware I/O ports
761#
762# CONFIG_SERIO is not set
763# CONFIG_GAMEPORT is not set
764
765#
766# Character devices
767#
768# CONFIG_VT is not set
769# CONFIG_DEVKMEM is not set
770# CONFIG_SERIAL_NONSTANDARD is not set
771# CONFIG_NOZOMI is not set
772
773#
774# Serial drivers
775#
776CONFIG_SERIAL_8250=y
777CONFIG_SERIAL_8250_CONSOLE=y
778# CONFIG_SERIAL_8250_PCI is not set
779CONFIG_SERIAL_8250_NR_UARTS=4
780CONFIG_SERIAL_8250_RUNTIME_UARTS=2
781# CONFIG_SERIAL_8250_EXTENDED is not set
782
783#
784# Non-8250 serial port support
785#
786CONFIG_SERIAL_CORE=y
787CONFIG_SERIAL_CORE_CONSOLE=y
788# CONFIG_SERIAL_JSM is not set
789CONFIG_UNIX98_PTYS=y
790CONFIG_LEGACY_PTYS=y
791CONFIG_LEGACY_PTY_COUNT=16
792# CONFIG_IPMI_HANDLER is not set
793# CONFIG_HW_RANDOM is not set
794# CONFIG_NVRAM is not set
795# CONFIG_R3964 is not set
796# CONFIG_APPLICOM is not set
797# CONFIG_RAW_DRIVER is not set
798# CONFIG_TCG_TPM is not set
799CONFIG_DEVPORT=y
800CONFIG_I2C=y
801CONFIG_I2C_BOARDINFO=y
802CONFIG_I2C_CHARDEV=y
803
804#
805# I2C Hardware Bus support
806#
807# CONFIG_I2C_ALI1535 is not set
808# CONFIG_I2C_ALI1563 is not set
809# CONFIG_I2C_ALI15X3 is not set
810# CONFIG_I2C_AMD756 is not set
811# CONFIG_I2C_AMD8111 is not set
812# CONFIG_I2C_GPIO is not set
813# CONFIG_I2C_I801 is not set
814# CONFIG_I2C_I810 is not set
815# CONFIG_I2C_PIIX4 is not set
816# CONFIG_I2C_NFORCE2 is not set
817# CONFIG_I2C_OCORES is not set
818# CONFIG_I2C_PARPORT_LIGHT is not set
819# CONFIG_I2C_PROSAVAGE is not set
820# CONFIG_I2C_SAVAGE4 is not set
821# CONFIG_I2C_SIMTEC is not set
822# CONFIG_I2C_SIS5595 is not set
823# CONFIG_I2C_SIS630 is not set
824# CONFIG_I2C_SIS96X is not set
825# CONFIG_I2C_TAOS_EVM is not set
826# CONFIG_I2C_STUB is not set
827# CONFIG_I2C_TINY_USB is not set
828# CONFIG_I2C_VIA is not set
829# CONFIG_I2C_VIAPRO is not set
830# CONFIG_I2C_VOODOO3 is not set
831# CONFIG_I2C_PCA_PLATFORM is not set
832CONFIG_I2C_MV64XXX=y
833
834#
835# Miscellaneous I2C Chip support
836#
837# CONFIG_DS1682 is not set
838# CONFIG_SENSORS_EEPROM is not set
839# CONFIG_SENSORS_PCF8574 is not set
840# CONFIG_PCF8575 is not set
841# CONFIG_SENSORS_PCF8591 is not set
842# CONFIG_SENSORS_MAX6875 is not set
843# CONFIG_SENSORS_TSL2550 is not set
844# CONFIG_I2C_DEBUG_CORE is not set
845# CONFIG_I2C_DEBUG_ALGO is not set
846# CONFIG_I2C_DEBUG_BUS is not set
847# CONFIG_I2C_DEBUG_CHIP is not set
848CONFIG_SPI=y
849# CONFIG_SPI_DEBUG is not set
850CONFIG_SPI_MASTER=y
851
852#
853# SPI Master Controller Drivers
854#
855# CONFIG_SPI_BITBANG is not set
856CONFIG_SPI_ORION=y
857
858#
859# SPI Protocol Masters
860#
861# CONFIG_SPI_AT25 is not set
862# CONFIG_SPI_SPIDEV is not set
863# CONFIG_SPI_TLE62X0 is not set
864# CONFIG_W1 is not set
865# CONFIG_POWER_SUPPLY is not set
866# CONFIG_HWMON is not set
867# CONFIG_WATCHDOG is not set
868
869#
870# Sonics Silicon Backplane
871#
872CONFIG_SSB_POSSIBLE=y
873# CONFIG_SSB is not set
874
875#
876# Multifunction device drivers
877#
878# CONFIG_MFD_SM501 is not set
879# CONFIG_MFD_ASIC3 is not set
880# CONFIG_HTC_PASIC3 is not set
881
882#
883# Multimedia devices
884#
885
886#
887# Multimedia core support
888#
889# CONFIG_VIDEO_DEV is not set
890# CONFIG_DVB_CORE is not set
891# CONFIG_VIDEO_MEDIA is not set
892
893#
894# Multimedia drivers
895#
896# CONFIG_DAB is not set
897
898#
899# Graphics support
900#
901# CONFIG_DRM is not set
902# CONFIG_VGASTATE is not set
903# CONFIG_VIDEO_OUTPUT_CONTROL is not set
904# CONFIG_FB is not set
905# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
906
907#
908# Display device support
909#
910# CONFIG_DISPLAY_SUPPORT is not set
911
912#
913# Sound
914#
915# CONFIG_SOUND is not set
916CONFIG_HID_SUPPORT=y
917CONFIG_HID=y
918# CONFIG_HID_DEBUG is not set
919# CONFIG_HIDRAW is not set
920
921#
922# USB Input Devices
923#
924CONFIG_USB_HID=y
925# CONFIG_USB_HIDINPUT_POWERBOOK is not set
926# CONFIG_HID_FF is not set
927# CONFIG_USB_HIDDEV is not set
928CONFIG_USB_SUPPORT=y
929CONFIG_USB_ARCH_HAS_HCD=y
930CONFIG_USB_ARCH_HAS_OHCI=y
931CONFIG_USB_ARCH_HAS_EHCI=y
932CONFIG_USB=y
933# CONFIG_USB_DEBUG is not set
934# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
935
936#
937# Miscellaneous USB options
938#
939CONFIG_USB_DEVICEFS=y
940CONFIG_USB_DEVICE_CLASS=y
941# CONFIG_USB_DYNAMIC_MINORS is not set
942# CONFIG_USB_OTG is not set
943# CONFIG_USB_OTG_WHITELIST is not set
944# CONFIG_USB_OTG_BLACKLIST_HUB is not set
945
946#
947# USB Host Controller Drivers
948#
949# CONFIG_USB_C67X00_HCD is not set
950CONFIG_USB_EHCI_HCD=y
951CONFIG_USB_EHCI_ROOT_HUB_TT=y
952CONFIG_USB_EHCI_TT_NEWSCHED=y
953# CONFIG_USB_ISP116X_HCD is not set
954# CONFIG_USB_ISP1760_HCD is not set
955# CONFIG_USB_OHCI_HCD is not set
956# CONFIG_USB_UHCI_HCD is not set
957# CONFIG_USB_SL811_HCD is not set
958# CONFIG_USB_R8A66597_HCD is not set
959
960#
961# USB Device Class drivers
962#
963# CONFIG_USB_ACM is not set
964CONFIG_USB_PRINTER=y
965# CONFIG_USB_WDM is not set
966
967#
968# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
969#
970
971#
972# may also be needed; see USB_STORAGE Help for more information
973#
974CONFIG_USB_STORAGE=y
975# CONFIG_USB_STORAGE_DEBUG is not set
976CONFIG_USB_STORAGE_DATAFAB=y
977CONFIG_USB_STORAGE_FREECOM=y
978# CONFIG_USB_STORAGE_ISD200 is not set
979CONFIG_USB_STORAGE_DPCM=y
980# CONFIG_USB_STORAGE_USBAT is not set
981CONFIG_USB_STORAGE_SDDR09=y
982CONFIG_USB_STORAGE_SDDR55=y
983CONFIG_USB_STORAGE_JUMPSHOT=y
984# CONFIG_USB_STORAGE_ALAUDA is not set
985# CONFIG_USB_STORAGE_ONETOUCH is not set
986# CONFIG_USB_STORAGE_KARMA is not set
987# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
988# CONFIG_USB_LIBUSUAL is not set
989
990#
991# USB Imaging devices
992#
993# CONFIG_USB_MDC800 is not set
994# CONFIG_USB_MICROTEK is not set
995# CONFIG_USB_MON is not set
996
997#
998# USB port drivers
999#
1000# CONFIG_USB_SERIAL is not set
1001
1002#
1003# USB Miscellaneous drivers
1004#
1005# CONFIG_USB_EMI62 is not set
1006# CONFIG_USB_EMI26 is not set
1007# CONFIG_USB_ADUTUX is not set
1008# CONFIG_USB_AUERSWALD is not set
1009# CONFIG_USB_RIO500 is not set
1010# CONFIG_USB_LEGOTOWER is not set
1011# CONFIG_USB_LCD is not set
1012# CONFIG_USB_BERRY_CHARGE is not set
1013# CONFIG_USB_LED is not set
1014# CONFIG_USB_CYPRESS_CY7C63 is not set
1015# CONFIG_USB_CYTHERM is not set
1016# CONFIG_USB_PHIDGET is not set
1017# CONFIG_USB_IDMOUSE is not set
1018# CONFIG_USB_FTDI_ELAN is not set
1019# CONFIG_USB_APPLEDISPLAY is not set
1020# CONFIG_USB_SISUSBVGA is not set
1021# CONFIG_USB_LD is not set
1022# CONFIG_USB_TRANCEVIBRATOR is not set
1023# CONFIG_USB_IOWARRIOR is not set
1024# CONFIG_USB_TEST is not set
1025# CONFIG_USB_ISIGHTFW is not set
1026# CONFIG_USB_GADGET is not set
1027# CONFIG_MMC is not set
1028CONFIG_NEW_LEDS=y
1029# CONFIG_LEDS_CLASS is not set
1030
1031#
1032# LED drivers
1033#
1034
1035#
1036# LED Triggers
1037#
1038# CONFIG_LEDS_TRIGGERS is not set
1039CONFIG_RTC_LIB=y
1040CONFIG_RTC_CLASS=y
1041# CONFIG_RTC_DEBUG is not set
1042
1043#
1044# RTC interfaces
1045#
1046CONFIG_RTC_INTF_SYSFS=y
1047CONFIG_RTC_INTF_PROC=y
1048CONFIG_RTC_INTF_DEV=y
1049# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1050# CONFIG_RTC_DRV_TEST is not set
1051
1052#
1053# I2C RTC drivers
1054#
1055# CONFIG_RTC_DRV_DS1307 is not set
1056# CONFIG_RTC_DRV_DS1374 is not set
1057# CONFIG_RTC_DRV_DS1672 is not set
1058# CONFIG_RTC_DRV_MAX6900 is not set
1059CONFIG_RTC_DRV_MV=y
1060# CONFIG_RTC_DRV_RS5C372 is not set
1061# CONFIG_RTC_DRV_ISL1208 is not set
1062# CONFIG_RTC_DRV_X1205 is not set
1063# CONFIG_RTC_DRV_PCF8563 is not set
1064# CONFIG_RTC_DRV_PCF8583 is not set
1065# CONFIG_RTC_DRV_M41T80 is not set
1066# CONFIG_RTC_DRV_S35390A is not set
1067
1068#
1069# SPI RTC drivers
1070#
1071# CONFIG_RTC_DRV_MAX6902 is not set
1072# CONFIG_RTC_DRV_R9701 is not set
1073# CONFIG_RTC_DRV_RS5C348 is not set
1074
1075#
1076# Platform RTC drivers
1077#
1078# CONFIG_RTC_DRV_CMOS is not set
1079# CONFIG_RTC_DRV_DS1511 is not set
1080# CONFIG_RTC_DRV_DS1553 is not set
1081# CONFIG_RTC_DRV_DS1742 is not set
1082# CONFIG_RTC_DRV_STK17TA8 is not set
1083# CONFIG_RTC_DRV_M48T86 is not set
1084# CONFIG_RTC_DRV_M48T59 is not set
1085# CONFIG_RTC_DRV_V3020 is not set
1086
1087#
1088# on-CPU RTC drivers
1089#
1090CONFIG_DMADEVICES=y
1091
1092#
1093# DMA Devices
1094#
1095CONFIG_MV_XOR=y
1096CONFIG_DMA_ENGINE=y
1097
1098#
1099# DMA Clients
1100#
1101# CONFIG_NET_DMA is not set
1102# CONFIG_UIO is not set
1103
1104#
1105# File systems
1106#
1107CONFIG_EXT2_FS=y
1108# CONFIG_EXT2_FS_XATTR is not set
1109# CONFIG_EXT2_FS_XIP is not set
1110CONFIG_EXT3_FS=y
1111# CONFIG_EXT3_FS_XATTR is not set
1112# CONFIG_EXT4DEV_FS is not set
1113CONFIG_JBD=y
1114# CONFIG_REISERFS_FS is not set
1115# CONFIG_JFS_FS is not set
1116# CONFIG_FS_POSIX_ACL is not set
1117CONFIG_XFS_FS=y
1118# CONFIG_XFS_QUOTA is not set
1119# CONFIG_XFS_POSIX_ACL is not set
1120# CONFIG_XFS_RT is not set
1121# CONFIG_XFS_DEBUG is not set
1122# CONFIG_OCFS2_FS is not set
1123CONFIG_DNOTIFY=y
1124CONFIG_INOTIFY=y
1125CONFIG_INOTIFY_USER=y
1126# CONFIG_QUOTA is not set
1127# CONFIG_AUTOFS_FS is not set
1128# CONFIG_AUTOFS4_FS is not set
1129# CONFIG_FUSE_FS is not set
1130
1131#
1132# CD-ROM/DVD Filesystems
1133#
1134CONFIG_ISO9660_FS=y
1135CONFIG_JOLIET=y
1136# CONFIG_ZISOFS is not set
1137CONFIG_UDF_FS=m
1138CONFIG_UDF_NLS=y
1139
1140#
1141# DOS/FAT/NT Filesystems
1142#
1143CONFIG_FAT_FS=y
1144CONFIG_MSDOS_FS=y
1145CONFIG_VFAT_FS=y
1146CONFIG_FAT_DEFAULT_CODEPAGE=437
1147CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1148# CONFIG_NTFS_FS is not set
1149
1150#
1151# Pseudo filesystems
1152#
1153CONFIG_PROC_FS=y
1154CONFIG_PROC_SYSCTL=y
1155CONFIG_SYSFS=y
1156CONFIG_TMPFS=y
1157# CONFIG_TMPFS_POSIX_ACL is not set
1158# CONFIG_HUGETLB_PAGE is not set
1159# CONFIG_CONFIGFS_FS is not set
1160
1161#
1162# Miscellaneous filesystems
1163#
1164# CONFIG_ADFS_FS is not set
1165# CONFIG_AFFS_FS is not set
1166# CONFIG_HFS_FS is not set
1167# CONFIG_HFSPLUS_FS is not set
1168# CONFIG_BEFS_FS is not set
1169# CONFIG_BFS_FS is not set
1170# CONFIG_EFS_FS is not set
1171CONFIG_JFFS2_FS=y
1172CONFIG_JFFS2_FS_DEBUG=0
1173CONFIG_JFFS2_FS_WRITEBUFFER=y
1174# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1175# CONFIG_JFFS2_SUMMARY is not set
1176# CONFIG_JFFS2_FS_XATTR is not set
1177# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1178CONFIG_JFFS2_ZLIB=y
1179# CONFIG_JFFS2_LZO is not set
1180CONFIG_JFFS2_RTIME=y
1181# CONFIG_JFFS2_RUBIN is not set
1182CONFIG_CRAMFS=y
1183# CONFIG_VXFS_FS is not set
1184# CONFIG_MINIX_FS is not set
1185# CONFIG_HPFS_FS is not set
1186# CONFIG_QNX4FS_FS is not set
1187# CONFIG_ROMFS_FS is not set
1188# CONFIG_SYSV_FS is not set
1189# CONFIG_UFS_FS is not set
1190CONFIG_NETWORK_FILESYSTEMS=y
1191CONFIG_NFS_FS=y
1192CONFIG_NFS_V3=y
1193# CONFIG_NFS_V3_ACL is not set
1194# CONFIG_NFS_V4 is not set
1195# CONFIG_NFSD is not set
1196CONFIG_ROOT_NFS=y
1197CONFIG_LOCKD=y
1198CONFIG_LOCKD_V4=y
1199CONFIG_NFS_COMMON=y
1200CONFIG_SUNRPC=y
1201# CONFIG_SUNRPC_BIND34 is not set
1202# CONFIG_RPCSEC_GSS_KRB5 is not set
1203# CONFIG_RPCSEC_GSS_SPKM3 is not set
1204# CONFIG_SMB_FS is not set
1205# CONFIG_CIFS is not set
1206# CONFIG_NCP_FS is not set
1207# CONFIG_CODA_FS is not set
1208# CONFIG_AFS_FS is not set
1209
1210#
1211# Partition Types
1212#
1213CONFIG_PARTITION_ADVANCED=y
1214# CONFIG_ACORN_PARTITION is not set
1215# CONFIG_OSF_PARTITION is not set
1216# CONFIG_AMIGA_PARTITION is not set
1217# CONFIG_ATARI_PARTITION is not set
1218# CONFIG_MAC_PARTITION is not set
1219CONFIG_MSDOS_PARTITION=y
1220# CONFIG_BSD_DISKLABEL is not set
1221# CONFIG_MINIX_SUBPARTITION is not set
1222# CONFIG_SOLARIS_X86_PARTITION is not set
1223# CONFIG_UNIXWARE_DISKLABEL is not set
1224# CONFIG_LDM_PARTITION is not set
1225# CONFIG_SGI_PARTITION is not set
1226# CONFIG_ULTRIX_PARTITION is not set
1227# CONFIG_SUN_PARTITION is not set
1228# CONFIG_KARMA_PARTITION is not set
1229# CONFIG_EFI_PARTITION is not set
1230# CONFIG_SYSV68_PARTITION is not set
1231CONFIG_NLS=y
1232CONFIG_NLS_DEFAULT="iso8859-1"
1233CONFIG_NLS_CODEPAGE_437=y
1234# CONFIG_NLS_CODEPAGE_737 is not set
1235# CONFIG_NLS_CODEPAGE_775 is not set
1236CONFIG_NLS_CODEPAGE_850=y
1237# CONFIG_NLS_CODEPAGE_852 is not set
1238# CONFIG_NLS_CODEPAGE_855 is not set
1239# CONFIG_NLS_CODEPAGE_857 is not set
1240# CONFIG_NLS_CODEPAGE_860 is not set
1241# CONFIG_NLS_CODEPAGE_861 is not set
1242# CONFIG_NLS_CODEPAGE_862 is not set
1243# CONFIG_NLS_CODEPAGE_863 is not set
1244# CONFIG_NLS_CODEPAGE_864 is not set
1245# CONFIG_NLS_CODEPAGE_865 is not set
1246# CONFIG_NLS_CODEPAGE_866 is not set
1247# CONFIG_NLS_CODEPAGE_869 is not set
1248# CONFIG_NLS_CODEPAGE_936 is not set
1249# CONFIG_NLS_CODEPAGE_950 is not set
1250# CONFIG_NLS_CODEPAGE_932 is not set
1251# CONFIG_NLS_CODEPAGE_949 is not set
1252# CONFIG_NLS_CODEPAGE_874 is not set
1253# CONFIG_NLS_ISO8859_8 is not set
1254# CONFIG_NLS_CODEPAGE_1250 is not set
1255# CONFIG_NLS_CODEPAGE_1251 is not set
1256# CONFIG_NLS_ASCII is not set
1257CONFIG_NLS_ISO8859_1=y
1258CONFIG_NLS_ISO8859_2=y
1259# CONFIG_NLS_ISO8859_3 is not set
1260# CONFIG_NLS_ISO8859_4 is not set
1261# CONFIG_NLS_ISO8859_5 is not set
1262# CONFIG_NLS_ISO8859_6 is not set
1263# CONFIG_NLS_ISO8859_7 is not set
1264# CONFIG_NLS_ISO8859_9 is not set
1265# CONFIG_NLS_ISO8859_13 is not set
1266# CONFIG_NLS_ISO8859_14 is not set
1267# CONFIG_NLS_ISO8859_15 is not set
1268# CONFIG_NLS_KOI8_R is not set
1269# CONFIG_NLS_KOI8_U is not set
1270CONFIG_NLS_UTF8=y
1271# CONFIG_DLM is not set
1272
1273#
1274# Kernel hacking
1275#
1276# CONFIG_PRINTK_TIME is not set
1277CONFIG_ENABLE_WARN_DEPRECATED=y
1278CONFIG_ENABLE_MUST_CHECK=y
1279CONFIG_FRAME_WARN=1024
1280CONFIG_MAGIC_SYSRQ=y
1281# CONFIG_UNUSED_SYMBOLS is not set
1282# CONFIG_DEBUG_FS is not set
1283# CONFIG_HEADERS_CHECK is not set
1284CONFIG_DEBUG_KERNEL=y
1285# CONFIG_DEBUG_SHIRQ is not set
1286CONFIG_DETECT_SOFTLOCKUP=y
1287# CONFIG_SCHED_DEBUG is not set
1288# CONFIG_SCHEDSTATS is not set
1289# CONFIG_TIMER_STATS is not set
1290# CONFIG_DEBUG_OBJECTS is not set
1291# CONFIG_DEBUG_SLAB is not set
1292# CONFIG_DEBUG_PREEMPT is not set
1293# CONFIG_DEBUG_RT_MUTEXES is not set
1294# CONFIG_RT_MUTEX_TESTER is not set
1295# CONFIG_DEBUG_SPINLOCK is not set
1296# CONFIG_DEBUG_MUTEXES is not set
1297# CONFIG_DEBUG_LOCK_ALLOC is not set
1298# CONFIG_PROVE_LOCKING is not set
1299# CONFIG_LOCK_STAT is not set
1300# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1301# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1302# CONFIG_DEBUG_KOBJECT is not set
1303# CONFIG_DEBUG_BUGVERBOSE is not set
1304CONFIG_DEBUG_INFO=y
1305# CONFIG_DEBUG_VM is not set
1306# CONFIG_DEBUG_WRITECOUNT is not set
1307# CONFIG_DEBUG_LIST is not set
1308# CONFIG_DEBUG_SG is not set
1309CONFIG_FRAME_POINTER=y
1310# CONFIG_BOOT_PRINTK_DELAY is not set
1311# CONFIG_RCU_TORTURE_TEST is not set
1312# CONFIG_KPROBES_SANITY_TEST is not set
1313# CONFIG_BACKTRACE_SELF_TEST is not set
1314# CONFIG_LKDTM is not set
1315# CONFIG_FAULT_INJECTION is not set
1316# CONFIG_LATENCYTOP is not set
1317# CONFIG_SAMPLES is not set
1318CONFIG_DEBUG_USER=y
1319CONFIG_DEBUG_ERRORS=y
1320# CONFIG_DEBUG_STACK_USAGE is not set
1321CONFIG_DEBUG_LL=y
1322# CONFIG_DEBUG_ICEDCC is not set
1323
1324#
1325# Security options
1326#
1327# CONFIG_KEYS is not set
1328# CONFIG_SECURITY is not set
1329# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1330CONFIG_ASYNC_CORE=y
1331CONFIG_CRYPTO=y
1332
1333#
1334# Crypto core or helper
1335#
1336CONFIG_CRYPTO_ALGAPI=m
1337CONFIG_CRYPTO_BLKCIPHER=m
1338CONFIG_CRYPTO_MANAGER=m
1339# CONFIG_CRYPTO_GF128MUL is not set
1340# CONFIG_CRYPTO_NULL is not set
1341# CONFIG_CRYPTO_CRYPTD is not set
1342# CONFIG_CRYPTO_AUTHENC is not set
1343# CONFIG_CRYPTO_TEST is not set
1344
1345#
1346# Authenticated Encryption with Associated Data
1347#
1348# CONFIG_CRYPTO_CCM is not set
1349# CONFIG_CRYPTO_GCM is not set
1350# CONFIG_CRYPTO_SEQIV is not set
1351
1352#
1353# Block modes
1354#
1355CONFIG_CRYPTO_CBC=m
1356# CONFIG_CRYPTO_CTR is not set
1357# CONFIG_CRYPTO_CTS is not set
1358CONFIG_CRYPTO_ECB=m
1359# CONFIG_CRYPTO_LRW is not set
1360CONFIG_CRYPTO_PCBC=m
1361# CONFIG_CRYPTO_XTS is not set
1362
1363#
1364# Hash modes
1365#
1366# CONFIG_CRYPTO_HMAC is not set
1367# CONFIG_CRYPTO_XCBC is not set
1368
1369#
1370# Digest
1371#
1372# CONFIG_CRYPTO_CRC32C is not set
1373# CONFIG_CRYPTO_MD4 is not set
1374# CONFIG_CRYPTO_MD5 is not set
1375# CONFIG_CRYPTO_MICHAEL_MIC is not set
1376# CONFIG_CRYPTO_SHA1 is not set
1377# CONFIG_CRYPTO_SHA256 is not set
1378# CONFIG_CRYPTO_SHA512 is not set
1379# CONFIG_CRYPTO_TGR192 is not set
1380# CONFIG_CRYPTO_WP512 is not set
1381
1382#
1383# Ciphers
1384#
1385# CONFIG_CRYPTO_AES is not set
1386# CONFIG_CRYPTO_ANUBIS is not set
1387# CONFIG_CRYPTO_ARC4 is not set
1388# CONFIG_CRYPTO_BLOWFISH is not set
1389# CONFIG_CRYPTO_CAMELLIA is not set
1390# CONFIG_CRYPTO_CAST5 is not set
1391# CONFIG_CRYPTO_CAST6 is not set
1392# CONFIG_CRYPTO_DES is not set
1393# CONFIG_CRYPTO_FCRYPT is not set
1394# CONFIG_CRYPTO_KHAZAD is not set
1395# CONFIG_CRYPTO_SALSA20 is not set
1396# CONFIG_CRYPTO_SEED is not set
1397# CONFIG_CRYPTO_SERPENT is not set
1398# CONFIG_CRYPTO_TEA is not set
1399# CONFIG_CRYPTO_TWOFISH is not set
1400
1401#
1402# Compression
1403#
1404# CONFIG_CRYPTO_DEFLATE is not set
1405# CONFIG_CRYPTO_LZO is not set
1406CONFIG_CRYPTO_HW=y
1407# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1408
1409#
1410# Library routines
1411#
1412CONFIG_BITREVERSE=y
1413# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1414# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1415CONFIG_CRC_CCITT=y
1416CONFIG_CRC16=y
1417CONFIG_CRC_ITU_T=m
1418CONFIG_CRC32=y
1419# CONFIG_CRC7 is not set
1420CONFIG_LIBCRC32C=y
1421CONFIG_ZLIB_INFLATE=y
1422CONFIG_ZLIB_DEFLATE=y
1423CONFIG_PLIST=y
1424CONFIG_HAS_IOMEM=y
1425CONFIG_HAS_IOPORT=y
1426CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/ks8695_defconfig b/arch/arm/configs/ks8695_defconfig
index 8ab21a0719e9..6077f2cb88e4 100644
--- a/arch/arm/configs/ks8695_defconfig
+++ b/arch/arm/configs/ks8695_defconfig
@@ -174,7 +174,6 @@ CONFIG_PCCARD_NONSTATIC=y
174# Kernel Features 174# Kernel Features
175# 175#
176# CONFIG_PREEMPT is not set 176# CONFIG_PREEMPT is not set
177# CONFIG_NO_IDLE_HZ is not set
178CONFIG_HZ=100 177CONFIG_HZ=100
179# CONFIG_AEABI is not set 178# CONFIG_AEABI is not set
180# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 179# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/loki_defconfig b/arch/arm/configs/loki_defconfig
new file mode 100644
index 000000000000..17da7c3b3d53
--- /dev/null
+++ b/arch/arm/configs/loki_defconfig
@@ -0,0 +1,1147 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5
4# Fri Jun 13 03:07:49 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_ZONE_DMA=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49# CONFIG_GROUP_SCHED is not set
50# CONFIG_SYSFS_DEPRECATED_V2 is not set
51# CONFIG_RELAY is not set
52# CONFIG_NAMESPACES is not set
53# CONFIG_BLK_DEV_INITRD is not set
54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
55CONFIG_SYSCTL=y
56CONFIG_EMBEDDED=y
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_SYSCTL_SYSCALL_CHECK=y
60CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_COMPAT_BRK=y
67CONFIG_BASE_FULL=y
68CONFIG_FUTEX=y
69CONFIG_ANON_INODES=y
70CONFIG_EPOLL=y
71CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y
74CONFIG_SHMEM=y
75CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLAB=y
77# CONFIG_SLUB is not set
78# CONFIG_SLOB is not set
79# CONFIG_PROFILING is not set
80# CONFIG_MARKERS is not set
81CONFIG_HAVE_OPROFILE=y
82# CONFIG_KPROBES is not set
83CONFIG_HAVE_KPROBES=y
84CONFIG_HAVE_KRETPROBES=y
85# CONFIG_HAVE_DMA_ATTRS is not set
86CONFIG_PROC_PAGE_MONITOR=y
87CONFIG_SLABINFO=y
88CONFIG_RT_MUTEXES=y
89# CONFIG_TINY_SHMEM is not set
90CONFIG_BASE_SMALL=0
91CONFIG_MODULES=y
92# CONFIG_MODULE_FORCE_LOAD is not set
93CONFIG_MODULE_UNLOAD=y
94# CONFIG_MODULE_FORCE_UNLOAD is not set
95# CONFIG_MODVERSIONS is not set
96# CONFIG_MODULE_SRCVERSION_ALL is not set
97# CONFIG_KMOD is not set
98CONFIG_BLOCK=y
99# CONFIG_LBD is not set
100# CONFIG_BLK_DEV_IO_TRACE is not set
101# CONFIG_LSF is not set
102# CONFIG_BLK_DEV_BSG is not set
103
104#
105# IO Schedulers
106#
107CONFIG_IOSCHED_NOOP=y
108CONFIG_IOSCHED_AS=y
109CONFIG_IOSCHED_DEADLINE=y
110CONFIG_IOSCHED_CFQ=y
111# CONFIG_DEFAULT_AS is not set
112# CONFIG_DEFAULT_DEADLINE is not set
113CONFIG_DEFAULT_CFQ=y
114# CONFIG_DEFAULT_NOOP is not set
115CONFIG_DEFAULT_IOSCHED="cfq"
116CONFIG_CLASSIC_RCU=y
117
118#
119# System Type
120#
121# CONFIG_ARCH_AAEC2000 is not set
122# CONFIG_ARCH_INTEGRATOR is not set
123# CONFIG_ARCH_REALVIEW is not set
124# CONFIG_ARCH_VERSATILE is not set
125# CONFIG_ARCH_AT91 is not set
126# CONFIG_ARCH_CLPS7500 is not set
127# CONFIG_ARCH_CLPS711X is not set
128# CONFIG_ARCH_CO285 is not set
129# CONFIG_ARCH_EBSA110 is not set
130# CONFIG_ARCH_EP93XX is not set
131# CONFIG_ARCH_FOOTBRIDGE is not set
132# CONFIG_ARCH_NETX is not set
133# CONFIG_ARCH_H720X is not set
134# CONFIG_ARCH_IMX is not set
135# CONFIG_ARCH_IOP13XX is not set
136# CONFIG_ARCH_IOP32X is not set
137# CONFIG_ARCH_IOP33X is not set
138# CONFIG_ARCH_IXP23XX is not set
139# CONFIG_ARCH_IXP2000 is not set
140# CONFIG_ARCH_IXP4XX is not set
141# CONFIG_ARCH_L7200 is not set
142# CONFIG_ARCH_KIRKWOOD is not set
143# CONFIG_ARCH_KS8695 is not set
144# CONFIG_ARCH_NS9XXX is not set
145CONFIG_ARCH_LOKI=y
146# CONFIG_ARCH_MV78XX0 is not set
147# CONFIG_ARCH_MXC is not set
148# CONFIG_ARCH_ORION5X is not set
149# CONFIG_ARCH_PNX4008 is not set
150# CONFIG_ARCH_PXA is not set
151# CONFIG_ARCH_RPC is not set
152# CONFIG_ARCH_SA1100 is not set
153# CONFIG_ARCH_S3C2410 is not set
154# CONFIG_ARCH_SHARK is not set
155# CONFIG_ARCH_LH7A40X is not set
156# CONFIG_ARCH_DAVINCI is not set
157# CONFIG_ARCH_OMAP is not set
158# CONFIG_ARCH_MSM7X00A is not set
159
160#
161# Marvell Loki (88RC8480) Implementations
162#
163CONFIG_MACH_LB88RC8480=y
164
165#
166# Boot options
167#
168
169#
170# Power management
171#
172CONFIG_PLAT_ORION=y
173
174#
175# Processor Type
176#
177CONFIG_CPU_32=y
178CONFIG_CPU_FEROCEON=y
179# CONFIG_CPU_FEROCEON_OLD_ID is not set
180CONFIG_CPU_32v5=y
181CONFIG_CPU_ABRT_EV5T=y
182CONFIG_CPU_PABRT_NOIFAR=y
183CONFIG_CPU_CACHE_VIVT=y
184CONFIG_CPU_COPY_FEROCEON=y
185CONFIG_CPU_TLB_FEROCEON=y
186CONFIG_CPU_CP15=y
187CONFIG_CPU_CP15_MMU=y
188
189#
190# Processor Features
191#
192CONFIG_ARM_THUMB=y
193# CONFIG_CPU_ICACHE_DISABLE is not set
194# CONFIG_CPU_DCACHE_DISABLE is not set
195# CONFIG_OUTER_CACHE is not set
196
197#
198# Bus support
199#
200# CONFIG_PCI_SYSCALL is not set
201# CONFIG_ARCH_SUPPORTS_MSI is not set
202# CONFIG_PCCARD is not set
203
204#
205# Kernel Features
206#
207CONFIG_TICK_ONESHOT=y
208CONFIG_NO_HZ=y
209CONFIG_HIGH_RES_TIMERS=y
210CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
211CONFIG_PREEMPT=y
212CONFIG_HZ=100
213CONFIG_AEABI=y
214CONFIG_OABI_COMPAT=y
215# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
216CONFIG_SELECT_MEMORY_MODEL=y
217CONFIG_FLATMEM_MANUAL=y
218# CONFIG_DISCONTIGMEM_MANUAL is not set
219# CONFIG_SPARSEMEM_MANUAL is not set
220CONFIG_FLATMEM=y
221CONFIG_FLAT_NODE_MEM_MAP=y
222# CONFIG_SPARSEMEM_STATIC is not set
223# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
224CONFIG_PAGEFLAGS_EXTENDED=y
225CONFIG_SPLIT_PTLOCK_CPUS=4096
226# CONFIG_RESOURCES_64BIT is not set
227CONFIG_ZONE_DMA_FLAG=1
228CONFIG_BOUNCE=y
229CONFIG_VIRT_TO_BUS=y
230CONFIG_ALIGNMENT_TRAP=y
231
232#
233# Boot options
234#
235CONFIG_ZBOOT_ROM_TEXT=0x0
236CONFIG_ZBOOT_ROM_BSS=0x0
237CONFIG_CMDLINE=""
238# CONFIG_XIP_KERNEL is not set
239# CONFIG_KEXEC is not set
240
241#
242# Floating point emulation
243#
244
245#
246# At least one emulation must be selected
247#
248# CONFIG_FPE_NWFPE is not set
249# CONFIG_FPE_FASTFPE is not set
250# CONFIG_VFP is not set
251
252#
253# Userspace binary formats
254#
255CONFIG_BINFMT_ELF=y
256# CONFIG_BINFMT_AOUT is not set
257# CONFIG_BINFMT_MISC is not set
258
259#
260# Power management options
261#
262# CONFIG_PM is not set
263CONFIG_ARCH_SUSPEND_POSSIBLE=y
264
265#
266# Networking
267#
268CONFIG_NET=y
269
270#
271# Networking options
272#
273CONFIG_PACKET=y
274CONFIG_PACKET_MMAP=y
275CONFIG_UNIX=y
276CONFIG_XFRM=y
277# CONFIG_XFRM_USER is not set
278# CONFIG_XFRM_SUB_POLICY is not set
279# CONFIG_XFRM_MIGRATE is not set
280# CONFIG_XFRM_STATISTICS is not set
281# CONFIG_NET_KEY is not set
282CONFIG_INET=y
283CONFIG_IP_MULTICAST=y
284# CONFIG_IP_ADVANCED_ROUTER is not set
285CONFIG_IP_FIB_HASH=y
286CONFIG_IP_PNP=y
287CONFIG_IP_PNP_DHCP=y
288CONFIG_IP_PNP_BOOTP=y
289# CONFIG_IP_PNP_RARP is not set
290# CONFIG_NET_IPIP is not set
291# CONFIG_NET_IPGRE is not set
292# CONFIG_IP_MROUTE is not set
293# CONFIG_ARPD is not set
294# CONFIG_SYN_COOKIES is not set
295# CONFIG_INET_AH is not set
296# CONFIG_INET_ESP is not set
297# CONFIG_INET_IPCOMP is not set
298# CONFIG_INET_XFRM_TUNNEL is not set
299# CONFIG_INET_TUNNEL is not set
300CONFIG_INET_XFRM_MODE_TRANSPORT=y
301CONFIG_INET_XFRM_MODE_TUNNEL=y
302CONFIG_INET_XFRM_MODE_BEET=y
303# CONFIG_INET_LRO is not set
304CONFIG_INET_DIAG=y
305CONFIG_INET_TCP_DIAG=y
306# CONFIG_TCP_CONG_ADVANCED is not set
307CONFIG_TCP_CONG_CUBIC=y
308CONFIG_DEFAULT_TCP_CONG="cubic"
309# CONFIG_TCP_MD5SIG is not set
310# CONFIG_IPV6 is not set
311# CONFIG_NETWORK_SECMARK is not set
312# CONFIG_NETFILTER is not set
313# CONFIG_IP_DCCP is not set
314# CONFIG_IP_SCTP is not set
315# CONFIG_TIPC is not set
316# CONFIG_ATM is not set
317# CONFIG_BRIDGE is not set
318# CONFIG_VLAN_8021Q is not set
319# CONFIG_DECNET is not set
320# CONFIG_LLC2 is not set
321# CONFIG_IPX is not set
322# CONFIG_ATALK is not set
323# CONFIG_X25 is not set
324# CONFIG_LAPB is not set
325# CONFIG_ECONET is not set
326# CONFIG_WAN_ROUTER is not set
327# CONFIG_NET_SCHED is not set
328
329#
330# Network testing
331#
332CONFIG_NET_PKTGEN=m
333# CONFIG_HAMRADIO is not set
334# CONFIG_CAN is not set
335# CONFIG_IRDA is not set
336# CONFIG_BT is not set
337# CONFIG_AF_RXRPC is not set
338
339#
340# Wireless
341#
342# CONFIG_CFG80211 is not set
343CONFIG_WIRELESS_EXT=y
344# CONFIG_MAC80211 is not set
345# CONFIG_IEEE80211 is not set
346# CONFIG_RFKILL is not set
347# CONFIG_NET_9P is not set
348
349#
350# Device Drivers
351#
352
353#
354# Generic Driver Options
355#
356CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
357CONFIG_STANDALONE=y
358CONFIG_PREVENT_FIRMWARE_BUILD=y
359CONFIG_FW_LOADER=y
360# CONFIG_SYS_HYPERVISOR is not set
361# CONFIG_CONNECTOR is not set
362CONFIG_MTD=y
363# CONFIG_MTD_DEBUG is not set
364# CONFIG_MTD_CONCAT is not set
365CONFIG_MTD_PARTITIONS=y
366# CONFIG_MTD_REDBOOT_PARTS is not set
367CONFIG_MTD_CMDLINE_PARTS=y
368# CONFIG_MTD_AFS_PARTS is not set
369# CONFIG_MTD_AR7_PARTS is not set
370
371#
372# User Modules And Translation Layers
373#
374CONFIG_MTD_CHAR=y
375CONFIG_MTD_BLKDEVS=y
376CONFIG_MTD_BLOCK=y
377CONFIG_FTL=y
378CONFIG_NFTL=y
379# CONFIG_NFTL_RW is not set
380# CONFIG_INFTL is not set
381# CONFIG_RFD_FTL is not set
382# CONFIG_SSFDC is not set
383# CONFIG_MTD_OOPS is not set
384
385#
386# RAM/ROM/Flash chip drivers
387#
388CONFIG_MTD_CFI=y
389CONFIG_MTD_JEDECPROBE=y
390CONFIG_MTD_GEN_PROBE=y
391CONFIG_MTD_CFI_ADV_OPTIONS=y
392CONFIG_MTD_CFI_NOSWAP=y
393# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
394# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
395CONFIG_MTD_CFI_GEOMETRY=y
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
404CONFIG_MTD_CFI_I4=y
405# CONFIG_MTD_CFI_I8 is not set
406# CONFIG_MTD_OTP is not set
407CONFIG_MTD_CFI_INTELEXT=y
408CONFIG_MTD_CFI_AMDSTD=y
409CONFIG_MTD_CFI_STAA=y
410CONFIG_MTD_CFI_UTIL=y
411# CONFIG_MTD_RAM is not set
412# CONFIG_MTD_ROM is not set
413# CONFIG_MTD_ABSENT is not set
414
415#
416# Mapping drivers for chip access
417#
418# CONFIG_MTD_COMPLEX_MAPPINGS is not set
419CONFIG_MTD_PHYSMAP=y
420CONFIG_MTD_PHYSMAP_START=0x0
421CONFIG_MTD_PHYSMAP_LEN=0x0
422CONFIG_MTD_PHYSMAP_BANKWIDTH=0
423# CONFIG_MTD_ARM_INTEGRATOR is not set
424# CONFIG_MTD_IMPA7 is not set
425# CONFIG_MTD_PLATRAM is not set
426
427#
428# Self-contained MTD device drivers
429#
430# CONFIG_MTD_DATAFLASH is not set
431CONFIG_MTD_M25P80=y
432CONFIG_M25PXX_USE_FAST_READ=y
433# CONFIG_MTD_SLRAM is not set
434# CONFIG_MTD_PHRAM is not set
435# CONFIG_MTD_MTDRAM is not set
436# CONFIG_MTD_BLOCK2MTD is not set
437
438#
439# Disk-On-Chip Device Drivers
440#
441# CONFIG_MTD_DOC2000 is not set
442# CONFIG_MTD_DOC2001 is not set
443# CONFIG_MTD_DOC2001PLUS is not set
444CONFIG_MTD_NAND=y
445CONFIG_MTD_NAND_VERIFY_WRITE=y
446# CONFIG_MTD_NAND_ECC_SMC is not set
447# CONFIG_MTD_NAND_MUSEUM_IDS is not set
448CONFIG_MTD_NAND_IDS=y
449# CONFIG_MTD_NAND_DISKONCHIP is not set
450# CONFIG_MTD_NAND_NANDSIM is not set
451# CONFIG_MTD_NAND_PLATFORM is not set
452# CONFIG_MTD_ALAUDA is not set
453CONFIG_MTD_NAND_ORION=y
454# CONFIG_MTD_ONENAND is not set
455
456#
457# UBI - Unsorted block images
458#
459# CONFIG_MTD_UBI is not set
460# CONFIG_PARPORT is not set
461CONFIG_BLK_DEV=y
462# CONFIG_BLK_DEV_COW_COMMON is not set
463CONFIG_BLK_DEV_LOOP=y
464# CONFIG_BLK_DEV_CRYPTOLOOP is not set
465# CONFIG_BLK_DEV_NBD is not set
466# CONFIG_BLK_DEV_UB is not set
467# CONFIG_BLK_DEV_RAM is not set
468# CONFIG_CDROM_PKTCDVD is not set
469# CONFIG_ATA_OVER_ETH is not set
470# CONFIG_MISC_DEVICES is not set
471CONFIG_HAVE_IDE=y
472# CONFIG_IDE is not set
473
474#
475# SCSI device support
476#
477# CONFIG_RAID_ATTRS is not set
478CONFIG_SCSI=y
479CONFIG_SCSI_DMA=y
480# CONFIG_SCSI_TGT is not set
481# CONFIG_SCSI_NETLINK is not set
482# CONFIG_SCSI_PROC_FS is not set
483
484#
485# SCSI support type (disk, tape, CD-ROM)
486#
487CONFIG_BLK_DEV_SD=y
488# CONFIG_CHR_DEV_ST is not set
489# CONFIG_CHR_DEV_OSST is not set
490CONFIG_BLK_DEV_SR=m
491# CONFIG_BLK_DEV_SR_VENDOR is not set
492CONFIG_CHR_DEV_SG=m
493# CONFIG_CHR_DEV_SCH is not set
494
495#
496# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
497#
498# CONFIG_SCSI_MULTI_LUN is not set
499# CONFIG_SCSI_CONSTANTS is not set
500# CONFIG_SCSI_LOGGING is not set
501# CONFIG_SCSI_SCAN_ASYNC is not set
502CONFIG_SCSI_WAIT_SCAN=m
503
504#
505# SCSI Transports
506#
507# CONFIG_SCSI_SPI_ATTRS is not set
508# CONFIG_SCSI_FC_ATTRS is not set
509# CONFIG_SCSI_ISCSI_ATTRS is not set
510# CONFIG_SCSI_SAS_LIBSAS is not set
511# CONFIG_SCSI_SRP_ATTRS is not set
512CONFIG_SCSI_LOWLEVEL=y
513# CONFIG_ISCSI_TCP is not set
514# CONFIG_SCSI_DEBUG is not set
515CONFIG_ATA=y
516# CONFIG_ATA_NONSTANDARD is not set
517CONFIG_SATA_PMP=y
518CONFIG_ATA_SFF=y
519CONFIG_SATA_MV=y
520# CONFIG_PATA_PLATFORM is not set
521# CONFIG_MD is not set
522CONFIG_NETDEVICES=y
523# CONFIG_NETDEVICES_MULTIQUEUE is not set
524# CONFIG_DUMMY is not set
525# CONFIG_BONDING is not set
526# CONFIG_MACVLAN is not set
527# CONFIG_EQUALIZER is not set
528# CONFIG_TUN is not set
529# CONFIG_VETH is not set
530# CONFIG_PHYLIB is not set
531CONFIG_NET_ETHERNET=y
532CONFIG_MII=y
533# CONFIG_AX88796 is not set
534# CONFIG_SMC91X is not set
535# CONFIG_DM9000 is not set
536# CONFIG_ENC28J60 is not set
537# CONFIG_IBM_NEW_EMAC_ZMII is not set
538# CONFIG_IBM_NEW_EMAC_RGMII is not set
539# CONFIG_IBM_NEW_EMAC_TAH is not set
540# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
541# CONFIG_B44 is not set
542CONFIG_NETDEV_1000=y
543# CONFIG_E1000E_ENABLED is not set
544CONFIG_MV643XX_ETH=y
545# CONFIG_NETDEV_10000 is not set
546
547#
548# Wireless LAN
549#
550# CONFIG_WLAN_PRE80211 is not set
551# CONFIG_WLAN_80211 is not set
552# CONFIG_IWLWIFI_LEDS is not set
553
554#
555# USB Network Adapters
556#
557# CONFIG_USB_CATC is not set
558# CONFIG_USB_KAWETH is not set
559# CONFIG_USB_PEGASUS is not set
560# CONFIG_USB_RTL8150 is not set
561# CONFIG_USB_USBNET is not set
562# CONFIG_WAN is not set
563# CONFIG_PPP is not set
564# CONFIG_SLIP is not set
565# CONFIG_NETCONSOLE is not set
566# CONFIG_NETPOLL is not set
567# CONFIG_NET_POLL_CONTROLLER is not set
568# CONFIG_ISDN is not set
569
570#
571# Input device support
572#
573CONFIG_INPUT=y
574# CONFIG_INPUT_FF_MEMLESS is not set
575# CONFIG_INPUT_POLLDEV is not set
576
577#
578# Userland interfaces
579#
580CONFIG_INPUT_MOUSEDEV=y
581CONFIG_INPUT_MOUSEDEV_PSAUX=y
582CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
583CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
584# CONFIG_INPUT_JOYDEV is not set
585# CONFIG_INPUT_EVDEV is not set
586# CONFIG_INPUT_EVBUG is not set
587
588#
589# Input Device Drivers
590#
591# CONFIG_INPUT_KEYBOARD is not set
592# CONFIG_INPUT_MOUSE is not set
593# CONFIG_INPUT_JOYSTICK is not set
594# CONFIG_INPUT_TABLET is not set
595# CONFIG_INPUT_TOUCHSCREEN is not set
596# CONFIG_INPUT_MISC is not set
597
598#
599# Hardware I/O ports
600#
601# CONFIG_SERIO is not set
602# CONFIG_GAMEPORT is not set
603
604#
605# Character devices
606#
607CONFIG_VT=y
608CONFIG_VT_CONSOLE=y
609CONFIG_HW_CONSOLE=y
610# CONFIG_VT_HW_CONSOLE_BINDING is not set
611CONFIG_DEVKMEM=y
612# CONFIG_SERIAL_NONSTANDARD is not set
613
614#
615# Serial drivers
616#
617CONFIG_SERIAL_8250=y
618CONFIG_SERIAL_8250_CONSOLE=y
619CONFIG_SERIAL_8250_NR_UARTS=4
620CONFIG_SERIAL_8250_RUNTIME_UARTS=2
621# CONFIG_SERIAL_8250_EXTENDED is not set
622
623#
624# Non-8250 serial port support
625#
626CONFIG_SERIAL_CORE=y
627CONFIG_SERIAL_CORE_CONSOLE=y
628CONFIG_UNIX98_PTYS=y
629CONFIG_LEGACY_PTYS=y
630CONFIG_LEGACY_PTY_COUNT=16
631# CONFIG_IPMI_HANDLER is not set
632CONFIG_HW_RANDOM=m
633# CONFIG_NVRAM is not set
634# CONFIG_R3964 is not set
635# CONFIG_RAW_DRIVER is not set
636# CONFIG_TCG_TPM is not set
637CONFIG_I2C=y
638CONFIG_I2C_BOARDINFO=y
639CONFIG_I2C_CHARDEV=y
640
641#
642# I2C Hardware Bus support
643#
644# CONFIG_I2C_OCORES is not set
645# CONFIG_I2C_PARPORT_LIGHT is not set
646# CONFIG_I2C_SIMTEC is not set
647# CONFIG_I2C_TAOS_EVM is not set
648# CONFIG_I2C_STUB is not set
649# CONFIG_I2C_TINY_USB is not set
650# CONFIG_I2C_PCA_PLATFORM is not set
651CONFIG_I2C_MV64XXX=y
652
653#
654# Miscellaneous I2C Chip support
655#
656# CONFIG_DS1682 is not set
657# CONFIG_SENSORS_EEPROM is not set
658# CONFIG_SENSORS_PCF8574 is not set
659# CONFIG_PCF8575 is not set
660# CONFIG_SENSORS_PCF8591 is not set
661# CONFIG_SENSORS_MAX6875 is not set
662# CONFIG_SENSORS_TSL2550 is not set
663# CONFIG_I2C_DEBUG_CORE is not set
664# CONFIG_I2C_DEBUG_ALGO is not set
665# CONFIG_I2C_DEBUG_BUS is not set
666# CONFIG_I2C_DEBUG_CHIP is not set
667CONFIG_SPI=y
668CONFIG_SPI_MASTER=y
669
670#
671# SPI Master Controller Drivers
672#
673# CONFIG_SPI_BITBANG is not set
674
675#
676# SPI Protocol Masters
677#
678# CONFIG_SPI_AT25 is not set
679# CONFIG_SPI_SPIDEV is not set
680# CONFIG_SPI_TLE62X0 is not set
681# CONFIG_W1 is not set
682# CONFIG_POWER_SUPPLY is not set
683# CONFIG_HWMON is not set
684# CONFIG_WATCHDOG is not set
685
686#
687# Sonics Silicon Backplane
688#
689CONFIG_SSB_POSSIBLE=y
690# CONFIG_SSB is not set
691
692#
693# Multifunction device drivers
694#
695# CONFIG_MFD_SM501 is not set
696# CONFIG_MFD_ASIC3 is not set
697# CONFIG_HTC_PASIC3 is not set
698
699#
700# Multimedia devices
701#
702
703#
704# Multimedia core support
705#
706# CONFIG_VIDEO_DEV is not set
707# CONFIG_DVB_CORE is not set
708# CONFIG_VIDEO_MEDIA is not set
709
710#
711# Multimedia drivers
712#
713# CONFIG_DAB is not set
714
715#
716# Graphics support
717#
718# CONFIG_VGASTATE is not set
719# CONFIG_VIDEO_OUTPUT_CONTROL is not set
720# CONFIG_FB is not set
721# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
722
723#
724# Display device support
725#
726# CONFIG_DISPLAY_SUPPORT is not set
727
728#
729# Console display driver support
730#
731# CONFIG_VGA_CONSOLE is not set
732CONFIG_DUMMY_CONSOLE=y
733
734#
735# Sound
736#
737# CONFIG_SOUND is not set
738CONFIG_HID_SUPPORT=y
739CONFIG_HID=y
740# CONFIG_HID_DEBUG is not set
741# CONFIG_HIDRAW is not set
742
743#
744# USB Input Devices
745#
746CONFIG_USB_HID=y
747# CONFIG_USB_HIDINPUT_POWERBOOK is not set
748# CONFIG_HID_FF is not set
749# CONFIG_USB_HIDDEV is not set
750CONFIG_USB_SUPPORT=y
751CONFIG_USB_ARCH_HAS_HCD=y
752# CONFIG_USB_ARCH_HAS_OHCI is not set
753# CONFIG_USB_ARCH_HAS_EHCI is not set
754CONFIG_USB=y
755# CONFIG_USB_DEBUG is not set
756# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
757
758#
759# Miscellaneous USB options
760#
761CONFIG_USB_DEVICEFS=y
762CONFIG_USB_DEVICE_CLASS=y
763# CONFIG_USB_DYNAMIC_MINORS is not set
764# CONFIG_USB_OTG is not set
765# CONFIG_USB_OTG_WHITELIST is not set
766# CONFIG_USB_OTG_BLACKLIST_HUB is not set
767
768#
769# USB Host Controller Drivers
770#
771# CONFIG_USB_C67X00_HCD is not set
772# CONFIG_USB_ISP116X_HCD is not set
773# CONFIG_USB_ISP1760_HCD is not set
774# CONFIG_USB_SL811_HCD is not set
775# CONFIG_USB_R8A66597_HCD is not set
776
777#
778# USB Device Class drivers
779#
780# CONFIG_USB_ACM is not set
781CONFIG_USB_PRINTER=y
782# CONFIG_USB_WDM is not set
783
784#
785# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
786#
787
788#
789# may also be needed; see USB_STORAGE Help for more information
790#
791CONFIG_USB_STORAGE=y
792# CONFIG_USB_STORAGE_DEBUG is not set
793CONFIG_USB_STORAGE_DATAFAB=y
794CONFIG_USB_STORAGE_FREECOM=y
795# CONFIG_USB_STORAGE_ISD200 is not set
796CONFIG_USB_STORAGE_DPCM=y
797# CONFIG_USB_STORAGE_USBAT is not set
798CONFIG_USB_STORAGE_SDDR09=y
799CONFIG_USB_STORAGE_SDDR55=y
800CONFIG_USB_STORAGE_JUMPSHOT=y
801# CONFIG_USB_STORAGE_ALAUDA is not set
802# CONFIG_USB_STORAGE_ONETOUCH is not set
803# CONFIG_USB_STORAGE_KARMA is not set
804# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
805# CONFIG_USB_LIBUSUAL is not set
806
807#
808# USB Imaging devices
809#
810# CONFIG_USB_MDC800 is not set
811# CONFIG_USB_MICROTEK is not set
812# CONFIG_USB_MON is not set
813
814#
815# USB port drivers
816#
817# CONFIG_USB_SERIAL is not set
818
819#
820# USB Miscellaneous drivers
821#
822# CONFIG_USB_EMI62 is not set
823# CONFIG_USB_EMI26 is not set
824# CONFIG_USB_ADUTUX is not set
825# CONFIG_USB_AUERSWALD is not set
826# CONFIG_USB_RIO500 is not set
827# CONFIG_USB_LEGOTOWER is not set
828# CONFIG_USB_LCD is not set
829# CONFIG_USB_BERRY_CHARGE is not set
830# CONFIG_USB_LED is not set
831# CONFIG_USB_CYPRESS_CY7C63 is not set
832# CONFIG_USB_CYTHERM is not set
833# CONFIG_USB_PHIDGET is not set
834# CONFIG_USB_IDMOUSE is not set
835# CONFIG_USB_FTDI_ELAN is not set
836# CONFIG_USB_APPLEDISPLAY is not set
837# CONFIG_USB_LD is not set
838# CONFIG_USB_TRANCEVIBRATOR is not set
839# CONFIG_USB_IOWARRIOR is not set
840# CONFIG_USB_TEST is not set
841# CONFIG_USB_ISIGHTFW is not set
842# CONFIG_USB_GADGET is not set
843# CONFIG_MMC is not set
844CONFIG_NEW_LEDS=y
845# CONFIG_LEDS_CLASS is not set
846
847#
848# LED drivers
849#
850
851#
852# LED Triggers
853#
854# CONFIG_LEDS_TRIGGERS is not set
855CONFIG_RTC_LIB=y
856# CONFIG_RTC_CLASS is not set
857# CONFIG_UIO is not set
858
859#
860# File systems
861#
862CONFIG_EXT2_FS=y
863# CONFIG_EXT2_FS_XATTR is not set
864# CONFIG_EXT2_FS_XIP is not set
865CONFIG_EXT3_FS=y
866# CONFIG_EXT3_FS_XATTR is not set
867# CONFIG_EXT4DEV_FS is not set
868CONFIG_JBD=y
869# CONFIG_REISERFS_FS is not set
870# CONFIG_JFS_FS is not set
871# CONFIG_FS_POSIX_ACL is not set
872CONFIG_XFS_FS=y
873# CONFIG_XFS_QUOTA is not set
874# CONFIG_XFS_POSIX_ACL is not set
875# CONFIG_XFS_RT is not set
876# CONFIG_XFS_DEBUG is not set
877# CONFIG_OCFS2_FS is not set
878CONFIG_DNOTIFY=y
879CONFIG_INOTIFY=y
880CONFIG_INOTIFY_USER=y
881# CONFIG_QUOTA is not set
882# CONFIG_AUTOFS_FS is not set
883# CONFIG_AUTOFS4_FS is not set
884# CONFIG_FUSE_FS is not set
885
886#
887# CD-ROM/DVD Filesystems
888#
889CONFIG_ISO9660_FS=y
890# CONFIG_JOLIET is not set
891# CONFIG_ZISOFS is not set
892CONFIG_UDF_FS=m
893CONFIG_UDF_NLS=y
894
895#
896# DOS/FAT/NT Filesystems
897#
898CONFIG_FAT_FS=y
899CONFIG_MSDOS_FS=y
900CONFIG_VFAT_FS=y
901CONFIG_FAT_DEFAULT_CODEPAGE=437
902CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
903# CONFIG_NTFS_FS is not set
904
905#
906# Pseudo filesystems
907#
908CONFIG_PROC_FS=y
909CONFIG_PROC_SYSCTL=y
910CONFIG_SYSFS=y
911CONFIG_TMPFS=y
912# CONFIG_TMPFS_POSIX_ACL is not set
913# CONFIG_HUGETLB_PAGE is not set
914# CONFIG_CONFIGFS_FS is not set
915
916#
917# Miscellaneous filesystems
918#
919# CONFIG_ADFS_FS is not set
920# CONFIG_AFFS_FS is not set
921# CONFIG_HFS_FS is not set
922# CONFIG_HFSPLUS_FS is not set
923# CONFIG_BEFS_FS is not set
924# CONFIG_BFS_FS is not set
925# CONFIG_EFS_FS is not set
926CONFIG_JFFS2_FS=y
927CONFIG_JFFS2_FS_DEBUG=0
928CONFIG_JFFS2_FS_WRITEBUFFER=y
929# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
930# CONFIG_JFFS2_SUMMARY is not set
931# CONFIG_JFFS2_FS_XATTR is not set
932# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
933CONFIG_JFFS2_ZLIB=y
934# CONFIG_JFFS2_LZO is not set
935CONFIG_JFFS2_RTIME=y
936# CONFIG_JFFS2_RUBIN is not set
937CONFIG_CRAMFS=y
938# CONFIG_VXFS_FS is not set
939# CONFIG_MINIX_FS is not set
940# CONFIG_HPFS_FS is not set
941# CONFIG_QNX4FS_FS is not set
942# CONFIG_ROMFS_FS is not set
943# CONFIG_SYSV_FS is not set
944# CONFIG_UFS_FS is not set
945CONFIG_NETWORK_FILESYSTEMS=y
946CONFIG_NFS_FS=y
947CONFIG_NFS_V3=y
948# CONFIG_NFS_V3_ACL is not set
949# CONFIG_NFS_V4 is not set
950# CONFIG_NFSD is not set
951CONFIG_ROOT_NFS=y
952CONFIG_LOCKD=y
953CONFIG_LOCKD_V4=y
954CONFIG_NFS_COMMON=y
955CONFIG_SUNRPC=y
956# CONFIG_SUNRPC_BIND34 is not set
957# CONFIG_RPCSEC_GSS_KRB5 is not set
958# CONFIG_RPCSEC_GSS_SPKM3 is not set
959# CONFIG_SMB_FS is not set
960# CONFIG_CIFS is not set
961# CONFIG_NCP_FS is not set
962# CONFIG_CODA_FS is not set
963# CONFIG_AFS_FS is not set
964
965#
966# Partition Types
967#
968CONFIG_PARTITION_ADVANCED=y
969# CONFIG_ACORN_PARTITION is not set
970# CONFIG_OSF_PARTITION is not set
971# CONFIG_AMIGA_PARTITION is not set
972# CONFIG_ATARI_PARTITION is not set
973# CONFIG_MAC_PARTITION is not set
974CONFIG_MSDOS_PARTITION=y
975CONFIG_BSD_DISKLABEL=y
976CONFIG_MINIX_SUBPARTITION=y
977CONFIG_SOLARIS_X86_PARTITION=y
978CONFIG_UNIXWARE_DISKLABEL=y
979CONFIG_LDM_PARTITION=y
980CONFIG_LDM_DEBUG=y
981# CONFIG_SGI_PARTITION is not set
982# CONFIG_ULTRIX_PARTITION is not set
983CONFIG_SUN_PARTITION=y
984# CONFIG_KARMA_PARTITION is not set
985# CONFIG_EFI_PARTITION is not set
986# CONFIG_SYSV68_PARTITION is not set
987CONFIG_NLS=y
988CONFIG_NLS_DEFAULT="iso8859-1"
989CONFIG_NLS_CODEPAGE_437=y
990# CONFIG_NLS_CODEPAGE_737 is not set
991# CONFIG_NLS_CODEPAGE_775 is not set
992CONFIG_NLS_CODEPAGE_850=y
993# CONFIG_NLS_CODEPAGE_852 is not set
994# CONFIG_NLS_CODEPAGE_855 is not set
995# CONFIG_NLS_CODEPAGE_857 is not set
996# CONFIG_NLS_CODEPAGE_860 is not set
997# CONFIG_NLS_CODEPAGE_861 is not set
998# CONFIG_NLS_CODEPAGE_862 is not set
999# CONFIG_NLS_CODEPAGE_863 is not set
1000# CONFIG_NLS_CODEPAGE_864 is not set
1001# CONFIG_NLS_CODEPAGE_865 is not set
1002# CONFIG_NLS_CODEPAGE_866 is not set
1003# CONFIG_NLS_CODEPAGE_869 is not set
1004# CONFIG_NLS_CODEPAGE_936 is not set
1005# CONFIG_NLS_CODEPAGE_950 is not set
1006# CONFIG_NLS_CODEPAGE_932 is not set
1007# CONFIG_NLS_CODEPAGE_949 is not set
1008# CONFIG_NLS_CODEPAGE_874 is not set
1009# CONFIG_NLS_ISO8859_8 is not set
1010# CONFIG_NLS_CODEPAGE_1250 is not set
1011# CONFIG_NLS_CODEPAGE_1251 is not set
1012# CONFIG_NLS_ASCII is not set
1013CONFIG_NLS_ISO8859_1=y
1014CONFIG_NLS_ISO8859_2=y
1015# CONFIG_NLS_ISO8859_3 is not set
1016# CONFIG_NLS_ISO8859_4 is not set
1017# CONFIG_NLS_ISO8859_5 is not set
1018# CONFIG_NLS_ISO8859_6 is not set
1019# CONFIG_NLS_ISO8859_7 is not set
1020# CONFIG_NLS_ISO8859_9 is not set
1021# CONFIG_NLS_ISO8859_13 is not set
1022# CONFIG_NLS_ISO8859_14 is not set
1023# CONFIG_NLS_ISO8859_15 is not set
1024# CONFIG_NLS_KOI8_R is not set
1025# CONFIG_NLS_KOI8_U is not set
1026# CONFIG_NLS_UTF8 is not set
1027# CONFIG_DLM is not set
1028
1029#
1030# Kernel hacking
1031#
1032# CONFIG_PRINTK_TIME is not set
1033CONFIG_ENABLE_WARN_DEPRECATED=y
1034CONFIG_ENABLE_MUST_CHECK=y
1035CONFIG_FRAME_WARN=1024
1036CONFIG_MAGIC_SYSRQ=y
1037# CONFIG_UNUSED_SYMBOLS is not set
1038# CONFIG_DEBUG_FS is not set
1039# CONFIG_HEADERS_CHECK is not set
1040# CONFIG_DEBUG_KERNEL is not set
1041# CONFIG_DEBUG_BUGVERBOSE is not set
1042CONFIG_FRAME_POINTER=y
1043# CONFIG_LATENCYTOP is not set
1044# CONFIG_SAMPLES is not set
1045CONFIG_DEBUG_USER=y
1046
1047#
1048# Security options
1049#
1050# CONFIG_KEYS is not set
1051# CONFIG_SECURITY is not set
1052# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1053CONFIG_CRYPTO=y
1054
1055#
1056# Crypto core or helper
1057#
1058CONFIG_CRYPTO_ALGAPI=m
1059CONFIG_CRYPTO_BLKCIPHER=m
1060CONFIG_CRYPTO_MANAGER=m
1061# CONFIG_CRYPTO_GF128MUL is not set
1062# CONFIG_CRYPTO_NULL is not set
1063# CONFIG_CRYPTO_CRYPTD is not set
1064# CONFIG_CRYPTO_AUTHENC is not set
1065# CONFIG_CRYPTO_TEST is not set
1066
1067#
1068# Authenticated Encryption with Associated Data
1069#
1070# CONFIG_CRYPTO_CCM is not set
1071# CONFIG_CRYPTO_GCM is not set
1072# CONFIG_CRYPTO_SEQIV is not set
1073
1074#
1075# Block modes
1076#
1077CONFIG_CRYPTO_CBC=m
1078# CONFIG_CRYPTO_CTR is not set
1079# CONFIG_CRYPTO_CTS is not set
1080CONFIG_CRYPTO_ECB=m
1081# CONFIG_CRYPTO_LRW is not set
1082CONFIG_CRYPTO_PCBC=m
1083# CONFIG_CRYPTO_XTS is not set
1084
1085#
1086# Hash modes
1087#
1088# CONFIG_CRYPTO_HMAC is not set
1089# CONFIG_CRYPTO_XCBC is not set
1090
1091#
1092# Digest
1093#
1094# CONFIG_CRYPTO_CRC32C is not set
1095# CONFIG_CRYPTO_MD4 is not set
1096# CONFIG_CRYPTO_MD5 is not set
1097# CONFIG_CRYPTO_MICHAEL_MIC is not set
1098# CONFIG_CRYPTO_SHA1 is not set
1099# CONFIG_CRYPTO_SHA256 is not set
1100# CONFIG_CRYPTO_SHA512 is not set
1101# CONFIG_CRYPTO_TGR192 is not set
1102# CONFIG_CRYPTO_WP512 is not set
1103
1104#
1105# Ciphers
1106#
1107# CONFIG_CRYPTO_AES is not set
1108# CONFIG_CRYPTO_ANUBIS is not set
1109# CONFIG_CRYPTO_ARC4 is not set
1110# CONFIG_CRYPTO_BLOWFISH is not set
1111# CONFIG_CRYPTO_CAMELLIA is not set
1112# CONFIG_CRYPTO_CAST5 is not set
1113# CONFIG_CRYPTO_CAST6 is not set
1114# CONFIG_CRYPTO_DES is not set
1115# CONFIG_CRYPTO_FCRYPT is not set
1116# CONFIG_CRYPTO_KHAZAD is not set
1117# CONFIG_CRYPTO_SALSA20 is not set
1118# CONFIG_CRYPTO_SEED is not set
1119# CONFIG_CRYPTO_SERPENT is not set
1120# CONFIG_CRYPTO_TEA is not set
1121# CONFIG_CRYPTO_TWOFISH is not set
1122
1123#
1124# Compression
1125#
1126# CONFIG_CRYPTO_DEFLATE is not set
1127# CONFIG_CRYPTO_LZO is not set
1128CONFIG_CRYPTO_HW=y
1129
1130#
1131# Library routines
1132#
1133CONFIG_BITREVERSE=y
1134# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1135# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1136CONFIG_CRC_CCITT=y
1137CONFIG_CRC16=y
1138CONFIG_CRC_ITU_T=m
1139CONFIG_CRC32=y
1140# CONFIG_CRC7 is not set
1141CONFIG_LIBCRC32C=y
1142CONFIG_ZLIB_INFLATE=y
1143CONFIG_ZLIB_DEFLATE=y
1144CONFIG_PLIST=y
1145CONFIG_HAS_IOMEM=y
1146CONFIG_HAS_IOPORT=y
1147CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/lpd270_defconfig b/arch/arm/configs/lpd270_defconfig
index a3bf5833b87a..1a38d8e3fe66 100644
--- a/arch/arm/configs/lpd270_defconfig
+++ b/arch/arm/configs/lpd270_defconfig
@@ -173,7 +173,6 @@ CONFIG_XSCALE_PMU=y
173# Kernel Features 173# Kernel Features
174# 174#
175# CONFIG_PREEMPT is not set 175# CONFIG_PREEMPT is not set
176# CONFIG_NO_IDLE_HZ is not set
177CONFIG_HZ=100 176CONFIG_HZ=100
178# CONFIG_AEABI is not set 177# CONFIG_AEABI is not set
179# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 178# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/lpd7a404_defconfig b/arch/arm/configs/lpd7a404_defconfig
index 46a0f7fe1fa5..7a2e932da1c6 100644
--- a/arch/arm/configs/lpd7a404_defconfig
+++ b/arch/arm/configs/lpd7a404_defconfig
@@ -148,7 +148,6 @@ CONFIG_ARM_AMBA=y
148# Kernel Features 148# Kernel Features
149# 149#
150CONFIG_PREEMPT=y 150CONFIG_PREEMPT=y
151# CONFIG_NO_IDLE_HZ is not set
152# CONFIG_AEABI is not set 151# CONFIG_AEABI is not set
153CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 152CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
154CONFIG_SELECT_MEMORY_MODEL=y 153CONFIG_SELECT_MEMORY_MODEL=y
diff --git a/arch/arm/configs/mv78xx0_defconfig b/arch/arm/configs/mv78xx0_defconfig
new file mode 100644
index 000000000000..d38ebf8721a4
--- /dev/null
+++ b/arch/arm/configs/mv78xx0_defconfig
@@ -0,0 +1,1445 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5
4# Fri Jun 13 02:57:32 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_ZONE_DMA=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49# CONFIG_GROUP_SCHED is not set
50CONFIG_SYSFS_DEPRECATED=y
51CONFIG_SYSFS_DEPRECATED_V2=y
52# CONFIG_RELAY is not set
53# CONFIG_NAMESPACES is not set
54# CONFIG_BLK_DEV_INITRD is not set
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56CONFIG_SYSCTL=y
57CONFIG_EMBEDDED=y
58CONFIG_UID16=y
59CONFIG_SYSCTL_SYSCALL=y
60CONFIG_SYSCTL_SYSCALL_CHECK=y
61CONFIG_KALLSYMS=y
62CONFIG_KALLSYMS_ALL=y
63# CONFIG_KALLSYMS_EXTRA_PASS is not set
64CONFIG_HOTPLUG=y
65CONFIG_PRINTK=y
66CONFIG_BUG=y
67CONFIG_ELF_CORE=y
68CONFIG_COMPAT_BRK=y
69CONFIG_BASE_FULL=y
70CONFIG_FUTEX=y
71CONFIG_ANON_INODES=y
72CONFIG_EPOLL=y
73CONFIG_SIGNALFD=y
74CONFIG_TIMERFD=y
75CONFIG_EVENTFD=y
76CONFIG_SHMEM=y
77CONFIG_VM_EVENT_COUNTERS=y
78# CONFIG_SLUB_DEBUG is not set
79# CONFIG_SLAB is not set
80CONFIG_SLUB=y
81# CONFIG_SLOB is not set
82CONFIG_PROFILING=y
83# CONFIG_MARKERS is not set
84CONFIG_OPROFILE=y
85CONFIG_HAVE_OPROFILE=y
86CONFIG_KPROBES=y
87CONFIG_KRETPROBES=y
88CONFIG_HAVE_KPROBES=y
89CONFIG_HAVE_KRETPROBES=y
90# CONFIG_HAVE_DMA_ATTRS is not set
91CONFIG_PROC_PAGE_MONITOR=y
92CONFIG_RT_MUTEXES=y
93# CONFIG_TINY_SHMEM is not set
94CONFIG_BASE_SMALL=0
95CONFIG_MODULES=y
96# CONFIG_MODULE_FORCE_LOAD is not set
97CONFIG_MODULE_UNLOAD=y
98# CONFIG_MODULE_FORCE_UNLOAD is not set
99# CONFIG_MODVERSIONS is not set
100# CONFIG_MODULE_SRCVERSION_ALL is not set
101# CONFIG_KMOD is not set
102CONFIG_BLOCK=y
103# CONFIG_LBD is not set
104# CONFIG_BLK_DEV_IO_TRACE is not set
105# CONFIG_LSF is not set
106# CONFIG_BLK_DEV_BSG is not set
107
108#
109# IO Schedulers
110#
111CONFIG_IOSCHED_NOOP=y
112CONFIG_IOSCHED_AS=y
113CONFIG_IOSCHED_DEADLINE=y
114CONFIG_IOSCHED_CFQ=y
115# CONFIG_DEFAULT_AS is not set
116# CONFIG_DEFAULT_DEADLINE is not set
117CONFIG_DEFAULT_CFQ=y
118# CONFIG_DEFAULT_NOOP is not set
119CONFIG_DEFAULT_IOSCHED="cfq"
120CONFIG_CLASSIC_RCU=y
121
122#
123# System Type
124#
125# CONFIG_ARCH_AAEC2000 is not set
126# CONFIG_ARCH_INTEGRATOR is not set
127# CONFIG_ARCH_REALVIEW is not set
128# CONFIG_ARCH_VERSATILE is not set
129# CONFIG_ARCH_AT91 is not set
130# CONFIG_ARCH_CLPS7500 is not set
131# CONFIG_ARCH_CLPS711X is not set
132# CONFIG_ARCH_CO285 is not set
133# CONFIG_ARCH_EBSA110 is not set
134# CONFIG_ARCH_EP93XX is not set
135# CONFIG_ARCH_FOOTBRIDGE is not set
136# CONFIG_ARCH_NETX is not set
137# CONFIG_ARCH_H720X is not set
138# CONFIG_ARCH_IMX is not set
139# CONFIG_ARCH_IOP13XX is not set
140# CONFIG_ARCH_IOP32X is not set
141# CONFIG_ARCH_IOP33X is not set
142# CONFIG_ARCH_IXP23XX is not set
143# CONFIG_ARCH_IXP2000 is not set
144# CONFIG_ARCH_IXP4XX is not set
145# CONFIG_ARCH_L7200 is not set
146# CONFIG_ARCH_KIRKWOOD is not set
147# CONFIG_ARCH_KS8695 is not set
148# CONFIG_ARCH_NS9XXX is not set
149# CONFIG_ARCH_LOKI is not set
150CONFIG_ARCH_MV78XX0=y
151# CONFIG_ARCH_MXC is not set
152# CONFIG_ARCH_ORION5X is not set
153# CONFIG_ARCH_PNX4008 is not set
154# CONFIG_ARCH_PXA is not set
155# CONFIG_ARCH_RPC is not set
156# CONFIG_ARCH_SA1100 is not set
157# CONFIG_ARCH_S3C2410 is not set
158# CONFIG_ARCH_SHARK is not set
159# CONFIG_ARCH_LH7A40X is not set
160# CONFIG_ARCH_DAVINCI is not set
161# CONFIG_ARCH_OMAP is not set
162# CONFIG_ARCH_MSM7X00A is not set
163
164#
165# Marvell MV78xx0 Implementations
166#
167CONFIG_MACH_DB78X00_BP=y
168
169#
170# Boot options
171#
172
173#
174# Power management
175#
176CONFIG_PLAT_ORION=y
177
178#
179# Processor Type
180#
181CONFIG_CPU_32=y
182CONFIG_CPU_FEROCEON=y
183CONFIG_CPU_FEROCEON_OLD_ID=y
184CONFIG_CPU_32v5=y
185CONFIG_CPU_ABRT_EV5T=y
186CONFIG_CPU_PABRT_NOIFAR=y
187CONFIG_CPU_CACHE_VIVT=y
188CONFIG_CPU_COPY_FEROCEON=y
189CONFIG_CPU_TLB_FEROCEON=y
190CONFIG_CPU_CP15=y
191CONFIG_CPU_CP15_MMU=y
192
193#
194# Processor Features
195#
196CONFIG_ARM_THUMB=y
197# CONFIG_CPU_ICACHE_DISABLE is not set
198# CONFIG_CPU_DCACHE_DISABLE is not set
199CONFIG_OUTER_CACHE=y
200CONFIG_CACHE_FEROCEON_L2=y
201
202#
203# Bus support
204#
205CONFIG_PCI=y
206CONFIG_PCI_SYSCALL=y
207# CONFIG_ARCH_SUPPORTS_MSI is not set
208CONFIG_PCI_LEGACY=y
209# CONFIG_PCI_DEBUG is not set
210# CONFIG_PCCARD is not set
211
212#
213# Kernel Features
214#
215CONFIG_TICK_ONESHOT=y
216CONFIG_NO_HZ=y
217CONFIG_HIGH_RES_TIMERS=y
218CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
219CONFIG_PREEMPT=y
220CONFIG_HZ=100
221CONFIG_AEABI=y
222CONFIG_OABI_COMPAT=y
223# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
224CONFIG_SELECT_MEMORY_MODEL=y
225CONFIG_FLATMEM_MANUAL=y
226# CONFIG_DISCONTIGMEM_MANUAL is not set
227# CONFIG_SPARSEMEM_MANUAL is not set
228CONFIG_FLATMEM=y
229CONFIG_FLAT_NODE_MEM_MAP=y
230# CONFIG_SPARSEMEM_STATIC is not set
231# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
232CONFIG_PAGEFLAGS_EXTENDED=y
233CONFIG_SPLIT_PTLOCK_CPUS=4096
234# CONFIG_RESOURCES_64BIT is not set
235CONFIG_ZONE_DMA_FLAG=1
236CONFIG_BOUNCE=y
237CONFIG_VIRT_TO_BUS=y
238CONFIG_ALIGNMENT_TRAP=y
239
240#
241# Boot options
242#
243CONFIG_ZBOOT_ROM_TEXT=0x0
244CONFIG_ZBOOT_ROM_BSS=0x0
245CONFIG_CMDLINE=""
246# CONFIG_XIP_KERNEL is not set
247# CONFIG_KEXEC is not set
248
249#
250# Floating point emulation
251#
252
253#
254# At least one emulation must be selected
255#
256CONFIG_FPE_NWFPE=y
257# CONFIG_FPE_NWFPE_XP is not set
258# CONFIG_FPE_FASTFPE is not set
259CONFIG_VFP=y
260
261#
262# Userspace binary formats
263#
264CONFIG_BINFMT_ELF=y
265# CONFIG_BINFMT_AOUT is not set
266# CONFIG_BINFMT_MISC is not set
267
268#
269# Power management options
270#
271# CONFIG_PM is not set
272CONFIG_ARCH_SUSPEND_POSSIBLE=y
273
274#
275# Networking
276#
277CONFIG_NET=y
278
279#
280# Networking options
281#
282CONFIG_PACKET=y
283CONFIG_PACKET_MMAP=y
284CONFIG_UNIX=y
285CONFIG_XFRM=y
286# CONFIG_XFRM_USER is not set
287# CONFIG_XFRM_SUB_POLICY is not set
288# CONFIG_XFRM_MIGRATE is not set
289# CONFIG_XFRM_STATISTICS is not set
290# CONFIG_NET_KEY is not set
291CONFIG_INET=y
292CONFIG_IP_MULTICAST=y
293# CONFIG_IP_ADVANCED_ROUTER is not set
294CONFIG_IP_FIB_HASH=y
295CONFIG_IP_PNP=y
296CONFIG_IP_PNP_DHCP=y
297CONFIG_IP_PNP_BOOTP=y
298# CONFIG_IP_PNP_RARP is not set
299# CONFIG_NET_IPIP is not set
300# CONFIG_NET_IPGRE is not set
301# CONFIG_IP_MROUTE is not set
302# CONFIG_ARPD is not set
303# CONFIG_SYN_COOKIES is not set
304# CONFIG_INET_AH is not set
305# CONFIG_INET_ESP is not set
306# CONFIG_INET_IPCOMP is not set
307# CONFIG_INET_XFRM_TUNNEL is not set
308# CONFIG_INET_TUNNEL is not set
309CONFIG_INET_XFRM_MODE_TRANSPORT=y
310CONFIG_INET_XFRM_MODE_TUNNEL=y
311CONFIG_INET_XFRM_MODE_BEET=y
312# CONFIG_INET_LRO is not set
313CONFIG_INET_DIAG=y
314CONFIG_INET_TCP_DIAG=y
315# CONFIG_TCP_CONG_ADVANCED is not set
316CONFIG_TCP_CONG_CUBIC=y
317CONFIG_DEFAULT_TCP_CONG="cubic"
318# CONFIG_TCP_MD5SIG is not set
319# CONFIG_IPV6 is not set
320# CONFIG_NETWORK_SECMARK is not set
321# CONFIG_NETFILTER is not set
322# CONFIG_IP_DCCP is not set
323# CONFIG_IP_SCTP is not set
324# CONFIG_TIPC is not set
325# CONFIG_ATM is not set
326# CONFIG_BRIDGE is not set
327# CONFIG_VLAN_8021Q is not set
328# CONFIG_DECNET is not set
329# CONFIG_LLC2 is not set
330# CONFIG_IPX is not set
331# CONFIG_ATALK is not set
332# CONFIG_X25 is not set
333# CONFIG_LAPB is not set
334# CONFIG_ECONET is not set
335# CONFIG_WAN_ROUTER is not set
336# CONFIG_NET_SCHED is not set
337
338#
339# Network testing
340#
341CONFIG_NET_PKTGEN=m
342# CONFIG_NET_TCPPROBE is not set
343# CONFIG_HAMRADIO is not set
344# CONFIG_CAN is not set
345# CONFIG_IRDA is not set
346# CONFIG_BT is not set
347# CONFIG_AF_RXRPC is not set
348
349#
350# Wireless
351#
352# CONFIG_CFG80211 is not set
353CONFIG_WIRELESS_EXT=y
354# CONFIG_MAC80211 is not set
355# CONFIG_IEEE80211 is not set
356# CONFIG_RFKILL is not set
357# CONFIG_NET_9P is not set
358
359#
360# Device Drivers
361#
362
363#
364# Generic Driver Options
365#
366CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
367CONFIG_STANDALONE=y
368CONFIG_PREVENT_FIRMWARE_BUILD=y
369CONFIG_FW_LOADER=y
370# CONFIG_DEBUG_DRIVER is not set
371# CONFIG_DEBUG_DEVRES is not set
372# CONFIG_SYS_HYPERVISOR is not set
373# CONFIG_CONNECTOR is not set
374CONFIG_MTD=y
375# CONFIG_MTD_DEBUG is not set
376# CONFIG_MTD_CONCAT is not set
377CONFIG_MTD_PARTITIONS=y
378# CONFIG_MTD_REDBOOT_PARTS is not set
379CONFIG_MTD_CMDLINE_PARTS=y
380# CONFIG_MTD_AFS_PARTS is not set
381# CONFIG_MTD_AR7_PARTS is not set
382
383#
384# User Modules And Translation Layers
385#
386CONFIG_MTD_CHAR=y
387CONFIG_MTD_BLKDEVS=y
388CONFIG_MTD_BLOCK=y
389# CONFIG_FTL is not set
390# CONFIG_NFTL is not set
391# CONFIG_INFTL is not set
392# CONFIG_RFD_FTL is not set
393# CONFIG_SSFDC is not set
394# CONFIG_MTD_OOPS is not set
395
396#
397# RAM/ROM/Flash chip drivers
398#
399CONFIG_MTD_CFI=y
400CONFIG_MTD_JEDECPROBE=y
401CONFIG_MTD_GEN_PROBE=y
402CONFIG_MTD_CFI_ADV_OPTIONS=y
403CONFIG_MTD_CFI_NOSWAP=y
404# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
405# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
406CONFIG_MTD_CFI_GEOMETRY=y
407CONFIG_MTD_MAP_BANK_WIDTH_1=y
408CONFIG_MTD_MAP_BANK_WIDTH_2=y
409CONFIG_MTD_MAP_BANK_WIDTH_4=y
410# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
411# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
412# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
413CONFIG_MTD_CFI_I1=y
414CONFIG_MTD_CFI_I2=y
415# CONFIG_MTD_CFI_I4 is not set
416# CONFIG_MTD_CFI_I8 is not set
417# CONFIG_MTD_OTP is not set
418CONFIG_MTD_CFI_INTELEXT=y
419CONFIG_MTD_CFI_AMDSTD=y
420# CONFIG_MTD_CFI_STAA is not set
421CONFIG_MTD_CFI_UTIL=y
422# CONFIG_MTD_RAM is not set
423# CONFIG_MTD_ROM is not set
424# CONFIG_MTD_ABSENT is not set
425
426#
427# Mapping drivers for chip access
428#
429# CONFIG_MTD_COMPLEX_MAPPINGS is not set
430CONFIG_MTD_PHYSMAP=y
431CONFIG_MTD_PHYSMAP_START=0x0
432CONFIG_MTD_PHYSMAP_LEN=0x0
433CONFIG_MTD_PHYSMAP_BANKWIDTH=0
434# CONFIG_MTD_ARM_INTEGRATOR is not set
435# CONFIG_MTD_IMPA7 is not set
436# CONFIG_MTD_INTEL_VR_NOR is not set
437# CONFIG_MTD_PLATRAM is not set
438
439#
440# Self-contained MTD device drivers
441#
442# CONFIG_MTD_PMC551 is not set
443# CONFIG_MTD_SLRAM is not set
444# CONFIG_MTD_PHRAM is not set
445# CONFIG_MTD_MTDRAM is not set
446# CONFIG_MTD_BLOCK2MTD is not set
447
448#
449# Disk-On-Chip Device Drivers
450#
451# CONFIG_MTD_DOC2000 is not set
452# CONFIG_MTD_DOC2001 is not set
453# CONFIG_MTD_DOC2001PLUS is not set
454CONFIG_MTD_NAND=y
455CONFIG_MTD_NAND_VERIFY_WRITE=y
456# CONFIG_MTD_NAND_ECC_SMC is not set
457# CONFIG_MTD_NAND_MUSEUM_IDS is not set
458CONFIG_MTD_NAND_IDS=y
459# CONFIG_MTD_NAND_DISKONCHIP is not set
460# CONFIG_MTD_NAND_CAFE is not set
461# CONFIG_MTD_NAND_NANDSIM is not set
462# CONFIG_MTD_NAND_PLATFORM is not set
463# CONFIG_MTD_ALAUDA is not set
464CONFIG_MTD_NAND_ORION=y
465# CONFIG_MTD_ONENAND is not set
466
467#
468# UBI - Unsorted block images
469#
470# CONFIG_MTD_UBI is not set
471# CONFIG_PARPORT is not set
472CONFIG_BLK_DEV=y
473# CONFIG_BLK_CPQ_DA is not set
474# CONFIG_BLK_CPQ_CISS_DA is not set
475# CONFIG_BLK_DEV_DAC960 is not set
476# CONFIG_BLK_DEV_UMEM is not set
477# CONFIG_BLK_DEV_COW_COMMON is not set
478CONFIG_BLK_DEV_LOOP=y
479# CONFIG_BLK_DEV_CRYPTOLOOP is not set
480# CONFIG_BLK_DEV_NBD is not set
481# CONFIG_BLK_DEV_SX8 is not set
482# CONFIG_BLK_DEV_UB is not set
483# CONFIG_BLK_DEV_RAM is not set
484# CONFIG_CDROM_PKTCDVD is not set
485# CONFIG_ATA_OVER_ETH is not set
486CONFIG_MISC_DEVICES=y
487# CONFIG_PHANTOM is not set
488# CONFIG_EEPROM_93CX6 is not set
489# CONFIG_SGI_IOC4 is not set
490# CONFIG_TIFM_CORE is not set
491# CONFIG_ENCLOSURE_SERVICES is not set
492CONFIG_HAVE_IDE=y
493# CONFIG_IDE is not set
494
495#
496# SCSI device support
497#
498# CONFIG_RAID_ATTRS is not set
499CONFIG_SCSI=y
500CONFIG_SCSI_DMA=y
501# CONFIG_SCSI_TGT is not set
502# CONFIG_SCSI_NETLINK is not set
503# CONFIG_SCSI_PROC_FS is not set
504
505#
506# SCSI support type (disk, tape, CD-ROM)
507#
508CONFIG_BLK_DEV_SD=y
509# CONFIG_CHR_DEV_ST is not set
510# CONFIG_CHR_DEV_OSST is not set
511CONFIG_BLK_DEV_SR=m
512# CONFIG_BLK_DEV_SR_VENDOR is not set
513CONFIG_CHR_DEV_SG=m
514# CONFIG_CHR_DEV_SCH is not set
515
516#
517# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
518#
519# CONFIG_SCSI_MULTI_LUN is not set
520# CONFIG_SCSI_CONSTANTS is not set
521# CONFIG_SCSI_LOGGING is not set
522# CONFIG_SCSI_SCAN_ASYNC is not set
523CONFIG_SCSI_WAIT_SCAN=m
524
525#
526# SCSI Transports
527#
528# CONFIG_SCSI_SPI_ATTRS is not set
529# CONFIG_SCSI_FC_ATTRS is not set
530# CONFIG_SCSI_ISCSI_ATTRS is not set
531# CONFIG_SCSI_SAS_LIBSAS is not set
532# CONFIG_SCSI_SRP_ATTRS is not set
533CONFIG_SCSI_LOWLEVEL=y
534# CONFIG_ISCSI_TCP is not set
535# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
536# CONFIG_SCSI_3W_9XXX is not set
537# CONFIG_SCSI_ACARD is not set
538# CONFIG_SCSI_AACRAID is not set
539# CONFIG_SCSI_AIC7XXX is not set
540# CONFIG_SCSI_AIC7XXX_OLD is not set
541# CONFIG_SCSI_AIC79XX is not set
542# CONFIG_SCSI_AIC94XX is not set
543# CONFIG_SCSI_DPT_I2O is not set
544# CONFIG_SCSI_ADVANSYS is not set
545# CONFIG_SCSI_ARCMSR is not set
546# CONFIG_MEGARAID_NEWGEN is not set
547# CONFIG_MEGARAID_LEGACY is not set
548# CONFIG_MEGARAID_SAS is not set
549# CONFIG_SCSI_HPTIOP is not set
550# CONFIG_SCSI_DMX3191D is not set
551# CONFIG_SCSI_FUTURE_DOMAIN is not set
552# CONFIG_SCSI_IPS is not set
553# CONFIG_SCSI_INITIO is not set
554# CONFIG_SCSI_INIA100 is not set
555# CONFIG_SCSI_MVSAS is not set
556# CONFIG_SCSI_STEX is not set
557# CONFIG_SCSI_SYM53C8XX_2 is not set
558# CONFIG_SCSI_IPR is not set
559# CONFIG_SCSI_QLOGIC_1280 is not set
560# CONFIG_SCSI_QLA_FC is not set
561# CONFIG_SCSI_QLA_ISCSI is not set
562# CONFIG_SCSI_LPFC is not set
563# CONFIG_SCSI_DC395x is not set
564# CONFIG_SCSI_DC390T is not set
565# CONFIG_SCSI_NSP32 is not set
566# CONFIG_SCSI_DEBUG is not set
567# CONFIG_SCSI_SRP is not set
568CONFIG_ATA=y
569# CONFIG_ATA_NONSTANDARD is not set
570CONFIG_SATA_PMP=y
571# CONFIG_SATA_AHCI is not set
572# CONFIG_SATA_SIL24 is not set
573CONFIG_ATA_SFF=y
574# CONFIG_SATA_SVW is not set
575# CONFIG_ATA_PIIX is not set
576CONFIG_SATA_MV=y
577# CONFIG_SATA_NV is not set
578# CONFIG_PDC_ADMA is not set
579# CONFIG_SATA_QSTOR is not set
580# CONFIG_SATA_PROMISE is not set
581# CONFIG_SATA_SX4 is not set
582# CONFIG_SATA_SIL is not set
583# CONFIG_SATA_SIS is not set
584# CONFIG_SATA_ULI is not set
585# CONFIG_SATA_VIA is not set
586# CONFIG_SATA_VITESSE is not set
587# CONFIG_SATA_INIC162X is not set
588# CONFIG_PATA_ALI is not set
589# CONFIG_PATA_AMD is not set
590# CONFIG_PATA_ARTOP is not set
591# CONFIG_PATA_ATIIXP is not set
592# CONFIG_PATA_CMD640_PCI is not set
593# CONFIG_PATA_CMD64X is not set
594# CONFIG_PATA_CS5520 is not set
595# CONFIG_PATA_CS5530 is not set
596# CONFIG_PATA_CYPRESS is not set
597# CONFIG_PATA_EFAR is not set
598# CONFIG_ATA_GENERIC is not set
599# CONFIG_PATA_HPT366 is not set
600# CONFIG_PATA_HPT37X is not set
601# CONFIG_PATA_HPT3X2N is not set
602# CONFIG_PATA_HPT3X3 is not set
603# CONFIG_PATA_IT821X is not set
604# CONFIG_PATA_IT8213 is not set
605# CONFIG_PATA_JMICRON is not set
606# CONFIG_PATA_TRIFLEX is not set
607# CONFIG_PATA_MARVELL is not set
608# CONFIG_PATA_MPIIX is not set
609# CONFIG_PATA_OLDPIIX is not set
610# CONFIG_PATA_NETCELL is not set
611# CONFIG_PATA_NINJA32 is not set
612# CONFIG_PATA_NS87410 is not set
613# CONFIG_PATA_NS87415 is not set
614# CONFIG_PATA_OPTI is not set
615# CONFIG_PATA_OPTIDMA is not set
616# CONFIG_PATA_PDC_OLD is not set
617# CONFIG_PATA_RADISYS is not set
618# CONFIG_PATA_RZ1000 is not set
619# CONFIG_PATA_SC1200 is not set
620# CONFIG_PATA_SERVERWORKS is not set
621# CONFIG_PATA_PDC2027X is not set
622# CONFIG_PATA_SIL680 is not set
623# CONFIG_PATA_SIS is not set
624# CONFIG_PATA_VIA is not set
625# CONFIG_PATA_WINBOND is not set
626# CONFIG_PATA_PLATFORM is not set
627# CONFIG_PATA_SCH is not set
628# CONFIG_MD is not set
629# CONFIG_FUSION is not set
630
631#
632# IEEE 1394 (FireWire) support
633#
634# CONFIG_FIREWIRE is not set
635# CONFIG_IEEE1394 is not set
636# CONFIG_I2O is not set
637CONFIG_NETDEVICES=y
638# CONFIG_NETDEVICES_MULTIQUEUE is not set
639# CONFIG_DUMMY is not set
640# CONFIG_BONDING is not set
641# CONFIG_MACVLAN is not set
642# CONFIG_EQUALIZER is not set
643# CONFIG_TUN is not set
644# CONFIG_VETH is not set
645# CONFIG_ARCNET is not set
646# CONFIG_PHYLIB is not set
647CONFIG_NET_ETHERNET=y
648CONFIG_MII=y
649# CONFIG_AX88796 is not set
650# CONFIG_HAPPYMEAL is not set
651# CONFIG_SUNGEM is not set
652# CONFIG_CASSINI is not set
653# CONFIG_NET_VENDOR_3COM is not set
654# CONFIG_SMC91X is not set
655# CONFIG_DM9000 is not set
656# CONFIG_NET_TULIP is not set
657# CONFIG_HP100 is not set
658# CONFIG_IBM_NEW_EMAC_ZMII is not set
659# CONFIG_IBM_NEW_EMAC_RGMII is not set
660# CONFIG_IBM_NEW_EMAC_TAH is not set
661# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
662CONFIG_NET_PCI=y
663# CONFIG_PCNET32 is not set
664# CONFIG_AMD8111_ETH is not set
665# CONFIG_ADAPTEC_STARFIRE is not set
666# CONFIG_B44 is not set
667# CONFIG_FORCEDETH is not set
668# CONFIG_EEPRO100 is not set
669# CONFIG_E100 is not set
670# CONFIG_FEALNX is not set
671# CONFIG_NATSEMI is not set
672# CONFIG_NE2K_PCI is not set
673# CONFIG_8139CP is not set
674# CONFIG_8139TOO is not set
675# CONFIG_R6040 is not set
676# CONFIG_SIS900 is not set
677# CONFIG_EPIC100 is not set
678# CONFIG_SUNDANCE is not set
679# CONFIG_TLAN is not set
680# CONFIG_VIA_RHINE is not set
681# CONFIG_SC92031 is not set
682CONFIG_NETDEV_1000=y
683# CONFIG_ACENIC is not set
684# CONFIG_DL2K is not set
685# CONFIG_E1000 is not set
686# CONFIG_E1000E is not set
687# CONFIG_E1000E_ENABLED is not set
688# CONFIG_IP1000 is not set
689# CONFIG_IGB is not set
690# CONFIG_NS83820 is not set
691# CONFIG_HAMACHI is not set
692# CONFIG_YELLOWFIN is not set
693# CONFIG_R8169 is not set
694# CONFIG_SIS190 is not set
695# CONFIG_SKGE is not set
696# CONFIG_SKY2 is not set
697# CONFIG_VIA_VELOCITY is not set
698# CONFIG_TIGON3 is not set
699# CONFIG_BNX2 is not set
700CONFIG_MV643XX_ETH=y
701# CONFIG_QLA3XXX is not set
702# CONFIG_ATL1 is not set
703# CONFIG_NETDEV_10000 is not set
704# CONFIG_TR is not set
705
706#
707# Wireless LAN
708#
709# CONFIG_WLAN_PRE80211 is not set
710# CONFIG_WLAN_80211 is not set
711# CONFIG_IWLWIFI_LEDS is not set
712
713#
714# USB Network Adapters
715#
716# CONFIG_USB_CATC is not set
717# CONFIG_USB_KAWETH is not set
718# CONFIG_USB_PEGASUS is not set
719# CONFIG_USB_RTL8150 is not set
720# CONFIG_USB_USBNET is not set
721# CONFIG_WAN is not set
722# CONFIG_FDDI is not set
723# CONFIG_HIPPI is not set
724# CONFIG_PPP is not set
725# CONFIG_SLIP is not set
726# CONFIG_NET_FC is not set
727# CONFIG_NETCONSOLE is not set
728# CONFIG_NETPOLL is not set
729# CONFIG_NET_POLL_CONTROLLER is not set
730# CONFIG_ISDN is not set
731
732#
733# Input device support
734#
735CONFIG_INPUT=y
736# CONFIG_INPUT_FF_MEMLESS is not set
737# CONFIG_INPUT_POLLDEV is not set
738
739#
740# Userland interfaces
741#
742# CONFIG_INPUT_MOUSEDEV is not set
743# CONFIG_INPUT_JOYDEV is not set
744CONFIG_INPUT_EVDEV=y
745# CONFIG_INPUT_EVBUG is not set
746
747#
748# Input Device Drivers
749#
750# CONFIG_INPUT_KEYBOARD is not set
751# CONFIG_INPUT_MOUSE is not set
752# CONFIG_INPUT_JOYSTICK is not set
753# CONFIG_INPUT_TABLET is not set
754# CONFIG_INPUT_TOUCHSCREEN is not set
755# CONFIG_INPUT_MISC is not set
756
757#
758# Hardware I/O ports
759#
760# CONFIG_SERIO is not set
761# CONFIG_GAMEPORT is not set
762
763#
764# Character devices
765#
766# CONFIG_VT is not set
767CONFIG_DEVKMEM=y
768# CONFIG_SERIAL_NONSTANDARD is not set
769# CONFIG_NOZOMI is not set
770
771#
772# Serial drivers
773#
774CONFIG_SERIAL_8250=y
775CONFIG_SERIAL_8250_CONSOLE=y
776# CONFIG_SERIAL_8250_PCI is not set
777CONFIG_SERIAL_8250_NR_UARTS=4
778CONFIG_SERIAL_8250_RUNTIME_UARTS=2
779# CONFIG_SERIAL_8250_EXTENDED is not set
780
781#
782# Non-8250 serial port support
783#
784CONFIG_SERIAL_CORE=y
785CONFIG_SERIAL_CORE_CONSOLE=y
786# CONFIG_SERIAL_JSM is not set
787CONFIG_UNIX98_PTYS=y
788CONFIG_LEGACY_PTYS=y
789CONFIG_LEGACY_PTY_COUNT=16
790# CONFIG_IPMI_HANDLER is not set
791# CONFIG_HW_RANDOM is not set
792# CONFIG_NVRAM is not set
793# CONFIG_R3964 is not set
794# CONFIG_APPLICOM is not set
795# CONFIG_RAW_DRIVER is not set
796# CONFIG_TCG_TPM is not set
797CONFIG_DEVPORT=y
798CONFIG_I2C=y
799CONFIG_I2C_BOARDINFO=y
800CONFIG_I2C_CHARDEV=y
801
802#
803# I2C Hardware Bus support
804#
805# CONFIG_I2C_ALI1535 is not set
806# CONFIG_I2C_ALI1563 is not set
807# CONFIG_I2C_ALI15X3 is not set
808# CONFIG_I2C_AMD756 is not set
809# CONFIG_I2C_AMD8111 is not set
810# CONFIG_I2C_I801 is not set
811# CONFIG_I2C_I810 is not set
812# CONFIG_I2C_PIIX4 is not set
813# CONFIG_I2C_NFORCE2 is not set
814# CONFIG_I2C_OCORES is not set
815# CONFIG_I2C_PARPORT_LIGHT is not set
816# CONFIG_I2C_PROSAVAGE is not set
817# CONFIG_I2C_SAVAGE4 is not set
818# CONFIG_I2C_SIMTEC is not set
819# CONFIG_I2C_SIS5595 is not set
820# CONFIG_I2C_SIS630 is not set
821# CONFIG_I2C_SIS96X is not set
822# CONFIG_I2C_TAOS_EVM is not set
823# CONFIG_I2C_STUB is not set
824# CONFIG_I2C_TINY_USB is not set
825# CONFIG_I2C_VIA is not set
826# CONFIG_I2C_VIAPRO is not set
827# CONFIG_I2C_VOODOO3 is not set
828# CONFIG_I2C_PCA_PLATFORM is not set
829CONFIG_I2C_MV64XXX=y
830
831#
832# Miscellaneous I2C Chip support
833#
834# CONFIG_DS1682 is not set
835# CONFIG_SENSORS_EEPROM is not set
836# CONFIG_SENSORS_PCF8574 is not set
837# CONFIG_PCF8575 is not set
838# CONFIG_SENSORS_PCF8591 is not set
839# CONFIG_SENSORS_MAX6875 is not set
840# CONFIG_SENSORS_TSL2550 is not set
841# CONFIG_I2C_DEBUG_CORE is not set
842# CONFIG_I2C_DEBUG_ALGO is not set
843# CONFIG_I2C_DEBUG_BUS is not set
844# CONFIG_I2C_DEBUG_CHIP is not set
845# CONFIG_SPI is not set
846# CONFIG_W1 is not set
847# CONFIG_POWER_SUPPLY is not set
848CONFIG_HWMON=y
849# CONFIG_HWMON_VID is not set
850# CONFIG_SENSORS_AD7418 is not set
851# CONFIG_SENSORS_ADM1021 is not set
852# CONFIG_SENSORS_ADM1025 is not set
853# CONFIG_SENSORS_ADM1026 is not set
854# CONFIG_SENSORS_ADM1029 is not set
855# CONFIG_SENSORS_ADM1031 is not set
856# CONFIG_SENSORS_ADM9240 is not set
857# CONFIG_SENSORS_ADT7470 is not set
858# CONFIG_SENSORS_ADT7473 is not set
859# CONFIG_SENSORS_ATXP1 is not set
860# CONFIG_SENSORS_DS1621 is not set
861# CONFIG_SENSORS_I5K_AMB is not set
862# CONFIG_SENSORS_F71805F is not set
863# CONFIG_SENSORS_F71882FG is not set
864# CONFIG_SENSORS_F75375S is not set
865# CONFIG_SENSORS_GL518SM is not set
866# CONFIG_SENSORS_GL520SM is not set
867# CONFIG_SENSORS_IT87 is not set
868# CONFIG_SENSORS_LM63 is not set
869# CONFIG_SENSORS_LM75 is not set
870# CONFIG_SENSORS_LM77 is not set
871# CONFIG_SENSORS_LM78 is not set
872# CONFIG_SENSORS_LM80 is not set
873# CONFIG_SENSORS_LM83 is not set
874# CONFIG_SENSORS_LM85 is not set
875# CONFIG_SENSORS_LM87 is not set
876# CONFIG_SENSORS_LM90 is not set
877# CONFIG_SENSORS_LM92 is not set
878# CONFIG_SENSORS_LM93 is not set
879# CONFIG_SENSORS_MAX1619 is not set
880# CONFIG_SENSORS_MAX6650 is not set
881# CONFIG_SENSORS_PC87360 is not set
882# CONFIG_SENSORS_PC87427 is not set
883# CONFIG_SENSORS_SIS5595 is not set
884# CONFIG_SENSORS_DME1737 is not set
885# CONFIG_SENSORS_SMSC47M1 is not set
886# CONFIG_SENSORS_SMSC47M192 is not set
887# CONFIG_SENSORS_SMSC47B397 is not set
888# CONFIG_SENSORS_ADS7828 is not set
889# CONFIG_SENSORS_THMC50 is not set
890# CONFIG_SENSORS_VIA686A is not set
891# CONFIG_SENSORS_VT1211 is not set
892# CONFIG_SENSORS_VT8231 is not set
893# CONFIG_SENSORS_W83781D is not set
894# CONFIG_SENSORS_W83791D is not set
895# CONFIG_SENSORS_W83792D is not set
896# CONFIG_SENSORS_W83793 is not set
897# CONFIG_SENSORS_W83L785TS is not set
898# CONFIG_SENSORS_W83L786NG is not set
899# CONFIG_SENSORS_W83627HF is not set
900# CONFIG_SENSORS_W83627EHF is not set
901# CONFIG_HWMON_DEBUG_CHIP is not set
902# CONFIG_WATCHDOG is not set
903
904#
905# Sonics Silicon Backplane
906#
907CONFIG_SSB_POSSIBLE=y
908# CONFIG_SSB is not set
909
910#
911# Multifunction device drivers
912#
913# CONFIG_MFD_SM501 is not set
914# CONFIG_MFD_ASIC3 is not set
915# CONFIG_HTC_PASIC3 is not set
916
917#
918# Multimedia devices
919#
920
921#
922# Multimedia core support
923#
924# CONFIG_VIDEO_DEV is not set
925# CONFIG_DVB_CORE is not set
926# CONFIG_VIDEO_MEDIA is not set
927
928#
929# Multimedia drivers
930#
931# CONFIG_DAB is not set
932
933#
934# Graphics support
935#
936# CONFIG_DRM is not set
937# CONFIG_VGASTATE is not set
938# CONFIG_VIDEO_OUTPUT_CONTROL is not set
939# CONFIG_FB is not set
940# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
941
942#
943# Display device support
944#
945# CONFIG_DISPLAY_SUPPORT is not set
946
947#
948# Sound
949#
950# CONFIG_SOUND is not set
951CONFIG_HID_SUPPORT=y
952CONFIG_HID=y
953# CONFIG_HID_DEBUG is not set
954# CONFIG_HIDRAW is not set
955
956#
957# USB Input Devices
958#
959CONFIG_USB_HID=y
960# CONFIG_USB_HIDINPUT_POWERBOOK is not set
961# CONFIG_HID_FF is not set
962# CONFIG_USB_HIDDEV is not set
963CONFIG_USB_SUPPORT=y
964CONFIG_USB_ARCH_HAS_HCD=y
965CONFIG_USB_ARCH_HAS_OHCI=y
966CONFIG_USB_ARCH_HAS_EHCI=y
967CONFIG_USB=y
968# CONFIG_USB_DEBUG is not set
969# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
970
971#
972# Miscellaneous USB options
973#
974CONFIG_USB_DEVICEFS=y
975CONFIG_USB_DEVICE_CLASS=y
976# CONFIG_USB_DYNAMIC_MINORS is not set
977# CONFIG_USB_OTG is not set
978# CONFIG_USB_OTG_WHITELIST is not set
979# CONFIG_USB_OTG_BLACKLIST_HUB is not set
980
981#
982# USB Host Controller Drivers
983#
984# CONFIG_USB_C67X00_HCD is not set
985CONFIG_USB_EHCI_HCD=y
986CONFIG_USB_EHCI_ROOT_HUB_TT=y
987CONFIG_USB_EHCI_TT_NEWSCHED=y
988# CONFIG_USB_ISP116X_HCD is not set
989# CONFIG_USB_ISP1760_HCD is not set
990# CONFIG_USB_OHCI_HCD is not set
991# CONFIG_USB_UHCI_HCD is not set
992# CONFIG_USB_SL811_HCD is not set
993# CONFIG_USB_R8A66597_HCD is not set
994
995#
996# USB Device Class drivers
997#
998# CONFIG_USB_ACM is not set
999CONFIG_USB_PRINTER=y
1000# CONFIG_USB_WDM is not set
1001
1002#
1003# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1004#
1005
1006#
1007# may also be needed; see USB_STORAGE Help for more information
1008#
1009CONFIG_USB_STORAGE=y
1010# CONFIG_USB_STORAGE_DEBUG is not set
1011CONFIG_USB_STORAGE_DATAFAB=y
1012CONFIG_USB_STORAGE_FREECOM=y
1013# CONFIG_USB_STORAGE_ISD200 is not set
1014CONFIG_USB_STORAGE_DPCM=y
1015# CONFIG_USB_STORAGE_USBAT is not set
1016CONFIG_USB_STORAGE_SDDR09=y
1017CONFIG_USB_STORAGE_SDDR55=y
1018CONFIG_USB_STORAGE_JUMPSHOT=y
1019# CONFIG_USB_STORAGE_ALAUDA is not set
1020# CONFIG_USB_STORAGE_ONETOUCH is not set
1021# CONFIG_USB_STORAGE_KARMA is not set
1022# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1023# CONFIG_USB_LIBUSUAL is not set
1024
1025#
1026# USB Imaging devices
1027#
1028# CONFIG_USB_MDC800 is not set
1029# CONFIG_USB_MICROTEK is not set
1030# CONFIG_USB_MON is not set
1031
1032#
1033# USB port drivers
1034#
1035# CONFIG_USB_SERIAL is not set
1036
1037#
1038# USB Miscellaneous drivers
1039#
1040# CONFIG_USB_EMI62 is not set
1041# CONFIG_USB_EMI26 is not set
1042# CONFIG_USB_ADUTUX is not set
1043# CONFIG_USB_AUERSWALD is not set
1044# CONFIG_USB_RIO500 is not set
1045# CONFIG_USB_LEGOTOWER is not set
1046# CONFIG_USB_LCD is not set
1047# CONFIG_USB_BERRY_CHARGE is not set
1048# CONFIG_USB_LED is not set
1049# CONFIG_USB_CYPRESS_CY7C63 is not set
1050# CONFIG_USB_CYTHERM is not set
1051# CONFIG_USB_PHIDGET is not set
1052# CONFIG_USB_IDMOUSE is not set
1053# CONFIG_USB_FTDI_ELAN is not set
1054# CONFIG_USB_APPLEDISPLAY is not set
1055# CONFIG_USB_SISUSBVGA is not set
1056# CONFIG_USB_LD is not set
1057# CONFIG_USB_TRANCEVIBRATOR is not set
1058# CONFIG_USB_IOWARRIOR is not set
1059# CONFIG_USB_TEST is not set
1060# CONFIG_USB_ISIGHTFW is not set
1061# CONFIG_USB_GADGET is not set
1062# CONFIG_MMC is not set
1063CONFIG_NEW_LEDS=y
1064CONFIG_LEDS_CLASS=y
1065
1066#
1067# LED drivers
1068#
1069
1070#
1071# LED Triggers
1072#
1073CONFIG_LEDS_TRIGGERS=y
1074CONFIG_LEDS_TRIGGER_TIMER=y
1075CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1076# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
1077CONFIG_RTC_LIB=y
1078CONFIG_RTC_CLASS=y
1079CONFIG_RTC_HCTOSYS=y
1080CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1081# CONFIG_RTC_DEBUG is not set
1082
1083#
1084# RTC interfaces
1085#
1086CONFIG_RTC_INTF_SYSFS=y
1087CONFIG_RTC_INTF_PROC=y
1088CONFIG_RTC_INTF_DEV=y
1089# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1090# CONFIG_RTC_DRV_TEST is not set
1091
1092#
1093# I2C RTC drivers
1094#
1095CONFIG_RTC_DRV_DS1307=y
1096# CONFIG_RTC_DRV_DS1374 is not set
1097# CONFIG_RTC_DRV_DS1672 is not set
1098# CONFIG_RTC_DRV_MAX6900 is not set
1099CONFIG_RTC_DRV_RS5C372=y
1100# CONFIG_RTC_DRV_ISL1208 is not set
1101# CONFIG_RTC_DRV_X1205 is not set
1102# CONFIG_RTC_DRV_PCF8563 is not set
1103# CONFIG_RTC_DRV_PCF8583 is not set
1104CONFIG_RTC_DRV_M41T80=y
1105# CONFIG_RTC_DRV_M41T80_WDT is not set
1106# CONFIG_RTC_DRV_S35390A is not set
1107
1108#
1109# SPI RTC drivers
1110#
1111
1112#
1113# Platform RTC drivers
1114#
1115# CONFIG_RTC_DRV_CMOS is not set
1116# CONFIG_RTC_DRV_DS1511 is not set
1117# CONFIG_RTC_DRV_DS1553 is not set
1118# CONFIG_RTC_DRV_DS1742 is not set
1119# CONFIG_RTC_DRV_STK17TA8 is not set
1120# CONFIG_RTC_DRV_M48T86 is not set
1121# CONFIG_RTC_DRV_M48T59 is not set
1122# CONFIG_RTC_DRV_V3020 is not set
1123
1124#
1125# on-CPU RTC drivers
1126#
1127# CONFIG_UIO is not set
1128
1129#
1130# File systems
1131#
1132CONFIG_EXT2_FS=y
1133# CONFIG_EXT2_FS_XATTR is not set
1134# CONFIG_EXT2_FS_XIP is not set
1135CONFIG_EXT3_FS=y
1136# CONFIG_EXT3_FS_XATTR is not set
1137# CONFIG_EXT4DEV_FS is not set
1138CONFIG_JBD=y
1139# CONFIG_REISERFS_FS is not set
1140# CONFIG_JFS_FS is not set
1141# CONFIG_FS_POSIX_ACL is not set
1142# CONFIG_XFS_FS is not set
1143# CONFIG_OCFS2_FS is not set
1144CONFIG_DNOTIFY=y
1145CONFIG_INOTIFY=y
1146CONFIG_INOTIFY_USER=y
1147# CONFIG_QUOTA is not set
1148# CONFIG_AUTOFS_FS is not set
1149# CONFIG_AUTOFS4_FS is not set
1150# CONFIG_FUSE_FS is not set
1151
1152#
1153# CD-ROM/DVD Filesystems
1154#
1155CONFIG_ISO9660_FS=m
1156CONFIG_JOLIET=y
1157# CONFIG_ZISOFS is not set
1158CONFIG_UDF_FS=m
1159CONFIG_UDF_NLS=y
1160
1161#
1162# DOS/FAT/NT Filesystems
1163#
1164CONFIG_FAT_FS=y
1165CONFIG_MSDOS_FS=y
1166CONFIG_VFAT_FS=y
1167CONFIG_FAT_DEFAULT_CODEPAGE=437
1168CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1169# CONFIG_NTFS_FS is not set
1170
1171#
1172# Pseudo filesystems
1173#
1174CONFIG_PROC_FS=y
1175CONFIG_PROC_SYSCTL=y
1176CONFIG_SYSFS=y
1177CONFIG_TMPFS=y
1178# CONFIG_TMPFS_POSIX_ACL is not set
1179# CONFIG_HUGETLB_PAGE is not set
1180# CONFIG_CONFIGFS_FS is not set
1181
1182#
1183# Miscellaneous filesystems
1184#
1185# CONFIG_ADFS_FS is not set
1186# CONFIG_AFFS_FS is not set
1187# CONFIG_HFS_FS is not set
1188# CONFIG_HFSPLUS_FS is not set
1189# CONFIG_BEFS_FS is not set
1190# CONFIG_BFS_FS is not set
1191# CONFIG_EFS_FS is not set
1192CONFIG_JFFS2_FS=y
1193CONFIG_JFFS2_FS_DEBUG=0
1194CONFIG_JFFS2_FS_WRITEBUFFER=y
1195# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1196# CONFIG_JFFS2_SUMMARY is not set
1197# CONFIG_JFFS2_FS_XATTR is not set
1198# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1199CONFIG_JFFS2_ZLIB=y
1200# CONFIG_JFFS2_LZO is not set
1201CONFIG_JFFS2_RTIME=y
1202# CONFIG_JFFS2_RUBIN is not set
1203CONFIG_CRAMFS=y
1204# CONFIG_VXFS_FS is not set
1205# CONFIG_MINIX_FS is not set
1206# CONFIG_HPFS_FS is not set
1207# CONFIG_QNX4FS_FS is not set
1208# CONFIG_ROMFS_FS is not set
1209# CONFIG_SYSV_FS is not set
1210# CONFIG_UFS_FS is not set
1211CONFIG_NETWORK_FILESYSTEMS=y
1212CONFIG_NFS_FS=y
1213CONFIG_NFS_V3=y
1214# CONFIG_NFS_V3_ACL is not set
1215# CONFIG_NFS_V4 is not set
1216# CONFIG_NFSD is not set
1217CONFIG_ROOT_NFS=y
1218CONFIG_LOCKD=y
1219CONFIG_LOCKD_V4=y
1220CONFIG_NFS_COMMON=y
1221CONFIG_SUNRPC=y
1222# CONFIG_SUNRPC_BIND34 is not set
1223# CONFIG_RPCSEC_GSS_KRB5 is not set
1224# CONFIG_RPCSEC_GSS_SPKM3 is not set
1225# CONFIG_SMB_FS is not set
1226# CONFIG_CIFS is not set
1227# CONFIG_NCP_FS is not set
1228# CONFIG_CODA_FS is not set
1229# CONFIG_AFS_FS is not set
1230
1231#
1232# Partition Types
1233#
1234CONFIG_PARTITION_ADVANCED=y
1235# CONFIG_ACORN_PARTITION is not set
1236# CONFIG_OSF_PARTITION is not set
1237# CONFIG_AMIGA_PARTITION is not set
1238# CONFIG_ATARI_PARTITION is not set
1239# CONFIG_MAC_PARTITION is not set
1240CONFIG_MSDOS_PARTITION=y
1241CONFIG_BSD_DISKLABEL=y
1242# CONFIG_MINIX_SUBPARTITION is not set
1243# CONFIG_SOLARIS_X86_PARTITION is not set
1244# CONFIG_UNIXWARE_DISKLABEL is not set
1245# CONFIG_LDM_PARTITION is not set
1246# CONFIG_SGI_PARTITION is not set
1247# CONFIG_ULTRIX_PARTITION is not set
1248# CONFIG_SUN_PARTITION is not set
1249# CONFIG_KARMA_PARTITION is not set
1250# CONFIG_EFI_PARTITION is not set
1251# CONFIG_SYSV68_PARTITION is not set
1252CONFIG_NLS=y
1253CONFIG_NLS_DEFAULT="iso8859-1"
1254CONFIG_NLS_CODEPAGE_437=y
1255# CONFIG_NLS_CODEPAGE_737 is not set
1256# CONFIG_NLS_CODEPAGE_775 is not set
1257CONFIG_NLS_CODEPAGE_850=y
1258# CONFIG_NLS_CODEPAGE_852 is not set
1259# CONFIG_NLS_CODEPAGE_855 is not set
1260# CONFIG_NLS_CODEPAGE_857 is not set
1261# CONFIG_NLS_CODEPAGE_860 is not set
1262# CONFIG_NLS_CODEPAGE_861 is not set
1263# CONFIG_NLS_CODEPAGE_862 is not set
1264# CONFIG_NLS_CODEPAGE_863 is not set
1265# CONFIG_NLS_CODEPAGE_864 is not set
1266# CONFIG_NLS_CODEPAGE_865 is not set
1267# CONFIG_NLS_CODEPAGE_866 is not set
1268# CONFIG_NLS_CODEPAGE_869 is not set
1269# CONFIG_NLS_CODEPAGE_936 is not set
1270# CONFIG_NLS_CODEPAGE_950 is not set
1271# CONFIG_NLS_CODEPAGE_932 is not set
1272# CONFIG_NLS_CODEPAGE_949 is not set
1273# CONFIG_NLS_CODEPAGE_874 is not set
1274# CONFIG_NLS_ISO8859_8 is not set
1275# CONFIG_NLS_CODEPAGE_1250 is not set
1276# CONFIG_NLS_CODEPAGE_1251 is not set
1277# CONFIG_NLS_ASCII is not set
1278CONFIG_NLS_ISO8859_1=y
1279CONFIG_NLS_ISO8859_2=y
1280# CONFIG_NLS_ISO8859_3 is not set
1281# CONFIG_NLS_ISO8859_4 is not set
1282# CONFIG_NLS_ISO8859_5 is not set
1283# CONFIG_NLS_ISO8859_6 is not set
1284# CONFIG_NLS_ISO8859_7 is not set
1285# CONFIG_NLS_ISO8859_9 is not set
1286# CONFIG_NLS_ISO8859_13 is not set
1287# CONFIG_NLS_ISO8859_14 is not set
1288# CONFIG_NLS_ISO8859_15 is not set
1289# CONFIG_NLS_KOI8_R is not set
1290# CONFIG_NLS_KOI8_U is not set
1291# CONFIG_NLS_UTF8 is not set
1292# CONFIG_DLM is not set
1293
1294#
1295# Kernel hacking
1296#
1297# CONFIG_PRINTK_TIME is not set
1298CONFIG_ENABLE_WARN_DEPRECATED=y
1299CONFIG_ENABLE_MUST_CHECK=y
1300CONFIG_FRAME_WARN=1024
1301CONFIG_MAGIC_SYSRQ=y
1302# CONFIG_UNUSED_SYMBOLS is not set
1303# CONFIG_DEBUG_FS is not set
1304# CONFIG_HEADERS_CHECK is not set
1305CONFIG_DEBUG_KERNEL=y
1306# CONFIG_DEBUG_SHIRQ is not set
1307CONFIG_DETECT_SOFTLOCKUP=y
1308CONFIG_SCHED_DEBUG=y
1309CONFIG_SCHEDSTATS=y
1310# CONFIG_TIMER_STATS is not set
1311# CONFIG_DEBUG_OBJECTS is not set
1312CONFIG_DEBUG_PREEMPT=y
1313# CONFIG_DEBUG_RT_MUTEXES is not set
1314# CONFIG_RT_MUTEX_TESTER is not set
1315# CONFIG_DEBUG_SPINLOCK is not set
1316# CONFIG_DEBUG_MUTEXES is not set
1317# CONFIG_DEBUG_LOCK_ALLOC is not set
1318# CONFIG_PROVE_LOCKING is not set
1319# CONFIG_LOCK_STAT is not set
1320# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1321# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1322# CONFIG_DEBUG_KOBJECT is not set
1323# CONFIG_DEBUG_BUGVERBOSE is not set
1324CONFIG_DEBUG_INFO=y
1325# CONFIG_DEBUG_VM is not set
1326# CONFIG_DEBUG_WRITECOUNT is not set
1327# CONFIG_DEBUG_LIST is not set
1328# CONFIG_DEBUG_SG is not set
1329CONFIG_FRAME_POINTER=y
1330# CONFIG_BOOT_PRINTK_DELAY is not set
1331# CONFIG_RCU_TORTURE_TEST is not set
1332# CONFIG_KPROBES_SANITY_TEST is not set
1333# CONFIG_BACKTRACE_SELF_TEST is not set
1334# CONFIG_LKDTM is not set
1335# CONFIG_FAULT_INJECTION is not set
1336# CONFIG_LATENCYTOP is not set
1337# CONFIG_SAMPLES is not set
1338CONFIG_DEBUG_USER=y
1339CONFIG_DEBUG_ERRORS=y
1340# CONFIG_DEBUG_STACK_USAGE is not set
1341CONFIG_DEBUG_LL=y
1342# CONFIG_DEBUG_ICEDCC is not set
1343
1344#
1345# Security options
1346#
1347# CONFIG_KEYS is not set
1348# CONFIG_SECURITY is not set
1349# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1350CONFIG_CRYPTO=y
1351
1352#
1353# Crypto core or helper
1354#
1355CONFIG_CRYPTO_ALGAPI=m
1356CONFIG_CRYPTO_BLKCIPHER=m
1357CONFIG_CRYPTO_MANAGER=m
1358# CONFIG_CRYPTO_GF128MUL is not set
1359# CONFIG_CRYPTO_NULL is not set
1360# CONFIG_CRYPTO_CRYPTD is not set
1361# CONFIG_CRYPTO_AUTHENC is not set
1362# CONFIG_CRYPTO_TEST is not set
1363
1364#
1365# Authenticated Encryption with Associated Data
1366#
1367# CONFIG_CRYPTO_CCM is not set
1368# CONFIG_CRYPTO_GCM is not set
1369# CONFIG_CRYPTO_SEQIV is not set
1370
1371#
1372# Block modes
1373#
1374CONFIG_CRYPTO_CBC=m
1375# CONFIG_CRYPTO_CTR is not set
1376# CONFIG_CRYPTO_CTS is not set
1377CONFIG_CRYPTO_ECB=m
1378# CONFIG_CRYPTO_LRW is not set
1379CONFIG_CRYPTO_PCBC=m
1380# CONFIG_CRYPTO_XTS is not set
1381
1382#
1383# Hash modes
1384#
1385# CONFIG_CRYPTO_HMAC is not set
1386# CONFIG_CRYPTO_XCBC is not set
1387
1388#
1389# Digest
1390#
1391# CONFIG_CRYPTO_CRC32C is not set
1392# CONFIG_CRYPTO_MD4 is not set
1393# CONFIG_CRYPTO_MD5 is not set
1394# CONFIG_CRYPTO_MICHAEL_MIC is not set
1395# CONFIG_CRYPTO_SHA1 is not set
1396# CONFIG_CRYPTO_SHA256 is not set
1397# CONFIG_CRYPTO_SHA512 is not set
1398# CONFIG_CRYPTO_TGR192 is not set
1399# CONFIG_CRYPTO_WP512 is not set
1400
1401#
1402# Ciphers
1403#
1404# CONFIG_CRYPTO_AES is not set
1405# CONFIG_CRYPTO_ANUBIS is not set
1406# CONFIG_CRYPTO_ARC4 is not set
1407# CONFIG_CRYPTO_BLOWFISH is not set
1408# CONFIG_CRYPTO_CAMELLIA is not set
1409# CONFIG_CRYPTO_CAST5 is not set
1410# CONFIG_CRYPTO_CAST6 is not set
1411# CONFIG_CRYPTO_DES is not set
1412# CONFIG_CRYPTO_FCRYPT is not set
1413# CONFIG_CRYPTO_KHAZAD is not set
1414# CONFIG_CRYPTO_SALSA20 is not set
1415# CONFIG_CRYPTO_SEED is not set
1416# CONFIG_CRYPTO_SERPENT is not set
1417# CONFIG_CRYPTO_TEA is not set
1418# CONFIG_CRYPTO_TWOFISH is not set
1419
1420#
1421# Compression
1422#
1423# CONFIG_CRYPTO_DEFLATE is not set
1424# CONFIG_CRYPTO_LZO is not set
1425CONFIG_CRYPTO_HW=y
1426# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1427
1428#
1429# Library routines
1430#
1431CONFIG_BITREVERSE=y
1432# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1433# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1434# CONFIG_CRC_CCITT is not set
1435# CONFIG_CRC16 is not set
1436CONFIG_CRC_ITU_T=m
1437CONFIG_CRC32=y
1438# CONFIG_CRC7 is not set
1439# CONFIG_LIBCRC32C is not set
1440CONFIG_ZLIB_INFLATE=y
1441CONFIG_ZLIB_DEFLATE=y
1442CONFIG_PLIST=y
1443CONFIG_HAS_IOMEM=y
1444CONFIG_HAS_IOPORT=y
1445CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/mx31ads_defconfig b/arch/arm/configs/mx31ads_defconfig
new file mode 100644
index 000000000000..e05271753e15
--- /dev/null
+++ b/arch/arm/configs/mx31ads_defconfig
@@ -0,0 +1,839 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc6
4# Fri Jun 20 16:21:11 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_ZONE_DMA=y
26CONFIG_ARCH_MTD_XIP=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46CONFIG_IKCONFIG=y
47CONFIG_IKCONFIG_PROC=y
48CONFIG_LOG_BUF_SHIFT=14
49# CONFIG_CGROUPS is not set
50CONFIG_GROUP_SCHED=y
51CONFIG_FAIR_GROUP_SCHED=y
52# CONFIG_RT_GROUP_SCHED is not set
53CONFIG_USER_SCHED=y
54# CONFIG_CGROUP_SCHED is not set
55CONFIG_SYSFS_DEPRECATED=y
56CONFIG_SYSFS_DEPRECATED_V2=y
57# CONFIG_RELAY is not set
58# CONFIG_NAMESPACES is not set
59# CONFIG_BLK_DEV_INITRD is not set
60CONFIG_CC_OPTIMIZE_FOR_SIZE=y
61CONFIG_SYSCTL=y
62CONFIG_EMBEDDED=y
63CONFIG_UID16=y
64CONFIG_SYSCTL_SYSCALL=y
65CONFIG_SYSCTL_SYSCALL_CHECK=y
66CONFIG_KALLSYMS=y
67# CONFIG_KALLSYMS_EXTRA_PASS is not set
68CONFIG_HOTPLUG=y
69CONFIG_PRINTK=y
70CONFIG_BUG=y
71CONFIG_ELF_CORE=y
72CONFIG_COMPAT_BRK=y
73CONFIG_BASE_FULL=y
74CONFIG_FUTEX=y
75CONFIG_ANON_INODES=y
76CONFIG_EPOLL=y
77CONFIG_SIGNALFD=y
78CONFIG_TIMERFD=y
79CONFIG_EVENTFD=y
80CONFIG_SHMEM=y
81CONFIG_VM_EVENT_COUNTERS=y
82CONFIG_SLAB=y
83# CONFIG_SLUB is not set
84# CONFIG_SLOB is not set
85# CONFIG_PROFILING is not set
86# CONFIG_MARKERS is not set
87CONFIG_HAVE_OPROFILE=y
88# CONFIG_KPROBES is not set
89CONFIG_HAVE_KPROBES=y
90CONFIG_HAVE_KRETPROBES=y
91# CONFIG_HAVE_DMA_ATTRS is not set
92CONFIG_PROC_PAGE_MONITOR=y
93CONFIG_SLABINFO=y
94CONFIG_RT_MUTEXES=y
95# CONFIG_TINY_SHMEM is not set
96CONFIG_BASE_SMALL=0
97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
99CONFIG_MODULE_UNLOAD=y
100CONFIG_MODULE_FORCE_UNLOAD=y
101CONFIG_MODVERSIONS=y
102# CONFIG_MODULE_SRCVERSION_ALL is not set
103CONFIG_KMOD=y
104CONFIG_BLOCK=y
105# CONFIG_LBD is not set
106# CONFIG_BLK_DEV_IO_TRACE is not set
107# CONFIG_LSF is not set
108# CONFIG_BLK_DEV_BSG is not set
109
110#
111# IO Schedulers
112#
113CONFIG_IOSCHED_NOOP=y
114CONFIG_IOSCHED_AS=y
115CONFIG_IOSCHED_DEADLINE=y
116CONFIG_IOSCHED_CFQ=y
117# CONFIG_DEFAULT_AS is not set
118# CONFIG_DEFAULT_DEADLINE is not set
119CONFIG_DEFAULT_CFQ=y
120# CONFIG_DEFAULT_NOOP is not set
121CONFIG_DEFAULT_IOSCHED="cfq"
122CONFIG_CLASSIC_RCU=y
123
124#
125# System Type
126#
127# CONFIG_ARCH_AAEC2000 is not set
128# CONFIG_ARCH_INTEGRATOR is not set
129# CONFIG_ARCH_REALVIEW is not set
130# CONFIG_ARCH_VERSATILE is not set
131# CONFIG_ARCH_AT91 is not set
132# CONFIG_ARCH_CLPS7500 is not set
133# CONFIG_ARCH_CLPS711X is not set
134# CONFIG_ARCH_CO285 is not set
135# CONFIG_ARCH_EBSA110 is not set
136# CONFIG_ARCH_EP93XX is not set
137# CONFIG_ARCH_FOOTBRIDGE is not set
138# CONFIG_ARCH_NETX is not set
139# CONFIG_ARCH_H720X is not set
140# CONFIG_ARCH_IMX is not set
141# CONFIG_ARCH_IOP13XX is not set
142# CONFIG_ARCH_IOP32X is not set
143# CONFIG_ARCH_IOP33X is not set
144# CONFIG_ARCH_IXP23XX is not set
145# CONFIG_ARCH_IXP2000 is not set
146# CONFIG_ARCH_IXP4XX is not set
147# CONFIG_ARCH_L7200 is not set
148# CONFIG_ARCH_KS8695 is not set
149# CONFIG_ARCH_NS9XXX is not set
150CONFIG_ARCH_MXC=y
151# CONFIG_ARCH_ORION5X is not set
152# CONFIG_ARCH_PNX4008 is not set
153# CONFIG_ARCH_PXA is not set
154# CONFIG_ARCH_RPC is not set
155# CONFIG_ARCH_SA1100 is not set
156# CONFIG_ARCH_S3C2410 is not set
157# CONFIG_ARCH_SHARK is not set
158# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set
160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
162
163#
164# Boot options
165#
166
167#
168# Power management
169#
170
171#
172# Freescale MXC Implementations
173#
174# CONFIG_ARCH_MX2 is not set
175CONFIG_ARCH_MX3=y
176
177#
178# MX3 Options
179#
180CONFIG_MACH_MX31ADS=y
181# CONFIG_MACH_PCM037 is not set
182
183#
184# Processor Type
185#
186CONFIG_CPU_32=y
187CONFIG_CPU_V6=y
188# CONFIG_CPU_32v6K is not set
189CONFIG_CPU_32v6=y
190CONFIG_CPU_ABRT_EV6=y
191CONFIG_CPU_PABRT_NOIFAR=y
192CONFIG_CPU_CACHE_V6=y
193CONFIG_CPU_CACHE_VIPT=y
194CONFIG_CPU_COPY_V6=y
195CONFIG_CPU_TLB_V6=y
196CONFIG_CPU_HAS_ASID=y
197CONFIG_CPU_CP15=y
198CONFIG_CPU_CP15_MMU=y
199
200#
201# Processor Features
202#
203CONFIG_ARM_THUMB=y
204# CONFIG_CPU_ICACHE_DISABLE is not set
205# CONFIG_CPU_DCACHE_DISABLE is not set
206# CONFIG_CPU_BPREDICT_DISABLE is not set
207# CONFIG_OUTER_CACHE is not set
208
209#
210# Bus support
211#
212# CONFIG_PCI_SYSCALL is not set
213# CONFIG_ARCH_SUPPORTS_MSI is not set
214# CONFIG_PCCARD is not set
215
216#
217# Kernel Features
218#
219CONFIG_TICK_ONESHOT=y
220CONFIG_NO_HZ=y
221CONFIG_HIGH_RES_TIMERS=y
222CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
223CONFIG_PREEMPT=y
224CONFIG_HZ=100
225CONFIG_AEABI=y
226# CONFIG_OABI_COMPAT is not set
227# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
228CONFIG_SELECT_MEMORY_MODEL=y
229CONFIG_FLATMEM_MANUAL=y
230# CONFIG_DISCONTIGMEM_MANUAL is not set
231# CONFIG_SPARSEMEM_MANUAL is not set
232CONFIG_FLATMEM=y
233CONFIG_FLAT_NODE_MEM_MAP=y
234# CONFIG_SPARSEMEM_STATIC is not set
235# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
236CONFIG_PAGEFLAGS_EXTENDED=y
237CONFIG_SPLIT_PTLOCK_CPUS=4
238# CONFIG_RESOURCES_64BIT is not set
239CONFIG_ZONE_DMA_FLAG=1
240CONFIG_BOUNCE=y
241CONFIG_VIRT_TO_BUS=y
242CONFIG_ALIGNMENT_TRAP=y
243
244#
245# Boot options
246#
247CONFIG_ZBOOT_ROM_TEXT=0x0
248CONFIG_ZBOOT_ROM_BSS=0x0
249CONFIG_CMDLINE="noinitrd console=ttymxc0,115200 root=/dev/mtdblock2 rw ip=off"
250# CONFIG_XIP_KERNEL is not set
251# CONFIG_KEXEC is not set
252
253#
254# Floating point emulation
255#
256
257#
258# At least one emulation must be selected
259#
260CONFIG_VFP=y
261
262#
263# Userspace binary formats
264#
265CONFIG_BINFMT_ELF=y
266# CONFIG_BINFMT_AOUT is not set
267# CONFIG_BINFMT_MISC is not set
268
269#
270# Power management options
271#
272# CONFIG_PM is not set
273CONFIG_ARCH_SUSPEND_POSSIBLE=y
274
275#
276# Networking
277#
278CONFIG_NET=y
279
280#
281# Networking options
282#
283CONFIG_PACKET=y
284# CONFIG_PACKET_MMAP is not set
285CONFIG_UNIX=y
286CONFIG_XFRM=y
287# CONFIG_XFRM_USER is not set
288# CONFIG_XFRM_SUB_POLICY is not set
289# CONFIG_XFRM_MIGRATE is not set
290# CONFIG_XFRM_STATISTICS is not set
291# CONFIG_NET_KEY is not set
292CONFIG_INET=y
293# CONFIG_IP_MULTICAST is not set
294# CONFIG_IP_ADVANCED_ROUTER is not set
295CONFIG_IP_FIB_HASH=y
296CONFIG_IP_PNP=y
297CONFIG_IP_PNP_DHCP=y
298# CONFIG_IP_PNP_BOOTP is not set
299# CONFIG_IP_PNP_RARP is not set
300# CONFIG_NET_IPIP is not set
301# CONFIG_NET_IPGRE is not set
302# CONFIG_ARPD is not set
303# CONFIG_SYN_COOKIES is not set
304# CONFIG_INET_AH is not set
305# CONFIG_INET_ESP is not set
306# CONFIG_INET_IPCOMP is not set
307# CONFIG_INET_XFRM_TUNNEL is not set
308# CONFIG_INET_TUNNEL is not set
309CONFIG_INET_XFRM_MODE_TRANSPORT=y
310CONFIG_INET_XFRM_MODE_TUNNEL=y
311CONFIG_INET_XFRM_MODE_BEET=y
312# CONFIG_INET_LRO is not set
313CONFIG_INET_DIAG=y
314CONFIG_INET_TCP_DIAG=y
315# CONFIG_TCP_CONG_ADVANCED is not set
316CONFIG_TCP_CONG_CUBIC=y
317CONFIG_DEFAULT_TCP_CONG="cubic"
318# CONFIG_TCP_MD5SIG is not set
319# CONFIG_IPV6 is not set
320# CONFIG_NETWORK_SECMARK is not set
321# CONFIG_NETFILTER is not set
322# CONFIG_IP_DCCP is not set
323# CONFIG_IP_SCTP is not set
324# CONFIG_TIPC is not set
325# CONFIG_ATM is not set
326# CONFIG_BRIDGE is not set
327# CONFIG_VLAN_8021Q is not set
328# CONFIG_DECNET is not set
329# CONFIG_LLC2 is not set
330# CONFIG_IPX is not set
331# CONFIG_ATALK is not set
332# CONFIG_X25 is not set
333# CONFIG_LAPB is not set
334# CONFIG_ECONET is not set
335# CONFIG_WAN_ROUTER is not set
336# CONFIG_NET_SCHED is not set
337
338#
339# Network testing
340#
341# CONFIG_NET_PKTGEN is not set
342# CONFIG_HAMRADIO is not set
343# CONFIG_CAN is not set
344# CONFIG_IRDA is not set
345# CONFIG_BT is not set
346# CONFIG_AF_RXRPC is not set
347
348#
349# Wireless
350#
351# CONFIG_CFG80211 is not set
352# CONFIG_WIRELESS_EXT is not set
353# CONFIG_MAC80211 is not set
354# CONFIG_IEEE80211 is not set
355# CONFIG_RFKILL is not set
356# CONFIG_NET_9P is not set
357
358#
359# Device Drivers
360#
361
362#
363# Generic Driver Options
364#
365CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
366CONFIG_STANDALONE=y
367CONFIG_PREVENT_FIRMWARE_BUILD=y
368CONFIG_FW_LOADER=m
369# CONFIG_SYS_HYPERVISOR is not set
370# CONFIG_CONNECTOR is not set
371CONFIG_MTD=y
372# CONFIG_MTD_DEBUG is not set
373# CONFIG_MTD_CONCAT is not set
374CONFIG_MTD_PARTITIONS=y
375CONFIG_MTD_REDBOOT_PARTS=y
376CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
377# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
378# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
379CONFIG_MTD_CMDLINE_PARTS=y
380# CONFIG_MTD_AFS_PARTS is not set
381# CONFIG_MTD_AR7_PARTS is not set
382
383#
384# User Modules And Translation Layers
385#
386CONFIG_MTD_CHAR=y
387CONFIG_MTD_BLKDEVS=y
388CONFIG_MTD_BLOCK=y
389# CONFIG_FTL is not set
390# CONFIG_NFTL is not set
391# CONFIG_INFTL is not set
392# CONFIG_RFD_FTL is not set
393# CONFIG_SSFDC is not set
394# CONFIG_MTD_OOPS is not set
395
396#
397# RAM/ROM/Flash chip drivers
398#
399CONFIG_MTD_CFI=y
400# CONFIG_MTD_JEDECPROBE is not set
401CONFIG_MTD_GEN_PROBE=y
402CONFIG_MTD_CFI_ADV_OPTIONS=y
403CONFIG_MTD_CFI_NOSWAP=y
404# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
405# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
406CONFIG_MTD_CFI_GEOMETRY=y
407# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
408CONFIG_MTD_MAP_BANK_WIDTH_2=y
409# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
410# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
411# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
412# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
413CONFIG_MTD_CFI_I1=y
414# CONFIG_MTD_CFI_I2 is not set
415# CONFIG_MTD_CFI_I4 is not set
416# CONFIG_MTD_CFI_I8 is not set
417# CONFIG_MTD_OTP is not set
418# CONFIG_MTD_CFI_INTELEXT is not set
419CONFIG_MTD_CFI_AMDSTD=y
420# CONFIG_MTD_CFI_STAA is not set
421CONFIG_MTD_CFI_UTIL=y
422CONFIG_MTD_RAM=y
423# CONFIG_MTD_ROM is not set
424# CONFIG_MTD_ABSENT is not set
425# CONFIG_MTD_XIP is not set
426
427#
428# Mapping drivers for chip access
429#
430# CONFIG_MTD_COMPLEX_MAPPINGS is not set
431# CONFIG_MTD_PHYSMAP is not set
432# CONFIG_MTD_ARM_INTEGRATOR is not set
433# CONFIG_MTD_PLATRAM is not set
434
435#
436# Self-contained MTD device drivers
437#
438# CONFIG_MTD_SLRAM is not set
439# CONFIG_MTD_PHRAM is not set
440# CONFIG_MTD_MTDRAM is not set
441# CONFIG_MTD_BLOCK2MTD is not set
442
443#
444# Disk-On-Chip Device Drivers
445#
446# CONFIG_MTD_DOC2000 is not set
447# CONFIG_MTD_DOC2001 is not set
448# CONFIG_MTD_DOC2001PLUS is not set
449CONFIG_MTD_NAND=y
450# CONFIG_MTD_NAND_VERIFY_WRITE is not set
451# CONFIG_MTD_NAND_ECC_SMC is not set
452# CONFIG_MTD_NAND_MUSEUM_IDS is not set
453CONFIG_MTD_NAND_IDS=y
454# CONFIG_MTD_NAND_DISKONCHIP is not set
455# CONFIG_MTD_NAND_NANDSIM is not set
456# CONFIG_MTD_NAND_PLATFORM is not set
457# CONFIG_MTD_ONENAND is not set
458
459#
460# UBI - Unsorted block images
461#
462# CONFIG_MTD_UBI is not set
463# CONFIG_PARPORT is not set
464# CONFIG_BLK_DEV is not set
465# CONFIG_MISC_DEVICES is not set
466CONFIG_HAVE_IDE=y
467# CONFIG_IDE is not set
468
469#
470# SCSI device support
471#
472# CONFIG_RAID_ATTRS is not set
473# CONFIG_SCSI is not set
474# CONFIG_SCSI_DMA is not set
475# CONFIG_SCSI_NETLINK is not set
476# CONFIG_ATA is not set
477# CONFIG_MD is not set
478CONFIG_NETDEVICES=y
479# CONFIG_NETDEVICES_MULTIQUEUE is not set
480# CONFIG_DUMMY is not set
481# CONFIG_BONDING is not set
482# CONFIG_MACVLAN is not set
483# CONFIG_EQUALIZER is not set
484# CONFIG_TUN is not set
485# CONFIG_VETH is not set
486# CONFIG_PHYLIB is not set
487CONFIG_NET_ETHERNET=y
488CONFIG_MII=y
489# CONFIG_AX88796 is not set
490# CONFIG_SMC91X is not set
491# CONFIG_DM9000 is not set
492# CONFIG_IBM_NEW_EMAC_ZMII is not set
493# CONFIG_IBM_NEW_EMAC_RGMII is not set
494# CONFIG_IBM_NEW_EMAC_TAH is not set
495# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
496# CONFIG_B44 is not set
497# CONFIG_NETDEV_1000 is not set
498# CONFIG_NETDEV_10000 is not set
499
500#
501# Wireless LAN
502#
503# CONFIG_WLAN_PRE80211 is not set
504# CONFIG_WLAN_80211 is not set
505# CONFIG_IWLWIFI_LEDS is not set
506# CONFIG_WAN is not set
507# CONFIG_PPP is not set
508# CONFIG_SLIP is not set
509# CONFIG_NETCONSOLE is not set
510# CONFIG_NETPOLL is not set
511# CONFIG_NET_POLL_CONTROLLER is not set
512# CONFIG_ISDN is not set
513
514#
515# Input device support
516#
517# CONFIG_INPUT is not set
518
519#
520# Hardware I/O ports
521#
522# CONFIG_SERIO is not set
523# CONFIG_GAMEPORT is not set
524
525#
526# Character devices
527#
528# CONFIG_VT is not set
529CONFIG_DEVKMEM=y
530# CONFIG_SERIAL_NONSTANDARD is not set
531
532#
533# Serial drivers
534#
535# CONFIG_SERIAL_8250 is not set
536
537#
538# Non-8250 serial port support
539#
540CONFIG_SERIAL_IMX=y
541CONFIG_SERIAL_IMX_CONSOLE=y
542CONFIG_SERIAL_CORE=y
543CONFIG_SERIAL_CORE_CONSOLE=y
544CONFIG_UNIX98_PTYS=y
545# CONFIG_LEGACY_PTYS is not set
546# CONFIG_IPMI_HANDLER is not set
547# CONFIG_HW_RANDOM is not set
548# CONFIG_NVRAM is not set
549# CONFIG_R3964 is not set
550# CONFIG_RAW_DRIVER is not set
551# CONFIG_TCG_TPM is not set
552# CONFIG_I2C is not set
553# CONFIG_SPI is not set
554CONFIG_HAVE_GPIO_LIB=y
555
556#
557# GPIO Support
558#
559
560#
561# I2C GPIO expanders:
562#
563
564#
565# SPI GPIO expanders:
566#
567# CONFIG_W1 is not set
568# CONFIG_POWER_SUPPLY is not set
569# CONFIG_HWMON is not set
570# CONFIG_WATCHDOG is not set
571
572#
573# Sonics Silicon Backplane
574#
575CONFIG_SSB_POSSIBLE=y
576# CONFIG_SSB is not set
577
578#
579# Multifunction device drivers
580#
581# CONFIG_MFD_SM501 is not set
582# CONFIG_MFD_ASIC3 is not set
583# CONFIG_HTC_EGPIO is not set
584# CONFIG_HTC_PASIC3 is not set
585
586#
587# Multimedia devices
588#
589
590#
591# Multimedia core support
592#
593# CONFIG_VIDEO_DEV is not set
594# CONFIG_DVB_CORE is not set
595# CONFIG_VIDEO_MEDIA is not set
596
597#
598# Multimedia drivers
599#
600# CONFIG_DAB is not set
601
602#
603# Graphics support
604#
605# CONFIG_VGASTATE is not set
606# CONFIG_VIDEO_OUTPUT_CONTROL is not set
607# CONFIG_FB is not set
608# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
609
610#
611# Display device support
612#
613# CONFIG_DISPLAY_SUPPORT is not set
614
615#
616# Sound
617#
618# CONFIG_SOUND is not set
619# CONFIG_USB_SUPPORT is not set
620# CONFIG_MMC is not set
621# CONFIG_NEW_LEDS is not set
622CONFIG_RTC_LIB=y
623# CONFIG_RTC_CLASS is not set
624# CONFIG_UIO is not set
625
626#
627# File systems
628#
629# CONFIG_EXT2_FS is not set
630# CONFIG_EXT3_FS is not set
631# CONFIG_EXT4DEV_FS is not set
632# CONFIG_REISERFS_FS is not set
633# CONFIG_JFS_FS is not set
634# CONFIG_FS_POSIX_ACL is not set
635# CONFIG_XFS_FS is not set
636# CONFIG_OCFS2_FS is not set
637# CONFIG_DNOTIFY is not set
638CONFIG_INOTIFY=y
639CONFIG_INOTIFY_USER=y
640# CONFIG_QUOTA is not set
641# CONFIG_AUTOFS_FS is not set
642# CONFIG_AUTOFS4_FS is not set
643# CONFIG_FUSE_FS is not set
644
645#
646# CD-ROM/DVD Filesystems
647#
648# CONFIG_ISO9660_FS is not set
649# CONFIG_UDF_FS is not set
650
651#
652# DOS/FAT/NT Filesystems
653#
654# CONFIG_MSDOS_FS is not set
655# CONFIG_VFAT_FS is not set
656# CONFIG_NTFS_FS is not set
657
658#
659# Pseudo filesystems
660#
661CONFIG_PROC_FS=y
662CONFIG_PROC_SYSCTL=y
663CONFIG_SYSFS=y
664CONFIG_TMPFS=y
665# CONFIG_TMPFS_POSIX_ACL is not set
666# CONFIG_HUGETLB_PAGE is not set
667# CONFIG_CONFIGFS_FS is not set
668
669#
670# Miscellaneous filesystems
671#
672# CONFIG_ADFS_FS is not set
673# CONFIG_AFFS_FS is not set
674# CONFIG_HFS_FS is not set
675# CONFIG_HFSPLUS_FS is not set
676# CONFIG_BEFS_FS is not set
677# CONFIG_BFS_FS is not set
678# CONFIG_EFS_FS is not set
679CONFIG_JFFS2_FS=y
680CONFIG_JFFS2_FS_DEBUG=0
681CONFIG_JFFS2_FS_WRITEBUFFER=y
682# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
683# CONFIG_JFFS2_SUMMARY is not set
684# CONFIG_JFFS2_FS_XATTR is not set
685# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
686CONFIG_JFFS2_ZLIB=y
687# CONFIG_JFFS2_LZO is not set
688CONFIG_JFFS2_RTIME=y
689# CONFIG_JFFS2_RUBIN is not set
690CONFIG_CRAMFS=y
691# CONFIG_VXFS_FS is not set
692# CONFIG_MINIX_FS is not set
693# CONFIG_HPFS_FS is not set
694# CONFIG_QNX4FS_FS is not set
695# CONFIG_ROMFS_FS is not set
696# CONFIG_SYSV_FS is not set
697# CONFIG_UFS_FS is not set
698CONFIG_NETWORK_FILESYSTEMS=y
699CONFIG_NFS_FS=y
700# CONFIG_NFS_V3 is not set
701# CONFIG_NFS_V4 is not set
702# CONFIG_NFSD is not set
703CONFIG_ROOT_NFS=y
704CONFIG_LOCKD=y
705CONFIG_NFS_COMMON=y
706CONFIG_SUNRPC=y
707# CONFIG_SUNRPC_BIND34 is not set
708# CONFIG_RPCSEC_GSS_KRB5 is not set
709# CONFIG_RPCSEC_GSS_SPKM3 is not set
710# CONFIG_SMB_FS is not set
711# CONFIG_CIFS is not set
712# CONFIG_NCP_FS is not set
713# CONFIG_CODA_FS is not set
714# CONFIG_AFS_FS is not set
715
716#
717# Partition Types
718#
719# CONFIG_PARTITION_ADVANCED is not set
720CONFIG_MSDOS_PARTITION=y
721# CONFIG_NLS is not set
722# CONFIG_DLM is not set
723
724#
725# Kernel hacking
726#
727CONFIG_PRINTK_TIME=y
728CONFIG_ENABLE_WARN_DEPRECATED=y
729CONFIG_ENABLE_MUST_CHECK=y
730CONFIG_FRAME_WARN=1024
731# CONFIG_MAGIC_SYSRQ is not set
732# CONFIG_UNUSED_SYMBOLS is not set
733# CONFIG_DEBUG_FS is not set
734# CONFIG_HEADERS_CHECK is not set
735# CONFIG_DEBUG_KERNEL is not set
736# CONFIG_DEBUG_BUGVERBOSE is not set
737CONFIG_FRAME_POINTER=y
738# CONFIG_SAMPLES is not set
739# CONFIG_DEBUG_USER is not set
740
741#
742# Security options
743#
744# CONFIG_KEYS is not set
745# CONFIG_SECURITY is not set
746# CONFIG_SECURITY_FILE_CAPABILITIES is not set
747CONFIG_CRYPTO=y
748
749#
750# Crypto core or helper
751#
752# CONFIG_CRYPTO_MANAGER is not set
753# CONFIG_CRYPTO_GF128MUL is not set
754# CONFIG_CRYPTO_NULL is not set
755# CONFIG_CRYPTO_CRYPTD is not set
756# CONFIG_CRYPTO_AUTHENC is not set
757# CONFIG_CRYPTO_TEST is not set
758
759#
760# Authenticated Encryption with Associated Data
761#
762# CONFIG_CRYPTO_CCM is not set
763# CONFIG_CRYPTO_GCM is not set
764# CONFIG_CRYPTO_SEQIV is not set
765
766#
767# Block modes
768#
769# CONFIG_CRYPTO_CBC is not set
770# CONFIG_CRYPTO_CTR is not set
771# CONFIG_CRYPTO_CTS is not set
772# CONFIG_CRYPTO_ECB is not set
773# CONFIG_CRYPTO_LRW is not set
774# CONFIG_CRYPTO_PCBC is not set
775# CONFIG_CRYPTO_XTS is not set
776
777#
778# Hash modes
779#
780# CONFIG_CRYPTO_HMAC is not set
781# CONFIG_CRYPTO_XCBC is not set
782
783#
784# Digest
785#
786# CONFIG_CRYPTO_CRC32C is not set
787# CONFIG_CRYPTO_MD4 is not set
788# CONFIG_CRYPTO_MD5 is not set
789# CONFIG_CRYPTO_MICHAEL_MIC is not set
790# CONFIG_CRYPTO_SHA1 is not set
791# CONFIG_CRYPTO_SHA256 is not set
792# CONFIG_CRYPTO_SHA512 is not set
793# CONFIG_CRYPTO_TGR192 is not set
794# CONFIG_CRYPTO_WP512 is not set
795
796#
797# Ciphers
798#
799# CONFIG_CRYPTO_AES is not set
800# CONFIG_CRYPTO_ANUBIS is not set
801# CONFIG_CRYPTO_ARC4 is not set
802# CONFIG_CRYPTO_BLOWFISH is not set
803# CONFIG_CRYPTO_CAMELLIA is not set
804# CONFIG_CRYPTO_CAST5 is not set
805# CONFIG_CRYPTO_CAST6 is not set
806# CONFIG_CRYPTO_DES is not set
807# CONFIG_CRYPTO_FCRYPT is not set
808# CONFIG_CRYPTO_KHAZAD is not set
809# CONFIG_CRYPTO_SALSA20 is not set
810# CONFIG_CRYPTO_SEED is not set
811# CONFIG_CRYPTO_SERPENT is not set
812# CONFIG_CRYPTO_TEA is not set
813# CONFIG_CRYPTO_TWOFISH is not set
814
815#
816# Compression
817#
818# CONFIG_CRYPTO_DEFLATE is not set
819# CONFIG_CRYPTO_LZO is not set
820# CONFIG_CRYPTO_HW is not set
821
822#
823# Library routines
824#
825CONFIG_BITREVERSE=y
826# CONFIG_GENERIC_FIND_FIRST_BIT is not set
827# CONFIG_GENERIC_FIND_NEXT_BIT is not set
828# CONFIG_CRC_CCITT is not set
829# CONFIG_CRC16 is not set
830# CONFIG_CRC_ITU_T is not set
831CONFIG_CRC32=y
832# CONFIG_CRC7 is not set
833# CONFIG_LIBCRC32C is not set
834CONFIG_ZLIB_INFLATE=y
835CONFIG_ZLIB_DEFLATE=y
836CONFIG_PLIST=y
837CONFIG_HAS_IOMEM=y
838CONFIG_HAS_IOPORT=y
839CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/mx31litekit_defconfig b/arch/arm/configs/mx31litekit_defconfig
new file mode 100644
index 000000000000..4f41c4135685
--- /dev/null
+++ b/arch/arm/configs/mx31litekit_defconfig
@@ -0,0 +1,1100 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc5
4# Fri Jun 13 14:23:39 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_ZONE_DMA=y
26CONFIG_ARCH_MTD_XIP=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46CONFIG_IKCONFIG=y
47CONFIG_IKCONFIG_PROC=y
48CONFIG_LOG_BUF_SHIFT=14
49# CONFIG_CGROUPS is not set
50# CONFIG_GROUP_SCHED is not set
51CONFIG_SYSFS_DEPRECATED=y
52CONFIG_SYSFS_DEPRECATED_V2=y
53# CONFIG_RELAY is not set
54# CONFIG_NAMESPACES is not set
55# CONFIG_BLK_DEV_INITRD is not set
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
57CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y
59CONFIG_UID16=y
60CONFIG_SYSCTL_SYSCALL=y
61CONFIG_SYSCTL_SYSCALL_CHECK=y
62CONFIG_KALLSYMS=y
63# CONFIG_KALLSYMS_ALL is not set
64# CONFIG_KALLSYMS_EXTRA_PASS is not set
65CONFIG_HOTPLUG=y
66CONFIG_PRINTK=y
67CONFIG_BUG=y
68CONFIG_ELF_CORE=y
69CONFIG_COMPAT_BRK=y
70CONFIG_BASE_FULL=y
71CONFIG_FUTEX=y
72CONFIG_ANON_INODES=y
73CONFIG_EPOLL=y
74CONFIG_SIGNALFD=y
75CONFIG_TIMERFD=y
76CONFIG_EVENTFD=y
77CONFIG_SHMEM=y
78CONFIG_VM_EVENT_COUNTERS=y
79CONFIG_SLAB=y
80# CONFIG_SLUB is not set
81# CONFIG_SLOB is not set
82# CONFIG_PROFILING is not set
83# CONFIG_MARKERS is not set
84CONFIG_HAVE_OPROFILE=y
85# CONFIG_KPROBES is not set
86CONFIG_HAVE_KPROBES=y
87CONFIG_HAVE_KRETPROBES=y
88# CONFIG_HAVE_DMA_ATTRS is not set
89CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_SLABINFO=y
91CONFIG_RT_MUTEXES=y
92# CONFIG_TINY_SHMEM is not set
93CONFIG_BASE_SMALL=0
94CONFIG_MODULES=y
95# CONFIG_MODULE_FORCE_LOAD is not set
96CONFIG_MODULE_UNLOAD=y
97CONFIG_MODULE_FORCE_UNLOAD=y
98CONFIG_MODVERSIONS=y
99# CONFIG_MODULE_SRCVERSION_ALL is not set
100CONFIG_KMOD=y
101CONFIG_BLOCK=y
102# CONFIG_LBD is not set
103# CONFIG_BLK_DEV_IO_TRACE is not set
104# CONFIG_LSF is not set
105# CONFIG_BLK_DEV_BSG is not set
106
107#
108# IO Schedulers
109#
110CONFIG_IOSCHED_NOOP=y
111CONFIG_IOSCHED_AS=y
112CONFIG_IOSCHED_DEADLINE=y
113CONFIG_IOSCHED_CFQ=y
114# CONFIG_DEFAULT_AS is not set
115# CONFIG_DEFAULT_DEADLINE is not set
116CONFIG_DEFAULT_CFQ=y
117# CONFIG_DEFAULT_NOOP is not set
118CONFIG_DEFAULT_IOSCHED="cfq"
119CONFIG_CLASSIC_RCU=y
120
121#
122# System Type
123#
124# CONFIG_ARCH_AAEC2000 is not set
125# CONFIG_ARCH_INTEGRATOR is not set
126# CONFIG_ARCH_REALVIEW is not set
127# CONFIG_ARCH_VERSATILE is not set
128# CONFIG_ARCH_AT91 is not set
129# CONFIG_ARCH_CLPS7500 is not set
130# CONFIG_ARCH_CLPS711X is not set
131# CONFIG_ARCH_CO285 is not set
132# CONFIG_ARCH_EBSA110 is not set
133# CONFIG_ARCH_EP93XX is not set
134# CONFIG_ARCH_FOOTBRIDGE is not set
135# CONFIG_ARCH_NETX is not set
136# CONFIG_ARCH_H720X is not set
137# CONFIG_ARCH_IMX is not set
138# CONFIG_ARCH_IOP13XX is not set
139# CONFIG_ARCH_IOP32X is not set
140# CONFIG_ARCH_IOP33X is not set
141# CONFIG_ARCH_IXP23XX is not set
142# CONFIG_ARCH_IXP2000 is not set
143# CONFIG_ARCH_IXP4XX is not set
144# CONFIG_ARCH_L7200 is not set
145# CONFIG_ARCH_KS8695 is not set
146# CONFIG_ARCH_NS9XXX is not set
147CONFIG_ARCH_MXC=y
148# CONFIG_ARCH_ORION5X is not set
149# CONFIG_ARCH_PNX4008 is not set
150# CONFIG_ARCH_PXA is not set
151# CONFIG_ARCH_RPC is not set
152# CONFIG_ARCH_SA1100 is not set
153# CONFIG_ARCH_S3C2410 is not set
154# CONFIG_ARCH_SHARK is not set
155# CONFIG_ARCH_LH7A40X is not set
156# CONFIG_ARCH_DAVINCI is not set
157# CONFIG_ARCH_OMAP is not set
158# CONFIG_ARCH_MSM7X00A is not set
159
160#
161# Boot options
162#
163
164#
165# Power management
166#
167
168#
169# Freescale MXC Implementations
170#
171CONFIG_ARCH_MX3=y
172
173#
174# MX3 Options
175#
176# CONFIG_MACH_MX31ADS is not set
177CONFIG_MACH_MX31LITE=y
178
179#
180# Processor Type
181#
182CONFIG_CPU_32=y
183CONFIG_CPU_V6=y
184# CONFIG_CPU_32v6K is not set
185CONFIG_CPU_32v6=y
186CONFIG_CPU_ABRT_EV6=y
187CONFIG_CPU_PABRT_NOIFAR=y
188CONFIG_CPU_CACHE_V6=y
189CONFIG_CPU_CACHE_VIPT=y
190CONFIG_CPU_COPY_V6=y
191CONFIG_CPU_TLB_V6=y
192CONFIG_CPU_HAS_ASID=y
193CONFIG_CPU_CP15=y
194CONFIG_CPU_CP15_MMU=y
195
196#
197# Processor Features
198#
199CONFIG_ARM_THUMB=y
200# CONFIG_CPU_ICACHE_DISABLE is not set
201# CONFIG_CPU_DCACHE_DISABLE is not set
202# CONFIG_CPU_BPREDICT_DISABLE is not set
203# CONFIG_OUTER_CACHE is not set
204
205#
206# Bus support
207#
208# CONFIG_PCI_SYSCALL is not set
209# CONFIG_ARCH_SUPPORTS_MSI is not set
210CONFIG_PCCARD=m
211# CONFIG_PCMCIA_DEBUG is not set
212# CONFIG_PCMCIA is not set
213
214#
215# PC-card bridges
216#
217
218#
219# Kernel Features
220#
221# CONFIG_TICK_ONESHOT is not set
222CONFIG_PREEMPT=y
223# CONFIG_NO_IDLE_HZ is not set
224CONFIG_HZ=100
225CONFIG_AEABI=y
226# CONFIG_OABI_COMPAT is not set
227# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
228CONFIG_SELECT_MEMORY_MODEL=y
229CONFIG_FLATMEM_MANUAL=y
230# CONFIG_DISCONTIGMEM_MANUAL is not set
231# CONFIG_SPARSEMEM_MANUAL is not set
232CONFIG_FLATMEM=y
233CONFIG_FLAT_NODE_MEM_MAP=y
234# CONFIG_SPARSEMEM_STATIC is not set
235# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
236CONFIG_PAGEFLAGS_EXTENDED=y
237CONFIG_SPLIT_PTLOCK_CPUS=4
238# CONFIG_RESOURCES_64BIT is not set
239CONFIG_ZONE_DMA_FLAG=1
240CONFIG_BOUNCE=y
241CONFIG_VIRT_TO_BUS=y
242CONFIG_ALIGNMENT_TRAP=y
243
244#
245# Boot options
246#
247CONFIG_ZBOOT_ROM_TEXT=0x0
248CONFIG_ZBOOT_ROM_BSS=0x0
249CONFIG_CMDLINE="noinitrd console=ttymxc0,115200 root=/dev/mtdblock2 rw ip=off"
250# CONFIG_XIP_KERNEL is not set
251# CONFIG_KEXEC is not set
252
253#
254# Floating point emulation
255#
256
257#
258# At least one emulation must be selected
259#
260CONFIG_VFP=y
261
262#
263# Userspace binary formats
264#
265CONFIG_BINFMT_ELF=y
266CONFIG_BINFMT_AOUT=y
267# CONFIG_BINFMT_MISC is not set
268
269#
270# Power management options
271#
272CONFIG_PM=y
273# CONFIG_PM_DEBUG is not set
274# CONFIG_SUSPEND is not set
275# CONFIG_APM_EMULATION is not set
276CONFIG_ARCH_SUSPEND_POSSIBLE=y
277
278#
279# Networking
280#
281CONFIG_NET=y
282
283#
284# Networking options
285#
286CONFIG_PACKET=y
287# CONFIG_PACKET_MMAP is not set
288CONFIG_UNIX=y
289CONFIG_XFRM=y
290# CONFIG_XFRM_USER is not set
291# CONFIG_XFRM_SUB_POLICY is not set
292# CONFIG_XFRM_MIGRATE is not set
293# CONFIG_XFRM_STATISTICS is not set
294# CONFIG_NET_KEY is not set
295CONFIG_INET=y
296# CONFIG_IP_MULTICAST is not set
297# CONFIG_IP_ADVANCED_ROUTER is not set
298CONFIG_IP_FIB_HASH=y
299CONFIG_IP_PNP=y
300CONFIG_IP_PNP_DHCP=y
301# CONFIG_IP_PNP_BOOTP is not set
302# CONFIG_IP_PNP_RARP is not set
303# CONFIG_NET_IPIP is not set
304# CONFIG_NET_IPGRE is not set
305# CONFIG_ARPD is not set
306# CONFIG_SYN_COOKIES is not set
307# CONFIG_INET_AH is not set
308# CONFIG_INET_ESP is not set
309# CONFIG_INET_IPCOMP is not set
310# CONFIG_INET_XFRM_TUNNEL is not set
311# CONFIG_INET_TUNNEL is not set
312CONFIG_INET_XFRM_MODE_TRANSPORT=y
313CONFIG_INET_XFRM_MODE_TUNNEL=y
314CONFIG_INET_XFRM_MODE_BEET=y
315# CONFIG_INET_LRO is not set
316CONFIG_INET_DIAG=y
317CONFIG_INET_TCP_DIAG=y
318# CONFIG_TCP_CONG_ADVANCED is not set
319CONFIG_TCP_CONG_CUBIC=y
320CONFIG_DEFAULT_TCP_CONG="cubic"
321# CONFIG_TCP_MD5SIG is not set
322# CONFIG_IPV6 is not set
323# CONFIG_NETWORK_SECMARK is not set
324# CONFIG_NETFILTER is not set
325# CONFIG_IP_DCCP is not set
326# CONFIG_IP_SCTP is not set
327# CONFIG_TIPC is not set
328# CONFIG_ATM is not set
329# CONFIG_BRIDGE is not set
330# CONFIG_VLAN_8021Q is not set
331# CONFIG_DECNET is not set
332# CONFIG_LLC2 is not set
333# CONFIG_IPX is not set
334# CONFIG_ATALK is not set
335# CONFIG_X25 is not set
336# CONFIG_LAPB is not set
337# CONFIG_ECONET is not set
338# CONFIG_WAN_ROUTER is not set
339# CONFIG_NET_SCHED is not set
340
341#
342# Network testing
343#
344# CONFIG_NET_PKTGEN is not set
345# CONFIG_HAMRADIO is not set
346# CONFIG_CAN is not set
347# CONFIG_IRDA is not set
348# CONFIG_BT is not set
349# CONFIG_AF_RXRPC is not set
350
351#
352# Wireless
353#
354# CONFIG_CFG80211 is not set
355# CONFIG_WIRELESS_EXT is not set
356# CONFIG_MAC80211 is not set
357# CONFIG_IEEE80211 is not set
358# CONFIG_RFKILL is not set
359# CONFIG_NET_9P is not set
360
361#
362# Device Drivers
363#
364
365#
366# Generic Driver Options
367#
368CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
369CONFIG_STANDALONE=y
370CONFIG_PREVENT_FIRMWARE_BUILD=y
371CONFIG_FW_LOADER=m
372# CONFIG_DEBUG_DRIVER is not set
373# CONFIG_DEBUG_DEVRES is not set
374# CONFIG_SYS_HYPERVISOR is not set
375# CONFIG_CONNECTOR is not set
376CONFIG_MTD=y
377# CONFIG_MTD_DEBUG is not set
378# CONFIG_MTD_CONCAT is not set
379CONFIG_MTD_PARTITIONS=y
380CONFIG_MTD_REDBOOT_PARTS=y
381CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
382# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
383# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
384CONFIG_MTD_CMDLINE_PARTS=y
385# CONFIG_MTD_AFS_PARTS is not set
386# CONFIG_MTD_AR7_PARTS is not set
387
388#
389# User Modules And Translation Layers
390#
391CONFIG_MTD_CHAR=y
392CONFIG_MTD_BLKDEVS=y
393CONFIG_MTD_BLOCK=y
394# CONFIG_FTL is not set
395# CONFIG_NFTL is not set
396# CONFIG_INFTL is not set
397# CONFIG_RFD_FTL is not set
398# CONFIG_SSFDC is not set
399# CONFIG_MTD_OOPS is not set
400
401#
402# RAM/ROM/Flash chip drivers
403#
404CONFIG_MTD_CFI=y
405# CONFIG_MTD_JEDECPROBE is not set
406CONFIG_MTD_GEN_PROBE=y
407CONFIG_MTD_CFI_ADV_OPTIONS=y
408CONFIG_MTD_CFI_NOSWAP=y
409# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
410# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
411CONFIG_MTD_CFI_GEOMETRY=y
412# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
413CONFIG_MTD_MAP_BANK_WIDTH_2=y
414# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
415# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
416# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
417# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
418CONFIG_MTD_CFI_I1=y
419# CONFIG_MTD_CFI_I2 is not set
420# CONFIG_MTD_CFI_I4 is not set
421# CONFIG_MTD_CFI_I8 is not set
422# CONFIG_MTD_OTP is not set
423# CONFIG_MTD_CFI_INTELEXT is not set
424CONFIG_MTD_CFI_AMDSTD=y
425# CONFIG_MTD_CFI_STAA is not set
426CONFIG_MTD_CFI_UTIL=y
427CONFIG_MTD_RAM=y
428# CONFIG_MTD_ROM is not set
429# CONFIG_MTD_ABSENT is not set
430# CONFIG_MTD_XIP is not set
431
432#
433# Mapping drivers for chip access
434#
435# CONFIG_MTD_COMPLEX_MAPPINGS is not set
436# CONFIG_MTD_PHYSMAP is not set
437# CONFIG_MTD_ARM_INTEGRATOR is not set
438# CONFIG_MTD_PLATRAM is not set
439
440#
441# Self-contained MTD device drivers
442#
443# CONFIG_MTD_SLRAM is not set
444# CONFIG_MTD_PHRAM is not set
445# CONFIG_MTD_MTDRAM is not set
446# CONFIG_MTD_BLOCK2MTD is not set
447
448#
449# Disk-On-Chip Device Drivers
450#
451# CONFIG_MTD_DOC2000 is not set
452# CONFIG_MTD_DOC2001 is not set
453# CONFIG_MTD_DOC2001PLUS is not set
454CONFIG_MTD_NAND=y
455# CONFIG_MTD_NAND_VERIFY_WRITE is not set
456# CONFIG_MTD_NAND_ECC_SMC is not set
457# CONFIG_MTD_NAND_MUSEUM_IDS is not set
458CONFIG_MTD_NAND_IDS=y
459# CONFIG_MTD_NAND_DISKONCHIP is not set
460# CONFIG_MTD_NAND_NANDSIM is not set
461# CONFIG_MTD_NAND_PLATFORM is not set
462# CONFIG_MTD_ALAUDA is not set
463# CONFIG_MTD_ONENAND is not set
464
465#
466# UBI - Unsorted block images
467#
468# CONFIG_MTD_UBI is not set
469# CONFIG_PARPORT is not set
470# CONFIG_BLK_DEV is not set
471# CONFIG_MISC_DEVICES is not set
472CONFIG_HAVE_IDE=y
473# CONFIG_IDE is not set
474
475#
476# SCSI device support
477#
478# CONFIG_RAID_ATTRS is not set
479CONFIG_SCSI=y
480CONFIG_SCSI_DMA=y
481# CONFIG_SCSI_TGT is not set
482# CONFIG_SCSI_NETLINK is not set
483CONFIG_SCSI_PROC_FS=y
484
485#
486# SCSI support type (disk, tape, CD-ROM)
487#
488CONFIG_BLK_DEV_SD=y
489# CONFIG_CHR_DEV_ST is not set
490# CONFIG_CHR_DEV_OSST is not set
491# CONFIG_BLK_DEV_SR is not set
492# CONFIG_CHR_DEV_SG is not set
493# CONFIG_CHR_DEV_SCH is not set
494
495#
496# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
497#
498CONFIG_SCSI_MULTI_LUN=y
499# CONFIG_SCSI_CONSTANTS is not set
500# CONFIG_SCSI_LOGGING is not set
501# CONFIG_SCSI_SCAN_ASYNC is not set
502CONFIG_SCSI_WAIT_SCAN=m
503
504#
505# SCSI Transports
506#
507# CONFIG_SCSI_SPI_ATTRS is not set
508# CONFIG_SCSI_FC_ATTRS is not set
509# CONFIG_SCSI_ISCSI_ATTRS is not set
510# CONFIG_SCSI_SAS_LIBSAS is not set
511# CONFIG_SCSI_SRP_ATTRS is not set
512CONFIG_SCSI_LOWLEVEL=y
513# CONFIG_ISCSI_TCP is not set
514# CONFIG_SCSI_DEBUG is not set
515# CONFIG_ATA is not set
516# CONFIG_MD is not set
517CONFIG_NETDEVICES=y
518# CONFIG_NETDEVICES_MULTIQUEUE is not set
519# CONFIG_DUMMY is not set
520# CONFIG_BONDING is not set
521# CONFIG_MACVLAN is not set
522# CONFIG_EQUALIZER is not set
523# CONFIG_TUN is not set
524# CONFIG_VETH is not set
525# CONFIG_PHYLIB is not set
526CONFIG_NET_ETHERNET=y
527CONFIG_MII=y
528# CONFIG_AX88796 is not set
529# CONFIG_SMC91X is not set
530# CONFIG_DM9000 is not set
531# CONFIG_IBM_NEW_EMAC_ZMII is not set
532# CONFIG_IBM_NEW_EMAC_RGMII is not set
533# CONFIG_IBM_NEW_EMAC_TAH is not set
534# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
535# CONFIG_B44 is not set
536# CONFIG_NETDEV_1000 is not set
537# CONFIG_NETDEV_10000 is not set
538
539#
540# Wireless LAN
541#
542# CONFIG_WLAN_PRE80211 is not set
543# CONFIG_WLAN_80211 is not set
544# CONFIG_IWLWIFI_LEDS is not set
545
546#
547# USB Network Adapters
548#
549# CONFIG_USB_CATC is not set
550# CONFIG_USB_KAWETH is not set
551# CONFIG_USB_PEGASUS is not set
552# CONFIG_USB_RTL8150 is not set
553# CONFIG_USB_USBNET is not set
554# CONFIG_WAN is not set
555# CONFIG_PPP is not set
556# CONFIG_SLIP is not set
557# CONFIG_NETCONSOLE is not set
558# CONFIG_NETPOLL is not set
559# CONFIG_NET_POLL_CONTROLLER is not set
560# CONFIG_ISDN is not set
561
562#
563# Input device support
564#
565CONFIG_INPUT=y
566# CONFIG_INPUT_FF_MEMLESS is not set
567# CONFIG_INPUT_POLLDEV is not set
568
569#
570# Userland interfaces
571#
572# CONFIG_INPUT_MOUSEDEV is not set
573# CONFIG_INPUT_JOYDEV is not set
574CONFIG_INPUT_EVDEV=y
575# CONFIG_INPUT_EVBUG is not set
576
577#
578# Input Device Drivers
579#
580CONFIG_INPUT_KEYBOARD=y
581# CONFIG_KEYBOARD_ATKBD is not set
582# CONFIG_KEYBOARD_SUNKBD is not set
583# CONFIG_KEYBOARD_LKKBD is not set
584# CONFIG_KEYBOARD_XTKBD is not set
585# CONFIG_KEYBOARD_NEWTON is not set
586# CONFIG_KEYBOARD_STOWAWAY is not set
587# CONFIG_INPUT_MOUSE is not set
588# CONFIG_INPUT_JOYSTICK is not set
589# CONFIG_INPUT_TABLET is not set
590CONFIG_INPUT_TOUCHSCREEN=y
591# CONFIG_TOUCHSCREEN_FUJITSU is not set
592# CONFIG_TOUCHSCREEN_GUNZE is not set
593# CONFIG_TOUCHSCREEN_ELO is not set
594# CONFIG_TOUCHSCREEN_MTOUCH is not set
595# CONFIG_TOUCHSCREEN_MK712 is not set
596# CONFIG_TOUCHSCREEN_PENMOUNT is not set
597# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
598# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
599# CONFIG_TOUCHSCREEN_UCB1400 is not set
600# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
601# CONFIG_INPUT_MISC is not set
602
603#
604# Hardware I/O ports
605#
606# CONFIG_SERIO is not set
607# CONFIG_GAMEPORT is not set
608
609#
610# Character devices
611#
612CONFIG_VT=y
613CONFIG_VT_CONSOLE=y
614CONFIG_HW_CONSOLE=y
615# CONFIG_VT_HW_CONSOLE_BINDING is not set
616CONFIG_DEVKMEM=y
617# CONFIG_SERIAL_NONSTANDARD is not set
618
619#
620# Serial drivers
621#
622# CONFIG_SERIAL_8250 is not set
623
624#
625# Non-8250 serial port support
626#
627CONFIG_UNIX98_PTYS=y
628CONFIG_LEGACY_PTYS=y
629CONFIG_LEGACY_PTY_COUNT=256
630# CONFIG_IPMI_HANDLER is not set
631CONFIG_HW_RANDOM=y
632# CONFIG_NVRAM is not set
633# CONFIG_R3964 is not set
634# CONFIG_RAW_DRIVER is not set
635# CONFIG_TCG_TPM is not set
636# CONFIG_I2C is not set
637# CONFIG_SPI is not set
638# CONFIG_W1 is not set
639# CONFIG_POWER_SUPPLY is not set
640# CONFIG_HWMON is not set
641CONFIG_WATCHDOG=y
642CONFIG_WATCHDOG_NOWAYOUT=y
643
644#
645# Watchdog Device Drivers
646#
647# CONFIG_SOFT_WATCHDOG is not set
648
649#
650# USB-based Watchdog Cards
651#
652# CONFIG_USBPCWATCHDOG is not set
653
654#
655# Sonics Silicon Backplane
656#
657CONFIG_SSB_POSSIBLE=y
658# CONFIG_SSB is not set
659
660#
661# Multifunction device drivers
662#
663# CONFIG_MFD_SM501 is not set
664# CONFIG_MFD_ASIC3 is not set
665# CONFIG_HTC_PASIC3 is not set
666
667#
668# Multimedia devices
669#
670
671#
672# Multimedia core support
673#
674CONFIG_VIDEO_DEV=y
675CONFIG_VIDEO_V4L2_COMMON=y
676CONFIG_VIDEO_ALLOW_V4L1=y
677CONFIG_VIDEO_V4L1_COMPAT=y
678# CONFIG_DVB_CORE is not set
679CONFIG_VIDEO_MEDIA=y
680
681#
682# Multimedia drivers
683#
684# CONFIG_MEDIA_ATTACH is not set
685CONFIG_VIDEO_V4L2=y
686CONFIG_VIDEO_V4L1=y
687CONFIG_VIDEO_CAPTURE_DRIVERS=y
688# CONFIG_VIDEO_ADV_DEBUG is not set
689CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
690# CONFIG_VIDEO_VIVI is not set
691# CONFIG_VIDEO_CPIA is not set
692# CONFIG_VIDEO_CPIA2 is not set
693CONFIG_V4L_USB_DRIVERS=y
694# CONFIG_USB_VICAM is not set
695# CONFIG_USB_IBMCAM is not set
696# CONFIG_USB_KONICAWC is not set
697# CONFIG_USB_QUICKCAM_MESSENGER is not set
698# CONFIG_USB_ET61X251 is not set
699# CONFIG_USB_OV511 is not set
700# CONFIG_USB_SE401 is not set
701# CONFIG_USB_SN9C102 is not set
702# CONFIG_USB_STV680 is not set
703# CONFIG_USB_ZC0301 is not set
704# CONFIG_USB_PWC is not set
705# CONFIG_USB_ZR364XX is not set
706# CONFIG_USB_STKWEBCAM is not set
707# CONFIG_SOC_CAMERA is not set
708CONFIG_RADIO_ADAPTERS=y
709# CONFIG_USB_DSBR is not set
710# CONFIG_USB_SI470X is not set
711CONFIG_DAB=y
712# CONFIG_USB_DABUSB is not set
713
714#
715# Graphics support
716#
717# CONFIG_VGASTATE is not set
718# CONFIG_VIDEO_OUTPUT_CONTROL is not set
719CONFIG_FB=y
720# CONFIG_FIRMWARE_EDID is not set
721# CONFIG_FB_DDC is not set
722# CONFIG_FB_CFB_FILLRECT is not set
723# CONFIG_FB_CFB_COPYAREA is not set
724# CONFIG_FB_CFB_IMAGEBLIT is not set
725# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
726# CONFIG_FB_SYS_FILLRECT is not set
727# CONFIG_FB_SYS_COPYAREA is not set
728# CONFIG_FB_SYS_IMAGEBLIT is not set
729# CONFIG_FB_FOREIGN_ENDIAN is not set
730# CONFIG_FB_SYS_FOPS is not set
731# CONFIG_FB_SVGALIB is not set
732# CONFIG_FB_MACMODES is not set
733# CONFIG_FB_BACKLIGHT is not set
734# CONFIG_FB_MODE_HELPERS is not set
735# CONFIG_FB_TILEBLITTING is not set
736
737#
738# Frame buffer hardware drivers
739#
740# CONFIG_FB_S1D13XXX is not set
741# CONFIG_FB_VIRTUAL is not set
742# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
743
744#
745# Display device support
746#
747# CONFIG_DISPLAY_SUPPORT is not set
748
749#
750# Console display driver support
751#
752# CONFIG_VGA_CONSOLE is not set
753CONFIG_DUMMY_CONSOLE=y
754CONFIG_FRAMEBUFFER_CONSOLE=y
755# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
756# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
757# CONFIG_FONTS is not set
758CONFIG_FONT_8x8=y
759CONFIG_FONT_8x16=y
760CONFIG_LOGO=y
761# CONFIG_LOGO_LINUX_MONO is not set
762# CONFIG_LOGO_LINUX_VGA16 is not set
763CONFIG_LOGO_LINUX_CLUT224=y
764
765#
766# Sound
767#
768# CONFIG_SOUND is not set
769# CONFIG_HID_SUPPORT is not set
770CONFIG_USB_SUPPORT=y
771CONFIG_USB_ARCH_HAS_HCD=y
772# CONFIG_USB_ARCH_HAS_OHCI is not set
773# CONFIG_USB_ARCH_HAS_EHCI is not set
774CONFIG_USB=y
775# CONFIG_USB_DEBUG is not set
776# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
777
778#
779# Miscellaneous USB options
780#
781# CONFIG_USB_DEVICEFS is not set
782CONFIG_USB_DEVICE_CLASS=y
783# CONFIG_USB_DYNAMIC_MINORS is not set
784# CONFIG_USB_SUSPEND is not set
785# CONFIG_USB_OTG is not set
786# CONFIG_USB_OTG_WHITELIST is not set
787# CONFIG_USB_OTG_BLACKLIST_HUB is not set
788
789#
790# USB Host Controller Drivers
791#
792# CONFIG_USB_C67X00_HCD is not set
793# CONFIG_USB_ISP116X_HCD is not set
794# CONFIG_USB_ISP1760_HCD is not set
795# CONFIG_USB_SL811_HCD is not set
796# CONFIG_USB_R8A66597_HCD is not set
797
798#
799# USB Device Class drivers
800#
801# CONFIG_USB_ACM is not set
802# CONFIG_USB_PRINTER is not set
803# CONFIG_USB_WDM is not set
804
805#
806# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
807#
808
809#
810# may also be needed; see USB_STORAGE Help for more information
811#
812# CONFIG_USB_STORAGE is not set
813# CONFIG_USB_LIBUSUAL is not set
814
815#
816# USB Imaging devices
817#
818# CONFIG_USB_MDC800 is not set
819# CONFIG_USB_MICROTEK is not set
820CONFIG_USB_MON=y
821
822#
823# USB port drivers
824#
825# CONFIG_USB_SERIAL is not set
826
827#
828# USB Miscellaneous drivers
829#
830# CONFIG_USB_EMI62 is not set
831# CONFIG_USB_EMI26 is not set
832# CONFIG_USB_ADUTUX is not set
833# CONFIG_USB_AUERSWALD is not set
834# CONFIG_USB_RIO500 is not set
835# CONFIG_USB_LEGOTOWER is not set
836# CONFIG_USB_LCD is not set
837# CONFIG_USB_BERRY_CHARGE is not set
838# CONFIG_USB_LED is not set
839# CONFIG_USB_CYPRESS_CY7C63 is not set
840# CONFIG_USB_CYTHERM is not set
841# CONFIG_USB_PHIDGET is not set
842# CONFIG_USB_IDMOUSE is not set
843# CONFIG_USB_FTDI_ELAN is not set
844# CONFIG_USB_APPLEDISPLAY is not set
845# CONFIG_USB_LD is not set
846# CONFIG_USB_TRANCEVIBRATOR is not set
847# CONFIG_USB_IOWARRIOR is not set
848# CONFIG_USB_ISIGHTFW is not set
849# CONFIG_USB_GADGET is not set
850# CONFIG_MMC is not set
851# CONFIG_NEW_LEDS is not set
852CONFIG_RTC_LIB=y
853# CONFIG_RTC_CLASS is not set
854# CONFIG_UIO is not set
855
856#
857# File systems
858#
859# CONFIG_EXT2_FS is not set
860# CONFIG_EXT3_FS is not set
861# CONFIG_EXT4DEV_FS is not set
862# CONFIG_REISERFS_FS is not set
863# CONFIG_JFS_FS is not set
864# CONFIG_FS_POSIX_ACL is not set
865# CONFIG_XFS_FS is not set
866# CONFIG_OCFS2_FS is not set
867# CONFIG_DNOTIFY is not set
868CONFIG_INOTIFY=y
869CONFIG_INOTIFY_USER=y
870# CONFIG_QUOTA is not set
871# CONFIG_AUTOFS_FS is not set
872# CONFIG_AUTOFS4_FS is not set
873# CONFIG_FUSE_FS is not set
874
875#
876# CD-ROM/DVD Filesystems
877#
878# CONFIG_ISO9660_FS is not set
879# CONFIG_UDF_FS is not set
880
881#
882# DOS/FAT/NT Filesystems
883#
884# CONFIG_MSDOS_FS is not set
885# CONFIG_VFAT_FS is not set
886# CONFIG_NTFS_FS is not set
887
888#
889# Pseudo filesystems
890#
891CONFIG_PROC_FS=y
892CONFIG_PROC_SYSCTL=y
893CONFIG_SYSFS=y
894CONFIG_TMPFS=y
895# CONFIG_TMPFS_POSIX_ACL is not set
896# CONFIG_HUGETLB_PAGE is not set
897# CONFIG_CONFIGFS_FS is not set
898
899#
900# Miscellaneous filesystems
901#
902# CONFIG_ADFS_FS is not set
903# CONFIG_AFFS_FS is not set
904# CONFIG_HFS_FS is not set
905# CONFIG_HFSPLUS_FS is not set
906# CONFIG_BEFS_FS is not set
907# CONFIG_BFS_FS is not set
908# CONFIG_EFS_FS is not set
909CONFIG_JFFS2_FS=y
910CONFIG_JFFS2_FS_DEBUG=0
911CONFIG_JFFS2_FS_WRITEBUFFER=y
912# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
913# CONFIG_JFFS2_SUMMARY is not set
914# CONFIG_JFFS2_FS_XATTR is not set
915# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
916CONFIG_JFFS2_ZLIB=y
917# CONFIG_JFFS2_LZO is not set
918CONFIG_JFFS2_RTIME=y
919# CONFIG_JFFS2_RUBIN is not set
920CONFIG_CRAMFS=y
921# CONFIG_VXFS_FS is not set
922# CONFIG_MINIX_FS is not set
923# CONFIG_HPFS_FS is not set
924# CONFIG_QNX4FS_FS is not set
925# CONFIG_ROMFS_FS is not set
926# CONFIG_SYSV_FS is not set
927# CONFIG_UFS_FS is not set
928CONFIG_NETWORK_FILESYSTEMS=y
929CONFIG_NFS_FS=y
930# CONFIG_NFS_V3 is not set
931# CONFIG_NFS_V4 is not set
932# CONFIG_NFSD is not set
933CONFIG_ROOT_NFS=y
934CONFIG_LOCKD=y
935CONFIG_NFS_COMMON=y
936CONFIG_SUNRPC=y
937# CONFIG_SUNRPC_BIND34 is not set
938# CONFIG_RPCSEC_GSS_KRB5 is not set
939# CONFIG_RPCSEC_GSS_SPKM3 is not set
940# CONFIG_SMB_FS is not set
941# CONFIG_CIFS is not set
942# CONFIG_NCP_FS is not set
943# CONFIG_CODA_FS is not set
944# CONFIG_AFS_FS is not set
945
946#
947# Partition Types
948#
949# CONFIG_PARTITION_ADVANCED is not set
950CONFIG_MSDOS_PARTITION=y
951# CONFIG_NLS is not set
952# CONFIG_DLM is not set
953
954#
955# Kernel hacking
956#
957CONFIG_PRINTK_TIME=y
958CONFIG_ENABLE_WARN_DEPRECATED=y
959CONFIG_ENABLE_MUST_CHECK=y
960CONFIG_FRAME_WARN=1024
961# CONFIG_MAGIC_SYSRQ is not set
962# CONFIG_UNUSED_SYMBOLS is not set
963# CONFIG_DEBUG_FS is not set
964# CONFIG_HEADERS_CHECK is not set
965CONFIG_DEBUG_KERNEL=y
966# CONFIG_DEBUG_SHIRQ is not set
967CONFIG_DETECT_SOFTLOCKUP=y
968CONFIG_SCHED_DEBUG=y
969# CONFIG_SCHEDSTATS is not set
970# CONFIG_TIMER_STATS is not set
971# CONFIG_DEBUG_OBJECTS is not set
972# CONFIG_DEBUG_SLAB is not set
973CONFIG_DEBUG_PREEMPT=y
974# CONFIG_DEBUG_RT_MUTEXES is not set
975# CONFIG_RT_MUTEX_TESTER is not set
976# CONFIG_DEBUG_SPINLOCK is not set
977# CONFIG_DEBUG_MUTEXES is not set
978# CONFIG_DEBUG_LOCK_ALLOC is not set
979# CONFIG_PROVE_LOCKING is not set
980# CONFIG_LOCK_STAT is not set
981# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
982# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
983# CONFIG_DEBUG_KOBJECT is not set
984CONFIG_DEBUG_BUGVERBOSE=y
985# CONFIG_DEBUG_INFO is not set
986# CONFIG_DEBUG_VM is not set
987# CONFIG_DEBUG_WRITECOUNT is not set
988# CONFIG_DEBUG_LIST is not set
989# CONFIG_DEBUG_SG is not set
990CONFIG_FRAME_POINTER=y
991# CONFIG_BOOT_PRINTK_DELAY is not set
992# CONFIG_RCU_TORTURE_TEST is not set
993# CONFIG_BACKTRACE_SELF_TEST is not set
994# CONFIG_FAULT_INJECTION is not set
995# CONFIG_SAMPLES is not set
996# CONFIG_DEBUG_USER is not set
997CONFIG_DEBUG_ERRORS=y
998# CONFIG_DEBUG_STACK_USAGE is not set
999CONFIG_DEBUG_LL=y
1000# CONFIG_DEBUG_ICEDCC is not set
1001
1002#
1003# Security options
1004#
1005# CONFIG_KEYS is not set
1006# CONFIG_SECURITY is not set
1007# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1008CONFIG_CRYPTO=y
1009
1010#
1011# Crypto core or helper
1012#
1013# CONFIG_CRYPTO_MANAGER is not set
1014# CONFIG_CRYPTO_GF128MUL is not set
1015# CONFIG_CRYPTO_NULL is not set
1016# CONFIG_CRYPTO_CRYPTD is not set
1017# CONFIG_CRYPTO_AUTHENC is not set
1018# CONFIG_CRYPTO_TEST is not set
1019
1020#
1021# Authenticated Encryption with Associated Data
1022#
1023# CONFIG_CRYPTO_CCM is not set
1024# CONFIG_CRYPTO_GCM is not set
1025# CONFIG_CRYPTO_SEQIV is not set
1026
1027#
1028# Block modes
1029#
1030# CONFIG_CRYPTO_CBC is not set
1031# CONFIG_CRYPTO_CTR is not set
1032# CONFIG_CRYPTO_CTS is not set
1033# CONFIG_CRYPTO_ECB is not set
1034# CONFIG_CRYPTO_LRW is not set
1035# CONFIG_CRYPTO_PCBC is not set
1036# CONFIG_CRYPTO_XTS is not set
1037
1038#
1039# Hash modes
1040#
1041# CONFIG_CRYPTO_HMAC is not set
1042# CONFIG_CRYPTO_XCBC is not set
1043
1044#
1045# Digest
1046#
1047# CONFIG_CRYPTO_CRC32C is not set
1048# CONFIG_CRYPTO_MD4 is not set
1049# CONFIG_CRYPTO_MD5 is not set
1050# CONFIG_CRYPTO_MICHAEL_MIC is not set
1051# CONFIG_CRYPTO_SHA1 is not set
1052# CONFIG_CRYPTO_SHA256 is not set
1053# CONFIG_CRYPTO_SHA512 is not set
1054# CONFIG_CRYPTO_TGR192 is not set
1055# CONFIG_CRYPTO_WP512 is not set
1056
1057#
1058# Ciphers
1059#
1060# CONFIG_CRYPTO_AES is not set
1061# CONFIG_CRYPTO_ANUBIS is not set
1062# CONFIG_CRYPTO_ARC4 is not set
1063# CONFIG_CRYPTO_BLOWFISH is not set
1064# CONFIG_CRYPTO_CAMELLIA is not set
1065# CONFIG_CRYPTO_CAST5 is not set
1066# CONFIG_CRYPTO_CAST6 is not set
1067# CONFIG_CRYPTO_DES is not set
1068# CONFIG_CRYPTO_FCRYPT is not set
1069# CONFIG_CRYPTO_KHAZAD is not set
1070# CONFIG_CRYPTO_SALSA20 is not set
1071# CONFIG_CRYPTO_SEED is not set
1072# CONFIG_CRYPTO_SERPENT is not set
1073# CONFIG_CRYPTO_TEA is not set
1074# CONFIG_CRYPTO_TWOFISH is not set
1075
1076#
1077# Compression
1078#
1079# CONFIG_CRYPTO_DEFLATE is not set
1080# CONFIG_CRYPTO_LZO is not set
1081CONFIG_CRYPTO_HW=y
1082
1083#
1084# Library routines
1085#
1086CONFIG_BITREVERSE=y
1087# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1088# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1089CONFIG_CRC_CCITT=m
1090# CONFIG_CRC16 is not set
1091# CONFIG_CRC_ITU_T is not set
1092CONFIG_CRC32=y
1093# CONFIG_CRC7 is not set
1094# CONFIG_LIBCRC32C is not set
1095CONFIG_ZLIB_INFLATE=y
1096CONFIG_ZLIB_DEFLATE=y
1097CONFIG_PLIST=y
1098CONFIG_HAS_IOMEM=y
1099CONFIG_HAS_IOPORT=y
1100CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/netx_defconfig b/arch/arm/configs/netx_defconfig
index 57f32f39d0ff..0884f2370c3a 100644
--- a/arch/arm/configs/netx_defconfig
+++ b/arch/arm/configs/netx_defconfig
@@ -154,7 +154,6 @@ CONFIG_ARM_AMBA=y
154# Kernel Features 154# Kernel Features
155# 155#
156CONFIG_PREEMPT=y 156CONFIG_PREEMPT=y
157# CONFIG_NO_IDLE_HZ is not set
158CONFIG_HZ=100 157CONFIG_HZ=100
159# CONFIG_AEABI is not set 158# CONFIG_AEABI is not set
160# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 159# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/onearm_defconfig b/arch/arm/configs/onearm_defconfig
index 650a248613e5..418ca2febbe3 100644
--- a/arch/arm/configs/onearm_defconfig
+++ b/arch/arm/configs/onearm_defconfig
@@ -202,7 +202,6 @@ CONFIG_AT91_CF=y
202# Kernel Features 202# Kernel Features
203# 203#
204# CONFIG_PREEMPT is not set 204# CONFIG_PREEMPT is not set
205# CONFIG_NO_IDLE_HZ is not set
206CONFIG_HZ=100 205CONFIG_HZ=100
207# CONFIG_AEABI is not set 206# CONFIG_AEABI is not set
208# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 207# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/orion5x_defconfig b/arch/arm/configs/orion5x_defconfig
index 52cd99bd52fb..9578b5d9f9c7 100644
--- a/arch/arm/configs/orion5x_defconfig
+++ b/arch/arm/configs/orion5x_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24 3# Linux kernel version: 2.6.26-rc4
4# Thu Feb 7 14:10:30 2008 4# Mon Jun 2 23:54:48 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -21,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
24CONFIG_ZONE_DMA=y 25CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000 26CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -40,24 +41,24 @@ CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set 41# CONFIG_POSIX_MQUEUE is not set
41# CONFIG_BSD_PROCESS_ACCT is not set 42# CONFIG_BSD_PROCESS_ACCT is not set
42# CONFIG_TASKSTATS is not set 43# CONFIG_TASKSTATS is not set
43# CONFIG_USER_NS is not set
44# CONFIG_PID_NS is not set
45# CONFIG_AUDIT is not set 44# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set 45# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14 46CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set 47# CONFIG_CGROUPS is not set
49CONFIG_FAIR_GROUP_SCHED=y 48# CONFIG_GROUP_SCHED is not set
50CONFIG_FAIR_USER_SCHED=y
51# CONFIG_FAIR_CGROUP_SCHED is not set
52CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
53# CONFIG_RELAY is not set 51# CONFIG_RELAY is not set
52# CONFIG_NAMESPACES is not set
54# CONFIG_BLK_DEV_INITRD is not set 53# CONFIG_BLK_DEV_INITRD is not set
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y 54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56CONFIG_SYSCTL=y 55CONFIG_SYSCTL=y
57CONFIG_EMBEDDED=y 56CONFIG_EMBEDDED=y
58CONFIG_UID16=y 57CONFIG_UID16=y
59CONFIG_SYSCTL_SYSCALL=y 58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_SYSCTL_SYSCALL_CHECK=y
60CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
61CONFIG_KALLSYMS_ALL=y
61# CONFIG_KALLSYMS_EXTRA_PASS is not set 62# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y 63CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y 64CONFIG_PRINTK=y
@@ -73,20 +74,25 @@ CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y 74CONFIG_EVENTFD=y
74CONFIG_SHMEM=y 75CONFIG_SHMEM=y
75CONFIG_VM_EVENT_COUNTERS=y 76CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLAB=y 77# CONFIG_SLUB_DEBUG is not set
77# CONFIG_SLUB is not set 78# CONFIG_SLAB is not set
79CONFIG_SLUB=y
78# CONFIG_SLOB is not set 80# CONFIG_SLOB is not set
79# CONFIG_PROFILING is not set 81CONFIG_PROFILING=y
80# CONFIG_MARKERS is not set 82# CONFIG_MARKERS is not set
83CONFIG_OPROFILE=y
81CONFIG_HAVE_OPROFILE=y 84CONFIG_HAVE_OPROFILE=y
82# CONFIG_KPROBES is not set 85CONFIG_KPROBES=y
86CONFIG_KRETPROBES=y
83CONFIG_HAVE_KPROBES=y 87CONFIG_HAVE_KPROBES=y
88CONFIG_HAVE_KRETPROBES=y
89# CONFIG_HAVE_DMA_ATTRS is not set
84CONFIG_PROC_PAGE_MONITOR=y 90CONFIG_PROC_PAGE_MONITOR=y
85CONFIG_SLABINFO=y
86CONFIG_RT_MUTEXES=y 91CONFIG_RT_MUTEXES=y
87# CONFIG_TINY_SHMEM is not set 92# CONFIG_TINY_SHMEM is not set
88CONFIG_BASE_SMALL=0 93CONFIG_BASE_SMALL=0
89CONFIG_MODULES=y 94CONFIG_MODULES=y
95# CONFIG_MODULE_FORCE_LOAD is not set
90CONFIG_MODULE_UNLOAD=y 96CONFIG_MODULE_UNLOAD=y
91# CONFIG_MODULE_FORCE_UNLOAD is not set 97# CONFIG_MODULE_FORCE_UNLOAD is not set
92# CONFIG_MODVERSIONS is not set 98# CONFIG_MODVERSIONS is not set
@@ -111,7 +117,6 @@ CONFIG_DEFAULT_CFQ=y
111# CONFIG_DEFAULT_NOOP is not set 117# CONFIG_DEFAULT_NOOP is not set
112CONFIG_DEFAULT_IOSCHED="cfq" 118CONFIG_DEFAULT_IOSCHED="cfq"
113CONFIG_CLASSIC_RCU=y 119CONFIG_CLASSIC_RCU=y
114# CONFIG_PREEMPT_RCU is not set
115 120
116# 121#
117# System Type 122# System Type
@@ -160,6 +165,15 @@ CONFIG_MACH_RD88F5182=y
160CONFIG_MACH_KUROBOX_PRO=y 165CONFIG_MACH_KUROBOX_PRO=y
161CONFIG_MACH_DNS323=y 166CONFIG_MACH_DNS323=y
162CONFIG_MACH_TS209=y 167CONFIG_MACH_TS209=y
168CONFIG_MACH_LINKSTATION_PRO=y
169CONFIG_MACH_TS409=y
170CONFIG_MACH_WRT350N_V2=y
171CONFIG_MACH_TS78XX=y
172CONFIG_MACH_MV2120=y
173CONFIG_MACH_MSS2=y
174CONFIG_MACH_WNR854T=y
175CONFIG_MACH_RD88F5181L_GE=y
176CONFIG_MACH_RD88F5181L_FXO=y
163 177
164# 178#
165# Boot options 179# Boot options
@@ -168,6 +182,7 @@ CONFIG_MACH_TS209=y
168# 182#
169# Power management 183# Power management
170# 184#
185CONFIG_PLAT_ORION=y
171 186
172# 187#
173# Processor Type 188# Processor Type
@@ -177,8 +192,9 @@ CONFIG_CPU_FEROCEON=y
177CONFIG_CPU_FEROCEON_OLD_ID=y 192CONFIG_CPU_FEROCEON_OLD_ID=y
178CONFIG_CPU_32v5=y 193CONFIG_CPU_32v5=y
179CONFIG_CPU_ABRT_EV5T=y 194CONFIG_CPU_ABRT_EV5T=y
195CONFIG_CPU_PABRT_NOIFAR=y
180CONFIG_CPU_CACHE_VIVT=y 196CONFIG_CPU_CACHE_VIVT=y
181CONFIG_CPU_COPY_V4WB=y 197CONFIG_CPU_COPY_FEROCEON=y
182CONFIG_CPU_TLB_V4WBI=y 198CONFIG_CPU_TLB_V4WBI=y
183CONFIG_CPU_CP15=y 199CONFIG_CPU_CP15=y
184CONFIG_CPU_CP15_MMU=y 200CONFIG_CPU_CP15_MMU=y
@@ -189,7 +205,6 @@ CONFIG_CPU_CP15_MMU=y
189CONFIG_ARM_THUMB=y 205CONFIG_ARM_THUMB=y
190# CONFIG_CPU_ICACHE_DISABLE is not set 206# CONFIG_CPU_ICACHE_DISABLE is not set
191# CONFIG_CPU_DCACHE_DISABLE is not set 207# CONFIG_CPU_DCACHE_DISABLE is not set
192# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
193# CONFIG_OUTER_CACHE is not set 208# CONFIG_OUTER_CACHE is not set
194 209
195# 210#
@@ -199,6 +214,7 @@ CONFIG_PCI=y
199CONFIG_PCI_SYSCALL=y 214CONFIG_PCI_SYSCALL=y
200# CONFIG_ARCH_SUPPORTS_MSI is not set 215# CONFIG_ARCH_SUPPORTS_MSI is not set
201CONFIG_PCI_LEGACY=y 216CONFIG_PCI_LEGACY=y
217# CONFIG_PCI_DEBUG is not set
202# CONFIG_PCCARD is not set 218# CONFIG_PCCARD is not set
203 219
204# 220#
@@ -221,6 +237,7 @@ CONFIG_FLATMEM=y
221CONFIG_FLAT_NODE_MEM_MAP=y 237CONFIG_FLAT_NODE_MEM_MAP=y
222# CONFIG_SPARSEMEM_STATIC is not set 238# CONFIG_SPARSEMEM_STATIC is not set
223# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 239# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
240CONFIG_PAGEFLAGS_EXTENDED=y
224CONFIG_SPLIT_PTLOCK_CPUS=4096 241CONFIG_SPLIT_PTLOCK_CPUS=4096
225# CONFIG_RESOURCES_64BIT is not set 242# CONFIG_RESOURCES_64BIT is not set
226CONFIG_ZONE_DMA_FLAG=1 243CONFIG_ZONE_DMA_FLAG=1
@@ -238,7 +255,6 @@ CONFIG_ZBOOT_ROM_BSS=0x0
238CONFIG_CMDLINE="" 255CONFIG_CMDLINE=""
239# CONFIG_XIP_KERNEL is not set 256# CONFIG_XIP_KERNEL is not set
240# CONFIG_KEXEC is not set 257# CONFIG_KEXEC is not set
241# CONFIG_ATAGS_PROC is not set
242 258
243# 259#
244# Floating point emulation 260# Floating point emulation
@@ -311,8 +327,6 @@ CONFIG_TCP_CONG_CUBIC=y
311CONFIG_DEFAULT_TCP_CONG="cubic" 327CONFIG_DEFAULT_TCP_CONG="cubic"
312# CONFIG_TCP_MD5SIG is not set 328# CONFIG_TCP_MD5SIG is not set
313# CONFIG_IPV6 is not set 329# CONFIG_IPV6 is not set
314# CONFIG_INET6_XFRM_TUNNEL is not set
315# CONFIG_INET6_TUNNEL is not set
316# CONFIG_NETWORK_SECMARK is not set 330# CONFIG_NETWORK_SECMARK is not set
317# CONFIG_NETFILTER is not set 331# CONFIG_NETFILTER is not set
318# CONFIG_IP_DCCP is not set 332# CONFIG_IP_DCCP is not set
@@ -335,6 +349,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
335# Network testing 349# Network testing
336# 350#
337CONFIG_NET_PKTGEN=m 351CONFIG_NET_PKTGEN=m
352# CONFIG_NET_TCPPROBE is not set
338# CONFIG_HAMRADIO is not set 353# CONFIG_HAMRADIO is not set
339# CONFIG_CAN is not set 354# CONFIG_CAN is not set
340# CONFIG_IRDA is not set 355# CONFIG_IRDA is not set
@@ -362,6 +377,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
362CONFIG_STANDALONE=y 377CONFIG_STANDALONE=y
363CONFIG_PREVENT_FIRMWARE_BUILD=y 378CONFIG_PREVENT_FIRMWARE_BUILD=y
364CONFIG_FW_LOADER=y 379CONFIG_FW_LOADER=y
380# CONFIG_DEBUG_DRIVER is not set
381# CONFIG_DEBUG_DEVRES is not set
365# CONFIG_SYS_HYPERVISOR is not set 382# CONFIG_SYS_HYPERVISOR is not set
366# CONFIG_CONNECTOR is not set 383# CONFIG_CONNECTOR is not set
367CONFIG_MTD=y 384CONFIG_MTD=y
@@ -371,6 +388,7 @@ CONFIG_MTD_PARTITIONS=y
371# CONFIG_MTD_REDBOOT_PARTS is not set 388# CONFIG_MTD_REDBOOT_PARTS is not set
372CONFIG_MTD_CMDLINE_PARTS=y 389CONFIG_MTD_CMDLINE_PARTS=y
373# CONFIG_MTD_AFS_PARTS is not set 390# CONFIG_MTD_AFS_PARTS is not set
391# CONFIG_MTD_AR7_PARTS is not set
374 392
375# 393#
376# User Modules And Translation Layers 394# User Modules And Translation Layers
@@ -378,9 +396,8 @@ CONFIG_MTD_CMDLINE_PARTS=y
378CONFIG_MTD_CHAR=y 396CONFIG_MTD_CHAR=y
379CONFIG_MTD_BLKDEVS=y 397CONFIG_MTD_BLKDEVS=y
380CONFIG_MTD_BLOCK=y 398CONFIG_MTD_BLOCK=y
381CONFIG_FTL=y 399# CONFIG_FTL is not set
382CONFIG_NFTL=y 400# CONFIG_NFTL is not set
383# CONFIG_NFTL_RW is not set
384# CONFIG_INFTL is not set 401# CONFIG_INFTL is not set
385# CONFIG_RFD_FTL is not set 402# CONFIG_RFD_FTL is not set
386# CONFIG_SSFDC is not set 403# CONFIG_SSFDC is not set
@@ -405,12 +422,12 @@ CONFIG_MTD_MAP_BANK_WIDTH_4=y
405# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set 422# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
406CONFIG_MTD_CFI_I1=y 423CONFIG_MTD_CFI_I1=y
407CONFIG_MTD_CFI_I2=y 424CONFIG_MTD_CFI_I2=y
408CONFIG_MTD_CFI_I4=y 425# CONFIG_MTD_CFI_I4 is not set
409# CONFIG_MTD_CFI_I8 is not set 426# CONFIG_MTD_CFI_I8 is not set
410# CONFIG_MTD_OTP is not set 427# CONFIG_MTD_OTP is not set
411CONFIG_MTD_CFI_INTELEXT=y 428CONFIG_MTD_CFI_INTELEXT=y
412CONFIG_MTD_CFI_AMDSTD=y 429CONFIG_MTD_CFI_AMDSTD=y
413CONFIG_MTD_CFI_STAA=y 430# CONFIG_MTD_CFI_STAA is not set
414CONFIG_MTD_CFI_UTIL=y 431CONFIG_MTD_CFI_UTIL=y
415# CONFIG_MTD_RAM is not set 432# CONFIG_MTD_RAM is not set
416# CONFIG_MTD_ROM is not set 433# CONFIG_MTD_ROM is not set
@@ -481,6 +498,9 @@ CONFIG_MISC_DEVICES=y
481# CONFIG_EEPROM_93CX6 is not set 498# CONFIG_EEPROM_93CX6 is not set
482# CONFIG_SGI_IOC4 is not set 499# CONFIG_SGI_IOC4 is not set
483# CONFIG_TIFM_CORE is not set 500# CONFIG_TIFM_CORE is not set
501# CONFIG_ENCLOSURE_SERVICES is not set
502CONFIG_HAVE_IDE=y
503# CONFIG_IDE is not set
484 504
485# 505#
486# SCSI device support 506# SCSI device support
@@ -542,6 +562,7 @@ CONFIG_SCSI_LOWLEVEL=y
542# CONFIG_SCSI_IPS is not set 562# CONFIG_SCSI_IPS is not set
543# CONFIG_SCSI_INITIO is not set 563# CONFIG_SCSI_INITIO is not set
544# CONFIG_SCSI_INIA100 is not set 564# CONFIG_SCSI_INIA100 is not set
565# CONFIG_SCSI_MVSAS is not set
545# CONFIG_SCSI_STEX is not set 566# CONFIG_SCSI_STEX is not set
546# CONFIG_SCSI_SYM53C8XX_2 is not set 567# CONFIG_SCSI_SYM53C8XX_2 is not set
547# CONFIG_SCSI_IPR is not set 568# CONFIG_SCSI_IPR is not set
@@ -556,7 +577,10 @@ CONFIG_SCSI_LOWLEVEL=y
556# CONFIG_SCSI_SRP is not set 577# CONFIG_SCSI_SRP is not set
557CONFIG_ATA=y 578CONFIG_ATA=y
558# CONFIG_ATA_NONSTANDARD is not set 579# CONFIG_ATA_NONSTANDARD is not set
580CONFIG_SATA_PMP=y
559# CONFIG_SATA_AHCI is not set 581# CONFIG_SATA_AHCI is not set
582# CONFIG_SATA_SIL24 is not set
583CONFIG_ATA_SFF=y
560# CONFIG_SATA_SVW is not set 584# CONFIG_SATA_SVW is not set
561# CONFIG_ATA_PIIX is not set 585# CONFIG_ATA_PIIX is not set
562CONFIG_SATA_MV=y 586CONFIG_SATA_MV=y
@@ -566,7 +590,6 @@ CONFIG_SATA_MV=y
566# CONFIG_SATA_PROMISE is not set 590# CONFIG_SATA_PROMISE is not set
567# CONFIG_SATA_SX4 is not set 591# CONFIG_SATA_SX4 is not set
568# CONFIG_SATA_SIL is not set 592# CONFIG_SATA_SIL is not set
569# CONFIG_SATA_SIL24 is not set
570# CONFIG_SATA_SIS is not set 593# CONFIG_SATA_SIS is not set
571# CONFIG_SATA_ULI is not set 594# CONFIG_SATA_ULI is not set
572# CONFIG_SATA_VIA is not set 595# CONFIG_SATA_VIA is not set
@@ -611,6 +634,7 @@ CONFIG_SATA_MV=y
611# CONFIG_PATA_VIA is not set 634# CONFIG_PATA_VIA is not set
612# CONFIG_PATA_WINBOND is not set 635# CONFIG_PATA_WINBOND is not set
613# CONFIG_PATA_PLATFORM is not set 636# CONFIG_PATA_PLATFORM is not set
637# CONFIG_PATA_SCH is not set
614# CONFIG_MD is not set 638# CONFIG_MD is not set
615# CONFIG_FUSION is not set 639# CONFIG_FUSION is not set
616 640
@@ -652,7 +676,7 @@ CONFIG_NET_PCI=y
652# CONFIG_B44 is not set 676# CONFIG_B44 is not set
653# CONFIG_FORCEDETH is not set 677# CONFIG_FORCEDETH is not set
654# CONFIG_EEPRO100 is not set 678# CONFIG_EEPRO100 is not set
655CONFIG_E100=y 679# CONFIG_E100 is not set
656# CONFIG_FEALNX is not set 680# CONFIG_FEALNX is not set
657# CONFIG_NATSEMI is not set 681# CONFIG_NATSEMI is not set
658# CONFIG_NE2K_PCI is not set 682# CONFIG_NE2K_PCI is not set
@@ -668,9 +692,7 @@ CONFIG_E100=y
668CONFIG_NETDEV_1000=y 692CONFIG_NETDEV_1000=y
669# CONFIG_ACENIC is not set 693# CONFIG_ACENIC is not set
670# CONFIG_DL2K is not set 694# CONFIG_DL2K is not set
671CONFIG_E1000=y 695# CONFIG_E1000 is not set
672CONFIG_E1000_NAPI=y
673# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
674# CONFIG_E1000E is not set 696# CONFIG_E1000E is not set
675# CONFIG_E1000E_ENABLED is not set 697# CONFIG_E1000E_ENABLED is not set
676# CONFIG_IP1000 is not set 698# CONFIG_IP1000 is not set
@@ -680,27 +702,15 @@ CONFIG_E1000_NAPI=y
680# CONFIG_YELLOWFIN is not set 702# CONFIG_YELLOWFIN is not set
681# CONFIG_R8169 is not set 703# CONFIG_R8169 is not set
682# CONFIG_SIS190 is not set 704# CONFIG_SIS190 is not set
683CONFIG_SKGE=y 705# CONFIG_SKGE is not set
684CONFIG_SKY2=y 706# CONFIG_SKY2 is not set
685# CONFIG_SK98LIN is not set
686# CONFIG_VIA_VELOCITY is not set 707# CONFIG_VIA_VELOCITY is not set
687CONFIG_TIGON3=y 708# CONFIG_TIGON3 is not set
688# CONFIG_BNX2 is not set 709# CONFIG_BNX2 is not set
689CONFIG_MV643XX_ETH=y 710CONFIG_MV643XX_ETH=y
690# CONFIG_QLA3XXX is not set 711# CONFIG_QLA3XXX is not set
691# CONFIG_ATL1 is not set 712# CONFIG_ATL1 is not set
692CONFIG_NETDEV_10000=y 713# CONFIG_NETDEV_10000 is not set
693# CONFIG_CHELSIO_T1 is not set
694# CONFIG_CHELSIO_T3 is not set
695# CONFIG_IXGBE is not set
696# CONFIG_IXGB is not set
697# CONFIG_S2IO is not set
698# CONFIG_MYRI10GE is not set
699# CONFIG_NETXEN_NIC is not set
700# CONFIG_NIU is not set
701# CONFIG_MLX4_CORE is not set
702# CONFIG_TEHUTI is not set
703# CONFIG_BNX2X is not set
704# CONFIG_TR is not set 714# CONFIG_TR is not set
705 715
706# 716#
@@ -708,6 +718,7 @@ CONFIG_NETDEV_10000=y
708# 718#
709# CONFIG_WLAN_PRE80211 is not set 719# CONFIG_WLAN_PRE80211 is not set
710# CONFIG_WLAN_80211 is not set 720# CONFIG_WLAN_80211 is not set
721# CONFIG_IWLWIFI_LEDS is not set
711 722
712# 723#
713# USB Network Adapters 724# USB Network Adapters
@@ -738,12 +749,9 @@ CONFIG_INPUT=y
738# 749#
739# Userland interfaces 750# Userland interfaces
740# 751#
741CONFIG_INPUT_MOUSEDEV=y 752# CONFIG_INPUT_MOUSEDEV is not set
742CONFIG_INPUT_MOUSEDEV_PSAUX=y
743CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
744CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
745# CONFIG_INPUT_JOYDEV is not set 753# CONFIG_INPUT_JOYDEV is not set
746# CONFIG_INPUT_EVDEV is not set 754CONFIG_INPUT_EVDEV=y
747# CONFIG_INPUT_EVBUG is not set 755# CONFIG_INPUT_EVBUG is not set
748 756
749# 757#
@@ -765,10 +773,8 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
765# 773#
766# Character devices 774# Character devices
767# 775#
768CONFIG_VT=y 776# CONFIG_VT is not set
769CONFIG_VT_CONSOLE=y 777CONFIG_DEVKMEM=y
770CONFIG_HW_CONSOLE=y
771# CONFIG_VT_HW_CONSOLE_BINDING is not set
772# CONFIG_SERIAL_NONSTANDARD is not set 778# CONFIG_SERIAL_NONSTANDARD is not set
773# CONFIG_NOZOMI is not set 779# CONFIG_NOZOMI is not set
774 780
@@ -777,7 +783,7 @@ CONFIG_HW_CONSOLE=y
777# 783#
778CONFIG_SERIAL_8250=y 784CONFIG_SERIAL_8250=y
779CONFIG_SERIAL_8250_CONSOLE=y 785CONFIG_SERIAL_8250_CONSOLE=y
780CONFIG_SERIAL_8250_PCI=y 786# CONFIG_SERIAL_8250_PCI is not set
781CONFIG_SERIAL_8250_NR_UARTS=4 787CONFIG_SERIAL_8250_NR_UARTS=4
782CONFIG_SERIAL_8250_RUNTIME_UARTS=2 788CONFIG_SERIAL_8250_RUNTIME_UARTS=2
783# CONFIG_SERIAL_8250_EXTENDED is not set 789# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -792,7 +798,7 @@ CONFIG_UNIX98_PTYS=y
792CONFIG_LEGACY_PTYS=y 798CONFIG_LEGACY_PTYS=y
793CONFIG_LEGACY_PTY_COUNT=16 799CONFIG_LEGACY_PTY_COUNT=16
794# CONFIG_IPMI_HANDLER is not set 800# CONFIG_IPMI_HANDLER is not set
795CONFIG_HW_RANDOM=m 801# CONFIG_HW_RANDOM is not set
796# CONFIG_NVRAM is not set 802# CONFIG_NVRAM is not set
797# CONFIG_R3964 is not set 803# CONFIG_R3964 is not set
798# CONFIG_APPLICOM is not set 804# CONFIG_APPLICOM is not set
@@ -804,13 +810,6 @@ CONFIG_I2C_BOARDINFO=y
804CONFIG_I2C_CHARDEV=y 810CONFIG_I2C_CHARDEV=y
805 811
806# 812#
807# I2C Algorithms
808#
809# CONFIG_I2C_ALGOBIT is not set
810# CONFIG_I2C_ALGOPCF is not set
811# CONFIG_I2C_ALGOPCA is not set
812
813#
814# I2C Hardware Bus support 813# I2C Hardware Bus support
815# 814#
816# CONFIG_I2C_ALI1535 is not set 815# CONFIG_I2C_ALI1535 is not set
@@ -837,6 +836,7 @@ CONFIG_I2C_CHARDEV=y
837# CONFIG_I2C_VIA is not set 836# CONFIG_I2C_VIA is not set
838# CONFIG_I2C_VIAPRO is not set 837# CONFIG_I2C_VIAPRO is not set
839# CONFIG_I2C_VOODOO3 is not set 838# CONFIG_I2C_VOODOO3 is not set
839# CONFIG_I2C_PCA_PLATFORM is not set
840CONFIG_I2C_MV64XXX=y 840CONFIG_I2C_MV64XXX=y
841 841
842# 842#
@@ -847,19 +847,13 @@ CONFIG_I2C_MV64XXX=y
847# CONFIG_SENSORS_PCF8574 is not set 847# CONFIG_SENSORS_PCF8574 is not set
848# CONFIG_PCF8575 is not set 848# CONFIG_PCF8575 is not set
849# CONFIG_SENSORS_PCF8591 is not set 849# CONFIG_SENSORS_PCF8591 is not set
850# CONFIG_TPS65010 is not set
851# CONFIG_SENSORS_MAX6875 is not set 850# CONFIG_SENSORS_MAX6875 is not set
852# CONFIG_SENSORS_TSL2550 is not set 851# CONFIG_SENSORS_TSL2550 is not set
853# CONFIG_I2C_DEBUG_CORE is not set 852# CONFIG_I2C_DEBUG_CORE is not set
854# CONFIG_I2C_DEBUG_ALGO is not set 853# CONFIG_I2C_DEBUG_ALGO is not set
855# CONFIG_I2C_DEBUG_BUS is not set 854# CONFIG_I2C_DEBUG_BUS is not set
856# CONFIG_I2C_DEBUG_CHIP is not set 855# CONFIG_I2C_DEBUG_CHIP is not set
857
858#
859# SPI support
860#
861# CONFIG_SPI is not set 856# CONFIG_SPI is not set
862# CONFIG_SPI_MASTER is not set
863# CONFIG_W1 is not set 857# CONFIG_W1 is not set
864# CONFIG_POWER_SUPPLY is not set 858# CONFIG_POWER_SUPPLY is not set
865CONFIG_HWMON=y 859CONFIG_HWMON=y
@@ -872,6 +866,7 @@ CONFIG_HWMON=y
872# CONFIG_SENSORS_ADM1031 is not set 866# CONFIG_SENSORS_ADM1031 is not set
873# CONFIG_SENSORS_ADM9240 is not set 867# CONFIG_SENSORS_ADM9240 is not set
874# CONFIG_SENSORS_ADT7470 is not set 868# CONFIG_SENSORS_ADT7470 is not set
869# CONFIG_SENSORS_ADT7473 is not set
875# CONFIG_SENSORS_ATXP1 is not set 870# CONFIG_SENSORS_ATXP1 is not set
876# CONFIG_SENSORS_DS1621 is not set 871# CONFIG_SENSORS_DS1621 is not set
877# CONFIG_SENSORS_I5K_AMB is not set 872# CONFIG_SENSORS_I5K_AMB is not set
@@ -901,6 +896,7 @@ CONFIG_HWMON=y
901# CONFIG_SENSORS_SMSC47M1 is not set 896# CONFIG_SENSORS_SMSC47M1 is not set
902# CONFIG_SENSORS_SMSC47M192 is not set 897# CONFIG_SENSORS_SMSC47M192 is not set
903# CONFIG_SENSORS_SMSC47B397 is not set 898# CONFIG_SENSORS_SMSC47B397 is not set
899# CONFIG_SENSORS_ADS7828 is not set
904# CONFIG_SENSORS_THMC50 is not set 900# CONFIG_SENSORS_THMC50 is not set
905# CONFIG_SENSORS_VIA686A is not set 901# CONFIG_SENSORS_VIA686A is not set
906# CONFIG_SENSORS_VT1211 is not set 902# CONFIG_SENSORS_VT1211 is not set
@@ -910,6 +906,7 @@ CONFIG_HWMON=y
910# CONFIG_SENSORS_W83792D is not set 906# CONFIG_SENSORS_W83792D is not set
911# CONFIG_SENSORS_W83793 is not set 907# CONFIG_SENSORS_W83793 is not set
912# CONFIG_SENSORS_W83L785TS is not set 908# CONFIG_SENSORS_W83L785TS is not set
909# CONFIG_SENSORS_W83L786NG is not set
913# CONFIG_SENSORS_W83627HF is not set 910# CONFIG_SENSORS_W83627HF is not set
914# CONFIG_SENSORS_W83627EHF is not set 911# CONFIG_SENSORS_W83627EHF is not set
915# CONFIG_HWMON_DEBUG_CHIP is not set 912# CONFIG_HWMON_DEBUG_CHIP is not set
@@ -925,14 +922,24 @@ CONFIG_SSB_POSSIBLE=y
925# Multifunction device drivers 922# Multifunction device drivers
926# 923#
927# CONFIG_MFD_SM501 is not set 924# CONFIG_MFD_SM501 is not set
925# CONFIG_MFD_ASIC3 is not set
926# CONFIG_HTC_PASIC3 is not set
928 927
929# 928#
930# Multimedia devices 929# Multimedia devices
931# 930#
931
932#
933# Multimedia core support
934#
932# CONFIG_VIDEO_DEV is not set 935# CONFIG_VIDEO_DEV is not set
933# CONFIG_DVB_CORE is not set 936# CONFIG_DVB_CORE is not set
934CONFIG_DAB=y 937# CONFIG_VIDEO_MEDIA is not set
935# CONFIG_USB_DABUSB is not set 938
939#
940# Multimedia drivers
941#
942# CONFIG_DAB is not set
936 943
937# 944#
938# Graphics support 945# Graphics support
@@ -949,12 +956,6 @@ CONFIG_DAB=y
949# CONFIG_DISPLAY_SUPPORT is not set 956# CONFIG_DISPLAY_SUPPORT is not set
950 957
951# 958#
952# Console display driver support
953#
954# CONFIG_VGA_CONSOLE is not set
955CONFIG_DUMMY_CONSOLE=y
956
957#
958# Sound 959# Sound
959# 960#
960# CONFIG_SOUND is not set 961# CONFIG_SOUND is not set
@@ -985,14 +986,18 @@ CONFIG_USB_DEVICEFS=y
985CONFIG_USB_DEVICE_CLASS=y 986CONFIG_USB_DEVICE_CLASS=y
986# CONFIG_USB_DYNAMIC_MINORS is not set 987# CONFIG_USB_DYNAMIC_MINORS is not set
987# CONFIG_USB_OTG is not set 988# CONFIG_USB_OTG is not set
989# CONFIG_USB_OTG_WHITELIST is not set
990# CONFIG_USB_OTG_BLACKLIST_HUB is not set
988 991
989# 992#
990# USB Host Controller Drivers 993# USB Host Controller Drivers
991# 994#
995# CONFIG_USB_C67X00_HCD is not set
992CONFIG_USB_EHCI_HCD=y 996CONFIG_USB_EHCI_HCD=y
993CONFIG_USB_EHCI_ROOT_HUB_TT=y 997CONFIG_USB_EHCI_ROOT_HUB_TT=y
994CONFIG_USB_EHCI_TT_NEWSCHED=y 998CONFIG_USB_EHCI_TT_NEWSCHED=y
995# CONFIG_USB_ISP116X_HCD is not set 999# CONFIG_USB_ISP116X_HCD is not set
1000# CONFIG_USB_ISP1760_HCD is not set
996# CONFIG_USB_OHCI_HCD is not set 1001# CONFIG_USB_OHCI_HCD is not set
997# CONFIG_USB_UHCI_HCD is not set 1002# CONFIG_USB_UHCI_HCD is not set
998# CONFIG_USB_SL811_HCD is not set 1003# CONFIG_USB_SL811_HCD is not set
@@ -1003,6 +1008,7 @@ CONFIG_USB_EHCI_TT_NEWSCHED=y
1003# 1008#
1004# CONFIG_USB_ACM is not set 1009# CONFIG_USB_ACM is not set
1005CONFIG_USB_PRINTER=y 1010CONFIG_USB_PRINTER=y
1011# CONFIG_USB_WDM is not set
1006 1012
1007# 1013#
1008# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1014# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1022,7 +1028,9 @@ CONFIG_USB_STORAGE_SDDR09=y
1022CONFIG_USB_STORAGE_SDDR55=y 1028CONFIG_USB_STORAGE_SDDR55=y
1023CONFIG_USB_STORAGE_JUMPSHOT=y 1029CONFIG_USB_STORAGE_JUMPSHOT=y
1024# CONFIG_USB_STORAGE_ALAUDA is not set 1030# CONFIG_USB_STORAGE_ALAUDA is not set
1031# CONFIG_USB_STORAGE_ONETOUCH is not set
1025# CONFIG_USB_STORAGE_KARMA is not set 1032# CONFIG_USB_STORAGE_KARMA is not set
1033# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1026# CONFIG_USB_LIBUSUAL is not set 1034# CONFIG_USB_LIBUSUAL is not set
1027 1035
1028# 1036#
@@ -1060,6 +1068,7 @@ CONFIG_USB_STORAGE_JUMPSHOT=y
1060# CONFIG_USB_TRANCEVIBRATOR is not set 1068# CONFIG_USB_TRANCEVIBRATOR is not set
1061# CONFIG_USB_IOWARRIOR is not set 1069# CONFIG_USB_IOWARRIOR is not set
1062# CONFIG_USB_TEST is not set 1070# CONFIG_USB_TEST is not set
1071# CONFIG_USB_ISIGHTFW is not set
1063# CONFIG_USB_GADGET is not set 1072# CONFIG_USB_GADGET is not set
1064# CONFIG_MMC is not set 1073# CONFIG_MMC is not set
1065CONFIG_NEW_LEDS=y 1074CONFIG_NEW_LEDS=y
@@ -1068,7 +1077,7 @@ CONFIG_LEDS_CLASS=y
1068# 1077#
1069# LED drivers 1078# LED drivers
1070# 1079#
1071# CONFIG_LEDS_GPIO is not set 1080CONFIG_LEDS_GPIO=y
1072 1081
1073# 1082#
1074# LED Triggers 1083# LED Triggers
@@ -1076,6 +1085,7 @@ CONFIG_LEDS_CLASS=y
1076CONFIG_LEDS_TRIGGERS=y 1085CONFIG_LEDS_TRIGGERS=y
1077CONFIG_LEDS_TRIGGER_TIMER=y 1086CONFIG_LEDS_TRIGGER_TIMER=y
1078CONFIG_LEDS_TRIGGER_HEARTBEAT=y 1087CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1088CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
1079CONFIG_RTC_LIB=y 1089CONFIG_RTC_LIB=y
1080CONFIG_RTC_CLASS=y 1090CONFIG_RTC_CLASS=y
1081CONFIG_RTC_HCTOSYS=y 1091CONFIG_RTC_HCTOSYS=y
@@ -1105,6 +1115,7 @@ CONFIG_RTC_DRV_RS5C372=y
1105# CONFIG_RTC_DRV_PCF8583 is not set 1115# CONFIG_RTC_DRV_PCF8583 is not set
1106CONFIG_RTC_DRV_M41T80=y 1116CONFIG_RTC_DRV_M41T80=y
1107# CONFIG_RTC_DRV_M41T80_WDT is not set 1117# CONFIG_RTC_DRV_M41T80_WDT is not set
1118# CONFIG_RTC_DRV_S35390A is not set
1108 1119
1109# 1120#
1110# SPI RTC drivers 1121# SPI RTC drivers
@@ -1125,6 +1136,7 @@ CONFIG_RTC_DRV_M41T80=y
1125# 1136#
1126# on-CPU RTC drivers 1137# on-CPU RTC drivers
1127# 1138#
1139# CONFIG_UIO is not set
1128 1140
1129# 1141#
1130# File systems 1142# File systems
@@ -1140,14 +1152,11 @@ CONFIG_JBD=y
1140# CONFIG_JFS_FS is not set 1152# CONFIG_JFS_FS is not set
1141# CONFIG_FS_POSIX_ACL is not set 1153# CONFIG_FS_POSIX_ACL is not set
1142# CONFIG_XFS_FS is not set 1154# CONFIG_XFS_FS is not set
1143# CONFIG_GFS2_FS is not set
1144# CONFIG_OCFS2_FS is not set 1155# CONFIG_OCFS2_FS is not set
1145# CONFIG_MINIX_FS is not set 1156CONFIG_DNOTIFY=y
1146# CONFIG_ROMFS_FS is not set
1147CONFIG_INOTIFY=y 1157CONFIG_INOTIFY=y
1148CONFIG_INOTIFY_USER=y 1158CONFIG_INOTIFY_USER=y
1149# CONFIG_QUOTA is not set 1159# CONFIG_QUOTA is not set
1150CONFIG_DNOTIFY=y
1151# CONFIG_AUTOFS_FS is not set 1160# CONFIG_AUTOFS_FS is not set
1152# CONFIG_AUTOFS4_FS is not set 1161# CONFIG_AUTOFS4_FS is not set
1153# CONFIG_FUSE_FS is not set 1162# CONFIG_FUSE_FS is not set
@@ -1155,8 +1164,8 @@ CONFIG_DNOTIFY=y
1155# 1164#
1156# CD-ROM/DVD Filesystems 1165# CD-ROM/DVD Filesystems
1157# 1166#
1158CONFIG_ISO9660_FS=y 1167CONFIG_ISO9660_FS=m
1159# CONFIG_JOLIET is not set 1168CONFIG_JOLIET=y
1160# CONFIG_ZISOFS is not set 1169# CONFIG_ZISOFS is not set
1161CONFIG_UDF_FS=m 1170CONFIG_UDF_FS=m
1162CONFIG_UDF_NLS=y 1171CONFIG_UDF_NLS=y
@@ -1205,8 +1214,10 @@ CONFIG_JFFS2_RTIME=y
1205# CONFIG_JFFS2_RUBIN is not set 1214# CONFIG_JFFS2_RUBIN is not set
1206CONFIG_CRAMFS=y 1215CONFIG_CRAMFS=y
1207# CONFIG_VXFS_FS is not set 1216# CONFIG_VXFS_FS is not set
1217# CONFIG_MINIX_FS is not set
1208# CONFIG_HPFS_FS is not set 1218# CONFIG_HPFS_FS is not set
1209# CONFIG_QNX4FS_FS is not set 1219# CONFIG_QNX4FS_FS is not set
1220# CONFIG_ROMFS_FS is not set
1210# CONFIG_SYSV_FS is not set 1221# CONFIG_SYSV_FS is not set
1211# CONFIG_UFS_FS is not set 1222# CONFIG_UFS_FS is not set
1212CONFIG_NETWORK_FILESYSTEMS=y 1223CONFIG_NETWORK_FILESYSTEMS=y
@@ -1214,7 +1225,6 @@ CONFIG_NFS_FS=y
1214CONFIG_NFS_V3=y 1225CONFIG_NFS_V3=y
1215# CONFIG_NFS_V3_ACL is not set 1226# CONFIG_NFS_V3_ACL is not set
1216# CONFIG_NFS_V4 is not set 1227# CONFIG_NFS_V4 is not set
1217# CONFIG_NFS_DIRECTIO is not set
1218# CONFIG_NFSD is not set 1228# CONFIG_NFSD is not set
1219CONFIG_ROOT_NFS=y 1229CONFIG_ROOT_NFS=y
1220CONFIG_LOCKD=y 1230CONFIG_LOCKD=y
@@ -1241,14 +1251,13 @@ CONFIG_PARTITION_ADVANCED=y
1241# CONFIG_MAC_PARTITION is not set 1251# CONFIG_MAC_PARTITION is not set
1242CONFIG_MSDOS_PARTITION=y 1252CONFIG_MSDOS_PARTITION=y
1243CONFIG_BSD_DISKLABEL=y 1253CONFIG_BSD_DISKLABEL=y
1244CONFIG_MINIX_SUBPARTITION=y 1254# CONFIG_MINIX_SUBPARTITION is not set
1245CONFIG_SOLARIS_X86_PARTITION=y 1255# CONFIG_SOLARIS_X86_PARTITION is not set
1246CONFIG_UNIXWARE_DISKLABEL=y 1256# CONFIG_UNIXWARE_DISKLABEL is not set
1247CONFIG_LDM_PARTITION=y 1257# CONFIG_LDM_PARTITION is not set
1248CONFIG_LDM_DEBUG=y
1249# CONFIG_SGI_PARTITION is not set 1258# CONFIG_SGI_PARTITION is not set
1250# CONFIG_ULTRIX_PARTITION is not set 1259# CONFIG_ULTRIX_PARTITION is not set
1251CONFIG_SUN_PARTITION=y 1260# CONFIG_SUN_PARTITION is not set
1252# CONFIG_KARMA_PARTITION is not set 1261# CONFIG_KARMA_PARTITION is not set
1253# CONFIG_EFI_PARTITION is not set 1262# CONFIG_EFI_PARTITION is not set
1254# CONFIG_SYSV68_PARTITION is not set 1263# CONFIG_SYSV68_PARTITION is not set
@@ -1300,15 +1309,48 @@ CONFIG_NLS_ISO8859_2=y
1300# CONFIG_PRINTK_TIME is not set 1309# CONFIG_PRINTK_TIME is not set
1301CONFIG_ENABLE_WARN_DEPRECATED=y 1310CONFIG_ENABLE_WARN_DEPRECATED=y
1302CONFIG_ENABLE_MUST_CHECK=y 1311CONFIG_ENABLE_MUST_CHECK=y
1303# CONFIG_MAGIC_SYSRQ is not set 1312CONFIG_FRAME_WARN=1024
1313CONFIG_MAGIC_SYSRQ=y
1304# CONFIG_UNUSED_SYMBOLS is not set 1314# CONFIG_UNUSED_SYMBOLS is not set
1305# CONFIG_DEBUG_FS is not set 1315# CONFIG_DEBUG_FS is not set
1306# CONFIG_HEADERS_CHECK is not set 1316# CONFIG_HEADERS_CHECK is not set
1307# CONFIG_DEBUG_KERNEL is not set 1317CONFIG_DEBUG_KERNEL=y
1318# CONFIG_DEBUG_SHIRQ is not set
1319CONFIG_DETECT_SOFTLOCKUP=y
1320CONFIG_SCHED_DEBUG=y
1321CONFIG_SCHEDSTATS=y
1322# CONFIG_TIMER_STATS is not set
1323# CONFIG_DEBUG_OBJECTS is not set
1324CONFIG_DEBUG_PREEMPT=y
1325# CONFIG_DEBUG_RT_MUTEXES is not set
1326# CONFIG_RT_MUTEX_TESTER is not set
1327# CONFIG_DEBUG_SPINLOCK is not set
1328# CONFIG_DEBUG_MUTEXES is not set
1329# CONFIG_DEBUG_LOCK_ALLOC is not set
1330# CONFIG_PROVE_LOCKING is not set
1331# CONFIG_LOCK_STAT is not set
1332# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1333# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1334# CONFIG_DEBUG_KOBJECT is not set
1308# CONFIG_DEBUG_BUGVERBOSE is not set 1335# CONFIG_DEBUG_BUGVERBOSE is not set
1336CONFIG_DEBUG_INFO=y
1337# CONFIG_DEBUG_VM is not set
1338# CONFIG_DEBUG_WRITECOUNT is not set
1339# CONFIG_DEBUG_LIST is not set
1340# CONFIG_DEBUG_SG is not set
1309CONFIG_FRAME_POINTER=y 1341CONFIG_FRAME_POINTER=y
1342# CONFIG_BOOT_PRINTK_DELAY is not set
1343# CONFIG_RCU_TORTURE_TEST is not set
1344# CONFIG_KPROBES_SANITY_TEST is not set
1345# CONFIG_BACKTRACE_SELF_TEST is not set
1346# CONFIG_LKDTM is not set
1347# CONFIG_FAULT_INJECTION is not set
1310# CONFIG_SAMPLES is not set 1348# CONFIG_SAMPLES is not set
1311CONFIG_DEBUG_USER=y 1349CONFIG_DEBUG_USER=y
1350CONFIG_DEBUG_ERRORS=y
1351# CONFIG_DEBUG_STACK_USAGE is not set
1352CONFIG_DEBUG_LL=y
1353# CONFIG_DEBUG_ICEDCC is not set
1312 1354
1313# 1355#
1314# Security options 1356# Security options
@@ -1317,50 +1359,79 @@ CONFIG_DEBUG_USER=y
1317# CONFIG_SECURITY is not set 1359# CONFIG_SECURITY is not set
1318# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1360# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1319CONFIG_CRYPTO=y 1361CONFIG_CRYPTO=y
1362
1363#
1364# Crypto core or helper
1365#
1320CONFIG_CRYPTO_ALGAPI=m 1366CONFIG_CRYPTO_ALGAPI=m
1321CONFIG_CRYPTO_BLKCIPHER=m 1367CONFIG_CRYPTO_BLKCIPHER=m
1322# CONFIG_CRYPTO_SEQIV is not set
1323CONFIG_CRYPTO_MANAGER=m 1368CONFIG_CRYPTO_MANAGER=m
1369# CONFIG_CRYPTO_GF128MUL is not set
1370# CONFIG_CRYPTO_NULL is not set
1371# CONFIG_CRYPTO_CRYPTD is not set
1372# CONFIG_CRYPTO_AUTHENC is not set
1373# CONFIG_CRYPTO_TEST is not set
1374
1375#
1376# Authenticated Encryption with Associated Data
1377#
1378# CONFIG_CRYPTO_CCM is not set
1379# CONFIG_CRYPTO_GCM is not set
1380# CONFIG_CRYPTO_SEQIV is not set
1381
1382#
1383# Block modes
1384#
1385CONFIG_CRYPTO_CBC=m
1386# CONFIG_CRYPTO_CTR is not set
1387# CONFIG_CRYPTO_CTS is not set
1388CONFIG_CRYPTO_ECB=m
1389# CONFIG_CRYPTO_LRW is not set
1390CONFIG_CRYPTO_PCBC=m
1391# CONFIG_CRYPTO_XTS is not set
1392
1393#
1394# Hash modes
1395#
1324# CONFIG_CRYPTO_HMAC is not set 1396# CONFIG_CRYPTO_HMAC is not set
1325# CONFIG_CRYPTO_XCBC is not set 1397# CONFIG_CRYPTO_XCBC is not set
1326# CONFIG_CRYPTO_NULL is not set 1398
1399#
1400# Digest
1401#
1402# CONFIG_CRYPTO_CRC32C is not set
1327# CONFIG_CRYPTO_MD4 is not set 1403# CONFIG_CRYPTO_MD4 is not set
1328# CONFIG_CRYPTO_MD5 is not set 1404# CONFIG_CRYPTO_MD5 is not set
1405# CONFIG_CRYPTO_MICHAEL_MIC is not set
1329# CONFIG_CRYPTO_SHA1 is not set 1406# CONFIG_CRYPTO_SHA1 is not set
1330# CONFIG_CRYPTO_SHA256 is not set 1407# CONFIG_CRYPTO_SHA256 is not set
1331# CONFIG_CRYPTO_SHA512 is not set 1408# CONFIG_CRYPTO_SHA512 is not set
1332# CONFIG_CRYPTO_WP512 is not set
1333# CONFIG_CRYPTO_TGR192 is not set 1409# CONFIG_CRYPTO_TGR192 is not set
1334# CONFIG_CRYPTO_GF128MUL is not set 1410# CONFIG_CRYPTO_WP512 is not set
1335CONFIG_CRYPTO_ECB=m 1411
1336CONFIG_CRYPTO_CBC=m 1412#
1337CONFIG_CRYPTO_PCBC=m 1413# Ciphers
1338# CONFIG_CRYPTO_LRW is not set 1414#
1339# CONFIG_CRYPTO_XTS is not set
1340# CONFIG_CRYPTO_CTR is not set
1341# CONFIG_CRYPTO_GCM is not set
1342# CONFIG_CRYPTO_CCM is not set
1343# CONFIG_CRYPTO_CRYPTD is not set
1344# CONFIG_CRYPTO_DES is not set
1345# CONFIG_CRYPTO_FCRYPT is not set
1346# CONFIG_CRYPTO_BLOWFISH is not set
1347# CONFIG_CRYPTO_TWOFISH is not set
1348# CONFIG_CRYPTO_SERPENT is not set
1349# CONFIG_CRYPTO_AES is not set 1415# CONFIG_CRYPTO_AES is not set
1416# CONFIG_CRYPTO_ANUBIS is not set
1417# CONFIG_CRYPTO_ARC4 is not set
1418# CONFIG_CRYPTO_BLOWFISH is not set
1419# CONFIG_CRYPTO_CAMELLIA is not set
1350# CONFIG_CRYPTO_CAST5 is not set 1420# CONFIG_CRYPTO_CAST5 is not set
1351# CONFIG_CRYPTO_CAST6 is not set 1421# CONFIG_CRYPTO_CAST6 is not set
1352# CONFIG_CRYPTO_TEA is not set 1422# CONFIG_CRYPTO_DES is not set
1353# CONFIG_CRYPTO_ARC4 is not set 1423# CONFIG_CRYPTO_FCRYPT is not set
1354# CONFIG_CRYPTO_KHAZAD is not set 1424# CONFIG_CRYPTO_KHAZAD is not set
1355# CONFIG_CRYPTO_ANUBIS is not set
1356# CONFIG_CRYPTO_SEED is not set
1357# CONFIG_CRYPTO_SALSA20 is not set 1425# CONFIG_CRYPTO_SALSA20 is not set
1426# CONFIG_CRYPTO_SEED is not set
1427# CONFIG_CRYPTO_SERPENT is not set
1428# CONFIG_CRYPTO_TEA is not set
1429# CONFIG_CRYPTO_TWOFISH is not set
1430
1431#
1432# Compression
1433#
1358# CONFIG_CRYPTO_DEFLATE is not set 1434# CONFIG_CRYPTO_DEFLATE is not set
1359# CONFIG_CRYPTO_MICHAEL_MIC is not set
1360# CONFIG_CRYPTO_CRC32C is not set
1361# CONFIG_CRYPTO_CAMELLIA is not set
1362# CONFIG_CRYPTO_TEST is not set
1363# CONFIG_CRYPTO_AUTHENC is not set
1364# CONFIG_CRYPTO_LZO is not set 1435# CONFIG_CRYPTO_LZO is not set
1365CONFIG_CRYPTO_HW=y 1436CONFIG_CRYPTO_HW=y
1366# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1437# CONFIG_CRYPTO_DEV_HIFN_795X is not set
@@ -1369,12 +1440,14 @@ CONFIG_CRYPTO_HW=y
1369# Library routines 1440# Library routines
1370# 1441#
1371CONFIG_BITREVERSE=y 1442CONFIG_BITREVERSE=y
1372CONFIG_CRC_CCITT=y 1443# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1373CONFIG_CRC16=y 1444# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1374# CONFIG_CRC_ITU_T is not set 1445# CONFIG_CRC_CCITT is not set
1446# CONFIG_CRC16 is not set
1447CONFIG_CRC_ITU_T=m
1375CONFIG_CRC32=y 1448CONFIG_CRC32=y
1376# CONFIG_CRC7 is not set 1449# CONFIG_CRC7 is not set
1377CONFIG_LIBCRC32C=y 1450# CONFIG_LIBCRC32C is not set
1378CONFIG_ZLIB_INFLATE=y 1451CONFIG_ZLIB_INFLATE=y
1379CONFIG_ZLIB_DEFLATE=y 1452CONFIG_ZLIB_DEFLATE=y
1380CONFIG_PLIST=y 1453CONFIG_PLIST=y
diff --git a/arch/arm/configs/pcm037_defconfig b/arch/arm/configs/pcm037_defconfig
new file mode 100644
index 000000000000..627474586470
--- /dev/null
+++ b/arch/arm/configs/pcm037_defconfig
@@ -0,0 +1,748 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc6
4# Wed Jun 25 11:52:42 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_ZONE_DMA=y
26CONFIG_ARCH_MTD_XIP=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39CONFIG_SWAP=y
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42# CONFIG_POSIX_MQUEUE is not set
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46CONFIG_IKCONFIG=y
47CONFIG_IKCONFIG_PROC=y
48CONFIG_LOG_BUF_SHIFT=14
49# CONFIG_CGROUPS is not set
50CONFIG_GROUP_SCHED=y
51CONFIG_FAIR_GROUP_SCHED=y
52# CONFIG_RT_GROUP_SCHED is not set
53CONFIG_USER_SCHED=y
54# CONFIG_CGROUP_SCHED is not set
55CONFIG_SYSFS_DEPRECATED=y
56CONFIG_SYSFS_DEPRECATED_V2=y
57# CONFIG_RELAY is not set
58# CONFIG_NAMESPACES is not set
59# CONFIG_BLK_DEV_INITRD is not set
60CONFIG_CC_OPTIMIZE_FOR_SIZE=y
61CONFIG_SYSCTL=y
62CONFIG_EMBEDDED=y
63CONFIG_UID16=y
64CONFIG_SYSCTL_SYSCALL=y
65CONFIG_SYSCTL_SYSCALL_CHECK=y
66CONFIG_KALLSYMS=y
67# CONFIG_KALLSYMS_EXTRA_PASS is not set
68CONFIG_HOTPLUG=y
69CONFIG_PRINTK=y
70CONFIG_BUG=y
71CONFIG_ELF_CORE=y
72CONFIG_COMPAT_BRK=y
73CONFIG_BASE_FULL=y
74CONFIG_FUTEX=y
75CONFIG_ANON_INODES=y
76CONFIG_EPOLL=y
77CONFIG_SIGNALFD=y
78CONFIG_TIMERFD=y
79CONFIG_EVENTFD=y
80CONFIG_SHMEM=y
81CONFIG_VM_EVENT_COUNTERS=y
82CONFIG_SLAB=y
83# CONFIG_SLUB is not set
84# CONFIG_SLOB is not set
85# CONFIG_PROFILING is not set
86# CONFIG_MARKERS is not set
87CONFIG_HAVE_OPROFILE=y
88# CONFIG_KPROBES is not set
89CONFIG_HAVE_KPROBES=y
90CONFIG_HAVE_KRETPROBES=y
91# CONFIG_HAVE_DMA_ATTRS is not set
92CONFIG_PROC_PAGE_MONITOR=y
93CONFIG_SLABINFO=y
94CONFIG_RT_MUTEXES=y
95# CONFIG_TINY_SHMEM is not set
96CONFIG_BASE_SMALL=0
97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
99CONFIG_MODULE_UNLOAD=y
100CONFIG_MODULE_FORCE_UNLOAD=y
101CONFIG_MODVERSIONS=y
102# CONFIG_MODULE_SRCVERSION_ALL is not set
103CONFIG_KMOD=y
104CONFIG_BLOCK=y
105# CONFIG_LBD is not set
106# CONFIG_BLK_DEV_IO_TRACE is not set
107# CONFIG_LSF is not set
108# CONFIG_BLK_DEV_BSG is not set
109
110#
111# IO Schedulers
112#
113CONFIG_IOSCHED_NOOP=y
114CONFIG_IOSCHED_AS=y
115CONFIG_IOSCHED_DEADLINE=y
116CONFIG_IOSCHED_CFQ=y
117# CONFIG_DEFAULT_AS is not set
118# CONFIG_DEFAULT_DEADLINE is not set
119CONFIG_DEFAULT_CFQ=y
120# CONFIG_DEFAULT_NOOP is not set
121CONFIG_DEFAULT_IOSCHED="cfq"
122CONFIG_CLASSIC_RCU=y
123
124#
125# System Type
126#
127# CONFIG_ARCH_AAEC2000 is not set
128# CONFIG_ARCH_INTEGRATOR is not set
129# CONFIG_ARCH_REALVIEW is not set
130# CONFIG_ARCH_VERSATILE is not set
131# CONFIG_ARCH_AT91 is not set
132# CONFIG_ARCH_CLPS7500 is not set
133# CONFIG_ARCH_CLPS711X is not set
134# CONFIG_ARCH_CO285 is not set
135# CONFIG_ARCH_EBSA110 is not set
136# CONFIG_ARCH_EP93XX is not set
137# CONFIG_ARCH_FOOTBRIDGE is not set
138# CONFIG_ARCH_NETX is not set
139# CONFIG_ARCH_H720X is not set
140# CONFIG_ARCH_IMX is not set
141# CONFIG_ARCH_IOP13XX is not set
142# CONFIG_ARCH_IOP32X is not set
143# CONFIG_ARCH_IOP33X is not set
144# CONFIG_ARCH_IXP23XX is not set
145# CONFIG_ARCH_IXP2000 is not set
146# CONFIG_ARCH_IXP4XX is not set
147# CONFIG_ARCH_L7200 is not set
148# CONFIG_ARCH_KS8695 is not set
149# CONFIG_ARCH_NS9XXX is not set
150CONFIG_ARCH_MXC=y
151# CONFIG_ARCH_ORION5X is not set
152# CONFIG_ARCH_PNX4008 is not set
153# CONFIG_ARCH_PXA is not set
154# CONFIG_ARCH_RPC is not set
155# CONFIG_ARCH_SA1100 is not set
156# CONFIG_ARCH_S3C2410 is not set
157# CONFIG_ARCH_SHARK is not set
158# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set
160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
162
163#
164# Boot options
165#
166
167#
168# Power management
169#
170
171#
172# Freescale MXC Implementations
173#
174CONFIG_ARCH_MX3=y
175
176#
177# MX3 Options
178#
179# CONFIG_MACH_MX31ADS is not set
180CONFIG_MACH_PCM037=y
181
182#
183# Processor Type
184#
185CONFIG_CPU_32=y
186CONFIG_CPU_V6=y
187# CONFIG_CPU_32v6K is not set
188CONFIG_CPU_32v6=y
189CONFIG_CPU_ABRT_EV6=y
190CONFIG_CPU_PABRT_NOIFAR=y
191CONFIG_CPU_CACHE_V6=y
192CONFIG_CPU_CACHE_VIPT=y
193CONFIG_CPU_COPY_V6=y
194CONFIG_CPU_TLB_V6=y
195CONFIG_CPU_HAS_ASID=y
196CONFIG_CPU_CP15=y
197CONFIG_CPU_CP15_MMU=y
198
199#
200# Processor Features
201#
202CONFIG_ARM_THUMB=y
203# CONFIG_CPU_ICACHE_DISABLE is not set
204# CONFIG_CPU_DCACHE_DISABLE is not set
205# CONFIG_CPU_BPREDICT_DISABLE is not set
206# CONFIG_OUTER_CACHE is not set
207
208#
209# Bus support
210#
211# CONFIG_PCI_SYSCALL is not set
212# CONFIG_ARCH_SUPPORTS_MSI is not set
213# CONFIG_PCCARD is not set
214
215#
216# Kernel Features
217#
218CONFIG_TICK_ONESHOT=y
219CONFIG_NO_HZ=y
220CONFIG_HIGH_RES_TIMERS=y
221CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
222CONFIG_PREEMPT=y
223CONFIG_HZ=100
224CONFIG_AEABI=y
225# CONFIG_OABI_COMPAT is not set
226# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
227CONFIG_SELECT_MEMORY_MODEL=y
228CONFIG_FLATMEM_MANUAL=y
229# CONFIG_DISCONTIGMEM_MANUAL is not set
230# CONFIG_SPARSEMEM_MANUAL is not set
231CONFIG_FLATMEM=y
232CONFIG_FLAT_NODE_MEM_MAP=y
233# CONFIG_SPARSEMEM_STATIC is not set
234# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
235CONFIG_PAGEFLAGS_EXTENDED=y
236CONFIG_SPLIT_PTLOCK_CPUS=4
237# CONFIG_RESOURCES_64BIT is not set
238CONFIG_ZONE_DMA_FLAG=1
239CONFIG_BOUNCE=y
240CONFIG_VIRT_TO_BUS=y
241CONFIG_ALIGNMENT_TRAP=y
242
243#
244# Boot options
245#
246CONFIG_ZBOOT_ROM_TEXT=0x0
247CONFIG_ZBOOT_ROM_BSS=0x0
248CONFIG_CMDLINE="noinitrd console=ttymxc0,115200 root=/dev/mtdblock2 rw ip=off"
249# CONFIG_XIP_KERNEL is not set
250# CONFIG_KEXEC is not set
251
252#
253# Floating point emulation
254#
255
256#
257# At least one emulation must be selected
258#
259CONFIG_VFP=y
260
261#
262# Userspace binary formats
263#
264CONFIG_BINFMT_ELF=y
265# CONFIG_BINFMT_AOUT is not set
266# CONFIG_BINFMT_MISC is not set
267
268#
269# Power management options
270#
271# CONFIG_PM is not set
272CONFIG_ARCH_SUSPEND_POSSIBLE=y
273
274#
275# Networking
276#
277CONFIG_NET=y
278
279#
280# Networking options
281#
282CONFIG_PACKET=y
283# CONFIG_PACKET_MMAP is not set
284CONFIG_UNIX=y
285# CONFIG_NET_KEY is not set
286CONFIG_INET=y
287# CONFIG_IP_MULTICAST is not set
288# CONFIG_IP_ADVANCED_ROUTER is not set
289CONFIG_IP_FIB_HASH=y
290CONFIG_IP_PNP=y
291CONFIG_IP_PNP_DHCP=y
292# CONFIG_IP_PNP_BOOTP is not set
293# CONFIG_IP_PNP_RARP is not set
294# CONFIG_NET_IPIP is not set
295# CONFIG_NET_IPGRE is not set
296# CONFIG_ARPD is not set
297# CONFIG_SYN_COOKIES is not set
298# CONFIG_INET_AH is not set
299# CONFIG_INET_ESP is not set
300# CONFIG_INET_IPCOMP is not set
301# CONFIG_INET_XFRM_TUNNEL is not set
302# CONFIG_INET_TUNNEL is not set
303# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
304# CONFIG_INET_XFRM_MODE_TUNNEL is not set
305# CONFIG_INET_XFRM_MODE_BEET is not set
306# CONFIG_INET_LRO is not set
307# CONFIG_INET_DIAG is not set
308# CONFIG_TCP_CONG_ADVANCED is not set
309CONFIG_TCP_CONG_CUBIC=y
310CONFIG_DEFAULT_TCP_CONG="cubic"
311# CONFIG_TCP_MD5SIG is not set
312# CONFIG_IPV6 is not set
313# CONFIG_NETWORK_SECMARK is not set
314# CONFIG_NETFILTER is not set
315# CONFIG_IP_DCCP is not set
316# CONFIG_IP_SCTP is not set
317# CONFIG_TIPC is not set
318# CONFIG_ATM is not set
319# CONFIG_BRIDGE is not set
320# CONFIG_VLAN_8021Q is not set
321# CONFIG_DECNET is not set
322# CONFIG_LLC2 is not set
323# CONFIG_IPX is not set
324# CONFIG_ATALK is not set
325# CONFIG_X25 is not set
326# CONFIG_LAPB is not set
327# CONFIG_ECONET is not set
328# CONFIG_WAN_ROUTER is not set
329# CONFIG_NET_SCHED is not set
330
331#
332# Network testing
333#
334# CONFIG_NET_PKTGEN is not set
335# CONFIG_HAMRADIO is not set
336# CONFIG_CAN is not set
337# CONFIG_IRDA is not set
338# CONFIG_BT is not set
339# CONFIG_AF_RXRPC is not set
340
341#
342# Wireless
343#
344# CONFIG_CFG80211 is not set
345# CONFIG_WIRELESS_EXT is not set
346# CONFIG_MAC80211 is not set
347# CONFIG_IEEE80211 is not set
348# CONFIG_RFKILL is not set
349# CONFIG_NET_9P is not set
350
351#
352# Device Drivers
353#
354
355#
356# Generic Driver Options
357#
358CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
359CONFIG_STANDALONE=y
360CONFIG_PREVENT_FIRMWARE_BUILD=y
361CONFIG_FW_LOADER=m
362# CONFIG_SYS_HYPERVISOR is not set
363# CONFIG_CONNECTOR is not set
364CONFIG_MTD=y
365# CONFIG_MTD_DEBUG is not set
366# CONFIG_MTD_CONCAT is not set
367CONFIG_MTD_PARTITIONS=y
368# CONFIG_MTD_REDBOOT_PARTS is not set
369CONFIG_MTD_CMDLINE_PARTS=y
370# CONFIG_MTD_AFS_PARTS is not set
371# CONFIG_MTD_AR7_PARTS is not set
372
373#
374# User Modules And Translation Layers
375#
376CONFIG_MTD_CHAR=y
377CONFIG_MTD_BLKDEVS=y
378CONFIG_MTD_BLOCK=y
379# CONFIG_FTL is not set
380# CONFIG_NFTL is not set
381# CONFIG_INFTL is not set
382# CONFIG_RFD_FTL is not set
383# CONFIG_SSFDC is not set
384# CONFIG_MTD_OOPS is not set
385
386#
387# RAM/ROM/Flash chip drivers
388#
389CONFIG_MTD_CFI=y
390# CONFIG_MTD_JEDECPROBE is not set
391CONFIG_MTD_GEN_PROBE=y
392# CONFIG_MTD_CFI_ADV_OPTIONS is not set
393# CONFIG_MTD_CFI_NOSWAP is not set
394# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
395# CONFIG_MTD_CFI_LE_BYTE_SWAP 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_CFI_INTELEXT is not set
407# CONFIG_MTD_CFI_AMDSTD is not set
408# CONFIG_MTD_CFI_STAA is not set
409# CONFIG_MTD_RAM is not set
410# CONFIG_MTD_ROM is not set
411# CONFIG_MTD_ABSENT is not set
412
413#
414# Mapping drivers for chip access
415#
416# CONFIG_MTD_COMPLEX_MAPPINGS is not set
417CONFIG_MTD_PHYSMAP=y
418CONFIG_MTD_PHYSMAP_START=0x0
419CONFIG_MTD_PHYSMAP_LEN=0
420CONFIG_MTD_PHYSMAP_BANKWIDTH=2
421# CONFIG_MTD_ARM_INTEGRATOR is not set
422# CONFIG_MTD_PLATRAM is not set
423
424#
425# Self-contained MTD device drivers
426#
427# CONFIG_MTD_SLRAM is not set
428# CONFIG_MTD_PHRAM is not set
429# CONFIG_MTD_MTDRAM is not set
430# CONFIG_MTD_BLOCK2MTD is not set
431
432#
433# Disk-On-Chip Device Drivers
434#
435# CONFIG_MTD_DOC2000 is not set
436# CONFIG_MTD_DOC2001 is not set
437# CONFIG_MTD_DOC2001PLUS is not set
438# CONFIG_MTD_NAND is not set
439# CONFIG_MTD_ONENAND is not set
440
441#
442# UBI - Unsorted block images
443#
444# CONFIG_MTD_UBI is not set
445# CONFIG_PARPORT is not set
446# CONFIG_BLK_DEV is not set
447# CONFIG_MISC_DEVICES is not set
448CONFIG_HAVE_IDE=y
449# CONFIG_IDE is not set
450
451#
452# SCSI device support
453#
454# CONFIG_RAID_ATTRS is not set
455# CONFIG_SCSI is not set
456# CONFIG_SCSI_DMA is not set
457# CONFIG_SCSI_NETLINK is not set
458# CONFIG_ATA is not set
459# CONFIG_MD is not set
460CONFIG_NETDEVICES=y
461# CONFIG_NETDEVICES_MULTIQUEUE is not set
462# CONFIG_DUMMY is not set
463# CONFIG_BONDING is not set
464# CONFIG_MACVLAN is not set
465# CONFIG_EQUALIZER is not set
466# CONFIG_TUN is not set
467# CONFIG_VETH is not set
468# CONFIG_PHYLIB is not set
469CONFIG_NET_ETHERNET=y
470CONFIG_MII=y
471# CONFIG_AX88796 is not set
472CONFIG_SMC91X=y
473# CONFIG_DM9000 is not set
474# CONFIG_IBM_NEW_EMAC_ZMII is not set
475# CONFIG_IBM_NEW_EMAC_RGMII is not set
476# CONFIG_IBM_NEW_EMAC_TAH is not set
477# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
478# CONFIG_B44 is not set
479# CONFIG_NETDEV_1000 is not set
480# CONFIG_NETDEV_10000 is not set
481
482#
483# Wireless LAN
484#
485# CONFIG_WLAN_PRE80211 is not set
486# CONFIG_WLAN_80211 is not set
487# CONFIG_IWLWIFI_LEDS is not set
488# CONFIG_WAN is not set
489# CONFIG_PPP is not set
490# CONFIG_SLIP is not set
491# CONFIG_NETCONSOLE is not set
492# CONFIG_NETPOLL is not set
493# CONFIG_NET_POLL_CONTROLLER is not set
494# CONFIG_ISDN is not set
495
496#
497# Input device support
498#
499# CONFIG_INPUT is not set
500
501#
502# Hardware I/O ports
503#
504# CONFIG_SERIO is not set
505# CONFIG_GAMEPORT is not set
506
507#
508# Character devices
509#
510# CONFIG_VT is not set
511CONFIG_DEVKMEM=y
512# CONFIG_SERIAL_NONSTANDARD is not set
513
514#
515# Serial drivers
516#
517# CONFIG_SERIAL_8250 is not set
518
519#
520# Non-8250 serial port support
521#
522CONFIG_SERIAL_IMX=y
523CONFIG_SERIAL_IMX_CONSOLE=y
524CONFIG_SERIAL_CORE=y
525CONFIG_SERIAL_CORE_CONSOLE=y
526CONFIG_UNIX98_PTYS=y
527# CONFIG_LEGACY_PTYS is not set
528# CONFIG_IPMI_HANDLER is not set
529# CONFIG_HW_RANDOM is not set
530# CONFIG_NVRAM is not set
531# CONFIG_R3964 is not set
532# CONFIG_RAW_DRIVER is not set
533# CONFIG_TCG_TPM is not set
534# CONFIG_I2C is not set
535# CONFIG_SPI is not set
536CONFIG_HAVE_GPIO_LIB=y
537
538#
539# GPIO Support
540#
541
542#
543# I2C GPIO expanders:
544#
545
546#
547# SPI GPIO expanders:
548#
549# CONFIG_W1 is not set
550# CONFIG_POWER_SUPPLY is not set
551# CONFIG_HWMON is not set
552# CONFIG_WATCHDOG is not set
553
554#
555# Sonics Silicon Backplane
556#
557CONFIG_SSB_POSSIBLE=y
558# CONFIG_SSB is not set
559
560#
561# Multifunction device drivers
562#
563# CONFIG_MFD_SM501 is not set
564# CONFIG_MFD_ASIC3 is not set
565# CONFIG_HTC_EGPIO is not set
566# CONFIG_HTC_PASIC3 is not set
567
568#
569# Multimedia devices
570#
571
572#
573# Multimedia core support
574#
575# CONFIG_VIDEO_DEV is not set
576# CONFIG_DVB_CORE is not set
577# CONFIG_VIDEO_MEDIA is not set
578
579#
580# Multimedia drivers
581#
582# CONFIG_DAB is not set
583
584#
585# Graphics support
586#
587# CONFIG_VGASTATE is not set
588# CONFIG_VIDEO_OUTPUT_CONTROL is not set
589# CONFIG_FB is not set
590# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
591
592#
593# Display device support
594#
595# CONFIG_DISPLAY_SUPPORT is not set
596
597#
598# Sound
599#
600# CONFIG_SOUND is not set
601# CONFIG_USB_SUPPORT is not set
602# CONFIG_MMC is not set
603# CONFIG_NEW_LEDS is not set
604CONFIG_RTC_LIB=y
605# CONFIG_RTC_CLASS is not set
606# CONFIG_UIO is not set
607
608#
609# File systems
610#
611# CONFIG_EXT2_FS is not set
612# CONFIG_EXT3_FS is not set
613# CONFIG_EXT4DEV_FS is not set
614# CONFIG_REISERFS_FS is not set
615# CONFIG_JFS_FS is not set
616# CONFIG_FS_POSIX_ACL is not set
617# CONFIG_XFS_FS is not set
618# CONFIG_OCFS2_FS is not set
619# CONFIG_DNOTIFY is not set
620CONFIG_INOTIFY=y
621CONFIG_INOTIFY_USER=y
622# CONFIG_QUOTA is not set
623# CONFIG_AUTOFS_FS is not set
624# CONFIG_AUTOFS4_FS is not set
625# CONFIG_FUSE_FS is not set
626
627#
628# CD-ROM/DVD Filesystems
629#
630# CONFIG_ISO9660_FS is not set
631# CONFIG_UDF_FS is not set
632
633#
634# DOS/FAT/NT Filesystems
635#
636# CONFIG_MSDOS_FS is not set
637# CONFIG_VFAT_FS is not set
638# CONFIG_NTFS_FS is not set
639
640#
641# Pseudo filesystems
642#
643CONFIG_PROC_FS=y
644CONFIG_PROC_SYSCTL=y
645CONFIG_SYSFS=y
646CONFIG_TMPFS=y
647# CONFIG_TMPFS_POSIX_ACL is not set
648# CONFIG_HUGETLB_PAGE is not set
649# CONFIG_CONFIGFS_FS is not set
650
651#
652# Miscellaneous filesystems
653#
654# CONFIG_ADFS_FS is not set
655# CONFIG_AFFS_FS is not set
656# CONFIG_HFS_FS is not set
657# CONFIG_HFSPLUS_FS is not set
658# CONFIG_BEFS_FS is not set
659# CONFIG_BFS_FS is not set
660# CONFIG_EFS_FS is not set
661CONFIG_JFFS2_FS=y
662CONFIG_JFFS2_FS_DEBUG=0
663CONFIG_JFFS2_FS_WRITEBUFFER=y
664# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
665# CONFIG_JFFS2_SUMMARY is not set
666# CONFIG_JFFS2_FS_XATTR is not set
667# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
668CONFIG_JFFS2_ZLIB=y
669# CONFIG_JFFS2_LZO is not set
670CONFIG_JFFS2_RTIME=y
671# CONFIG_JFFS2_RUBIN is not set
672# CONFIG_CRAMFS is not set
673# CONFIG_VXFS_FS is not set
674# CONFIG_MINIX_FS is not set
675# CONFIG_HPFS_FS is not set
676# CONFIG_QNX4FS_FS is not set
677# CONFIG_ROMFS_FS is not set
678# CONFIG_SYSV_FS is not set
679# CONFIG_UFS_FS is not set
680CONFIG_NETWORK_FILESYSTEMS=y
681CONFIG_NFS_FS=y
682# CONFIG_NFS_V3 is not set
683# CONFIG_NFS_V4 is not set
684# CONFIG_NFSD is not set
685CONFIG_ROOT_NFS=y
686CONFIG_LOCKD=y
687CONFIG_NFS_COMMON=y
688CONFIG_SUNRPC=y
689# CONFIG_SUNRPC_BIND34 is not set
690# CONFIG_RPCSEC_GSS_KRB5 is not set
691# CONFIG_RPCSEC_GSS_SPKM3 is not set
692# CONFIG_SMB_FS is not set
693# CONFIG_CIFS is not set
694# CONFIG_NCP_FS is not set
695# CONFIG_CODA_FS is not set
696# CONFIG_AFS_FS is not set
697
698#
699# Partition Types
700#
701# CONFIG_PARTITION_ADVANCED is not set
702CONFIG_MSDOS_PARTITION=y
703# CONFIG_NLS is not set
704# CONFIG_DLM is not set
705
706#
707# Kernel hacking
708#
709# CONFIG_PRINTK_TIME is not set
710# CONFIG_ENABLE_WARN_DEPRECATED is not set
711# CONFIG_ENABLE_MUST_CHECK is not set
712CONFIG_FRAME_WARN=1024
713# CONFIG_MAGIC_SYSRQ is not set
714# CONFIG_UNUSED_SYMBOLS is not set
715# CONFIG_DEBUG_FS is not set
716# CONFIG_HEADERS_CHECK is not set
717# CONFIG_DEBUG_KERNEL is not set
718# CONFIG_DEBUG_BUGVERBOSE is not set
719CONFIG_FRAME_POINTER=y
720# CONFIG_SAMPLES is not set
721# CONFIG_DEBUG_USER is not set
722
723#
724# Security options
725#
726# CONFIG_KEYS is not set
727# CONFIG_SECURITY is not set
728# CONFIG_SECURITY_FILE_CAPABILITIES is not set
729# CONFIG_CRYPTO is not set
730
731#
732# Library routines
733#
734CONFIG_BITREVERSE=y
735# CONFIG_GENERIC_FIND_FIRST_BIT is not set
736# CONFIG_GENERIC_FIND_NEXT_BIT is not set
737# CONFIG_CRC_CCITT is not set
738# CONFIG_CRC16 is not set
739# CONFIG_CRC_ITU_T is not set
740CONFIG_CRC32=y
741# CONFIG_CRC7 is not set
742# CONFIG_LIBCRC32C is not set
743CONFIG_ZLIB_INFLATE=y
744CONFIG_ZLIB_DEFLATE=y
745CONFIG_PLIST=y
746CONFIG_HAS_IOMEM=y
747CONFIG_HAS_IOPORT=y
748CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/pcm038_defconfig b/arch/arm/configs/pcm038_defconfig
new file mode 100644
index 000000000000..6b798c215ca8
--- /dev/null
+++ b/arch/arm/configs/pcm038_defconfig
@@ -0,0 +1,1008 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc6
4# Fri Jun 20 16:38:36 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_ZONE_DMA=y
26CONFIG_ARCH_MTD_XIP=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39# CONFIG_SWAP is not set
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42CONFIG_POSIX_MQUEUE=y
43# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set
45# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49CONFIG_GROUP_SCHED=y
50CONFIG_FAIR_GROUP_SCHED=y
51CONFIG_RT_GROUP_SCHED=y
52CONFIG_USER_SCHED=y
53# CONFIG_CGROUP_SCHED is not set
54# CONFIG_SYSFS_DEPRECATED_V2 is not set
55# CONFIG_RELAY is not set
56# CONFIG_NAMESPACES is not set
57# CONFIG_BLK_DEV_INITRD is not set
58# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
59CONFIG_SYSCTL=y
60CONFIG_EMBEDDED=y
61CONFIG_UID16=y
62CONFIG_SYSCTL_SYSCALL=y
63CONFIG_SYSCTL_SYSCALL_CHECK=y
64CONFIG_KALLSYMS=y
65CONFIG_KALLSYMS_EXTRA_PASS=y
66CONFIG_HOTPLUG=y
67CONFIG_PRINTK=y
68CONFIG_BUG=y
69CONFIG_ELF_CORE=y
70# CONFIG_COMPAT_BRK is not set
71CONFIG_BASE_FULL=y
72CONFIG_FUTEX=y
73CONFIG_ANON_INODES=y
74CONFIG_EPOLL=y
75CONFIG_SIGNALFD=y
76CONFIG_TIMERFD=y
77CONFIG_EVENTFD=y
78CONFIG_SHMEM=y
79CONFIG_VM_EVENT_COUNTERS=y
80CONFIG_SLAB=y
81# CONFIG_SLUB is not set
82# CONFIG_SLOB is not set
83CONFIG_PROFILING=y
84CONFIG_MARKERS=y
85CONFIG_OPROFILE=y
86CONFIG_HAVE_OPROFILE=y
87CONFIG_KPROBES=y
88CONFIG_KRETPROBES=y
89CONFIG_HAVE_KPROBES=y
90CONFIG_HAVE_KRETPROBES=y
91# CONFIG_HAVE_DMA_ATTRS is not set
92# CONFIG_PROC_PAGE_MONITOR is not set
93CONFIG_SLABINFO=y
94CONFIG_RT_MUTEXES=y
95# CONFIG_TINY_SHMEM is not set
96CONFIG_BASE_SMALL=0
97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
99CONFIG_MODULE_UNLOAD=y
100# CONFIG_MODULE_FORCE_UNLOAD is not set
101# CONFIG_MODVERSIONS is not set
102# CONFIG_MODULE_SRCVERSION_ALL is not set
103# CONFIG_KMOD is not set
104CONFIG_BLOCK=y
105# CONFIG_LBD is not set
106# CONFIG_BLK_DEV_IO_TRACE is not set
107# CONFIG_LSF is not set
108# CONFIG_BLK_DEV_BSG is not set
109
110#
111# IO Schedulers
112#
113CONFIG_IOSCHED_NOOP=y
114# CONFIG_IOSCHED_AS is not set
115# CONFIG_IOSCHED_DEADLINE is not set
116# CONFIG_IOSCHED_CFQ is not set
117# CONFIG_DEFAULT_AS is not set
118# CONFIG_DEFAULT_DEADLINE is not set
119# CONFIG_DEFAULT_CFQ is not set
120CONFIG_DEFAULT_NOOP=y
121CONFIG_DEFAULT_IOSCHED="noop"
122CONFIG_CLASSIC_RCU=y
123
124#
125# System Type
126#
127# CONFIG_ARCH_AAEC2000 is not set
128# CONFIG_ARCH_INTEGRATOR is not set
129# CONFIG_ARCH_REALVIEW is not set
130# CONFIG_ARCH_VERSATILE is not set
131# CONFIG_ARCH_AT91 is not set
132# CONFIG_ARCH_CLPS7500 is not set
133# CONFIG_ARCH_CLPS711X is not set
134# CONFIG_ARCH_CO285 is not set
135# CONFIG_ARCH_EBSA110 is not set
136# CONFIG_ARCH_EP93XX is not set
137# CONFIG_ARCH_FOOTBRIDGE is not set
138# CONFIG_ARCH_NETX is not set
139# CONFIG_ARCH_H720X is not set
140# CONFIG_ARCH_IMX is not set
141# CONFIG_ARCH_IOP13XX is not set
142# CONFIG_ARCH_IOP32X is not set
143# CONFIG_ARCH_IOP33X is not set
144# CONFIG_ARCH_IXP23XX is not set
145# CONFIG_ARCH_IXP2000 is not set
146# CONFIG_ARCH_IXP4XX is not set
147# CONFIG_ARCH_L7200 is not set
148# CONFIG_ARCH_KS8695 is not set
149# CONFIG_ARCH_NS9XXX is not set
150CONFIG_ARCH_MXC=y
151# CONFIG_ARCH_ORION5X is not set
152# CONFIG_ARCH_PNX4008 is not set
153# CONFIG_ARCH_PXA is not set
154# CONFIG_ARCH_RPC is not set
155# CONFIG_ARCH_SA1100 is not set
156# CONFIG_ARCH_S3C2410 is not set
157# CONFIG_ARCH_SHARK is not set
158# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set
160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
162
163#
164# Boot options
165#
166
167#
168# Power management
169#
170
171#
172# Freescale MXC Implementations
173#
174CONFIG_ARCH_MX2=y
175# CONFIG_ARCH_MX3 is not set
176
177#
178# MX2 family CPU support
179#
180CONFIG_MACH_MX27=y
181
182#
183# MX2 Platforms
184#
185# CONFIG_MACH_MX27ADS is not set
186CONFIG_MACH_PCM038=y
187CONFIG_MACH_PCM970_BASEBOARD=y
188
189#
190# Processor Type
191#
192CONFIG_CPU_32=y
193CONFIG_CPU_ARM926T=y
194CONFIG_CPU_32v5=y
195CONFIG_CPU_ABRT_EV5TJ=y
196CONFIG_CPU_PABRT_NOIFAR=y
197CONFIG_CPU_CACHE_VIVT=y
198CONFIG_CPU_COPY_V4WB=y
199CONFIG_CPU_TLB_V4WBI=y
200CONFIG_CPU_CP15=y
201CONFIG_CPU_CP15_MMU=y
202
203#
204# Processor Features
205#
206CONFIG_ARM_THUMB=y
207# CONFIG_CPU_ICACHE_DISABLE is not set
208# CONFIG_CPU_DCACHE_DISABLE is not set
209# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
210# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
211# CONFIG_OUTER_CACHE is not set
212
213#
214# Bus support
215#
216# CONFIG_PCI_SYSCALL is not set
217# CONFIG_ARCH_SUPPORTS_MSI is not set
218# CONFIG_PCCARD is not set
219
220#
221# Kernel Features
222#
223CONFIG_TICK_ONESHOT=y
224CONFIG_NO_HZ=y
225CONFIG_HIGH_RES_TIMERS=y
226CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
227CONFIG_PREEMPT=y
228CONFIG_HZ=100
229CONFIG_AEABI=y
230# CONFIG_OABI_COMPAT is not set
231# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
232CONFIG_SELECT_MEMORY_MODEL=y
233CONFIG_FLATMEM_MANUAL=y
234# CONFIG_DISCONTIGMEM_MANUAL is not set
235# CONFIG_SPARSEMEM_MANUAL is not set
236CONFIG_FLATMEM=y
237CONFIG_FLAT_NODE_MEM_MAP=y
238# CONFIG_SPARSEMEM_STATIC is not set
239# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
240CONFIG_PAGEFLAGS_EXTENDED=y
241CONFIG_SPLIT_PTLOCK_CPUS=4096
242# CONFIG_RESOURCES_64BIT is not set
243CONFIG_ZONE_DMA_FLAG=1
244CONFIG_BOUNCE=y
245CONFIG_VIRT_TO_BUS=y
246CONFIG_ALIGNMENT_TRAP=y
247
248#
249# Boot options
250#
251CONFIG_ZBOOT_ROM_TEXT=0x0
252CONFIG_ZBOOT_ROM_BSS=0x0
253CONFIG_CMDLINE=""
254# CONFIG_XIP_KERNEL is not set
255# CONFIG_KEXEC is not set
256
257#
258# Floating point emulation
259#
260
261#
262# At least one emulation must be selected
263#
264# CONFIG_VFP is not set
265
266#
267# Userspace binary formats
268#
269CONFIG_BINFMT_ELF=y
270# CONFIG_BINFMT_AOUT is not set
271# CONFIG_BINFMT_MISC is not set
272
273#
274# Power management options
275#
276# CONFIG_PM is not set
277CONFIG_ARCH_SUSPEND_POSSIBLE=y
278
279#
280# Networking
281#
282CONFIG_NET=y
283
284#
285# Networking options
286#
287CONFIG_PACKET=y
288CONFIG_PACKET_MMAP=y
289CONFIG_UNIX=y
290# CONFIG_NET_KEY is not set
291CONFIG_INET=y
292CONFIG_IP_MULTICAST=y
293# CONFIG_IP_ADVANCED_ROUTER is not set
294CONFIG_IP_FIB_HASH=y
295CONFIG_IP_PNP=y
296# CONFIG_IP_PNP_DHCP is not set
297# CONFIG_IP_PNP_BOOTP is not set
298# CONFIG_IP_PNP_RARP is not set
299# CONFIG_NET_IPIP is not set
300# CONFIG_NET_IPGRE is not set
301# CONFIG_IP_MROUTE is not set
302# CONFIG_ARPD is not set
303# CONFIG_SYN_COOKIES is not set
304# CONFIG_INET_AH is not set
305# CONFIG_INET_ESP is not set
306# CONFIG_INET_IPCOMP is not set
307# CONFIG_INET_XFRM_TUNNEL is not set
308# CONFIG_INET_TUNNEL is not set
309# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
310# CONFIG_INET_XFRM_MODE_TUNNEL is not set
311# CONFIG_INET_XFRM_MODE_BEET is not set
312# CONFIG_INET_LRO is not set
313# CONFIG_INET_DIAG is not set
314# CONFIG_TCP_CONG_ADVANCED is not set
315CONFIG_TCP_CONG_CUBIC=y
316CONFIG_DEFAULT_TCP_CONG="cubic"
317# CONFIG_TCP_MD5SIG is not set
318# CONFIG_IPV6 is not set
319# CONFIG_NETWORK_SECMARK is not set
320# CONFIG_NETFILTER is not set
321# CONFIG_IP_DCCP is not set
322# CONFIG_IP_SCTP is not set
323# CONFIG_TIPC is not set
324# CONFIG_ATM is not set
325# CONFIG_BRIDGE is not set
326# CONFIG_VLAN_8021Q is not set
327# CONFIG_DECNET is not set
328# CONFIG_LLC2 is not set
329# CONFIG_IPX is not set
330# CONFIG_ATALK is not set
331# CONFIG_X25 is not set
332# CONFIG_LAPB is not set
333# CONFIG_ECONET is not set
334# CONFIG_WAN_ROUTER is not set
335# CONFIG_NET_SCHED is not set
336
337#
338# Network testing
339#
340# CONFIG_NET_PKTGEN is not set
341# CONFIG_NET_TCPPROBE is not set
342# CONFIG_HAMRADIO is not set
343# CONFIG_CAN is not set
344# CONFIG_IRDA is not set
345# CONFIG_BT is not set
346# CONFIG_AF_RXRPC is not set
347
348#
349# Wireless
350#
351# CONFIG_CFG80211 is not set
352# CONFIG_WIRELESS_EXT is not set
353# CONFIG_MAC80211 is not set
354# CONFIG_IEEE80211 is not set
355# CONFIG_RFKILL is not set
356# CONFIG_NET_9P is not set
357
358#
359# Device Drivers
360#
361
362#
363# Generic Driver Options
364#
365CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
366CONFIG_STANDALONE=y
367CONFIG_PREVENT_FIRMWARE_BUILD=y
368CONFIG_FW_LOADER=y
369# CONFIG_SYS_HYPERVISOR is not set
370# CONFIG_CONNECTOR is not set
371CONFIG_MTD=y
372# CONFIG_MTD_DEBUG is not set
373# CONFIG_MTD_CONCAT is not set
374CONFIG_MTD_PARTITIONS=y
375# CONFIG_MTD_REDBOOT_PARTS is not set
376CONFIG_MTD_CMDLINE_PARTS=y
377# CONFIG_MTD_AFS_PARTS is not set
378# CONFIG_MTD_AR7_PARTS is not set
379
380#
381# User Modules And Translation Layers
382#
383CONFIG_MTD_CHAR=y
384CONFIG_MTD_BLKDEVS=y
385CONFIG_MTD_BLOCK=y
386# CONFIG_FTL is not set
387# CONFIG_NFTL is not set
388# CONFIG_INFTL is not set
389# CONFIG_RFD_FTL is not set
390# CONFIG_SSFDC is not set
391# CONFIG_MTD_OOPS is not set
392
393#
394# RAM/ROM/Flash chip drivers
395#
396CONFIG_MTD_CFI=y
397# CONFIG_MTD_JEDECPROBE is not set
398CONFIG_MTD_GEN_PROBE=y
399CONFIG_MTD_CFI_ADV_OPTIONS=y
400CONFIG_MTD_CFI_NOSWAP=y
401# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
402# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
403CONFIG_MTD_CFI_GEOMETRY=y
404# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
405CONFIG_MTD_MAP_BANK_WIDTH_2=y
406# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
407# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
408# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
409# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
410CONFIG_MTD_CFI_I1=y
411# CONFIG_MTD_CFI_I2 is not set
412# CONFIG_MTD_CFI_I4 is not set
413# CONFIG_MTD_CFI_I8 is not set
414# CONFIG_MTD_OTP is not set
415CONFIG_MTD_CFI_INTELEXT=y
416# CONFIG_MTD_CFI_AMDSTD is not set
417# CONFIG_MTD_CFI_STAA is not set
418CONFIG_MTD_CFI_UTIL=y
419# CONFIG_MTD_RAM is not set
420# CONFIG_MTD_ROM is not set
421# CONFIG_MTD_ABSENT is not set
422# CONFIG_MTD_XIP is not set
423
424#
425# Mapping drivers for chip access
426#
427# CONFIG_MTD_COMPLEX_MAPPINGS is not set
428CONFIG_MTD_PHYSMAP=y
429CONFIG_MTD_PHYSMAP_START=0x00000000
430CONFIG_MTD_PHYSMAP_LEN=0x0
431CONFIG_MTD_PHYSMAP_BANKWIDTH=2
432# CONFIG_MTD_ARM_INTEGRATOR is not set
433# CONFIG_MTD_PLATRAM is not set
434
435#
436# Self-contained MTD device drivers
437#
438# CONFIG_MTD_DATAFLASH is not set
439# CONFIG_MTD_M25P80 is not set
440# CONFIG_MTD_SLRAM is not set
441# CONFIG_MTD_PHRAM is not set
442# CONFIG_MTD_MTDRAM is not set
443# CONFIG_MTD_BLOCK2MTD is not set
444
445#
446# Disk-On-Chip Device Drivers
447#
448# CONFIG_MTD_DOC2000 is not set
449# CONFIG_MTD_DOC2001 is not set
450# CONFIG_MTD_DOC2001PLUS is not set
451# CONFIG_MTD_NAND is not set
452# CONFIG_MTD_ONENAND is not set
453
454#
455# UBI - Unsorted block images
456#
457# CONFIG_MTD_UBI is not set
458# CONFIG_PARPORT is not set
459CONFIG_BLK_DEV=y
460# CONFIG_BLK_DEV_COW_COMMON is not set
461# CONFIG_BLK_DEV_LOOP is not set
462# CONFIG_BLK_DEV_NBD is not set
463# CONFIG_BLK_DEV_RAM is not set
464# CONFIG_CDROM_PKTCDVD is not set
465# CONFIG_ATA_OVER_ETH is not set
466# CONFIG_MISC_DEVICES is not set
467CONFIG_HAVE_IDE=y
468# CONFIG_IDE is not set
469
470#
471# SCSI device support
472#
473# CONFIG_RAID_ATTRS is not set
474# CONFIG_SCSI is not set
475# CONFIG_SCSI_DMA is not set
476# CONFIG_SCSI_NETLINK is not set
477# CONFIG_ATA is not set
478# CONFIG_MD is not set
479CONFIG_NETDEVICES=y
480# CONFIG_NETDEVICES_MULTIQUEUE is not set
481# CONFIG_DUMMY is not set
482# CONFIG_BONDING is not set
483# CONFIG_MACVLAN is not set
484# CONFIG_EQUALIZER is not set
485# CONFIG_TUN is not set
486# CONFIG_VETH is not set
487# CONFIG_PHYLIB is not set
488CONFIG_NET_ETHERNET=y
489# CONFIG_MII is not set
490# CONFIG_AX88796 is not set
491# CONFIG_SMC91X is not set
492# CONFIG_DM9000 is not set
493# CONFIG_ENC28J60 is not set
494# CONFIG_IBM_NEW_EMAC_ZMII is not set
495# CONFIG_IBM_NEW_EMAC_RGMII is not set
496# CONFIG_IBM_NEW_EMAC_TAH is not set
497# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
498# CONFIG_B44 is not set
499CONFIG_FEC_OLD=y
500# CONFIG_NETDEV_1000 is not set
501# CONFIG_NETDEV_10000 is not set
502
503#
504# Wireless LAN
505#
506# CONFIG_WLAN_PRE80211 is not set
507# CONFIG_WLAN_80211 is not set
508# CONFIG_IWLWIFI_LEDS is not set
509# CONFIG_WAN is not set
510# CONFIG_PPP is not set
511# CONFIG_SLIP is not set
512# CONFIG_NETCONSOLE is not set
513# CONFIG_NETPOLL is not set
514# CONFIG_NET_POLL_CONTROLLER is not set
515# CONFIG_ISDN is not set
516
517#
518# Input device support
519#
520CONFIG_INPUT=y
521# CONFIG_INPUT_FF_MEMLESS is not set
522# CONFIG_INPUT_POLLDEV is not set
523
524#
525# Userland interfaces
526#
527# CONFIG_INPUT_MOUSEDEV is not set
528# CONFIG_INPUT_JOYDEV is not set
529CONFIG_INPUT_EVDEV=y
530# CONFIG_INPUT_EVBUG is not set
531
532#
533# Input Device Drivers
534#
535# CONFIG_INPUT_KEYBOARD is not set
536# CONFIG_INPUT_MOUSE is not set
537# CONFIG_INPUT_JOYSTICK is not set
538# CONFIG_INPUT_TABLET is not set
539CONFIG_INPUT_TOUCHSCREEN=y
540# CONFIG_TOUCHSCREEN_ADS7846 is not set
541# CONFIG_TOUCHSCREEN_FUJITSU is not set
542# CONFIG_TOUCHSCREEN_GUNZE is not set
543# CONFIG_TOUCHSCREEN_ELO is not set
544# CONFIG_TOUCHSCREEN_MTOUCH is not set
545# CONFIG_TOUCHSCREEN_MK712 is not set
546# CONFIG_TOUCHSCREEN_PENMOUNT is not set
547# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
548# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
549# CONFIG_TOUCHSCREEN_UCB1400 is not set
550# CONFIG_INPUT_MISC is not set
551
552#
553# Hardware I/O ports
554#
555# CONFIG_SERIO is not set
556# CONFIG_GAMEPORT is not set
557
558#
559# Character devices
560#
561CONFIG_VT=y
562CONFIG_VT_CONSOLE=y
563CONFIG_HW_CONSOLE=y
564# CONFIG_VT_HW_CONSOLE_BINDING is not set
565CONFIG_DEVKMEM=y
566# CONFIG_SERIAL_NONSTANDARD is not set
567
568#
569# Serial drivers
570#
571# CONFIG_SERIAL_8250 is not set
572
573#
574# Non-8250 serial port support
575#
576CONFIG_SERIAL_IMX=y
577CONFIG_SERIAL_IMX_CONSOLE=y
578CONFIG_SERIAL_CORE=y
579CONFIG_SERIAL_CORE_CONSOLE=y
580CONFIG_UNIX98_PTYS=y
581# CONFIG_LEGACY_PTYS is not set
582# CONFIG_IPMI_HANDLER is not set
583# CONFIG_HW_RANDOM is not set
584# CONFIG_NVRAM is not set
585# CONFIG_R3964 is not set
586# CONFIG_RAW_DRIVER is not set
587# CONFIG_TCG_TPM is not set
588CONFIG_I2C=y
589CONFIG_I2C_BOARDINFO=y
590# CONFIG_I2C_CHARDEV is not set
591
592#
593# I2C Hardware Bus support
594#
595# CONFIG_I2C_GPIO is not set
596# CONFIG_I2C_OCORES is not set
597# CONFIG_I2C_PARPORT_LIGHT is not set
598# CONFIG_I2C_SIMTEC is not set
599# CONFIG_I2C_TAOS_EVM is not set
600# CONFIG_I2C_STUB is not set
601# CONFIG_I2C_PCA_PLATFORM is not set
602
603#
604# Miscellaneous I2C Chip support
605#
606# CONFIG_DS1682 is not set
607# CONFIG_SENSORS_EEPROM is not set
608# CONFIG_SENSORS_PCF8574 is not set
609# CONFIG_PCF8575 is not set
610# CONFIG_SENSORS_PCF8591 is not set
611# CONFIG_TPS65010 is not set
612# CONFIG_SENSORS_MAX6875 is not set
613# CONFIG_SENSORS_TSL2550 is not set
614# CONFIG_I2C_DEBUG_CORE is not set
615# CONFIG_I2C_DEBUG_ALGO is not set
616# CONFIG_I2C_DEBUG_BUS is not set
617# CONFIG_I2C_DEBUG_CHIP is not set
618CONFIG_SPI=y
619CONFIG_SPI_MASTER=y
620
621#
622# SPI Master Controller Drivers
623#
624CONFIG_SPI_BITBANG=y
625
626#
627# SPI Protocol Masters
628#
629# CONFIG_SPI_AT25 is not set
630# CONFIG_SPI_SPIDEV is not set
631# CONFIG_SPI_TLE62X0 is not set
632CONFIG_HAVE_GPIO_LIB=y
633
634#
635# GPIO Support
636#
637
638#
639# I2C GPIO expanders:
640#
641# CONFIG_GPIO_PCA953X is not set
642# CONFIG_GPIO_PCF857X is not set
643
644#
645# SPI GPIO expanders:
646#
647# CONFIG_GPIO_MCP23S08 is not set
648# CONFIG_W1 is not set
649# CONFIG_POWER_SUPPLY is not set
650# CONFIG_HWMON is not set
651# CONFIG_WATCHDOG is not set
652
653#
654# Sonics Silicon Backplane
655#
656CONFIG_SSB_POSSIBLE=y
657# CONFIG_SSB is not set
658
659#
660# Multifunction device drivers
661#
662# CONFIG_MFD_SM501 is not set
663# CONFIG_MFD_ASIC3 is not set
664# CONFIG_HTC_EGPIO is not set
665# CONFIG_HTC_PASIC3 is not set
666
667#
668# Multimedia devices
669#
670
671#
672# Multimedia core support
673#
674CONFIG_VIDEO_DEV=y
675CONFIG_VIDEO_V4L2_COMMON=y
676CONFIG_VIDEO_ALLOW_V4L1=y
677CONFIG_VIDEO_V4L1_COMPAT=y
678# CONFIG_DVB_CORE is not set
679CONFIG_VIDEO_MEDIA=y
680
681#
682# Multimedia drivers
683#
684# CONFIG_MEDIA_ATTACH is not set
685CONFIG_MEDIA_TUNER=y
686# CONFIG_MEDIA_TUNER_CUSTOMIZE is not set
687CONFIG_MEDIA_TUNER_SIMPLE=y
688CONFIG_MEDIA_TUNER_TDA8290=y
689CONFIG_MEDIA_TUNER_TDA9887=y
690CONFIG_MEDIA_TUNER_TEA5761=y
691CONFIG_MEDIA_TUNER_TEA5767=y
692CONFIG_MEDIA_TUNER_MT20XX=y
693CONFIG_MEDIA_TUNER_XC2028=y
694CONFIG_MEDIA_TUNER_XC5000=y
695CONFIG_VIDEO_V4L2=y
696CONFIG_VIDEO_V4L1=y
697CONFIG_VIDEO_CAPTURE_DRIVERS=y
698# CONFIG_VIDEO_ADV_DEBUG is not set
699CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
700# CONFIG_VIDEO_VIVI is not set
701# CONFIG_VIDEO_CPIA is not set
702# CONFIG_VIDEO_SAA5246A is not set
703# CONFIG_VIDEO_SAA5249 is not set
704# CONFIG_TUNER_3036 is not set
705# CONFIG_SOC_CAMERA is not set
706# CONFIG_RADIO_ADAPTERS is not set
707# CONFIG_DAB is not set
708
709#
710# Graphics support
711#
712# CONFIG_VGASTATE is not set
713# CONFIG_VIDEO_OUTPUT_CONTROL is not set
714CONFIG_FB=y
715# CONFIG_FIRMWARE_EDID is not set
716# CONFIG_FB_DDC is not set
717# CONFIG_FB_CFB_FILLRECT is not set
718# CONFIG_FB_CFB_COPYAREA is not set
719# CONFIG_FB_CFB_IMAGEBLIT is not set
720# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
721# CONFIG_FB_SYS_FILLRECT is not set
722# CONFIG_FB_SYS_COPYAREA is not set
723# CONFIG_FB_SYS_IMAGEBLIT is not set
724# CONFIG_FB_FOREIGN_ENDIAN is not set
725# CONFIG_FB_SYS_FOPS is not set
726# CONFIG_FB_SVGALIB is not set
727# CONFIG_FB_MACMODES is not set
728# CONFIG_FB_BACKLIGHT is not set
729# CONFIG_FB_MODE_HELPERS is not set
730# CONFIG_FB_TILEBLITTING is not set
731
732#
733# Frame buffer hardware drivers
734#
735# CONFIG_FB_S1D13XXX is not set
736# CONFIG_FB_VIRTUAL is not set
737# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
738
739#
740# Display device support
741#
742# CONFIG_DISPLAY_SUPPORT is not set
743
744#
745# Console display driver support
746#
747# CONFIG_VGA_CONSOLE is not set
748CONFIG_DUMMY_CONSOLE=y
749CONFIG_FRAMEBUFFER_CONSOLE=y
750# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
751# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
752CONFIG_FONTS=y
753CONFIG_FONT_8x8=y
754# CONFIG_FONT_8x16 is not set
755# CONFIG_FONT_6x11 is not set
756# CONFIG_FONT_7x14 is not set
757# CONFIG_FONT_PEARL_8x8 is not set
758# CONFIG_FONT_ACORN_8x8 is not set
759# CONFIG_FONT_MINI_4x6 is not set
760# CONFIG_FONT_SUN8x16 is not set
761# CONFIG_FONT_SUN12x22 is not set
762# CONFIG_FONT_10x18 is not set
763# CONFIG_LOGO is not set
764
765#
766# Sound
767#
768# CONFIG_SOUND is not set
769# CONFIG_HID_SUPPORT is not set
770# CONFIG_USB_SUPPORT is not set
771# CONFIG_MMC is not set
772# CONFIG_NEW_LEDS is not set
773CONFIG_RTC_LIB=y
774CONFIG_RTC_CLASS=y
775CONFIG_RTC_HCTOSYS=y
776CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
777# CONFIG_RTC_DEBUG is not set
778
779#
780# RTC interfaces
781#
782CONFIG_RTC_INTF_SYSFS=y
783CONFIG_RTC_INTF_PROC=y
784CONFIG_RTC_INTF_DEV=y
785# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
786# CONFIG_RTC_DRV_TEST is not set
787
788#
789# I2C RTC drivers
790#
791# CONFIG_RTC_DRV_DS1307 is not set
792# CONFIG_RTC_DRV_DS1374 is not set
793# CONFIG_RTC_DRV_DS1672 is not set
794# CONFIG_RTC_DRV_MAX6900 is not set
795# CONFIG_RTC_DRV_RS5C372 is not set
796# CONFIG_RTC_DRV_ISL1208 is not set
797# CONFIG_RTC_DRV_X1205 is not set
798CONFIG_RTC_DRV_PCF8563=y
799# CONFIG_RTC_DRV_PCF8583 is not set
800# CONFIG_RTC_DRV_M41T80 is not set
801# CONFIG_RTC_DRV_S35390A is not set
802# CONFIG_RTC_DRV_FM3130 is not set
803
804#
805# SPI RTC drivers
806#
807# CONFIG_RTC_DRV_MAX6902 is not set
808# CONFIG_RTC_DRV_R9701 is not set
809# CONFIG_RTC_DRV_RS5C348 is not set
810
811#
812# Platform RTC drivers
813#
814# CONFIG_RTC_DRV_CMOS is not set
815# CONFIG_RTC_DRV_DS1511 is not set
816# CONFIG_RTC_DRV_DS1553 is not set
817# CONFIG_RTC_DRV_DS1742 is not set
818# CONFIG_RTC_DRV_STK17TA8 is not set
819# CONFIG_RTC_DRV_M48T86 is not set
820# CONFIG_RTC_DRV_M48T59 is not set
821# CONFIG_RTC_DRV_V3020 is not set
822
823#
824# on-CPU RTC drivers
825#
826# CONFIG_UIO is not set
827
828#
829# File systems
830#
831# CONFIG_EXT2_FS is not set
832# CONFIG_EXT3_FS is not set
833# CONFIG_EXT4DEV_FS is not set
834# CONFIG_REISERFS_FS is not set
835# CONFIG_JFS_FS is not set
836# CONFIG_FS_POSIX_ACL is not set
837# CONFIG_XFS_FS is not set
838# CONFIG_OCFS2_FS is not set
839# CONFIG_DNOTIFY is not set
840# CONFIG_INOTIFY is not set
841# CONFIG_QUOTA is not set
842# CONFIG_AUTOFS_FS is not set
843# CONFIG_AUTOFS4_FS is not set
844# CONFIG_FUSE_FS is not set
845
846#
847# CD-ROM/DVD Filesystems
848#
849# CONFIG_ISO9660_FS is not set
850# CONFIG_UDF_FS is not set
851
852#
853# DOS/FAT/NT Filesystems
854#
855# CONFIG_MSDOS_FS is not set
856# CONFIG_VFAT_FS is not set
857# CONFIG_NTFS_FS is not set
858
859#
860# Pseudo filesystems
861#
862CONFIG_PROC_FS=y
863CONFIG_PROC_SYSCTL=y
864CONFIG_SYSFS=y
865CONFIG_TMPFS=y
866# CONFIG_TMPFS_POSIX_ACL is not set
867# CONFIG_HUGETLB_PAGE is not set
868# CONFIG_CONFIGFS_FS is not set
869
870#
871# Miscellaneous filesystems
872#
873# CONFIG_ADFS_FS is not set
874# CONFIG_AFFS_FS is not set
875# CONFIG_HFS_FS is not set
876# CONFIG_HFSPLUS_FS is not set
877# CONFIG_BEFS_FS is not set
878# CONFIG_BFS_FS is not set
879# CONFIG_EFS_FS is not set
880CONFIG_JFFS2_FS=y
881CONFIG_JFFS2_FS_DEBUG=0
882CONFIG_JFFS2_FS_WRITEBUFFER=y
883# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
884# CONFIG_JFFS2_SUMMARY is not set
885# CONFIG_JFFS2_FS_XATTR is not set
886# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
887CONFIG_JFFS2_ZLIB=y
888# CONFIG_JFFS2_LZO is not set
889CONFIG_JFFS2_RTIME=y
890# CONFIG_JFFS2_RUBIN is not set
891# CONFIG_CRAMFS is not set
892# CONFIG_VXFS_FS is not set
893# CONFIG_MINIX_FS is not set
894# CONFIG_HPFS_FS is not set
895# CONFIG_QNX4FS_FS is not set
896# CONFIG_ROMFS_FS is not set
897# CONFIG_SYSV_FS is not set
898# CONFIG_UFS_FS is not set
899CONFIG_NETWORK_FILESYSTEMS=y
900CONFIG_NFS_FS=y
901CONFIG_NFS_V3=y
902# CONFIG_NFS_V3_ACL is not set
903# CONFIG_NFS_V4 is not set
904# CONFIG_NFSD is not set
905CONFIG_ROOT_NFS=y
906CONFIG_LOCKD=y
907CONFIG_LOCKD_V4=y
908CONFIG_NFS_COMMON=y
909CONFIG_SUNRPC=y
910# CONFIG_SUNRPC_BIND34 is not set
911# CONFIG_RPCSEC_GSS_KRB5 is not set
912# CONFIG_RPCSEC_GSS_SPKM3 is not set
913# CONFIG_SMB_FS is not set
914# CONFIG_CIFS is not set
915# CONFIG_NCP_FS is not set
916# CONFIG_CODA_FS is not set
917# CONFIG_AFS_FS is not set
918
919#
920# Partition Types
921#
922# CONFIG_PARTITION_ADVANCED is not set
923CONFIG_MSDOS_PARTITION=y
924CONFIG_NLS=y
925CONFIG_NLS_DEFAULT="iso8859-1"
926CONFIG_NLS_CODEPAGE_437=m
927# CONFIG_NLS_CODEPAGE_737 is not set
928# CONFIG_NLS_CODEPAGE_775 is not set
929CONFIG_NLS_CODEPAGE_850=m
930# CONFIG_NLS_CODEPAGE_852 is not set
931# CONFIG_NLS_CODEPAGE_855 is not set
932# CONFIG_NLS_CODEPAGE_857 is not set
933# CONFIG_NLS_CODEPAGE_860 is not set
934# CONFIG_NLS_CODEPAGE_861 is not set
935# CONFIG_NLS_CODEPAGE_862 is not set
936# CONFIG_NLS_CODEPAGE_863 is not set
937# CONFIG_NLS_CODEPAGE_864 is not set
938# CONFIG_NLS_CODEPAGE_865 is not set
939# CONFIG_NLS_CODEPAGE_866 is not set
940# CONFIG_NLS_CODEPAGE_869 is not set
941# CONFIG_NLS_CODEPAGE_936 is not set
942# CONFIG_NLS_CODEPAGE_950 is not set
943# CONFIG_NLS_CODEPAGE_932 is not set
944# CONFIG_NLS_CODEPAGE_949 is not set
945# CONFIG_NLS_CODEPAGE_874 is not set
946# CONFIG_NLS_ISO8859_8 is not set
947# CONFIG_NLS_CODEPAGE_1250 is not set
948# CONFIG_NLS_CODEPAGE_1251 is not set
949# CONFIG_NLS_ASCII is not set
950CONFIG_NLS_ISO8859_1=y
951# CONFIG_NLS_ISO8859_2 is not set
952# CONFIG_NLS_ISO8859_3 is not set
953# CONFIG_NLS_ISO8859_4 is not set
954# CONFIG_NLS_ISO8859_5 is not set
955# CONFIG_NLS_ISO8859_6 is not set
956# CONFIG_NLS_ISO8859_7 is not set
957# CONFIG_NLS_ISO8859_9 is not set
958# CONFIG_NLS_ISO8859_13 is not set
959# CONFIG_NLS_ISO8859_14 is not set
960CONFIG_NLS_ISO8859_15=m
961# CONFIG_NLS_KOI8_R is not set
962# CONFIG_NLS_KOI8_U is not set
963# CONFIG_NLS_UTF8 is not set
964# CONFIG_DLM is not set
965
966#
967# Kernel hacking
968#
969# CONFIG_PRINTK_TIME is not set
970CONFIG_ENABLE_WARN_DEPRECATED=y
971CONFIG_ENABLE_MUST_CHECK=y
972CONFIG_FRAME_WARN=1024
973# CONFIG_MAGIC_SYSRQ is not set
974# CONFIG_UNUSED_SYMBOLS is not set
975# CONFIG_DEBUG_FS is not set
976# CONFIG_HEADERS_CHECK is not set
977# CONFIG_DEBUG_KERNEL is not set
978# CONFIG_DEBUG_BUGVERBOSE is not set
979CONFIG_FRAME_POINTER=y
980# CONFIG_SAMPLES is not set
981# CONFIG_DEBUG_USER is not set
982
983#
984# Security options
985#
986# CONFIG_KEYS is not set
987# CONFIG_SECURITY is not set
988# CONFIG_SECURITY_FILE_CAPABILITIES is not set
989# CONFIG_CRYPTO is not set
990
991#
992# Library routines
993#
994CONFIG_BITREVERSE=y
995# CONFIG_GENERIC_FIND_FIRST_BIT is not set
996# CONFIG_GENERIC_FIND_NEXT_BIT is not set
997# CONFIG_CRC_CCITT is not set
998# CONFIG_CRC16 is not set
999# CONFIG_CRC_ITU_T is not set
1000CONFIG_CRC32=y
1001# CONFIG_CRC7 is not set
1002# CONFIG_LIBCRC32C is not set
1003CONFIG_ZLIB_INFLATE=y
1004CONFIG_ZLIB_DEFLATE=y
1005CONFIG_PLIST=y
1006CONFIG_HAS_IOMEM=y
1007CONFIG_HAS_IOPORT=y
1008CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/picotux200_defconfig b/arch/arm/configs/picotux200_defconfig
index 95a22f512805..14826f0dabde 100644
--- a/arch/arm/configs/picotux200_defconfig
+++ b/arch/arm/configs/picotux200_defconfig
@@ -201,7 +201,6 @@ CONFIG_ARM_THUMB=y
201# Kernel Features 201# Kernel Features
202# 202#
203# CONFIG_PREEMPT is not set 203# CONFIG_PREEMPT is not set
204CONFIG_NO_IDLE_HZ=y
205CONFIG_HZ=100 204CONFIG_HZ=100
206CONFIG_AEABI=y 205CONFIG_AEABI=y
207CONFIG_OABI_COMPAT=y 206CONFIG_OABI_COMPAT=y
diff --git a/arch/arm/configs/pnx4008_defconfig b/arch/arm/configs/pnx4008_defconfig
index b5e11aa2e290..811b8f60d19d 100644
--- a/arch/arm/configs/pnx4008_defconfig
+++ b/arch/arm/configs/pnx4008_defconfig
@@ -151,7 +151,6 @@ CONFIG_ARM_THUMB=y
151# Kernel Features 151# Kernel Features
152# 152#
153CONFIG_PREEMPT=y 153CONFIG_PREEMPT=y
154# CONFIG_NO_IDLE_HZ is not set
155CONFIG_HZ=100 154CONFIG_HZ=100
156# CONFIG_AEABI is not set 155# CONFIG_AEABI is not set
157# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 156# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig
new file mode 100644
index 000000000000..ef903bed061e
--- /dev/null
+++ b/arch/arm/configs/qil-a9260_defconfig
@@ -0,0 +1,1256 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24
4# Tue Apr 15 12:28:38 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51# CONFIG_SYSFS_DEPRECATED is not set
52# CONFIG_RELAY is not set
53# CONFIG_BLK_DEV_INITRD is not set
54# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
55CONFIG_SYSCTL=y
56# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_KALLSYMS=y
60# CONFIG_KALLSYMS_ALL is not set
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y
71CONFIG_EVENTFD=y
72CONFIG_SHMEM=y
73CONFIG_VM_EVENT_COUNTERS=y
74CONFIG_SLAB=y
75# CONFIG_SLUB is not set
76# CONFIG_SLOB is not set
77CONFIG_SLABINFO=y
78CONFIG_RT_MUTEXES=y
79# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0
81CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y
87CONFIG_BLOCK=y
88# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set
91# CONFIG_BLK_DEV_BSG is not set
92
93#
94# IO Schedulers
95#
96CONFIG_IOSCHED_NOOP=y
97CONFIG_IOSCHED_AS=y
98# CONFIG_IOSCHED_DEADLINE is not set
99# CONFIG_IOSCHED_CFQ is not set
100CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_DEADLINE is not set
102# CONFIG_DEFAULT_CFQ is not set
103# CONFIG_DEFAULT_NOOP is not set
104CONFIG_DEFAULT_IOSCHED="anticipatory"
105
106#
107# System Type
108#
109# CONFIG_ARCH_AAEC2000 is not set
110# CONFIG_ARCH_INTEGRATOR is not set
111# CONFIG_ARCH_REALVIEW is not set
112# CONFIG_ARCH_VERSATILE is not set
113CONFIG_ARCH_AT91=y
114# CONFIG_ARCH_CLPS7500 is not set
115# CONFIG_ARCH_CLPS711X is not set
116# CONFIG_ARCH_CO285 is not set
117# CONFIG_ARCH_EBSA110 is not set
118# CONFIG_ARCH_EP93XX is not set
119# CONFIG_ARCH_FOOTBRIDGE is not set
120# CONFIG_ARCH_NETX is not set
121# CONFIG_ARCH_H720X is not set
122# CONFIG_ARCH_IMX is not set
123# CONFIG_ARCH_IOP13XX is not set
124# CONFIG_ARCH_IOP32X is not set
125# CONFIG_ARCH_IOP33X is not set
126# CONFIG_ARCH_IXP23XX is not set
127# CONFIG_ARCH_IXP2000 is not set
128# CONFIG_ARCH_IXP4XX is not set
129# CONFIG_ARCH_L7200 is not set
130# CONFIG_ARCH_KS8695 is not set
131# CONFIG_ARCH_NS9XXX is not set
132# CONFIG_ARCH_MXC is not set
133# CONFIG_ARCH_PNX4008 is not set
134# CONFIG_ARCH_PXA is not set
135# CONFIG_ARCH_RPC is not set
136# CONFIG_ARCH_SA1100 is not set
137# CONFIG_ARCH_S3C2410 is not set
138# CONFIG_ARCH_SHARK is not set
139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
141# CONFIG_ARCH_OMAP is not set
142
143#
144# Boot options
145#
146
147#
148# Power management
149#
150
151#
152# Atmel AT91 System-on-Chip
153#
154# CONFIG_ARCH_AT91RM9200 is not set
155CONFIG_ARCH_AT91SAM9260=y
156# CONFIG_ARCH_AT91SAM9261 is not set
157# CONFIG_ARCH_AT91SAM9263 is not set
158# CONFIG_ARCH_AT91SAM9RL is not set
159# CONFIG_ARCH_AT91CAP9 is not set
160# CONFIG_ARCH_AT91X40 is not set
161CONFIG_AT91_PMC_UNIT=y
162
163#
164# AT91SAM9260 Variants
165#
166# CONFIG_ARCH_AT91SAM9260_SAM9XE is not set
167
168#
169# AT91SAM9260 / AT91SAM9XE Board Type
170#
171# CONFIG_MACH_AT91SAM9260EK is not set
172# CONFIG_MACH_CAM60 is not set
173# CONFIG_MACH_SAM9_L9260 is not set
174# CONFIG_MACH_USB_A9260 is not set
175CONFIG_MACH_QIL_A9260=y
176
177#
178# AT91 Board Options
179#
180
181#
182# AT91 Feature Selections
183#
184# CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set
185CONFIG_AT91_SLOW_CLOCK=y
186CONFIG_AT91_TIMER_HZ=100
187# CONFIG_AT91_EARLY_DBGU is not set
188CONFIG_AT91_EARLY_USART0=y
189# CONFIG_AT91_EARLY_USART1 is not set
190# CONFIG_AT91_EARLY_USART2 is not set
191# CONFIG_AT91_EARLY_USART3 is not set
192# CONFIG_AT91_EARLY_USART4 is not set
193# CONFIG_AT91_EARLY_USART5 is not set
194
195#
196# Processor Type
197#
198CONFIG_CPU_32=y
199CONFIG_CPU_ARM926T=y
200CONFIG_CPU_32v5=y
201CONFIG_CPU_ABRT_EV5TJ=y
202CONFIG_CPU_CACHE_VIVT=y
203CONFIG_CPU_COPY_V4WB=y
204CONFIG_CPU_TLB_V4WBI=y
205CONFIG_CPU_CP15=y
206CONFIG_CPU_CP15_MMU=y
207
208#
209# Processor Features
210#
211# CONFIG_ARM_THUMB is not set
212# CONFIG_CPU_ICACHE_DISABLE is not set
213# CONFIG_CPU_DCACHE_DISABLE is not set
214# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
215# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
216# CONFIG_OUTER_CACHE is not set
217
218#
219# Bus support
220#
221# CONFIG_PCI_SYSCALL is not set
222# CONFIG_ARCH_SUPPORTS_MSI is not set
223# CONFIG_PCCARD is not set
224
225#
226# Kernel Features
227#
228# CONFIG_TICK_ONESHOT is not set
229# CONFIG_NO_HZ is not set
230# CONFIG_HIGH_RES_TIMERS is not set
231CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
232# CONFIG_PREEMPT is not set
233CONFIG_HZ=100
234CONFIG_AEABI=y
235CONFIG_OABI_COMPAT=y
236# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
237CONFIG_SELECT_MEMORY_MODEL=y
238CONFIG_FLATMEM_MANUAL=y
239# CONFIG_DISCONTIGMEM_MANUAL is not set
240# CONFIG_SPARSEMEM_MANUAL is not set
241CONFIG_FLATMEM=y
242CONFIG_FLAT_NODE_MEM_MAP=y
243# CONFIG_SPARSEMEM_STATIC is not set
244# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
245CONFIG_SPLIT_PTLOCK_CPUS=4096
246# CONFIG_RESOURCES_64BIT is not set
247CONFIG_ZONE_DMA_FLAG=1
248CONFIG_BOUNCE=y
249CONFIG_VIRT_TO_BUS=y
250# CONFIG_LEDS is not set
251CONFIG_ALIGNMENT_TRAP=y
252
253#
254# Boot options
255#
256CONFIG_ZBOOT_ROM_TEXT=0x0
257CONFIG_ZBOOT_ROM_BSS=0x0
258CONFIG_CMDLINE="mem=64M console=ttyS1,115200"
259# CONFIG_XIP_KERNEL is not set
260# CONFIG_KEXEC is not set
261
262#
263# Floating point emulation
264#
265
266#
267# At least one emulation must be selected
268#
269CONFIG_FPE_NWFPE=y
270# CONFIG_FPE_NWFPE_XP is not set
271# CONFIG_FPE_FASTFPE is not set
272# CONFIG_VFP is not set
273
274#
275# Userspace binary formats
276#
277CONFIG_BINFMT_ELF=y
278# CONFIG_BINFMT_AOUT is not set
279# CONFIG_BINFMT_MISC is not set
280
281#
282# Power management options
283#
284CONFIG_PM=y
285# CONFIG_PM_LEGACY is not set
286# CONFIG_PM_DEBUG is not set
287CONFIG_PM_SLEEP=y
288CONFIG_SUSPEND_UP_POSSIBLE=y
289CONFIG_SUSPEND=y
290# CONFIG_APM_EMULATION is not set
291
292#
293# Networking
294#
295CONFIG_NET=y
296
297#
298# Networking options
299#
300CONFIG_PACKET=y
301# CONFIG_PACKET_MMAP is not set
302CONFIG_UNIX=y
303# CONFIG_NET_KEY is not set
304CONFIG_INET=y
305CONFIG_IP_MULTICAST=y
306CONFIG_IP_ADVANCED_ROUTER=y
307CONFIG_ASK_IP_FIB_HASH=y
308# CONFIG_IP_FIB_TRIE is not set
309CONFIG_IP_FIB_HASH=y
310# CONFIG_IP_MULTIPLE_TABLES is not set
311# CONFIG_IP_ROUTE_MULTIPATH is not set
312CONFIG_IP_ROUTE_VERBOSE=y
313CONFIG_IP_PNP=y
314# CONFIG_IP_PNP_DHCP is not set
315CONFIG_IP_PNP_BOOTP=y
316CONFIG_IP_PNP_RARP=y
317# CONFIG_NET_IPIP is not set
318# CONFIG_NET_IPGRE is not set
319CONFIG_IP_MROUTE=y
320CONFIG_IP_PIMSM_V1=y
321CONFIG_IP_PIMSM_V2=y
322# CONFIG_ARPD is not set
323# CONFIG_SYN_COOKIES is not set
324# CONFIG_INET_AH is not set
325# CONFIG_INET_ESP is not set
326# CONFIG_INET_IPCOMP is not set
327# CONFIG_INET_XFRM_TUNNEL is not set
328# CONFIG_INET_TUNNEL is not set
329# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
330# CONFIG_INET_XFRM_MODE_TUNNEL is not set
331# CONFIG_INET_XFRM_MODE_BEET is not set
332# CONFIG_INET_LRO is not set
333# CONFIG_INET_DIAG is not set
334# CONFIG_TCP_CONG_ADVANCED is not set
335CONFIG_TCP_CONG_CUBIC=y
336CONFIG_DEFAULT_TCP_CONG="cubic"
337# CONFIG_TCP_MD5SIG is not set
338# CONFIG_IPV6 is not set
339# CONFIG_INET6_XFRM_TUNNEL is not set
340# CONFIG_INET6_TUNNEL is not set
341# CONFIG_NETWORK_SECMARK is not set
342# CONFIG_NETFILTER is not set
343# CONFIG_IP_DCCP is not set
344# CONFIG_IP_SCTP is not set
345# CONFIG_TIPC is not set
346# CONFIG_ATM is not set
347# CONFIG_BRIDGE is not set
348# CONFIG_VLAN_8021Q is not set
349# CONFIG_DECNET is not set
350# CONFIG_LLC2 is not set
351# CONFIG_IPX is not set
352# CONFIG_ATALK is not set
353# CONFIG_X25 is not set
354# CONFIG_LAPB is not set
355# CONFIG_ECONET is not set
356# CONFIG_WAN_ROUTER is not set
357# CONFIG_NET_SCHED is not set
358
359#
360# Network testing
361#
362# CONFIG_NET_PKTGEN is not set
363# CONFIG_HAMRADIO is not set
364# CONFIG_IRDA is not set
365# CONFIG_BT is not set
366# CONFIG_AF_RXRPC is not set
367
368#
369# Wireless
370#
371# CONFIG_CFG80211 is not set
372# CONFIG_WIRELESS_EXT is not set
373# CONFIG_MAC80211 is not set
374# CONFIG_IEEE80211 is not set
375# CONFIG_RFKILL is not set
376# CONFIG_NET_9P is not set
377
378#
379# Device Drivers
380#
381
382#
383# Generic Driver Options
384#
385CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
386CONFIG_STANDALONE=y
387CONFIG_PREVENT_FIRMWARE_BUILD=y
388# CONFIG_FW_LOADER is not set
389# CONFIG_DEBUG_DRIVER is not set
390# CONFIG_DEBUG_DEVRES is not set
391# CONFIG_SYS_HYPERVISOR is not set
392# CONFIG_CONNECTOR is not set
393CONFIG_MTD=y
394# CONFIG_MTD_DEBUG is not set
395# CONFIG_MTD_CONCAT is not set
396CONFIG_MTD_PARTITIONS=y
397# CONFIG_MTD_REDBOOT_PARTS is not set
398CONFIG_MTD_CMDLINE_PARTS=y
399# CONFIG_MTD_AFS_PARTS is not set
400
401#
402# User Modules And Translation Layers
403#
404CONFIG_MTD_CHAR=y
405CONFIG_MTD_BLKDEVS=y
406CONFIG_MTD_BLOCK=y
407# CONFIG_FTL is not set
408# CONFIG_NFTL is not set
409# CONFIG_INFTL is not set
410# CONFIG_RFD_FTL is not set
411# CONFIG_SSFDC is not set
412# CONFIG_MTD_OOPS is not set
413
414#
415# RAM/ROM/Flash chip drivers
416#
417# CONFIG_MTD_CFI is not set
418# CONFIG_MTD_JEDECPROBE is not set
419CONFIG_MTD_MAP_BANK_WIDTH_1=y
420CONFIG_MTD_MAP_BANK_WIDTH_2=y
421CONFIG_MTD_MAP_BANK_WIDTH_4=y
422# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
423# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
424# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
425CONFIG_MTD_CFI_I1=y
426CONFIG_MTD_CFI_I2=y
427# CONFIG_MTD_CFI_I4 is not set
428# CONFIG_MTD_CFI_I8 is not set
429# CONFIG_MTD_RAM is not set
430# CONFIG_MTD_ROM is not set
431# CONFIG_MTD_ABSENT is not set
432
433#
434# Mapping drivers for chip access
435#
436# CONFIG_MTD_COMPLEX_MAPPINGS is not set
437# CONFIG_MTD_PLATRAM is not set
438
439#
440# Self-contained MTD device drivers
441#
442CONFIG_MTD_DATAFLASH=y
443# CONFIG_MTD_M25P80 is not set
444# CONFIG_MTD_SLRAM is not set
445# CONFIG_MTD_PHRAM is not set
446# CONFIG_MTD_MTDRAM is not set
447# CONFIG_MTD_BLOCK2MTD is not set
448
449#
450# Disk-On-Chip Device Drivers
451#
452# CONFIG_MTD_DOC2000 is not set
453# CONFIG_MTD_DOC2001 is not set
454# CONFIG_MTD_DOC2001PLUS is not set
455CONFIG_MTD_NAND=y
456# CONFIG_MTD_NAND_VERIFY_WRITE is not set
457# CONFIG_MTD_NAND_ECC_SMC is not set
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y
460# CONFIG_MTD_NAND_DISKONCHIP is not set
461CONFIG_MTD_NAND_AT91=y
462CONFIG_MTD_NAND_AT91_ECC_SOFT=y
463# CONFIG_MTD_NAND_AT91_ECC_HW is not set
464# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
465# CONFIG_MTD_NAND_NANDSIM is not set
466# CONFIG_MTD_NAND_PLATFORM is not set
467# CONFIG_MTD_ALAUDA is not set
468# CONFIG_MTD_ONENAND is not set
469
470#
471# UBI - Unsorted block images
472#
473# CONFIG_MTD_UBI is not set
474# CONFIG_PARPORT is not set
475CONFIG_BLK_DEV=y
476# CONFIG_BLK_DEV_COW_COMMON is not set
477CONFIG_BLK_DEV_LOOP=y
478# CONFIG_BLK_DEV_CRYPTOLOOP is not set
479# CONFIG_BLK_DEV_NBD is not set
480# CONFIG_BLK_DEV_UB is not set
481# CONFIG_BLK_DEV_RAM is not set
482# CONFIG_CDROM_PKTCDVD is not set
483# CONFIG_ATA_OVER_ETH is not set
484# CONFIG_MISC_DEVICES is not set
485
486#
487# SCSI device support
488#
489# CONFIG_RAID_ATTRS is not set
490CONFIG_SCSI=y
491CONFIG_SCSI_DMA=y
492# CONFIG_SCSI_TGT is not set
493# CONFIG_SCSI_NETLINK is not set
494CONFIG_SCSI_PROC_FS=y
495
496#
497# SCSI support type (disk, tape, CD-ROM)
498#
499CONFIG_BLK_DEV_SD=y
500# CONFIG_CHR_DEV_ST is not set
501# CONFIG_CHR_DEV_OSST is not set
502# CONFIG_BLK_DEV_SR is not set
503# CONFIG_CHR_DEV_SG is not set
504# CONFIG_CHR_DEV_SCH is not set
505
506#
507# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
508#
509CONFIG_SCSI_MULTI_LUN=y
510# CONFIG_SCSI_CONSTANTS is not set
511# CONFIG_SCSI_LOGGING is not set
512# CONFIG_SCSI_SCAN_ASYNC is not set
513CONFIG_SCSI_WAIT_SCAN=m
514
515#
516# SCSI Transports
517#
518# CONFIG_SCSI_SPI_ATTRS is not set
519# CONFIG_SCSI_FC_ATTRS is not set
520# CONFIG_SCSI_ISCSI_ATTRS is not set
521# CONFIG_SCSI_SAS_LIBSAS is not set
522# CONFIG_SCSI_SRP_ATTRS is not set
523CONFIG_SCSI_LOWLEVEL=y
524# CONFIG_ISCSI_TCP is not set
525# CONFIG_SCSI_DEBUG is not set
526# CONFIG_ATA is not set
527# CONFIG_MD is not set
528CONFIG_NETDEVICES=y
529# CONFIG_NETDEVICES_MULTIQUEUE is not set
530# CONFIG_DUMMY is not set
531# CONFIG_BONDING is not set
532# CONFIG_MACVLAN is not set
533# CONFIG_EQUALIZER is not set
534# CONFIG_TUN is not set
535# CONFIG_VETH is not set
536CONFIG_PHYLIB=y
537
538#
539# MII PHY device drivers
540#
541# CONFIG_MARVELL_PHY is not set
542# CONFIG_DAVICOM_PHY is not set
543# CONFIG_QSEMI_PHY is not set
544# CONFIG_LXT_PHY is not set
545# CONFIG_CICADA_PHY is not set
546# CONFIG_VITESSE_PHY is not set
547# CONFIG_SMSC_PHY is not set
548# CONFIG_BROADCOM_PHY is not set
549# CONFIG_ICPLUS_PHY is not set
550# CONFIG_FIXED_PHY is not set
551# CONFIG_MDIO_BITBANG is not set
552CONFIG_NET_ETHERNET=y
553CONFIG_MII=y
554CONFIG_MACB=y
555# CONFIG_AX88796 is not set
556# CONFIG_SMC91X is not set
557# CONFIG_DM9000 is not set
558# CONFIG_IBM_NEW_EMAC_ZMII is not set
559# CONFIG_IBM_NEW_EMAC_RGMII is not set
560# CONFIG_IBM_NEW_EMAC_TAH is not set
561# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
562# CONFIG_B44 is not set
563CONFIG_NETDEV_1000=y
564CONFIG_NETDEV_10000=y
565
566#
567# Wireless LAN
568#
569# CONFIG_WLAN_PRE80211 is not set
570# CONFIG_WLAN_80211 is not set
571
572#
573# USB Network Adapters
574#
575# CONFIG_USB_CATC is not set
576# CONFIG_USB_KAWETH is not set
577# CONFIG_USB_PEGASUS is not set
578# CONFIG_USB_RTL8150 is not set
579# CONFIG_USB_USBNET is not set
580# CONFIG_WAN is not set
581# CONFIG_PPP is not set
582# CONFIG_SLIP is not set
583# CONFIG_SHAPER is not set
584# CONFIG_NETCONSOLE is not set
585# CONFIG_NETPOLL is not set
586# CONFIG_NET_POLL_CONTROLLER is not set
587# CONFIG_ISDN is not set
588
589#
590# Input device support
591#
592CONFIG_INPUT=y
593# CONFIG_INPUT_FF_MEMLESS is not set
594# CONFIG_INPUT_POLLDEV is not set
595
596#
597# Userland interfaces
598#
599CONFIG_INPUT_MOUSEDEV=y
600# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
601CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
602CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
603# CONFIG_INPUT_JOYDEV is not set
604CONFIG_INPUT_EVDEV=y
605CONFIG_INPUT_EVBUG=y
606
607#
608# Input Device Drivers
609#
610CONFIG_INPUT_KEYBOARD=y
611# CONFIG_KEYBOARD_ATKBD is not set
612# CONFIG_KEYBOARD_SUNKBD is not set
613# CONFIG_KEYBOARD_LKKBD is not set
614# CONFIG_KEYBOARD_XTKBD is not set
615# CONFIG_KEYBOARD_NEWTON is not set
616# CONFIG_KEYBOARD_STOWAWAY is not set
617CONFIG_KEYBOARD_GPIO=y
618# CONFIG_INPUT_MOUSE is not set
619# CONFIG_INPUT_JOYSTICK is not set
620# CONFIG_INPUT_TABLET is not set
621# CONFIG_INPUT_TOUCHSCREEN is not set
622# CONFIG_INPUT_MISC is not set
623
624#
625# Hardware I/O ports
626#
627# CONFIG_SERIO is not set
628# CONFIG_GAMEPORT is not set
629
630#
631# Character devices
632#
633CONFIG_VT=y
634CONFIG_VT_CONSOLE=y
635CONFIG_HW_CONSOLE=y
636# CONFIG_VT_HW_CONSOLE_BINDING is not set
637# CONFIG_SERIAL_NONSTANDARD is not set
638
639#
640# Serial drivers
641#
642# CONFIG_SERIAL_8250 is not set
643
644#
645# Non-8250 serial port support
646#
647CONFIG_SERIAL_ATMEL=y
648CONFIG_SERIAL_ATMEL_CONSOLE=y
649# CONFIG_SERIAL_ATMEL_TTYAT is not set
650CONFIG_SERIAL_CORE=y
651CONFIG_SERIAL_CORE_CONSOLE=y
652CONFIG_UNIX98_PTYS=y
653CONFIG_LEGACY_PTYS=y
654CONFIG_LEGACY_PTY_COUNT=256
655# CONFIG_IPMI_HANDLER is not set
656CONFIG_HW_RANDOM=y
657# CONFIG_NVRAM is not set
658# CONFIG_R3964 is not set
659# CONFIG_RAW_DRIVER is not set
660# CONFIG_TCG_TPM is not set
661CONFIG_I2C=y
662CONFIG_I2C_BOARDINFO=y
663CONFIG_I2C_CHARDEV=y
664
665#
666# I2C Algorithms
667#
668# CONFIG_I2C_ALGOBIT is not set
669# CONFIG_I2C_ALGOPCF is not set
670# CONFIG_I2C_ALGOPCA is not set
671
672#
673# I2C Hardware Bus support
674#
675# CONFIG_I2C_GPIO is not set
676# CONFIG_I2C_OCORES is not set
677# CONFIG_I2C_PARPORT_LIGHT is not set
678# CONFIG_I2C_SIMTEC is not set
679# CONFIG_I2C_TAOS_EVM is not set
680# CONFIG_I2C_STUB is not set
681# CONFIG_I2C_TINY_USB is not set
682# CONFIG_I2C_PCA is not set
683
684#
685# Miscellaneous I2C Chip support
686#
687# CONFIG_SENSORS_DS1337 is not set
688# CONFIG_SENSORS_DS1374 is not set
689# CONFIG_DS1682 is not set
690# CONFIG_SENSORS_EEPROM is not set
691# CONFIG_SENSORS_PCF8574 is not set
692# CONFIG_SENSORS_PCA9539 is not set
693# CONFIG_SENSORS_PCF8591 is not set
694# CONFIG_SENSORS_MAX6875 is not set
695# CONFIG_SENSORS_TSL2550 is not set
696# CONFIG_I2C_DEBUG_CORE is not set
697# CONFIG_I2C_DEBUG_ALGO is not set
698# CONFIG_I2C_DEBUG_BUS is not set
699# CONFIG_I2C_DEBUG_CHIP is not set
700
701#
702# SPI support
703#
704CONFIG_SPI=y
705# CONFIG_SPI_DEBUG is not set
706CONFIG_SPI_MASTER=y
707
708#
709# SPI Master Controller Drivers
710#
711CONFIG_SPI_ATMEL=y
712# CONFIG_SPI_BITBANG is not set
713
714#
715# SPI Protocol Masters
716#
717# CONFIG_SPI_AT25 is not set
718# CONFIG_SPI_SPIDEV is not set
719# CONFIG_SPI_TLE62X0 is not set
720# CONFIG_W1 is not set
721# CONFIG_POWER_SUPPLY is not set
722# CONFIG_HWMON is not set
723CONFIG_WATCHDOG=y
724CONFIG_WATCHDOG_NOWAYOUT=y
725
726#
727# Watchdog Device Drivers
728#
729# CONFIG_SOFT_WATCHDOG is not set
730# CONFIG_AT91SAM9_WATCHDOG is not set
731
732#
733# USB-based Watchdog Cards
734#
735# CONFIG_USBPCWATCHDOG is not set
736
737#
738# Sonics Silicon Backplane
739#
740CONFIG_SSB_POSSIBLE=y
741# CONFIG_SSB is not set
742
743#
744# Multifunction device drivers
745#
746# CONFIG_MFD_SM501 is not set
747
748#
749# Multimedia devices
750#
751# CONFIG_VIDEO_DEV is not set
752# CONFIG_DVB_CORE is not set
753# CONFIG_DAB is not set
754
755#
756# Graphics support
757#
758# CONFIG_VGASTATE is not set
759# CONFIG_VIDEO_OUTPUT_CONTROL is not set
760# CONFIG_FB is not set
761# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
762
763#
764# Display device support
765#
766# CONFIG_DISPLAY_SUPPORT is not set
767
768#
769# Console display driver support
770#
771# CONFIG_VGA_CONSOLE is not set
772CONFIG_DUMMY_CONSOLE=y
773
774#
775# Sound
776#
777# CONFIG_SOUND is not set
778CONFIG_HID_SUPPORT=y
779CONFIG_HID=y
780# CONFIG_HID_DEBUG is not set
781# CONFIG_HIDRAW is not set
782
783#
784# USB Input Devices
785#
786# CONFIG_USB_HID is not set
787
788#
789# USB HID Boot Protocol drivers
790#
791# CONFIG_USB_KBD is not set
792# CONFIG_USB_MOUSE is not set
793CONFIG_USB_SUPPORT=y
794CONFIG_USB_ARCH_HAS_HCD=y
795CONFIG_USB_ARCH_HAS_OHCI=y
796# CONFIG_USB_ARCH_HAS_EHCI is not set
797CONFIG_USB=y
798# CONFIG_USB_DEBUG is not set
799
800#
801# Miscellaneous USB options
802#
803CONFIG_USB_DEVICEFS=y
804CONFIG_USB_DEVICE_CLASS=y
805# CONFIG_USB_DYNAMIC_MINORS is not set
806# CONFIG_USB_SUSPEND is not set
807# CONFIG_USB_PERSIST is not set
808# CONFIG_USB_OTG is not set
809
810#
811# USB Host Controller Drivers
812#
813# CONFIG_USB_ISP116X_HCD is not set
814CONFIG_USB_OHCI_HCD=y
815# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
816# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
817CONFIG_USB_OHCI_LITTLE_ENDIAN=y
818# CONFIG_USB_SL811_HCD is not set
819# CONFIG_USB_R8A66597_HCD is not set
820
821#
822# USB Device Class drivers
823#
824# CONFIG_USB_ACM is not set
825# CONFIG_USB_PRINTER is not set
826
827#
828# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
829#
830
831#
832# may also be needed; see USB_STORAGE Help for more information
833#
834CONFIG_USB_STORAGE=y
835# CONFIG_USB_STORAGE_DEBUG is not set
836# CONFIG_USB_STORAGE_DATAFAB is not set
837# CONFIG_USB_STORAGE_FREECOM is not set
838# CONFIG_USB_STORAGE_ISD200 is not set
839# CONFIG_USB_STORAGE_DPCM is not set
840# CONFIG_USB_STORAGE_USBAT is not set
841# CONFIG_USB_STORAGE_SDDR09 is not set
842# CONFIG_USB_STORAGE_SDDR55 is not set
843# CONFIG_USB_STORAGE_JUMPSHOT is not set
844# CONFIG_USB_STORAGE_ALAUDA is not set
845# CONFIG_USB_STORAGE_KARMA is not set
846# CONFIG_USB_LIBUSUAL is not set
847
848#
849# USB Imaging devices
850#
851# CONFIG_USB_MDC800 is not set
852# CONFIG_USB_MICROTEK is not set
853CONFIG_USB_MON=y
854
855#
856# USB port drivers
857#
858
859#
860# USB Serial Converter support
861#
862# CONFIG_USB_SERIAL is not set
863
864#
865# USB Miscellaneous drivers
866#
867# CONFIG_USB_EMI62 is not set
868# CONFIG_USB_EMI26 is not set
869# CONFIG_USB_ADUTUX is not set
870# CONFIG_USB_AUERSWALD is not set
871# CONFIG_USB_RIO500 is not set
872# CONFIG_USB_LEGOTOWER is not set
873# CONFIG_USB_LCD is not set
874# CONFIG_USB_BERRY_CHARGE is not set
875# CONFIG_USB_LED is not set
876# CONFIG_USB_CYPRESS_CY7C63 is not set
877# CONFIG_USB_CYTHERM is not set
878# CONFIG_USB_PHIDGET is not set
879# CONFIG_USB_IDMOUSE is not set
880# CONFIG_USB_FTDI_ELAN is not set
881# CONFIG_USB_APPLEDISPLAY is not set
882# CONFIG_USB_LD is not set
883# CONFIG_USB_TRANCEVIBRATOR is not set
884# CONFIG_USB_IOWARRIOR is not set
885# CONFIG_USB_TEST is not set
886
887#
888# USB DSL modem support
889#
890
891#
892# USB Gadget Support
893#
894CONFIG_USB_GADGET=y
895# CONFIG_USB_GADGET_DEBUG is not set
896# CONFIG_USB_GADGET_DEBUG_FILES is not set
897CONFIG_USB_GADGET_SELECTED=y
898# CONFIG_USB_GADGET_AMD5536UDC is not set
899# CONFIG_USB_GADGET_ATMEL_USBA is not set
900# CONFIG_USB_GADGET_FSL_USB2 is not set
901# CONFIG_USB_GADGET_NET2280 is not set
902# CONFIG_USB_GADGET_PXA2XX is not set
903# CONFIG_USB_GADGET_M66592 is not set
904# CONFIG_USB_GADGET_GOKU is not set
905# CONFIG_USB_GADGET_LH7A40X is not set
906# CONFIG_USB_GADGET_OMAP is not set
907# CONFIG_USB_GADGET_S3C2410 is not set
908CONFIG_USB_GADGET_AT91=y
909CONFIG_USB_AT91=y
910# CONFIG_USB_GADGET_DUMMY_HCD is not set
911# CONFIG_USB_GADGET_DUALSPEED is not set
912# CONFIG_USB_ZERO is not set
913CONFIG_USB_ETH=y
914CONFIG_USB_ETH_RNDIS=y
915# CONFIG_USB_GADGETFS is not set
916# CONFIG_USB_FILE_STORAGE is not set
917# CONFIG_USB_G_SERIAL is not set
918# CONFIG_USB_MIDI_GADGET is not set
919CONFIG_MMC=y
920# CONFIG_MMC_DEBUG is not set
921# CONFIG_MMC_UNSAFE_RESUME is not set
922
923#
924# MMC/SD Card Drivers
925#
926CONFIG_MMC_BLOCK=y
927CONFIG_MMC_BLOCK_BOUNCE=y
928# CONFIG_SDIO_UART is not set
929
930#
931# MMC/SD Host Controller Drivers
932#
933CONFIG_MMC_AT91=y
934# CONFIG_MMC_SPI is not set
935CONFIG_NEW_LEDS=y
936CONFIG_LEDS_CLASS=y
937
938#
939# LED drivers
940#
941CONFIG_LEDS_GPIO=y
942
943#
944# LED Triggers
945#
946CONFIG_LEDS_TRIGGERS=y
947# CONFIG_LEDS_TRIGGER_TIMER is not set
948CONFIG_LEDS_TRIGGER_HEARTBEAT=y
949CONFIG_RTC_LIB=y
950CONFIG_RTC_CLASS=y
951CONFIG_RTC_HCTOSYS=y
952CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
953# CONFIG_RTC_DEBUG is not set
954
955#
956# RTC interfaces
957#
958CONFIG_RTC_INTF_SYSFS=y
959CONFIG_RTC_INTF_PROC=y
960CONFIG_RTC_INTF_DEV=y
961# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
962# CONFIG_RTC_DRV_TEST is not set
963
964#
965# I2C RTC drivers
966#
967# CONFIG_RTC_DRV_DS1307 is not set
968# CONFIG_RTC_DRV_DS1374 is not set
969# CONFIG_RTC_DRV_DS1672 is not set
970# CONFIG_RTC_DRV_MAX6900 is not set
971# CONFIG_RTC_DRV_RS5C372 is not set
972# CONFIG_RTC_DRV_ISL1208 is not set
973# CONFIG_RTC_DRV_X1205 is not set
974# CONFIG_RTC_DRV_PCF8563 is not set
975# CONFIG_RTC_DRV_PCF8583 is not set
976# CONFIG_RTC_DRV_M41T80 is not set
977
978#
979# SPI RTC drivers
980#
981# CONFIG_RTC_DRV_RS5C348 is not set
982# CONFIG_RTC_DRV_MAX6902 is not set
983CONFIG_RTC_DRV_M41T94=y
984
985#
986# Platform RTC drivers
987#
988# CONFIG_RTC_DRV_CMOS is not set
989# CONFIG_RTC_DRV_DS1553 is not set
990# CONFIG_RTC_DRV_STK17TA8 is not set
991# CONFIG_RTC_DRV_DS1742 is not set
992# CONFIG_RTC_DRV_M48T86 is not set
993# CONFIG_RTC_DRV_M48T59 is not set
994# CONFIG_RTC_DRV_V3020 is not set
995
996#
997# on-CPU RTC drivers
998#
999# CONFIG_RTC_DRV_AT91SAM9 is not set
1000
1001#
1002# File systems
1003#
1004CONFIG_EXT2_FS=y
1005# CONFIG_EXT2_FS_XATTR is not set
1006# CONFIG_EXT2_FS_XIP is not set
1007# CONFIG_EXT3_FS is not set
1008# CONFIG_EXT4DEV_FS is not set
1009# CONFIG_REISERFS_FS is not set
1010# CONFIG_JFS_FS is not set
1011CONFIG_FS_POSIX_ACL=y
1012# CONFIG_XFS_FS is not set
1013# CONFIG_GFS2_FS is not set
1014# CONFIG_OCFS2_FS is not set
1015# CONFIG_MINIX_FS is not set
1016# CONFIG_ROMFS_FS is not set
1017CONFIG_INOTIFY=y
1018CONFIG_INOTIFY_USER=y
1019# CONFIG_QUOTA is not set
1020CONFIG_DNOTIFY=y
1021# CONFIG_AUTOFS_FS is not set
1022# CONFIG_AUTOFS4_FS is not set
1023CONFIG_FUSE_FS=m
1024
1025#
1026# CD-ROM/DVD Filesystems
1027#
1028# CONFIG_ISO9660_FS is not set
1029# CONFIG_UDF_FS is not set
1030
1031#
1032# DOS/FAT/NT Filesystems
1033#
1034CONFIG_FAT_FS=y
1035# CONFIG_MSDOS_FS is not set
1036CONFIG_VFAT_FS=y
1037CONFIG_FAT_DEFAULT_CODEPAGE=437
1038CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1039# CONFIG_NTFS_FS is not set
1040
1041#
1042# Pseudo filesystems
1043#
1044CONFIG_PROC_FS=y
1045CONFIG_PROC_SYSCTL=y
1046CONFIG_SYSFS=y
1047CONFIG_TMPFS=y
1048# CONFIG_TMPFS_POSIX_ACL is not set
1049# CONFIG_HUGETLB_PAGE is not set
1050# CONFIG_CONFIGFS_FS is not set
1051
1052#
1053# Miscellaneous filesystems
1054#
1055# CONFIG_ADFS_FS is not set
1056# CONFIG_AFFS_FS is not set
1057# CONFIG_HFS_FS is not set
1058# CONFIG_HFSPLUS_FS is not set
1059# CONFIG_BEFS_FS is not set
1060# CONFIG_BFS_FS is not set
1061# CONFIG_EFS_FS is not set
1062CONFIG_JFFS2_FS=y
1063CONFIG_JFFS2_FS_DEBUG=0
1064CONFIG_JFFS2_FS_WRITEBUFFER=y
1065# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1066# CONFIG_JFFS2_SUMMARY is not set
1067# CONFIG_JFFS2_FS_XATTR is not set
1068# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1069CONFIG_JFFS2_ZLIB=y
1070# CONFIG_JFFS2_LZO is not set
1071CONFIG_JFFS2_RTIME=y
1072# CONFIG_JFFS2_RUBIN is not set
1073# CONFIG_CRAMFS is not set
1074# CONFIG_VXFS_FS is not set
1075# CONFIG_HPFS_FS is not set
1076# CONFIG_QNX4FS_FS is not set
1077# CONFIG_SYSV_FS is not set
1078# CONFIG_UFS_FS is not set
1079CONFIG_NETWORK_FILESYSTEMS=y
1080CONFIG_NFS_FS=y
1081CONFIG_NFS_V3=y
1082CONFIG_NFS_V3_ACL=y
1083CONFIG_NFS_V4=y
1084# CONFIG_NFS_DIRECTIO is not set
1085# CONFIG_NFSD is not set
1086CONFIG_ROOT_NFS=y
1087CONFIG_LOCKD=y
1088CONFIG_LOCKD_V4=y
1089CONFIG_NFS_ACL_SUPPORT=y
1090CONFIG_NFS_COMMON=y
1091CONFIG_SUNRPC=y
1092CONFIG_SUNRPC_GSS=y
1093# CONFIG_SUNRPC_BIND34 is not set
1094CONFIG_RPCSEC_GSS_KRB5=y
1095# CONFIG_RPCSEC_GSS_SPKM3 is not set
1096# CONFIG_SMB_FS is not set
1097# CONFIG_CIFS is not set
1098# CONFIG_NCP_FS is not set
1099# CONFIG_CODA_FS is not set
1100# CONFIG_AFS_FS is not set
1101
1102#
1103# Partition Types
1104#
1105# CONFIG_PARTITION_ADVANCED is not set
1106CONFIG_MSDOS_PARTITION=y
1107CONFIG_NLS=y
1108CONFIG_NLS_DEFAULT="iso8859-1"
1109CONFIG_NLS_CODEPAGE_437=y
1110# CONFIG_NLS_CODEPAGE_737 is not set
1111# CONFIG_NLS_CODEPAGE_775 is not set
1112CONFIG_NLS_CODEPAGE_850=y
1113# CONFIG_NLS_CODEPAGE_852 is not set
1114# CONFIG_NLS_CODEPAGE_855 is not set
1115# CONFIG_NLS_CODEPAGE_857 is not set
1116# CONFIG_NLS_CODEPAGE_860 is not set
1117# CONFIG_NLS_CODEPAGE_861 is not set
1118# CONFIG_NLS_CODEPAGE_862 is not set
1119# CONFIG_NLS_CODEPAGE_863 is not set
1120# CONFIG_NLS_CODEPAGE_864 is not set
1121# CONFIG_NLS_CODEPAGE_865 is not set
1122# CONFIG_NLS_CODEPAGE_866 is not set
1123# CONFIG_NLS_CODEPAGE_869 is not set
1124# CONFIG_NLS_CODEPAGE_936 is not set
1125# CONFIG_NLS_CODEPAGE_950 is not set
1126# CONFIG_NLS_CODEPAGE_932 is not set
1127# CONFIG_NLS_CODEPAGE_949 is not set
1128# CONFIG_NLS_CODEPAGE_874 is not set
1129# CONFIG_NLS_ISO8859_8 is not set
1130# CONFIG_NLS_CODEPAGE_1250 is not set
1131# CONFIG_NLS_CODEPAGE_1251 is not set
1132# CONFIG_NLS_ASCII is not set
1133CONFIG_NLS_ISO8859_1=y
1134# CONFIG_NLS_ISO8859_2 is not set
1135# CONFIG_NLS_ISO8859_3 is not set
1136# CONFIG_NLS_ISO8859_4 is not set
1137# CONFIG_NLS_ISO8859_5 is not set
1138# CONFIG_NLS_ISO8859_6 is not set
1139# CONFIG_NLS_ISO8859_7 is not set
1140# CONFIG_NLS_ISO8859_9 is not set
1141# CONFIG_NLS_ISO8859_13 is not set
1142# CONFIG_NLS_ISO8859_14 is not set
1143# CONFIG_NLS_ISO8859_15 is not set
1144# CONFIG_NLS_KOI8_R is not set
1145# CONFIG_NLS_KOI8_U is not set
1146# CONFIG_NLS_UTF8 is not set
1147# CONFIG_DLM is not set
1148# CONFIG_INSTRUMENTATION is not set
1149
1150#
1151# Kernel hacking
1152#
1153# CONFIG_PRINTK_TIME is not set
1154CONFIG_ENABLE_WARN_DEPRECATED=y
1155CONFIG_ENABLE_MUST_CHECK=y
1156# CONFIG_MAGIC_SYSRQ is not set
1157# CONFIG_UNUSED_SYMBOLS is not set
1158# CONFIG_DEBUG_FS is not set
1159# CONFIG_HEADERS_CHECK is not set
1160CONFIG_DEBUG_KERNEL=y
1161# CONFIG_DEBUG_SHIRQ is not set
1162CONFIG_DETECT_SOFTLOCKUP=y
1163CONFIG_SCHED_DEBUG=y
1164# CONFIG_SCHEDSTATS is not set
1165# CONFIG_TIMER_STATS is not set
1166# CONFIG_DEBUG_SLAB is not set
1167# CONFIG_DEBUG_RT_MUTEXES is not set
1168# CONFIG_RT_MUTEX_TESTER is not set
1169# CONFIG_DEBUG_SPINLOCK is not set
1170# CONFIG_DEBUG_MUTEXES is not set
1171# CONFIG_DEBUG_LOCK_ALLOC is not set
1172# CONFIG_PROVE_LOCKING is not set
1173# CONFIG_LOCK_STAT is not set
1174# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1175# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1176# CONFIG_DEBUG_KOBJECT is not set
1177CONFIG_DEBUG_BUGVERBOSE=y
1178# CONFIG_DEBUG_INFO is not set
1179# CONFIG_DEBUG_VM is not set
1180# CONFIG_DEBUG_LIST is not set
1181# CONFIG_DEBUG_SG is not set
1182CONFIG_FRAME_POINTER=y
1183CONFIG_FORCED_INLINING=y
1184# CONFIG_BOOT_PRINTK_DELAY is not set
1185# CONFIG_RCU_TORTURE_TEST is not set
1186# CONFIG_FAULT_INJECTION is not set
1187# CONFIG_SAMPLES is not set
1188CONFIG_DEBUG_USER=y
1189# CONFIG_DEBUG_ERRORS is not set
1190CONFIG_DEBUG_LL=y
1191# CONFIG_DEBUG_ICEDCC is not set
1192
1193#
1194# Security options
1195#
1196# CONFIG_KEYS is not set
1197# CONFIG_SECURITY is not set
1198# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1199CONFIG_CRYPTO=y
1200CONFIG_CRYPTO_ALGAPI=y
1201CONFIG_CRYPTO_BLKCIPHER=y
1202CONFIG_CRYPTO_MANAGER=y
1203# CONFIG_CRYPTO_HMAC is not set
1204# CONFIG_CRYPTO_XCBC is not set
1205# CONFIG_CRYPTO_NULL is not set
1206# CONFIG_CRYPTO_MD4 is not set
1207CONFIG_CRYPTO_MD5=y
1208# CONFIG_CRYPTO_SHA1 is not set
1209# CONFIG_CRYPTO_SHA256 is not set
1210# CONFIG_CRYPTO_SHA512 is not set
1211# CONFIG_CRYPTO_WP512 is not set
1212# CONFIG_CRYPTO_TGR192 is not set
1213# CONFIG_CRYPTO_GF128MUL is not set
1214# CONFIG_CRYPTO_ECB is not set
1215CONFIG_CRYPTO_CBC=y
1216# CONFIG_CRYPTO_PCBC is not set
1217# CONFIG_CRYPTO_LRW is not set
1218# CONFIG_CRYPTO_XTS is not set
1219# CONFIG_CRYPTO_CRYPTD is not set
1220CONFIG_CRYPTO_DES=y
1221# CONFIG_CRYPTO_FCRYPT is not set
1222# CONFIG_CRYPTO_BLOWFISH is not set
1223# CONFIG_CRYPTO_TWOFISH is not set
1224# CONFIG_CRYPTO_SERPENT is not set
1225# CONFIG_CRYPTO_AES is not set
1226# CONFIG_CRYPTO_CAST5 is not set
1227# CONFIG_CRYPTO_CAST6 is not set
1228# CONFIG_CRYPTO_TEA is not set
1229# CONFIG_CRYPTO_ARC4 is not set
1230# CONFIG_CRYPTO_KHAZAD is not set
1231# CONFIG_CRYPTO_ANUBIS is not set
1232# CONFIG_CRYPTO_SEED is not set
1233# CONFIG_CRYPTO_DEFLATE is not set
1234# CONFIG_CRYPTO_MICHAEL_MIC is not set
1235# CONFIG_CRYPTO_CRC32C is not set
1236# CONFIG_CRYPTO_CAMELLIA is not set
1237# CONFIG_CRYPTO_TEST is not set
1238# CONFIG_CRYPTO_AUTHENC is not set
1239# CONFIG_CRYPTO_HW is not set
1240
1241#
1242# Library routines
1243#
1244CONFIG_BITREVERSE=y
1245# CONFIG_CRC_CCITT is not set
1246# CONFIG_CRC16 is not set
1247# CONFIG_CRC_ITU_T is not set
1248CONFIG_CRC32=y
1249# CONFIG_CRC7 is not set
1250# CONFIG_LIBCRC32C is not set
1251CONFIG_ZLIB_INFLATE=y
1252CONFIG_ZLIB_DEFLATE=y
1253CONFIG_PLIST=y
1254CONFIG_HAS_IOMEM=y
1255CONFIG_HAS_IOPORT=y
1256CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/realview-smp_defconfig b/arch/arm/configs/realview-smp_defconfig
index fc39ba1a89f3..0c09b23167ec 100644
--- a/arch/arm/configs/realview-smp_defconfig
+++ b/arch/arm/configs/realview-smp_defconfig
@@ -177,7 +177,6 @@ CONFIG_NR_CPUS=4
177CONFIG_HOTPLUG_CPU=y 177CONFIG_HOTPLUG_CPU=y
178CONFIG_LOCAL_TIMERS=y 178CONFIG_LOCAL_TIMERS=y
179# CONFIG_PREEMPT is not set 179# CONFIG_PREEMPT is not set
180# CONFIG_NO_IDLE_HZ is not set
181CONFIG_HZ=100 180CONFIG_HZ=100
182# CONFIG_AEABI is not set 181# CONFIG_AEABI is not set
183# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 182# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/realview_defconfig b/arch/arm/configs/realview_defconfig
index accbf529ce5b..907e54344dad 100644
--- a/arch/arm/configs/realview_defconfig
+++ b/arch/arm/configs/realview_defconfig
@@ -126,7 +126,6 @@ CONFIG_ISA_DMA_API=y
126# 126#
127# Kernel Features 127# Kernel Features
128# 128#
129# CONFIG_NO_IDLE_HZ is not set
130# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 129# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
131CONFIG_FLATMEM=y 130CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y 131CONFIG_FLAT_NODE_MEM_MAP=y
diff --git a/arch/arm/configs/rpc_defconfig b/arch/arm/configs/rpc_defconfig
index 5ddecb9ddf01..f62d1817d2c6 100644
--- a/arch/arm/configs/rpc_defconfig
+++ b/arch/arm/configs/rpc_defconfig
@@ -190,7 +190,6 @@ CONFIG_ISA_DMA_API=y
190# 190#
191# CONFIG_TICK_ONESHOT is not set 191# CONFIG_TICK_ONESHOT is not set
192# CONFIG_PREEMPT is not set 192# CONFIG_PREEMPT is not set
193# CONFIG_NO_IDLE_HZ is not set
194CONFIG_HZ=100 193CONFIG_HZ=100
195# CONFIG_AEABI is not set 194# CONFIG_AEABI is not set
196# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 195# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index f8a1645b3d4a..35faaea8623e 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -1,15 +1,18 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc6 3# Linux kernel version: 2.6.26-rc8
4# Mon Apr 9 10:12:58 2007 4# Mon Jul 7 16:59:23 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y 8CONFIG_GENERIC_GPIO=y
9# CONFIG_GENERIC_TIME is not set 9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
10CONFIG_MMU=y 11CONFIG_MMU=y
11CONFIG_NO_IOPORT=y 12CONFIG_NO_IOPORT=y
12CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
13CONFIG_TRACE_IRQFLAGS_SUPPORT=y 16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
14CONFIG_HARDIRQS_SW_RESEND=y 17CONFIG_HARDIRQS_SW_RESEND=y
15CONFIG_GENERIC_IRQ_PROBE=y 18CONFIG_GENERIC_IRQ_PROBE=y
@@ -18,34 +21,39 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
19CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
20CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
21CONFIG_ZONE_DMA=y 25CONFIG_ZONE_DMA=y
22CONFIG_VECTORS_BASE=0xffff0000 26CONFIG_VECTORS_BASE=0xffff0000
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 28
25# 29#
26# Code maturity level options 30# General setup
27# 31#
28CONFIG_EXPERIMENTAL=y 32CONFIG_EXPERIMENTAL=y
29CONFIG_BROKEN_ON_SMP=y 33CONFIG_BROKEN_ON_SMP=y
30CONFIG_INIT_ENV_ARG_LIMIT=32 34CONFIG_INIT_ENV_ARG_LIMIT=32
31
32#
33# General setup
34#
35CONFIG_LOCALVERSION="" 35CONFIG_LOCALVERSION=""
36CONFIG_LOCALVERSION_AUTO=y 36CONFIG_LOCALVERSION_AUTO=y
37CONFIG_SWAP=y 37CONFIG_SWAP=y
38CONFIG_SYSVIPC=y 38CONFIG_SYSVIPC=y
39# CONFIG_IPC_NS is not set
40CONFIG_SYSVIPC_SYSCTL=y 39CONFIG_SYSVIPC_SYSCTL=y
41# CONFIG_POSIX_MQUEUE is not set 40# CONFIG_POSIX_MQUEUE is not set
42# CONFIG_BSD_PROCESS_ACCT is not set 41# CONFIG_BSD_PROCESS_ACCT is not set
43# CONFIG_TASKSTATS is not set 42# CONFIG_TASKSTATS is not set
44# CONFIG_UTS_NS is not set
45# CONFIG_AUDIT is not set 43# CONFIG_AUDIT is not set
46# CONFIG_IKCONFIG is not set 44CONFIG_IKCONFIG=m
45CONFIG_IKCONFIG_PROC=y
46CONFIG_LOG_BUF_SHIFT=16
47# CONFIG_CGROUPS is not set
48# CONFIG_GROUP_SCHED is not set
47CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
48# CONFIG_RELAY is not set 51# CONFIG_RELAY is not set
52CONFIG_NAMESPACES=y
53# CONFIG_UTS_NS is not set
54# CONFIG_IPC_NS is not set
55# CONFIG_USER_NS is not set
56# CONFIG_PID_NS is not set
49CONFIG_BLK_DEV_INITRD=y 57CONFIG_BLK_DEV_INITRD=y
50CONFIG_INITRAMFS_SOURCE="" 58CONFIG_INITRAMFS_SOURCE=""
51CONFIG_CC_OPTIMIZE_FOR_SIZE=y 59CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -53,6 +61,7 @@ CONFIG_SYSCTL=y
53# CONFIG_EMBEDDED is not set 61# CONFIG_EMBEDDED is not set
54CONFIG_UID16=y 62CONFIG_UID16=y
55CONFIG_SYSCTL_SYSCALL=y 63CONFIG_SYSCTL_SYSCALL=y
64CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 65CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_ALL is not set 66# CONFIG_KALLSYMS_ALL is not set
58# CONFIG_KALLSYMS_EXTRA_PASS is not set 67# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -60,34 +69,43 @@ CONFIG_HOTPLUG=y
60CONFIG_PRINTK=y 69CONFIG_PRINTK=y
61CONFIG_BUG=y 70CONFIG_BUG=y
62CONFIG_ELF_CORE=y 71CONFIG_ELF_CORE=y
72CONFIG_COMPAT_BRK=y
63CONFIG_BASE_FULL=y 73CONFIG_BASE_FULL=y
64CONFIG_FUTEX=y 74CONFIG_FUTEX=y
75CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 76CONFIG_EPOLL=y
77CONFIG_SIGNALFD=y
78CONFIG_TIMERFD=y
79CONFIG_EVENTFD=y
66CONFIG_SHMEM=y 80CONFIG_SHMEM=y
67CONFIG_SLAB=y
68CONFIG_VM_EVENT_COUNTERS=y 81CONFIG_VM_EVENT_COUNTERS=y
82CONFIG_SLAB=y
83# CONFIG_SLUB is not set
84# CONFIG_SLOB is not set
85# CONFIG_PROFILING is not set
86# CONFIG_MARKERS is not set
87CONFIG_HAVE_OPROFILE=y
88# CONFIG_KPROBES is not set
89CONFIG_HAVE_KPROBES=y
90CONFIG_HAVE_KRETPROBES=y
91# CONFIG_HAVE_DMA_ATTRS is not set
92CONFIG_PROC_PAGE_MONITOR=y
93CONFIG_SLABINFO=y
69CONFIG_RT_MUTEXES=y 94CONFIG_RT_MUTEXES=y
70# CONFIG_TINY_SHMEM is not set 95# CONFIG_TINY_SHMEM is not set
71CONFIG_BASE_SMALL=0 96CONFIG_BASE_SMALL=0
72# CONFIG_SLOB is not set
73
74#
75# Loadable module support
76#
77CONFIG_MODULES=y 97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
78CONFIG_MODULE_UNLOAD=y 99CONFIG_MODULE_UNLOAD=y
79# CONFIG_MODULE_FORCE_UNLOAD is not set 100# CONFIG_MODULE_FORCE_UNLOAD is not set
80# CONFIG_MODVERSIONS is not set 101# CONFIG_MODVERSIONS is not set
81# CONFIG_MODULE_SRCVERSION_ALL is not set 102# CONFIG_MODULE_SRCVERSION_ALL is not set
82CONFIG_KMOD=y 103CONFIG_KMOD=y
83
84#
85# Block layer
86#
87CONFIG_BLOCK=y 104CONFIG_BLOCK=y
88# CONFIG_LBD is not set 105# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set 106# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set 107# CONFIG_LSF is not set
108# CONFIG_BLK_DEV_BSG is not set
91 109
92# 110#
93# IO Schedulers 111# IO Schedulers
@@ -101,6 +119,7 @@ CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_CFQ is not set 119# CONFIG_DEFAULT_CFQ is not set
102# CONFIG_DEFAULT_NOOP is not set 120# CONFIG_DEFAULT_NOOP is not set
103CONFIG_DEFAULT_IOSCHED="anticipatory" 121CONFIG_DEFAULT_IOSCHED="anticipatory"
122CONFIG_CLASSIC_RCU=y
104 123
105# 124#
106# System Type 125# System Type
@@ -119,14 +138,17 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
119# CONFIG_ARCH_NETX is not set 138# CONFIG_ARCH_NETX is not set
120# CONFIG_ARCH_H720X is not set 139# CONFIG_ARCH_H720X is not set
121# CONFIG_ARCH_IMX is not set 140# CONFIG_ARCH_IMX is not set
141# CONFIG_ARCH_IOP13XX is not set
122# CONFIG_ARCH_IOP32X is not set 142# CONFIG_ARCH_IOP32X is not set
123# CONFIG_ARCH_IOP33X is not set 143# CONFIG_ARCH_IOP33X is not set
124# CONFIG_ARCH_IOP13XX is not set
125# CONFIG_ARCH_IXP4XX is not set
126# CONFIG_ARCH_IXP2000 is not set
127# CONFIG_ARCH_IXP23XX is not set 144# CONFIG_ARCH_IXP23XX is not set
145# CONFIG_ARCH_IXP2000 is not set
146# CONFIG_ARCH_IXP4XX is not set
128# CONFIG_ARCH_L7200 is not set 147# CONFIG_ARCH_L7200 is not set
148# CONFIG_ARCH_KS8695 is not set
129# CONFIG_ARCH_NS9XXX is not set 149# CONFIG_ARCH_NS9XXX is not set
150# CONFIG_ARCH_MXC is not set
151# CONFIG_ARCH_ORION5X is not set
130# CONFIG_ARCH_PNX4008 is not set 152# CONFIG_ARCH_PNX4008 is not set
131# CONFIG_ARCH_PXA is not set 153# CONFIG_ARCH_PXA is not set
132# CONFIG_ARCH_RPC is not set 154# CONFIG_ARCH_RPC is not set
@@ -134,18 +156,32 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
134CONFIG_ARCH_S3C2410=y 156CONFIG_ARCH_S3C2410=y
135# CONFIG_ARCH_SHARK is not set 157# CONFIG_ARCH_SHARK is not set
136# CONFIG_ARCH_LH7A40X is not set 158# CONFIG_ARCH_LH7A40X is not set
159# CONFIG_ARCH_DAVINCI is not set
137# CONFIG_ARCH_OMAP is not set 160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
138CONFIG_PLAT_S3C24XX=y 162CONFIG_PLAT_S3C24XX=y
139CONFIG_CPU_S3C244X=y 163CONFIG_CPU_S3C244X=y
164# CONFIG_S3C24XX_PWM is not set
140CONFIG_PM_SIMTEC=y 165CONFIG_PM_SIMTEC=y
166CONFIG_S3C2410_DMA=y
167# CONFIG_S3C2410_DMA_DEBUG is not set
168CONFIG_MACH_SMDK=y
169CONFIG_PLAT_S3C=y
170CONFIG_CPU_LLSERIAL_S3C2410=y
171CONFIG_CPU_LLSERIAL_S3C2440=y
172
173#
174# Boot options
175#
141# CONFIG_S3C_BOOT_WATCHDOG is not set 176# CONFIG_S3C_BOOT_WATCHDOG is not set
142# CONFIG_S3C_BOOT_ERROR_RESET is not set 177# CONFIG_S3C_BOOT_ERROR_RESET is not set
178
179#
180# Power management
181#
143# CONFIG_S3C2410_PM_DEBUG is not set 182# CONFIG_S3C2410_PM_DEBUG is not set
144# CONFIG_S3C2410_PM_CHECK is not set 183# CONFIG_S3C2410_PM_CHECK is not set
145CONFIG_S3C_LOWLEVEL_UART_PORT=0 184CONFIG_S3C_LOWLEVEL_UART_PORT=0
146CONFIG_S3C2410_DMA=y
147# CONFIG_S3C2410_DMA_DEBUG is not set
148CONFIG_MACH_SMDK=y
149 185
150# 186#
151# S3C2400 Machines 187# S3C2400 Machines
@@ -155,6 +191,8 @@ CONFIG_CPU_S3C2410_DMA=y
155CONFIG_S3C2410_PM=y 191CONFIG_S3C2410_PM=y
156CONFIG_S3C2410_GPIO=y 192CONFIG_S3C2410_GPIO=y
157CONFIG_S3C2410_CLOCK=y 193CONFIG_S3C2410_CLOCK=y
194CONFIG_SIMTEC_NOR=y
195CONFIG_MACH_BAST_IDE=y
158 196
159# 197#
160# S3C2410 Machines 198# S3C2410 Machines
@@ -167,6 +205,7 @@ CONFIG_ARCH_BAST=y
167CONFIG_MACH_OTOM=y 205CONFIG_MACH_OTOM=y
168CONFIG_MACH_AML_M5900=y 206CONFIG_MACH_AML_M5900=y
169CONFIG_BAST_PC104_IRQ=y 207CONFIG_BAST_PC104_IRQ=y
208# CONFIG_MACH_TCT_HAMMER is not set
170CONFIG_MACH_VR1000=y 209CONFIG_MACH_VR1000=y
171CONFIG_MACH_QT2410=y 210CONFIG_MACH_QT2410=y
172CONFIG_CPU_S3C2412=y 211CONFIG_CPU_S3C2412=y
@@ -176,8 +215,10 @@ CONFIG_S3C2412_PM=y
176# 215#
177# S3C2412 Machines 216# S3C2412 Machines
178# 217#
218# CONFIG_MACH_JIVE is not set
179CONFIG_MACH_SMDK2413=y 219CONFIG_MACH_SMDK2413=y
180CONFIG_MACH_S3C2413=y 220CONFIG_MACH_S3C2413=y
221# CONFIG_MACH_SMDK2412 is not set
181CONFIG_MACH_VSTMS=y 222CONFIG_MACH_VSTMS=y
182CONFIG_CPU_S3C2440=y 223CONFIG_CPU_S3C2440=y
183CONFIG_S3C2440_DMA=y 224CONFIG_S3C2440_DMA=y
@@ -191,6 +232,7 @@ CONFIG_MACH_RX3715=y
191CONFIG_ARCH_S3C2440=y 232CONFIG_ARCH_S3C2440=y
192CONFIG_MACH_NEXCODER_2440=y 233CONFIG_MACH_NEXCODER_2440=y
193CONFIG_SMDK2440_CPU2440=y 234CONFIG_SMDK2440_CPU2440=y
235# CONFIG_MACH_AT2440EVB is not set
194CONFIG_CPU_S3C2442=y 236CONFIG_CPU_S3C2442=y
195 237
196# 238#
@@ -215,6 +257,7 @@ CONFIG_CPU_32v4T=y
215CONFIG_CPU_32v5=y 257CONFIG_CPU_32v5=y
216CONFIG_CPU_ABRT_EV4T=y 258CONFIG_CPU_ABRT_EV4T=y
217CONFIG_CPU_ABRT_EV5TJ=y 259CONFIG_CPU_ABRT_EV5TJ=y
260CONFIG_CPU_PABRT_NOIFAR=y
218CONFIG_CPU_CACHE_V4WT=y 261CONFIG_CPU_CACHE_V4WT=y
219CONFIG_CPU_CACHE_VIVT=y 262CONFIG_CPU_CACHE_VIVT=y
220CONFIG_CPU_COPY_V4WB=y 263CONFIG_CPU_COPY_V4WB=y
@@ -236,17 +279,15 @@ CONFIG_CPU_CP15_MMU=y
236# Bus support 279# Bus support
237# 280#
238CONFIG_ISA=y 281CONFIG_ISA=y
239 282# CONFIG_PCI_SYSCALL is not set
240# 283# CONFIG_ARCH_SUPPORTS_MSI is not set
241# PCCARD (PCMCIA/CardBus) support
242#
243# CONFIG_PCCARD is not set 284# CONFIG_PCCARD is not set
244 285
245# 286#
246# Kernel Features 287# Kernel Features
247# 288#
289# CONFIG_TICK_ONESHOT is not set
248# CONFIG_PREEMPT is not set 290# CONFIG_PREEMPT is not set
249# CONFIG_NO_IDLE_HZ is not set
250CONFIG_HZ=200 291CONFIG_HZ=200
251# CONFIG_AEABI is not set 292# CONFIG_AEABI is not set
252# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 293# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
@@ -257,9 +298,13 @@ CONFIG_FLATMEM_MANUAL=y
257CONFIG_FLATMEM=y 298CONFIG_FLATMEM=y
258CONFIG_FLAT_NODE_MEM_MAP=y 299CONFIG_FLAT_NODE_MEM_MAP=y
259# CONFIG_SPARSEMEM_STATIC is not set 300# CONFIG_SPARSEMEM_STATIC is not set
301# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
302CONFIG_PAGEFLAGS_EXTENDED=y
260CONFIG_SPLIT_PTLOCK_CPUS=4096 303CONFIG_SPLIT_PTLOCK_CPUS=4096
261# CONFIG_RESOURCES_64BIT is not set 304# CONFIG_RESOURCES_64BIT is not set
262CONFIG_ZONE_DMA_FLAG=1 305CONFIG_ZONE_DMA_FLAG=1
306CONFIG_BOUNCE=y
307CONFIG_VIRT_TO_BUS=y
263CONFIG_ALIGNMENT_TRAP=y 308CONFIG_ALIGNMENT_TRAP=y
264 309
265# 310#
@@ -279,7 +324,7 @@ CONFIG_CMDLINE="root=/dev/hda1 ro init=/bin/bash console=ttySAC0"
279# At least one emulation must be selected 324# At least one emulation must be selected
280# 325#
281CONFIG_FPE_NWFPE=y 326CONFIG_FPE_NWFPE=y
282# CONFIG_FPE_NWFPE_XP is not set 327CONFIG_FPE_NWFPE_XP=y
283# CONFIG_FPE_FASTFPE is not set 328# CONFIG_FPE_FASTFPE is not set
284# CONFIG_VFP is not set 329# CONFIG_VFP is not set
285 330
@@ -295,10 +340,12 @@ CONFIG_BINFMT_AOUT=y
295# Power management options 340# Power management options
296# 341#
297CONFIG_PM=y 342CONFIG_PM=y
298# CONFIG_PM_LEGACY is not set
299# CONFIG_PM_DEBUG is not set 343# CONFIG_PM_DEBUG is not set
300# CONFIG_PM_SYSFS_DEPRECATED is not set 344CONFIG_PM_SLEEP=y
301# CONFIG_APM_EMULATION is not set 345CONFIG_SUSPEND=y
346CONFIG_SUSPEND_FREEZER=y
347CONFIG_APM_EMULATION=m
348CONFIG_ARCH_SUSPEND_POSSIBLE=y
302 349
303# 350#
304# Networking 351# Networking
@@ -308,59 +355,67 @@ CONFIG_NET=y
308# 355#
309# Networking options 356# Networking options
310# 357#
311# CONFIG_NETDEBUG is not set 358CONFIG_PACKET=y
312# CONFIG_PACKET is not set 359# CONFIG_PACKET_MMAP is not set
313CONFIG_UNIX=y 360CONFIG_UNIX=y
314CONFIG_XFRM=y 361CONFIG_XFRM=y
315# CONFIG_XFRM_USER is not set 362# CONFIG_XFRM_USER is not set
316# CONFIG_XFRM_SUB_POLICY is not set 363# CONFIG_XFRM_SUB_POLICY is not set
317# CONFIG_XFRM_MIGRATE is not set 364# CONFIG_XFRM_MIGRATE is not set
365# CONFIG_XFRM_STATISTICS is not set
318# CONFIG_NET_KEY is not set 366# CONFIG_NET_KEY is not set
319CONFIG_INET=y 367CONFIG_INET=y
320# CONFIG_IP_MULTICAST is not set 368CONFIG_IP_MULTICAST=y
321# CONFIG_IP_ADVANCED_ROUTER is not set 369# CONFIG_IP_ADVANCED_ROUTER is not set
322CONFIG_IP_FIB_HASH=y 370CONFIG_IP_FIB_HASH=y
323CONFIG_IP_PNP=y 371CONFIG_IP_PNP=y
324# CONFIG_IP_PNP_DHCP is not set 372CONFIG_IP_PNP_DHCP=y
325CONFIG_IP_PNP_BOOTP=y 373CONFIG_IP_PNP_BOOTP=y
326# CONFIG_IP_PNP_RARP is not set 374# CONFIG_IP_PNP_RARP is not set
327# CONFIG_NET_IPIP is not set 375# CONFIG_NET_IPIP is not set
328# CONFIG_NET_IPGRE is not set 376# CONFIG_NET_IPGRE is not set
377# CONFIG_IP_MROUTE is not set
329# CONFIG_ARPD is not set 378# CONFIG_ARPD is not set
330# CONFIG_SYN_COOKIES is not set 379# CONFIG_SYN_COOKIES is not set
331# CONFIG_INET_AH is not set 380# CONFIG_INET_AH is not set
332# CONFIG_INET_ESP is not set 381# CONFIG_INET_ESP is not set
333# CONFIG_INET_IPCOMP is not set 382# CONFIG_INET_IPCOMP is not set
334# CONFIG_INET_XFRM_TUNNEL is not set 383# CONFIG_INET_XFRM_TUNNEL is not set
335# CONFIG_INET_TUNNEL is not set 384CONFIG_INET_TUNNEL=m
336CONFIG_INET_XFRM_MODE_TRANSPORT=y 385CONFIG_INET_XFRM_MODE_TRANSPORT=y
337CONFIG_INET_XFRM_MODE_TUNNEL=y 386CONFIG_INET_XFRM_MODE_TUNNEL=y
338CONFIG_INET_XFRM_MODE_BEET=y 387CONFIG_INET_XFRM_MODE_BEET=y
388# CONFIG_INET_LRO is not set
339CONFIG_INET_DIAG=y 389CONFIG_INET_DIAG=y
340CONFIG_INET_TCP_DIAG=y 390CONFIG_INET_TCP_DIAG=y
341# CONFIG_TCP_CONG_ADVANCED is not set 391# CONFIG_TCP_CONG_ADVANCED is not set
342CONFIG_TCP_CONG_CUBIC=y 392CONFIG_TCP_CONG_CUBIC=y
343CONFIG_DEFAULT_TCP_CONG="cubic" 393CONFIG_DEFAULT_TCP_CONG="cubic"
344# CONFIG_TCP_MD5SIG is not set 394# CONFIG_TCP_MD5SIG is not set
345# CONFIG_IPV6 is not set 395CONFIG_IPV6=m
346# CONFIG_INET6_XFRM_TUNNEL is not set 396CONFIG_IPV6_PRIVACY=y
347# CONFIG_INET6_TUNNEL is not set 397CONFIG_IPV6_ROUTER_PREF=y
398# CONFIG_IPV6_ROUTE_INFO is not set
399# CONFIG_IPV6_OPTIMISTIC_DAD is not set
400CONFIG_INET6_AH=m
401CONFIG_INET6_ESP=m
402CONFIG_INET6_IPCOMP=m
403CONFIG_IPV6_MIP6=m
404CONFIG_INET6_XFRM_TUNNEL=m
405CONFIG_INET6_TUNNEL=m
406CONFIG_INET6_XFRM_MODE_TRANSPORT=m
407CONFIG_INET6_XFRM_MODE_TUNNEL=m
408CONFIG_INET6_XFRM_MODE_BEET=m
409CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
410CONFIG_IPV6_SIT=m
411CONFIG_IPV6_NDISC_NODETYPE=y
412CONFIG_IPV6_TUNNEL=m
413# CONFIG_IPV6_MULTIPLE_TABLES is not set
414# CONFIG_IPV6_MROUTE is not set
348# CONFIG_NETWORK_SECMARK is not set 415# CONFIG_NETWORK_SECMARK is not set
349# CONFIG_NETFILTER is not set 416# CONFIG_NETFILTER is not set
350
351#
352# DCCP Configuration (EXPERIMENTAL)
353#
354# CONFIG_IP_DCCP is not set 417# CONFIG_IP_DCCP is not set
355
356#
357# SCTP Configuration (EXPERIMENTAL)
358#
359# CONFIG_IP_SCTP is not set 418# CONFIG_IP_SCTP is not set
360
361#
362# TIPC Configuration (EXPERIMENTAL)
363#
364# CONFIG_TIPC is not set 419# CONFIG_TIPC is not set
365# CONFIG_ATM is not set 420# CONFIG_ATM is not set
366# CONFIG_BRIDGE is not set 421# CONFIG_BRIDGE is not set
@@ -373,20 +428,71 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
373# CONFIG_LAPB is not set 428# CONFIG_LAPB is not set
374# CONFIG_ECONET is not set 429# CONFIG_ECONET is not set
375# CONFIG_WAN_ROUTER is not set 430# CONFIG_WAN_ROUTER is not set
376
377#
378# QoS and/or fair queueing
379#
380# CONFIG_NET_SCHED is not set 431# CONFIG_NET_SCHED is not set
432CONFIG_NET_SCH_FIFO=y
381 433
382# 434#
383# Network testing 435# Network testing
384# 436#
385# CONFIG_NET_PKTGEN is not set 437# CONFIG_NET_PKTGEN is not set
386# CONFIG_HAMRADIO is not set 438# CONFIG_HAMRADIO is not set
439# CONFIG_CAN is not set
387# CONFIG_IRDA is not set 440# CONFIG_IRDA is not set
388# CONFIG_BT is not set 441CONFIG_BT=m
442CONFIG_BT_L2CAP=m
443CONFIG_BT_SCO=m
444CONFIG_BT_RFCOMM=m
445CONFIG_BT_RFCOMM_TTY=y
446CONFIG_BT_BNEP=m
447CONFIG_BT_BNEP_MC_FILTER=y
448CONFIG_BT_BNEP_PROTO_FILTER=y
449CONFIG_BT_HIDP=m
450
451#
452# Bluetooth device drivers
453#
454CONFIG_BT_HCIUSB=m
455CONFIG_BT_HCIUSB_SCO=y
456CONFIG_BT_HCIUART=m
457CONFIG_BT_HCIUART_H4=y
458CONFIG_BT_HCIUART_BCSP=y
459CONFIG_BT_HCIUART_LL=y
460CONFIG_BT_HCIBCM203X=m
461CONFIG_BT_HCIBPA10X=m
462CONFIG_BT_HCIBFUSB=m
463CONFIG_BT_HCIVHCI=m
464# CONFIG_AF_RXRPC is not set
465
466#
467# Wireless
468#
469CONFIG_CFG80211=m
470CONFIG_NL80211=y
471CONFIG_WIRELESS_EXT=y
472CONFIG_MAC80211=m
473
474#
475# Rate control algorithm selection
476#
477CONFIG_MAC80211_RC_DEFAULT_PID=y
478# CONFIG_MAC80211_RC_DEFAULT_NONE is not set
479
480#
481# Selecting 'y' for an algorithm will
482#
483
484#
485# build the algorithm into mac80211.
486#
487CONFIG_MAC80211_RC_DEFAULT="pid"
488CONFIG_MAC80211_RC_PID=y
489CONFIG_MAC80211_MESH=y
490CONFIG_MAC80211_LEDS=y
491# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
492# CONFIG_MAC80211_DEBUG is not set
389# CONFIG_IEEE80211 is not set 493# CONFIG_IEEE80211 is not set
494# CONFIG_RFKILL is not set
495# CONFIG_NET_9P is not set
390 496
391# 497#
392# Device Drivers 498# Device Drivers
@@ -395,21 +501,14 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
395# 501#
396# Generic Driver Options 502# Generic Driver Options
397# 503#
504CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
398CONFIG_STANDALONE=y 505CONFIG_STANDALONE=y
399CONFIG_PREVENT_FIRMWARE_BUILD=y 506CONFIG_PREVENT_FIRMWARE_BUILD=y
400# CONFIG_FW_LOADER is not set 507CONFIG_FW_LOADER=m
401# CONFIG_DEBUG_DRIVER is not set 508# CONFIG_DEBUG_DRIVER is not set
402# CONFIG_DEBUG_DEVRES is not set 509# CONFIG_DEBUG_DEVRES is not set
403# CONFIG_SYS_HYPERVISOR is not set 510# CONFIG_SYS_HYPERVISOR is not set
404
405#
406# Connector - unified userspace <-> kernelspace linker
407#
408# CONFIG_CONNECTOR is not set 511# CONFIG_CONNECTOR is not set
409
410#
411# Memory Technology Devices (MTD)
412#
413CONFIG_MTD=y 512CONFIG_MTD=y
414# CONFIG_MTD_DEBUG is not set 513# CONFIG_MTD_DEBUG is not set
415# CONFIG_MTD_CONCAT is not set 514# CONFIG_MTD_CONCAT is not set
@@ -420,6 +519,7 @@ CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
420# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set 519# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
421CONFIG_MTD_CMDLINE_PARTS=y 520CONFIG_MTD_CMDLINE_PARTS=y
422# CONFIG_MTD_AFS_PARTS is not set 521# CONFIG_MTD_AFS_PARTS is not set
522# CONFIG_MTD_AR7_PARTS is not set
423 523
424# 524#
425# User Modules And Translation Layers 525# User Modules And Translation Layers
@@ -432,6 +532,7 @@ CONFIG_MTD_BLOCK=y
432# CONFIG_INFTL is not set 532# CONFIG_INFTL is not set
433# CONFIG_RFD_FTL is not set 533# CONFIG_RFD_FTL is not set
434# CONFIG_SSFDC is not set 534# CONFIG_SSFDC is not set
535# CONFIG_MTD_OOPS is not set
435 536
436# 537#
437# RAM/ROM/Flash chip drivers 538# RAM/ROM/Flash chip drivers
@@ -457,7 +558,6 @@ CONFIG_MTD_CFI_UTIL=y
457# CONFIG_MTD_RAM is not set 558# CONFIG_MTD_RAM is not set
458CONFIG_MTD_ROM=y 559CONFIG_MTD_ROM=y
459# CONFIG_MTD_ABSENT is not set 560# CONFIG_MTD_ABSENT is not set
460# CONFIG_MTD_OBSOLETE_CHIPS is not set
461 561
462# 562#
463# Mapping drivers for chip access 563# Mapping drivers for chip access
@@ -486,13 +586,10 @@ CONFIG_MTD_BAST_MAXSIZE=4
486# CONFIG_MTD_DOC2000 is not set 586# CONFIG_MTD_DOC2000 is not set
487# CONFIG_MTD_DOC2001 is not set 587# CONFIG_MTD_DOC2001 is not set
488# CONFIG_MTD_DOC2001PLUS is not set 588# CONFIG_MTD_DOC2001PLUS is not set
489
490#
491# NAND Flash Device Drivers
492#
493CONFIG_MTD_NAND=y 589CONFIG_MTD_NAND=y
494# CONFIG_MTD_NAND_VERIFY_WRITE is not set 590# CONFIG_MTD_NAND_VERIFY_WRITE is not set
495# CONFIG_MTD_NAND_ECC_SMC is not set 591# CONFIG_MTD_NAND_ECC_SMC is not set
592# CONFIG_MTD_NAND_MUSEUM_IDS is not set
496CONFIG_MTD_NAND_IDS=y 593CONFIG_MTD_NAND_IDS=y
497CONFIG_MTD_NAND_S3C2410=y 594CONFIG_MTD_NAND_S3C2410=y
498# CONFIG_MTD_NAND_S3C2410_DEBUG is not set 595# CONFIG_MTD_NAND_S3C2410_DEBUG is not set
@@ -500,30 +597,25 @@ CONFIG_MTD_NAND_S3C2410=y
500# CONFIG_MTD_NAND_S3C2410_CLKSTOP is not set 597# CONFIG_MTD_NAND_S3C2410_CLKSTOP is not set
501# CONFIG_MTD_NAND_DISKONCHIP is not set 598# CONFIG_MTD_NAND_DISKONCHIP is not set
502# CONFIG_MTD_NAND_NANDSIM is not set 599# CONFIG_MTD_NAND_NANDSIM is not set
503 600# CONFIG_MTD_NAND_PLATFORM is not set
504# 601# CONFIG_MTD_ALAUDA is not set
505# OneNAND Flash Device Drivers
506#
507# CONFIG_MTD_ONENAND is not set 602# CONFIG_MTD_ONENAND is not set
508 603
509# 604#
510# Parallel port support 605# UBI - Unsorted block images
511# 606#
607# CONFIG_MTD_UBI is not set
512CONFIG_PARPORT=y 608CONFIG_PARPORT=y
513# CONFIG_PARPORT_PC is not set 609CONFIG_PARPORT_PC=m
610# CONFIG_PARPORT_PC_FIFO is not set
611# CONFIG_PARPORT_PC_SUPERIO is not set
514# CONFIG_PARPORT_GSC is not set 612# CONFIG_PARPORT_GSC is not set
515# CONFIG_PARPORT_AX88796 is not set 613CONFIG_PARPORT_AX88796=m
516CONFIG_PARPORT_1284=y 614CONFIG_PARPORT_1284=y
517 615CONFIG_PARPORT_NOT_PC=y
518#
519# Plug and Play support
520#
521# CONFIG_PNP is not set 616# CONFIG_PNP is not set
522# CONFIG_PNPACPI is not set 617CONFIG_BLK_DEV=y
523 618# CONFIG_PARIDE is not set
524#
525# Block devices
526#
527# CONFIG_BLK_DEV_COW_COMMON is not set 619# CONFIG_BLK_DEV_COW_COMMON is not set
528CONFIG_BLK_DEV_LOOP=y 620CONFIG_BLK_DEV_LOOP=y
529# CONFIG_BLK_DEV_CRYPTOLOOP is not set 621# CONFIG_BLK_DEV_CRYPTOLOOP is not set
@@ -532,34 +624,34 @@ CONFIG_BLK_DEV_NBD=m
532CONFIG_BLK_DEV_RAM=y 624CONFIG_BLK_DEV_RAM=y
533CONFIG_BLK_DEV_RAM_COUNT=16 625CONFIG_BLK_DEV_RAM_COUNT=16
534CONFIG_BLK_DEV_RAM_SIZE=4096 626CONFIG_BLK_DEV_RAM_SIZE=4096
535CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 627# CONFIG_BLK_DEV_XIP is not set
536# CONFIG_CDROM_PKTCDVD is not set 628# CONFIG_CDROM_PKTCDVD is not set
537CONFIG_ATA_OVER_ETH=m 629CONFIG_ATA_OVER_ETH=m
538 630CONFIG_MISC_DEVICES=y
539# 631# CONFIG_EEPROM_93CX6 is not set
540# ATA/ATAPI/MFM/RLL support 632# CONFIG_ENCLOSURE_SERVICES is not set
541# 633CONFIG_HAVE_IDE=y
542CONFIG_IDE=y 634CONFIG_IDE=y
543CONFIG_BLK_DEV_IDE=y 635CONFIG_BLK_DEV_IDE=y
544 636
545# 637#
546# Please see Documentation/ide.txt for help/info on IDE drives 638# Please see Documentation/ide/ide.txt for help/info on IDE drives
547# 639#
548# CONFIG_BLK_DEV_IDE_SATA is not set 640# CONFIG_BLK_DEV_IDE_SATA is not set
549CONFIG_BLK_DEV_IDEDISK=y 641CONFIG_BLK_DEV_IDEDISK=y
550# CONFIG_IDEDISK_MULTI_MODE is not set 642# CONFIG_IDEDISK_MULTI_MODE is not set
551CONFIG_BLK_DEV_IDECD=y 643CONFIG_BLK_DEV_IDECD=y
644CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
552CONFIG_BLK_DEV_IDETAPE=m 645CONFIG_BLK_DEV_IDETAPE=m
553CONFIG_BLK_DEV_IDEFLOPPY=m 646CONFIG_BLK_DEV_IDEFLOPPY=m
647# CONFIG_BLK_DEV_IDESCSI is not set
554# CONFIG_IDE_TASK_IOCTL is not set 648# CONFIG_IDE_TASK_IOCTL is not set
649CONFIG_IDE_PROC_FS=y
555 650
556# 651#
557# IDE chipset support/bugfixes 652# IDE chipset support/bugfixes
558# 653#
559CONFIG_IDE_GENERIC=y 654# CONFIG_BLK_DEV_PLATFORM is not set
560# CONFIG_IDE_ARM is not set
561CONFIG_BLK_DEV_IDE_BAST=y
562# CONFIG_IDE_CHIPSETS is not set
563# CONFIG_BLK_DEV_IDEDMA is not set 655# CONFIG_BLK_DEV_IDEDMA is not set
564# CONFIG_BLK_DEV_HD is not set 656# CONFIG_BLK_DEV_HD is not set
565 657
@@ -567,101 +659,119 @@ CONFIG_BLK_DEV_IDE_BAST=y
567# SCSI device support 659# SCSI device support
568# 660#
569# CONFIG_RAID_ATTRS is not set 661# CONFIG_RAID_ATTRS is not set
570# CONFIG_SCSI is not set 662CONFIG_SCSI=y
663CONFIG_SCSI_DMA=y
664CONFIG_SCSI_TGT=m
571# CONFIG_SCSI_NETLINK is not set 665# CONFIG_SCSI_NETLINK is not set
572 666CONFIG_SCSI_PROC_FS=y
573# 667
574# Serial ATA (prod) and Parallel ATA (experimental) drivers 668#
575# 669# SCSI support type (disk, tape, CD-ROM)
670#
671CONFIG_BLK_DEV_SD=y
672CONFIG_CHR_DEV_ST=m
673# CONFIG_CHR_DEV_OSST is not set
674CONFIG_BLK_DEV_SR=m
675CONFIG_BLK_DEV_SR_VENDOR=y
676CONFIG_CHR_DEV_SG=y
677CONFIG_CHR_DEV_SCH=m
678
679#
680# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
681#
682CONFIG_SCSI_MULTI_LUN=y
683CONFIG_SCSI_CONSTANTS=y
684# CONFIG_SCSI_LOGGING is not set
685CONFIG_SCSI_SCAN_ASYNC=y
686CONFIG_SCSI_WAIT_SCAN=m
687
688#
689# SCSI Transports
690#
691# CONFIG_SCSI_SPI_ATTRS is not set
692# CONFIG_SCSI_FC_ATTRS is not set
693# CONFIG_SCSI_ISCSI_ATTRS is not set
694# CONFIG_SCSI_SAS_LIBSAS is not set
695# CONFIG_SCSI_SRP_ATTRS is not set
696CONFIG_SCSI_LOWLEVEL=y
697# CONFIG_ISCSI_TCP is not set
698# CONFIG_SCSI_AHA152X is not set
699# CONFIG_SCSI_AIC7XXX_OLD is not set
700# CONFIG_SCSI_ADVANSYS is not set
701# CONFIG_SCSI_IN2000 is not set
702# CONFIG_SCSI_DTC3280 is not set
703# CONFIG_SCSI_FUTURE_DOMAIN is not set
704# CONFIG_SCSI_GENERIC_NCR5380 is not set
705# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
706# CONFIG_SCSI_PPA is not set
707# CONFIG_SCSI_IMM is not set
708# CONFIG_SCSI_NCR53C406A is not set
709# CONFIG_SCSI_PAS16 is not set
710# CONFIG_SCSI_QLOGIC_FAS is not set
711# CONFIG_SCSI_SYM53C416 is not set
712# CONFIG_SCSI_T128 is not set
713# CONFIG_SCSI_DEBUG is not set
576# CONFIG_ATA is not set 714# CONFIG_ATA is not set
577 715CONFIG_HAVE_PATA_PLATFORM=y
578#
579# Multi-device support (RAID and LVM)
580#
581# CONFIG_MD is not set 716# CONFIG_MD is not set
582
583#
584# Fusion MPT device support
585#
586# CONFIG_FUSION is not set
587
588#
589# IEEE 1394 (FireWire) support
590#
591
592#
593# I2O device support
594#
595
596#
597# Network device support
598#
599CONFIG_NETDEVICES=y 717CONFIG_NETDEVICES=y
718# CONFIG_NETDEVICES_MULTIQUEUE is not set
600# CONFIG_DUMMY is not set 719# CONFIG_DUMMY is not set
601# CONFIG_BONDING is not set 720# CONFIG_BONDING is not set
721# CONFIG_MACVLAN is not set
602# CONFIG_EQUALIZER is not set 722# CONFIG_EQUALIZER is not set
603# CONFIG_TUN is not set 723# CONFIG_TUN is not set
604 724# CONFIG_VETH is not set
605#
606# ARCnet devices
607#
608# CONFIG_ARCNET is not set 725# CONFIG_ARCNET is not set
609
610#
611# PHY device support
612#
613# CONFIG_PHYLIB is not set 726# CONFIG_PHYLIB is not set
614
615#
616# Ethernet (10 or 100Mbit)
617#
618CONFIG_NET_ETHERNET=y 727CONFIG_NET_ETHERNET=y
619CONFIG_MII=y 728CONFIG_MII=y
729# CONFIG_AX88796 is not set
620# CONFIG_NET_VENDOR_3COM is not set 730# CONFIG_NET_VENDOR_3COM is not set
621# CONFIG_NET_VENDOR_SMC is not set 731# CONFIG_NET_VENDOR_SMC is not set
622# CONFIG_SMC91X is not set 732# CONFIG_SMC91X is not set
623CONFIG_DM9000=y 733CONFIG_DM9000=y
734# CONFIG_ENC28J60 is not set
735CONFIG_DM9000_DEBUGLEVEL=4
624# CONFIG_NET_VENDOR_RACAL is not set 736# CONFIG_NET_VENDOR_RACAL is not set
625# CONFIG_AT1700 is not set 737# CONFIG_AT1700 is not set
626# CONFIG_DEPCA is not set 738# CONFIG_DEPCA is not set
627# CONFIG_HP100 is not set 739# CONFIG_HP100 is not set
628# CONFIG_NET_ISA is not set 740# CONFIG_NET_ISA is not set
741# CONFIG_IBM_NEW_EMAC_ZMII is not set
742# CONFIG_IBM_NEW_EMAC_RGMII is not set
743# CONFIG_IBM_NEW_EMAC_TAH is not set
744# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
629# CONFIG_NET_PCI is not set 745# CONFIG_NET_PCI is not set
746# CONFIG_B44 is not set
630# CONFIG_NET_POCKET is not set 747# CONFIG_NET_POCKET is not set
631 748CONFIG_NETDEV_1000=y
632# 749# CONFIG_E1000E_ENABLED is not set
633# Ethernet (1000 Mbit) 750CONFIG_NETDEV_10000=y
634#
635
636#
637# Ethernet (10000 Mbit)
638#
639
640#
641# Token Ring devices
642#
643# CONFIG_TR is not set 751# CONFIG_TR is not set
644 752
645# 753#
646# Wireless LAN (non-hamradio) 754# Wireless LAN
647# 755#
648# CONFIG_NET_RADIO is not set 756# CONFIG_WLAN_PRE80211 is not set
757# CONFIG_WLAN_80211 is not set
758# CONFIG_IWLWIFI_LEDS is not set
649 759
650# 760#
651# Wan interfaces 761# USB Network Adapters
652# 762#
763# CONFIG_USB_CATC is not set
764# CONFIG_USB_KAWETH is not set
765# CONFIG_USB_PEGASUS is not set
766# CONFIG_USB_RTL8150 is not set
767# CONFIG_USB_USBNET is not set
653# CONFIG_WAN is not set 768# CONFIG_WAN is not set
654# CONFIG_PLIP is not set 769# CONFIG_PLIP is not set
655# CONFIG_PPP is not set 770# CONFIG_PPP is not set
656# CONFIG_SLIP is not set 771# CONFIG_SLIP is not set
657# CONFIG_SHAPER is not set
658# CONFIG_NETCONSOLE is not set 772# CONFIG_NETCONSOLE is not set
659# CONFIG_NETPOLL is not set 773# CONFIG_NETPOLL is not set
660# CONFIG_NET_POLL_CONTROLLER is not set 774# CONFIG_NET_POLL_CONTROLLER is not set
661
662#
663# ISDN subsystem
664#
665# CONFIG_ISDN is not set 775# CONFIG_ISDN is not set
666 776
667# 777#
@@ -669,6 +779,7 @@ CONFIG_DM9000=y
669# 779#
670CONFIG_INPUT=y 780CONFIG_INPUT=y
671# CONFIG_INPUT_FF_MEMLESS is not set 781# CONFIG_INPUT_FF_MEMLESS is not set
782# CONFIG_INPUT_POLLDEV is not set
672 783
673# 784#
674# Userland interfaces 785# Userland interfaces
@@ -678,7 +789,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
678CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 789CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
679CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 790CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
680# CONFIG_INPUT_JOYDEV is not set 791# CONFIG_INPUT_JOYDEV is not set
681# CONFIG_INPUT_TSDEV is not set
682# CONFIG_INPUT_EVDEV is not set 792# CONFIG_INPUT_EVDEV is not set
683# CONFIG_INPUT_EVBUG is not set 793# CONFIG_INPUT_EVBUG is not set
684 794
@@ -695,12 +805,21 @@ CONFIG_KEYBOARD_ATKBD=y
695# CONFIG_KEYBOARD_GPIO is not set 805# CONFIG_KEYBOARD_GPIO is not set
696CONFIG_INPUT_MOUSE=y 806CONFIG_INPUT_MOUSE=y
697CONFIG_MOUSE_PS2=y 807CONFIG_MOUSE_PS2=y
808CONFIG_MOUSE_PS2_ALPS=y
809CONFIG_MOUSE_PS2_LOGIPS2PP=y
810CONFIG_MOUSE_PS2_SYNAPTICS=y
811CONFIG_MOUSE_PS2_LIFEBOOK=y
812CONFIG_MOUSE_PS2_TRACKPOINT=y
813# CONFIG_MOUSE_PS2_TOUCHKIT is not set
698# CONFIG_MOUSE_SERIAL is not set 814# CONFIG_MOUSE_SERIAL is not set
815# CONFIG_MOUSE_APPLETOUCH is not set
699# CONFIG_MOUSE_INPORT is not set 816# CONFIG_MOUSE_INPORT is not set
700# CONFIG_MOUSE_LOGIBM is not set 817# CONFIG_MOUSE_LOGIBM is not set
701# CONFIG_MOUSE_PC110PAD is not set 818# CONFIG_MOUSE_PC110PAD is not set
702# CONFIG_MOUSE_VSXXXAA is not set 819# CONFIG_MOUSE_VSXXXAA is not set
820# CONFIG_MOUSE_GPIO is not set
703# CONFIG_INPUT_JOYSTICK is not set 821# CONFIG_INPUT_JOYSTICK is not set
822# CONFIG_INPUT_TABLET is not set
704# CONFIG_INPUT_TOUCHSCREEN is not set 823# CONFIG_INPUT_TOUCHSCREEN is not set
705# CONFIG_INPUT_MISC is not set 824# CONFIG_INPUT_MISC is not set
706 825
@@ -721,6 +840,7 @@ CONFIG_VT=y
721CONFIG_VT_CONSOLE=y 840CONFIG_VT_CONSOLE=y
722CONFIG_HW_CONSOLE=y 841CONFIG_HW_CONSOLE=y
723# CONFIG_VT_HW_CONSOLE_BINDING is not set 842# CONFIG_VT_HW_CONSOLE_BINDING is not set
843CONFIG_DEVKMEM=y
724CONFIG_SERIAL_NONSTANDARD=y 844CONFIG_SERIAL_NONSTANDARD=y
725# CONFIG_COMPUTONE is not set 845# CONFIG_COMPUTONE is not set
726# CONFIG_ROCKETPORT is not set 846# CONFIG_ROCKETPORT is not set
@@ -728,8 +848,6 @@ CONFIG_SERIAL_NONSTANDARD=y
728# CONFIG_DIGIEPCA is not set 848# CONFIG_DIGIEPCA is not set
729# CONFIG_MOXA_INTELLIO is not set 849# CONFIG_MOXA_INTELLIO is not set
730# CONFIG_MOXA_SMARTIO is not set 850# CONFIG_MOXA_SMARTIO is not set
731# CONFIG_MOXA_SMARTIO_NEW is not set
732# CONFIG_SYNCLINKMP is not set
733# CONFIG_N_HDLC is not set 851# CONFIG_N_HDLC is not set
734# CONFIG_RISCOM8 is not set 852# CONFIG_RISCOM8 is not set
735# CONFIG_SPECIALIX is not set 853# CONFIG_SPECIALIX is not set
@@ -758,8 +876,12 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
758# 876#
759# Non-8250 serial port support 877# Non-8250 serial port support
760# 878#
879CONFIG_SERIAL_SAMSUNG=y
880# CONFIG_SERIAL_SAMSUNG_DEBUG is not set
881CONFIG_SERIAL_SAMSUNG_CONSOLE=y
761CONFIG_SERIAL_S3C2410=y 882CONFIG_SERIAL_S3C2410=y
762CONFIG_SERIAL_S3C2410_CONSOLE=y 883CONFIG_SERIAL_S3C2412=y
884CONFIG_SERIAL_S3C2440=y
763CONFIG_SERIAL_CORE=y 885CONFIG_SERIAL_CORE=y
764CONFIG_SERIAL_CORE_CONSOLE=y 886CONFIG_SERIAL_CORE_CONSOLE=y
765CONFIG_UNIX98_PTYS=y 887CONFIG_UNIX98_PTYS=y
@@ -768,89 +890,50 @@ CONFIG_LEGACY_PTY_COUNT=256
768CONFIG_PRINTER=y 890CONFIG_PRINTER=y
769# CONFIG_LP_CONSOLE is not set 891# CONFIG_LP_CONSOLE is not set
770CONFIG_PPDEV=y 892CONFIG_PPDEV=y
771# CONFIG_TIPAR is not set
772
773#
774# IPMI
775#
776# CONFIG_IPMI_HANDLER is not set 893# CONFIG_IPMI_HANDLER is not set
777
778#
779# Watchdog Cards
780#
781CONFIG_WATCHDOG=y
782# CONFIG_WATCHDOG_NOWAYOUT is not set
783
784#
785# Watchdog Device Drivers
786#
787# CONFIG_SOFT_WATCHDOG is not set
788CONFIG_S3C2410_WATCHDOG=y
789
790#
791# ISA-based Watchdog Cards
792#
793# CONFIG_PCWATCHDOG is not set
794# CONFIG_MIXCOMWD is not set
795# CONFIG_WDT is not set
796
797#
798# USB-based Watchdog Cards
799#
800# CONFIG_USBPCWATCHDOG is not set
801CONFIG_HW_RANDOM=y 894CONFIG_HW_RANDOM=y
802# CONFIG_NVRAM is not set 895# CONFIG_NVRAM is not set
803# CONFIG_DTLK is not set 896# CONFIG_DTLK is not set
804# CONFIG_R3964 is not set 897# CONFIG_R3964 is not set
805# CONFIG_RAW_DRIVER is not set 898# CONFIG_RAW_DRIVER is not set
806
807#
808# TPM devices
809#
810# CONFIG_TCG_TPM is not set 899# CONFIG_TCG_TPM is not set
811 900CONFIG_DEVPORT=y
812#
813# I2C support
814#
815CONFIG_I2C=y 901CONFIG_I2C=y
902CONFIG_I2C_BOARDINFO=y
816CONFIG_I2C_CHARDEV=m 903CONFIG_I2C_CHARDEV=m
817 904CONFIG_I2C_ALGOBIT=y
818#
819# I2C Algorithms
820#
821CONFIG_I2C_ALGOBIT=m
822# CONFIG_I2C_ALGOPCF is not set
823# CONFIG_I2C_ALGOPCA is not set
824 905
825# 906#
826# I2C Hardware Bus support 907# I2C Hardware Bus support
827# 908#
828# CONFIG_I2C_ELEKTOR is not set 909# CONFIG_I2C_ELEKTOR is not set
910# CONFIG_I2C_GPIO is not set
829# CONFIG_I2C_OCORES is not set 911# CONFIG_I2C_OCORES is not set
830# CONFIG_I2C_PARPORT is not set 912# CONFIG_I2C_PARPORT is not set
831# CONFIG_I2C_PARPORT_LIGHT is not set 913# CONFIG_I2C_PARPORT_LIGHT is not set
832CONFIG_I2C_S3C2410=y 914CONFIG_I2C_S3C2410=y
915CONFIG_I2C_SIMTEC=y
916# CONFIG_I2C_TAOS_EVM is not set
833# CONFIG_I2C_STUB is not set 917# CONFIG_I2C_STUB is not set
918# CONFIG_I2C_TINY_USB is not set
834# CONFIG_I2C_PCA_ISA is not set 919# CONFIG_I2C_PCA_ISA is not set
920# CONFIG_I2C_PCA_PLATFORM is not set
835 921
836# 922#
837# Miscellaneous I2C Chip support 923# Miscellaneous I2C Chip support
838# 924#
839# CONFIG_SENSORS_DS1337 is not set 925# CONFIG_DS1682 is not set
840# CONFIG_SENSORS_DS1374 is not set
841CONFIG_SENSORS_EEPROM=m 926CONFIG_SENSORS_EEPROM=m
842# CONFIG_SENSORS_PCF8574 is not set 927# CONFIG_SENSORS_PCF8574 is not set
843# CONFIG_SENSORS_PCA9539 is not set 928# CONFIG_PCF8575 is not set
844# CONFIG_SENSORS_PCF8591 is not set 929# CONFIG_SENSORS_PCF8591 is not set
930# CONFIG_TPS65010 is not set
845# CONFIG_SENSORS_MAX6875 is not set 931# CONFIG_SENSORS_MAX6875 is not set
932# CONFIG_SENSORS_TSL2550 is not set
846# CONFIG_I2C_DEBUG_CORE is not set 933# CONFIG_I2C_DEBUG_CORE is not set
847# CONFIG_I2C_DEBUG_ALGO is not set 934# CONFIG_I2C_DEBUG_ALGO is not set
848# CONFIG_I2C_DEBUG_BUS is not set 935# CONFIG_I2C_DEBUG_BUS is not set
849# CONFIG_I2C_DEBUG_CHIP is not set 936# CONFIG_I2C_DEBUG_CHIP is not set
850
851#
852# SPI support
853#
854CONFIG_SPI=y 937CONFIG_SPI=y
855# CONFIG_SPI_DEBUG is not set 938# CONFIG_SPI_DEBUG is not set
856CONFIG_SPI_MASTER=y 939CONFIG_SPI_MASTER=y
@@ -860,6 +943,7 @@ CONFIG_SPI_MASTER=y
860# 943#
861CONFIG_SPI_BITBANG=m 944CONFIG_SPI_BITBANG=m
862# CONFIG_SPI_BUTTERFLY is not set 945# CONFIG_SPI_BUTTERFLY is not set
946# CONFIG_SPI_LM70_LLP is not set
863CONFIG_SPI_S3C24XX=m 947CONFIG_SPI_S3C24XX=m
864CONFIG_SPI_S3C24XX_GPIO=m 948CONFIG_SPI_S3C24XX_GPIO=m
865 949
@@ -867,30 +951,43 @@ CONFIG_SPI_S3C24XX_GPIO=m
867# SPI Protocol Masters 951# SPI Protocol Masters
868# 952#
869# CONFIG_SPI_AT25 is not set 953# CONFIG_SPI_AT25 is not set
954# CONFIG_SPI_SPIDEV is not set
955# CONFIG_SPI_TLE62X0 is not set
956CONFIG_HAVE_GPIO_LIB=y
870 957
871# 958#
872# Dallas's 1-wire bus 959# GPIO Support
873# 960#
874# CONFIG_W1 is not set 961# CONFIG_DEBUG_GPIO is not set
875 962
876# 963#
877# Hardware Monitoring support 964# I2C GPIO expanders:
965#
966# CONFIG_GPIO_PCA953X is not set
967# CONFIG_GPIO_PCF857X is not set
968
878# 969#
970# SPI GPIO expanders:
971#
972# CONFIG_GPIO_MCP23S08 is not set
973# CONFIG_W1 is not set
974# CONFIG_POWER_SUPPLY is not set
879CONFIG_HWMON=y 975CONFIG_HWMON=y
880CONFIG_HWMON_VID=m 976CONFIG_HWMON_VID=m
881# CONFIG_SENSORS_ABITUGURU is not set 977# CONFIG_SENSORS_AD7418 is not set
882# CONFIG_SENSORS_ADM1021 is not set 978# CONFIG_SENSORS_ADM1021 is not set
883# CONFIG_SENSORS_ADM1025 is not set 979# CONFIG_SENSORS_ADM1025 is not set
884# CONFIG_SENSORS_ADM1026 is not set 980# CONFIG_SENSORS_ADM1026 is not set
885# CONFIG_SENSORS_ADM1029 is not set 981# CONFIG_SENSORS_ADM1029 is not set
886# CONFIG_SENSORS_ADM1031 is not set 982# CONFIG_SENSORS_ADM1031 is not set
887# CONFIG_SENSORS_ADM9240 is not set 983# CONFIG_SENSORS_ADM9240 is not set
888# CONFIG_SENSORS_ASB100 is not set 984# CONFIG_SENSORS_ADT7470 is not set
985# CONFIG_SENSORS_ADT7473 is not set
889# CONFIG_SENSORS_ATXP1 is not set 986# CONFIG_SENSORS_ATXP1 is not set
890# CONFIG_SENSORS_DS1621 is not set 987# CONFIG_SENSORS_DS1621 is not set
891# CONFIG_SENSORS_F71805F is not set 988# CONFIG_SENSORS_F71805F is not set
892# CONFIG_SENSORS_FSCHER is not set 989# CONFIG_SENSORS_F71882FG is not set
893# CONFIG_SENSORS_FSCPOS is not set 990# CONFIG_SENSORS_F75375S is not set
894# CONFIG_SENSORS_GL518SM is not set 991# CONFIG_SENSORS_GL518SM is not set
895# CONFIG_SENSORS_GL520SM is not set 992# CONFIG_SENSORS_GL520SM is not set
896# CONFIG_SENSORS_IT87 is not set 993# CONFIG_SENSORS_IT87 is not set
@@ -905,72 +1002,95 @@ CONFIG_SENSORS_LM85=m
905# CONFIG_SENSORS_LM87 is not set 1002# CONFIG_SENSORS_LM87 is not set
906# CONFIG_SENSORS_LM90 is not set 1003# CONFIG_SENSORS_LM90 is not set
907# CONFIG_SENSORS_LM92 is not set 1004# CONFIG_SENSORS_LM92 is not set
1005# CONFIG_SENSORS_LM93 is not set
908# CONFIG_SENSORS_MAX1619 is not set 1006# CONFIG_SENSORS_MAX1619 is not set
1007# CONFIG_SENSORS_MAX6650 is not set
909# CONFIG_SENSORS_PC87360 is not set 1008# CONFIG_SENSORS_PC87360 is not set
910# CONFIG_SENSORS_PC87427 is not set 1009# CONFIG_SENSORS_PC87427 is not set
1010# CONFIG_SENSORS_DME1737 is not set
911# CONFIG_SENSORS_SMSC47M1 is not set 1011# CONFIG_SENSORS_SMSC47M1 is not set
912# CONFIG_SENSORS_SMSC47M192 is not set 1012# CONFIG_SENSORS_SMSC47M192 is not set
913# CONFIG_SENSORS_SMSC47B397 is not set 1013# CONFIG_SENSORS_SMSC47B397 is not set
1014# CONFIG_SENSORS_ADS7828 is not set
1015# CONFIG_SENSORS_THMC50 is not set
914# CONFIG_SENSORS_VT1211 is not set 1016# CONFIG_SENSORS_VT1211 is not set
915# CONFIG_SENSORS_W83781D is not set 1017# CONFIG_SENSORS_W83781D is not set
916# CONFIG_SENSORS_W83791D is not set 1018# CONFIG_SENSORS_W83791D is not set
917# CONFIG_SENSORS_W83792D is not set 1019# CONFIG_SENSORS_W83792D is not set
918# CONFIG_SENSORS_W83793 is not set 1020# CONFIG_SENSORS_W83793 is not set
919# CONFIG_SENSORS_W83L785TS is not set 1021# CONFIG_SENSORS_W83L785TS is not set
1022# CONFIG_SENSORS_W83L786NG is not set
920# CONFIG_SENSORS_W83627HF is not set 1023# CONFIG_SENSORS_W83627HF is not set
921# CONFIG_SENSORS_W83627EHF is not set 1024# CONFIG_SENSORS_W83627EHF is not set
922# CONFIG_HWMON_DEBUG_CHIP is not set 1025# CONFIG_HWMON_DEBUG_CHIP is not set
1026CONFIG_WATCHDOG=y
1027# CONFIG_WATCHDOG_NOWAYOUT is not set
923 1028
924# 1029#
925# Misc devices 1030# Watchdog Device Drivers
926# 1031#
1032# CONFIG_SOFT_WATCHDOG is not set
1033CONFIG_S3C2410_WATCHDOG=y
927 1034
928# 1035#
929# Multifunction device drivers 1036# ISA-based Watchdog Cards
930# 1037#
931# CONFIG_MFD_SM501 is not set 1038# CONFIG_PCWATCHDOG is not set
1039# CONFIG_MIXCOMWD is not set
1040# CONFIG_WDT is not set
932 1041
933# 1042#
934# LED devices 1043# USB-based Watchdog Cards
935# 1044#
936CONFIG_NEW_LEDS=y 1045# CONFIG_USBPCWATCHDOG is not set
937CONFIG_LEDS_CLASS=m
938 1046
939# 1047#
940# LED drivers 1048# Sonics Silicon Backplane
941# 1049#
942CONFIG_LEDS_S3C24XX=m 1050CONFIG_SSB_POSSIBLE=y
943CONFIG_LEDS_H1940=m 1051# CONFIG_SSB is not set
944 1052
945# 1053#
946# LED Triggers 1054# Multifunction device drivers
947# 1055#
948CONFIG_LEDS_TRIGGERS=y 1056CONFIG_MFD_SM501=y
949CONFIG_LEDS_TRIGGER_TIMER=m 1057# CONFIG_MFD_ASIC3 is not set
950# CONFIG_LEDS_TRIGGER_IDE_DISK is not set 1058# CONFIG_HTC_EGPIO is not set
951CONFIG_LEDS_TRIGGER_HEARTBEAT=m 1059# CONFIG_HTC_PASIC3 is not set
952 1060
953# 1061#
954# Multimedia devices 1062# Multimedia devices
955# 1063#
1064
1065#
1066# Multimedia core support
1067#
956# CONFIG_VIDEO_DEV is not set 1068# CONFIG_VIDEO_DEV is not set
1069# CONFIG_DVB_CORE is not set
1070# CONFIG_VIDEO_MEDIA is not set
957 1071
958# 1072#
959# Digital Video Broadcasting Devices 1073# Multimedia drivers
960# 1074#
961# CONFIG_DVB is not set 1075# CONFIG_DAB is not set
962# CONFIG_USB_DABUSB is not set
963 1076
964# 1077#
965# Graphics support 1078# Graphics support
966# 1079#
967# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1080# CONFIG_VGASTATE is not set
1081# CONFIG_VIDEO_OUTPUT_CONTROL is not set
968CONFIG_FB=y 1082CONFIG_FB=y
969CONFIG_FIRMWARE_EDID=y 1083CONFIG_FIRMWARE_EDID=y
970# CONFIG_FB_DDC is not set 1084# CONFIG_FB_DDC is not set
971CONFIG_FB_CFB_FILLRECT=y 1085CONFIG_FB_CFB_FILLRECT=y
972CONFIG_FB_CFB_COPYAREA=y 1086CONFIG_FB_CFB_COPYAREA=y
973CONFIG_FB_CFB_IMAGEBLIT=y 1087CONFIG_FB_CFB_IMAGEBLIT=y
1088# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1089# CONFIG_FB_SYS_FILLRECT is not set
1090# CONFIG_FB_SYS_COPYAREA is not set
1091# CONFIG_FB_SYS_IMAGEBLIT is not set
1092# CONFIG_FB_FOREIGN_ENDIAN is not set
1093# CONFIG_FB_SYS_FOPS is not set
974# CONFIG_FB_SVGALIB is not set 1094# CONFIG_FB_SVGALIB is not set
975# CONFIG_FB_MACMODES is not set 1095# CONFIG_FB_MACMODES is not set
976# CONFIG_FB_BACKLIGHT is not set 1096# CONFIG_FB_BACKLIGHT is not set
@@ -978,12 +1098,19 @@ CONFIG_FB_MODE_HELPERS=y
978# CONFIG_FB_TILEBLITTING is not set 1098# CONFIG_FB_TILEBLITTING is not set
979 1099
980# 1100#
981# Frambuffer hardware drivers 1101# Frame buffer hardware drivers
982# 1102#
983# CONFIG_FB_S1D13XXX is not set 1103# CONFIG_FB_S1D13XXX is not set
984CONFIG_FB_S3C2410=y 1104CONFIG_FB_S3C2410=y
985# CONFIG_FB_S3C2410_DEBUG is not set 1105# CONFIG_FB_S3C2410_DEBUG is not set
1106CONFIG_FB_SM501=y
986# CONFIG_FB_VIRTUAL is not set 1107# CONFIG_FB_VIRTUAL is not set
1108# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1109
1110#
1111# Display device support
1112#
1113# CONFIG_DISPLAY_SUPPORT is not set
987 1114
988# 1115#
989# Console display driver support 1116# Console display driver support
@@ -992,40 +1119,45 @@ CONFIG_FB_S3C2410=y
992# CONFIG_MDA_CONSOLE is not set 1119# CONFIG_MDA_CONSOLE is not set
993CONFIG_DUMMY_CONSOLE=y 1120CONFIG_DUMMY_CONSOLE=y
994CONFIG_FRAMEBUFFER_CONSOLE=y 1121CONFIG_FRAMEBUFFER_CONSOLE=y
1122# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
995# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 1123# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
996# CONFIG_FONTS is not set 1124# CONFIG_FONTS is not set
997CONFIG_FONT_8x8=y 1125CONFIG_FONT_8x8=y
998CONFIG_FONT_8x16=y 1126CONFIG_FONT_8x16=y
999
1000#
1001# Logo configuration
1002#
1003# CONFIG_LOGO is not set 1127# CONFIG_LOGO is not set
1004 1128
1005# 1129#
1006# Sound 1130# Sound
1007# 1131#
1008# CONFIG_SOUND is not set 1132# CONFIG_SOUND is not set
1133CONFIG_HID_SUPPORT=y
1134CONFIG_HID=y
1135# CONFIG_HID_DEBUG is not set
1136# CONFIG_HIDRAW is not set
1009 1137
1010# 1138#
1011# HID Devices 1139# USB Input Devices
1012# 1140#
1013CONFIG_HID=y 1141# CONFIG_USB_HID is not set
1014# CONFIG_HID_DEBUG is not set
1015 1142
1016# 1143#
1017# USB support 1144# USB HID Boot Protocol drivers
1018# 1145#
1146# CONFIG_USB_KBD is not set
1147# CONFIG_USB_MOUSE is not set
1148CONFIG_USB_SUPPORT=y
1019CONFIG_USB_ARCH_HAS_HCD=y 1149CONFIG_USB_ARCH_HAS_HCD=y
1020CONFIG_USB_ARCH_HAS_OHCI=y 1150CONFIG_USB_ARCH_HAS_OHCI=y
1021# CONFIG_USB_ARCH_HAS_EHCI is not set 1151# CONFIG_USB_ARCH_HAS_EHCI is not set
1022CONFIG_USB=y 1152CONFIG_USB=y
1023# CONFIG_USB_DEBUG is not set 1153# CONFIG_USB_DEBUG is not set
1154# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1024 1155
1025# 1156#
1026# Miscellaneous USB options 1157# Miscellaneous USB options
1027# 1158#
1028CONFIG_USB_DEVICEFS=y 1159CONFIG_USB_DEVICEFS=y
1160CONFIG_USB_DEVICE_CLASS=y
1029# CONFIG_USB_DYNAMIC_MINORS is not set 1161# CONFIG_USB_DYNAMIC_MINORS is not set
1030# CONFIG_USB_SUSPEND is not set 1162# CONFIG_USB_SUSPEND is not set
1031# CONFIG_USB_OTG is not set 1163# CONFIG_USB_OTG is not set
@@ -1033,18 +1165,22 @@ CONFIG_USB_DEVICEFS=y
1033# 1165#
1034# USB Host Controller Drivers 1166# USB Host Controller Drivers
1035# 1167#
1168# CONFIG_USB_C67X00_HCD is not set
1036# CONFIG_USB_ISP116X_HCD is not set 1169# CONFIG_USB_ISP116X_HCD is not set
1170# CONFIG_USB_ISP1760_HCD is not set
1037CONFIG_USB_OHCI_HCD=y 1171CONFIG_USB_OHCI_HCD=y
1038# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1172# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1039# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1173# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1040CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1174CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1041# CONFIG_USB_SL811_HCD is not set 1175# CONFIG_USB_SL811_HCD is not set
1176# CONFIG_USB_R8A66597_HCD is not set
1042 1177
1043# 1178#
1044# USB Device Class drivers 1179# USB Device Class drivers
1045# 1180#
1046# CONFIG_USB_ACM is not set 1181CONFIG_USB_ACM=m
1047# CONFIG_USB_PRINTER is not set 1182CONFIG_USB_PRINTER=m
1183CONFIG_USB_WDM=m
1048 1184
1049# 1185#
1050# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1186# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1053,57 +1189,78 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1053# 1189#
1054# may also be needed; see USB_STORAGE Help for more information 1190# may also be needed; see USB_STORAGE Help for more information
1055# 1191#
1056# CONFIG_USB_LIBUSUAL is not set 1192CONFIG_USB_STORAGE=m
1057 1193# CONFIG_USB_STORAGE_DEBUG is not set
1058# 1194# CONFIG_USB_STORAGE_DATAFAB is not set
1059# USB Input Devices 1195# CONFIG_USB_STORAGE_FREECOM is not set
1060# 1196# CONFIG_USB_STORAGE_ISD200 is not set
1061# CONFIG_USB_HID is not set 1197# CONFIG_USB_STORAGE_DPCM is not set
1062 1198# CONFIG_USB_STORAGE_USBAT is not set
1063# 1199# CONFIG_USB_STORAGE_SDDR09 is not set
1064# USB HID Boot Protocol drivers 1200# CONFIG_USB_STORAGE_SDDR55 is not set
1065# 1201# CONFIG_USB_STORAGE_JUMPSHOT is not set
1066# CONFIG_USB_KBD is not set 1202# CONFIG_USB_STORAGE_ALAUDA is not set
1067# CONFIG_USB_MOUSE is not set 1203# CONFIG_USB_STORAGE_ONETOUCH is not set
1068# CONFIG_USB_AIPTEK is not set 1204# CONFIG_USB_STORAGE_KARMA is not set
1069# CONFIG_USB_WACOM is not set 1205# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1070# CONFIG_USB_ACECAD is not set 1206CONFIG_USB_LIBUSUAL=y
1071# CONFIG_USB_KBTAB is not set
1072# CONFIG_USB_POWERMATE is not set
1073# CONFIG_USB_TOUCHSCREEN is not set
1074# CONFIG_USB_YEALINK is not set
1075# CONFIG_USB_XPAD is not set
1076# CONFIG_USB_ATI_REMOTE is not set
1077# CONFIG_USB_ATI_REMOTE2 is not set
1078# CONFIG_USB_KEYSPAN_REMOTE is not set
1079# CONFIG_USB_APPLETOUCH is not set
1080# CONFIG_USB_GTCO is not set
1081 1207
1082# 1208#
1083# USB Imaging devices 1209# USB Imaging devices
1084# 1210#
1085# CONFIG_USB_MDC800 is not set 1211# CONFIG_USB_MDC800 is not set
1086 1212# CONFIG_USB_MICROTEK is not set
1087#
1088# USB Network Adapters
1089#
1090# CONFIG_USB_CATC is not set
1091# CONFIG_USB_KAWETH is not set
1092# CONFIG_USB_PEGASUS is not set
1093# CONFIG_USB_RTL8150 is not set
1094# CONFIG_USB_USBNET_MII is not set
1095# CONFIG_USB_USBNET is not set
1096CONFIG_USB_MON=y 1213CONFIG_USB_MON=y
1097 1214
1098# 1215#
1099# USB port drivers 1216# USB port drivers
1100# 1217#
1101# CONFIG_USB_USS720 is not set 1218# CONFIG_USB_USS720 is not set
1102 1219CONFIG_USB_SERIAL=y
1103# 1220# CONFIG_USB_SERIAL_CONSOLE is not set
1104# USB Serial Converter support 1221# CONFIG_USB_EZUSB is not set
1105# 1222CONFIG_USB_SERIAL_GENERIC=y
1106# CONFIG_USB_SERIAL is not set 1223# CONFIG_USB_SERIAL_AIRCABLE is not set
1224# CONFIG_USB_SERIAL_AIRPRIME is not set
1225# CONFIG_USB_SERIAL_ARK3116 is not set
1226# CONFIG_USB_SERIAL_BELKIN is not set
1227# CONFIG_USB_SERIAL_CH341 is not set
1228# CONFIG_USB_SERIAL_WHITEHEAT is not set
1229# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1230# CONFIG_USB_SERIAL_CP2101 is not set
1231# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1232# CONFIG_USB_SERIAL_EMPEG is not set
1233CONFIG_USB_SERIAL_FTDI_SIO=y
1234# CONFIG_USB_SERIAL_FUNSOFT is not set
1235# CONFIG_USB_SERIAL_VISOR is not set
1236# CONFIG_USB_SERIAL_IPAQ is not set
1237# CONFIG_USB_SERIAL_IR is not set
1238# CONFIG_USB_SERIAL_EDGEPORT is not set
1239# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1240# CONFIG_USB_SERIAL_GARMIN is not set
1241# CONFIG_USB_SERIAL_IPW is not set
1242# CONFIG_USB_SERIAL_IUU is not set
1243# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1244# CONFIG_USB_SERIAL_KEYSPAN is not set
1245# CONFIG_USB_SERIAL_KLSI is not set
1246# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1247# CONFIG_USB_SERIAL_MCT_U232 is not set
1248# CONFIG_USB_SERIAL_MOS7720 is not set
1249# CONFIG_USB_SERIAL_MOS7840 is not set
1250# CONFIG_USB_SERIAL_MOTOROLA is not set
1251CONFIG_USB_SERIAL_NAVMAN=m
1252CONFIG_USB_SERIAL_PL2303=y
1253# CONFIG_USB_SERIAL_OTI6858 is not set
1254# CONFIG_USB_SERIAL_SPCP8X5 is not set
1255# CONFIG_USB_SERIAL_HP4X is not set
1256# CONFIG_USB_SERIAL_SAFE is not set
1257# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
1258# CONFIG_USB_SERIAL_TI is not set
1259# CONFIG_USB_SERIAL_CYBERJACK is not set
1260# CONFIG_USB_SERIAL_XIRCOM is not set
1261CONFIG_USB_SERIAL_OPTION=m
1262# CONFIG_USB_SERIAL_OMNINET is not set
1263# CONFIG_USB_SERIAL_DEBUG is not set
1107 1264
1108# 1265#
1109# USB Miscellaneous drivers 1266# USB Miscellaneous drivers
@@ -1116,35 +1273,38 @@ CONFIG_USB_MON=y
1116# CONFIG_USB_LEGOTOWER is not set 1273# CONFIG_USB_LEGOTOWER is not set
1117# CONFIG_USB_LCD is not set 1274# CONFIG_USB_LCD is not set
1118# CONFIG_USB_BERRY_CHARGE is not set 1275# CONFIG_USB_BERRY_CHARGE is not set
1119# CONFIG_USB_LED is not set 1276CONFIG_USB_LED=m
1120# CONFIG_USB_CYPRESS_CY7C63 is not set 1277# CONFIG_USB_CYPRESS_CY7C63 is not set
1121# CONFIG_USB_CYTHERM is not set 1278# CONFIG_USB_CYTHERM is not set
1122# CONFIG_USB_PHIDGET is not set 1279# CONFIG_USB_PHIDGET is not set
1123# CONFIG_USB_IDMOUSE is not set 1280# CONFIG_USB_IDMOUSE is not set
1124# CONFIG_USB_FTDI_ELAN is not set 1281# CONFIG_USB_FTDI_ELAN is not set
1125# CONFIG_USB_APPLEDISPLAY is not set 1282# CONFIG_USB_APPLEDISPLAY is not set
1126# CONFIG_USB_LD is not set 1283CONFIG_USB_LD=m
1127# CONFIG_USB_TRANCEVIBRATOR is not set 1284# CONFIG_USB_TRANCEVIBRATOR is not set
1128# CONFIG_USB_IOWARRIOR is not set 1285# CONFIG_USB_IOWARRIOR is not set
1129# CONFIG_USB_TEST is not set 1286# CONFIG_USB_TEST is not set
1130 1287# CONFIG_USB_ISIGHTFW is not set
1131#
1132# USB DSL modem support
1133#
1134
1135#
1136# USB Gadget Support
1137#
1138# CONFIG_USB_GADGET is not set 1288# CONFIG_USB_GADGET is not set
1289# CONFIG_MMC is not set
1290CONFIG_NEW_LEDS=y
1291CONFIG_LEDS_CLASS=m
1139 1292
1140# 1293#
1141# MMC/SD Card support 1294# LED drivers
1142# 1295#
1143# CONFIG_MMC is not set 1296CONFIG_LEDS_S3C24XX=m
1297CONFIG_LEDS_H1940=m
1298# CONFIG_LEDS_GPIO is not set
1144 1299
1145# 1300#
1146# Real Time Clock 1301# LED Triggers
1147# 1302#
1303CONFIG_LEDS_TRIGGERS=y
1304CONFIG_LEDS_TRIGGER_TIMER=m
1305# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
1306CONFIG_LEDS_TRIGGER_HEARTBEAT=m
1307# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
1148CONFIG_RTC_LIB=y 1308CONFIG_RTC_LIB=y
1149CONFIG_RTC_CLASS=y 1309CONFIG_RTC_CLASS=y
1150CONFIG_RTC_HCTOSYS=y 1310CONFIG_RTC_HCTOSYS=y
@@ -1158,61 +1318,86 @@ CONFIG_RTC_INTF_SYSFS=y
1158CONFIG_RTC_INTF_PROC=y 1318CONFIG_RTC_INTF_PROC=y
1159CONFIG_RTC_INTF_DEV=y 1319CONFIG_RTC_INTF_DEV=y
1160# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set 1320# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1321# CONFIG_RTC_DRV_TEST is not set
1161 1322
1162# 1323#
1163# RTC drivers 1324# I2C RTC drivers
1164# 1325#
1165# CONFIG_RTC_DRV_CMOS is not set
1166# CONFIG_RTC_DRV_X1205 is not set
1167# CONFIG_RTC_DRV_DS1307 is not set 1326# CONFIG_RTC_DRV_DS1307 is not set
1168# CONFIG_RTC_DRV_DS1553 is not set 1327# CONFIG_RTC_DRV_DS1374 is not set
1169# CONFIG_RTC_DRV_ISL1208 is not set
1170# CONFIG_RTC_DRV_DS1672 is not set 1328# CONFIG_RTC_DRV_DS1672 is not set
1171# CONFIG_RTC_DRV_DS1742 is not set 1329# CONFIG_RTC_DRV_MAX6900 is not set
1330# CONFIG_RTC_DRV_RS5C372 is not set
1331# CONFIG_RTC_DRV_ISL1208 is not set
1332# CONFIG_RTC_DRV_X1205 is not set
1172# CONFIG_RTC_DRV_PCF8563 is not set 1333# CONFIG_RTC_DRV_PCF8563 is not set
1334# CONFIG_RTC_DRV_PCF8583 is not set
1335# CONFIG_RTC_DRV_M41T80 is not set
1336# CONFIG_RTC_DRV_S35390A is not set
1337# CONFIG_RTC_DRV_FM3130 is not set
1338
1339#
1340# SPI RTC drivers
1341#
1342# CONFIG_RTC_DRV_MAX6902 is not set
1343# CONFIG_RTC_DRV_R9701 is not set
1173# CONFIG_RTC_DRV_RS5C348 is not set 1344# CONFIG_RTC_DRV_RS5C348 is not set
1174# CONFIG_RTC_DRV_RS5C372 is not set 1345
1175CONFIG_RTC_DRV_S3C=y 1346#
1347# Platform RTC drivers
1348#
1349# CONFIG_RTC_DRV_CMOS is not set
1350# CONFIG_RTC_DRV_DS1511 is not set
1351# CONFIG_RTC_DRV_DS1553 is not set
1352# CONFIG_RTC_DRV_DS1742 is not set
1353# CONFIG_RTC_DRV_STK17TA8 is not set
1176# CONFIG_RTC_DRV_M48T86 is not set 1354# CONFIG_RTC_DRV_M48T86 is not set
1177# CONFIG_RTC_DRV_TEST is not set 1355# CONFIG_RTC_DRV_M48T59 is not set
1178# CONFIG_RTC_DRV_MAX6902 is not set
1179# CONFIG_RTC_DRV_V3020 is not set 1356# CONFIG_RTC_DRV_V3020 is not set
1180 1357
1181# 1358#
1359# on-CPU RTC drivers
1360#
1361CONFIG_RTC_DRV_S3C=y
1362# CONFIG_UIO is not set
1363
1364#
1182# File systems 1365# File systems
1183# 1366#
1184CONFIG_EXT2_FS=y 1367CONFIG_EXT2_FS=y
1185# CONFIG_EXT2_FS_XATTR is not set 1368CONFIG_EXT2_FS_XATTR=y
1369CONFIG_EXT2_FS_POSIX_ACL=y
1370CONFIG_EXT2_FS_SECURITY=y
1186# CONFIG_EXT2_FS_XIP is not set 1371# CONFIG_EXT2_FS_XIP is not set
1187CONFIG_EXT3_FS=y 1372CONFIG_EXT3_FS=y
1188CONFIG_EXT3_FS_XATTR=y 1373CONFIG_EXT3_FS_XATTR=y
1189# CONFIG_EXT3_FS_POSIX_ACL is not set 1374CONFIG_EXT3_FS_POSIX_ACL=y
1190# CONFIG_EXT3_FS_SECURITY is not set 1375# CONFIG_EXT3_FS_SECURITY is not set
1191# CONFIG_EXT4DEV_FS is not set 1376# CONFIG_EXT4DEV_FS is not set
1192CONFIG_JBD=y 1377CONFIG_JBD=y
1193# CONFIG_JBD_DEBUG is not set
1194CONFIG_FS_MBCACHE=y 1378CONFIG_FS_MBCACHE=y
1195# CONFIG_REISERFS_FS is not set 1379# CONFIG_REISERFS_FS is not set
1196# CONFIG_JFS_FS is not set 1380# CONFIG_JFS_FS is not set
1197# CONFIG_FS_POSIX_ACL is not set 1381CONFIG_FS_POSIX_ACL=y
1198# CONFIG_XFS_FS is not set 1382# CONFIG_XFS_FS is not set
1199# CONFIG_GFS2_FS is not set
1200# CONFIG_OCFS2_FS is not set 1383# CONFIG_OCFS2_FS is not set
1201# CONFIG_MINIX_FS is not set 1384CONFIG_DNOTIFY=y
1202CONFIG_ROMFS_FS=y
1203CONFIG_INOTIFY=y 1385CONFIG_INOTIFY=y
1204CONFIG_INOTIFY_USER=y 1386CONFIG_INOTIFY_USER=y
1205# CONFIG_QUOTA is not set 1387# CONFIG_QUOTA is not set
1206CONFIG_DNOTIFY=y
1207# CONFIG_AUTOFS_FS is not set 1388# CONFIG_AUTOFS_FS is not set
1208# CONFIG_AUTOFS4_FS is not set 1389# CONFIG_AUTOFS4_FS is not set
1209# CONFIG_FUSE_FS is not set 1390# CONFIG_FUSE_FS is not set
1391CONFIG_GENERIC_ACL=y
1210 1392
1211# 1393#
1212# CD-ROM/DVD Filesystems 1394# CD-ROM/DVD Filesystems
1213# 1395#
1214# CONFIG_ISO9660_FS is not set 1396CONFIG_ISO9660_FS=y
1215# CONFIG_UDF_FS is not set 1397CONFIG_JOLIET=y
1398# CONFIG_ZISOFS is not set
1399CONFIG_UDF_FS=m
1400CONFIG_UDF_NLS=y
1216 1401
1217# 1402#
1218# DOS/FAT/NT Filesystems 1403# DOS/FAT/NT Filesystems
@@ -1222,7 +1407,9 @@ CONFIG_MSDOS_FS=y
1222CONFIG_VFAT_FS=y 1407CONFIG_VFAT_FS=y
1223CONFIG_FAT_DEFAULT_CODEPAGE=437 1408CONFIG_FAT_DEFAULT_CODEPAGE=437
1224CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 1409CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1225# CONFIG_NTFS_FS is not set 1410CONFIG_NTFS_FS=m
1411# CONFIG_NTFS_DEBUG is not set
1412# CONFIG_NTFS_RW is not set
1226 1413
1227# 1414#
1228# Pseudo filesystems 1415# Pseudo filesystems
@@ -1230,10 +1417,10 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1230CONFIG_PROC_FS=y 1417CONFIG_PROC_FS=y
1231CONFIG_PROC_SYSCTL=y 1418CONFIG_PROC_SYSCTL=y
1232CONFIG_SYSFS=y 1419CONFIG_SYSFS=y
1233# CONFIG_TMPFS is not set 1420CONFIG_TMPFS=y
1421CONFIG_TMPFS_POSIX_ACL=y
1234# CONFIG_HUGETLB_PAGE is not set 1422# CONFIG_HUGETLB_PAGE is not set
1235CONFIG_RAMFS=y 1423CONFIG_CONFIGFS_FS=m
1236# CONFIG_CONFIGFS_FS is not set
1237 1424
1238# 1425#
1239# Miscellaneous filesystems 1426# Miscellaneous filesystems
@@ -1248,31 +1435,32 @@ CONFIG_RAMFS=y
1248CONFIG_JFFS2_FS=y 1435CONFIG_JFFS2_FS=y
1249CONFIG_JFFS2_FS_DEBUG=0 1436CONFIG_JFFS2_FS_DEBUG=0
1250CONFIG_JFFS2_FS_WRITEBUFFER=y 1437CONFIG_JFFS2_FS_WRITEBUFFER=y
1251# CONFIG_JFFS2_SUMMARY is not set 1438# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1439CONFIG_JFFS2_SUMMARY=y
1252# CONFIG_JFFS2_FS_XATTR is not set 1440# CONFIG_JFFS2_FS_XATTR is not set
1253# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1441# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1254CONFIG_JFFS2_ZLIB=y 1442CONFIG_JFFS2_ZLIB=y
1443# CONFIG_JFFS2_LZO is not set
1255CONFIG_JFFS2_RTIME=y 1444CONFIG_JFFS2_RTIME=y
1256# CONFIG_JFFS2_RUBIN is not set 1445# CONFIG_JFFS2_RUBIN is not set
1257CONFIG_CRAMFS=y 1446CONFIG_CRAMFS=y
1258# CONFIG_VXFS_FS is not set 1447# CONFIG_VXFS_FS is not set
1448# CONFIG_MINIX_FS is not set
1259# CONFIG_HPFS_FS is not set 1449# CONFIG_HPFS_FS is not set
1260# CONFIG_QNX4FS_FS is not set 1450# CONFIG_QNX4FS_FS is not set
1451CONFIG_ROMFS_FS=y
1261# CONFIG_SYSV_FS is not set 1452# CONFIG_SYSV_FS is not set
1262# CONFIG_UFS_FS is not set 1453# CONFIG_UFS_FS is not set
1263 1454CONFIG_NETWORK_FILESYSTEMS=y
1264#
1265# Network File Systems
1266#
1267CONFIG_NFS_FS=y 1455CONFIG_NFS_FS=y
1268# CONFIG_NFS_V3 is not set 1456# CONFIG_NFS_V3 is not set
1269# CONFIG_NFS_V4 is not set 1457# CONFIG_NFS_V4 is not set
1270# CONFIG_NFS_DIRECTIO is not set
1271# CONFIG_NFSD is not set 1458# CONFIG_NFSD is not set
1272CONFIG_ROOT_NFS=y 1459CONFIG_ROOT_NFS=y
1273CONFIG_LOCKD=y 1460CONFIG_LOCKD=y
1274CONFIG_NFS_COMMON=y 1461CONFIG_NFS_COMMON=y
1275CONFIG_SUNRPC=y 1462CONFIG_SUNRPC=y
1463# CONFIG_SUNRPC_BIND34 is not set
1276# CONFIG_RPCSEC_GSS_KRB5 is not set 1464# CONFIG_RPCSEC_GSS_KRB5 is not set
1277# CONFIG_RPCSEC_GSS_SPKM3 is not set 1465# CONFIG_RPCSEC_GSS_SPKM3 is not set
1278# CONFIG_SMB_FS is not set 1466# CONFIG_SMB_FS is not set
@@ -1280,7 +1468,6 @@ CONFIG_SUNRPC=y
1280# CONFIG_NCP_FS is not set 1468# CONFIG_NCP_FS is not set
1281# CONFIG_CODA_FS is not set 1469# CONFIG_CODA_FS is not set
1282# CONFIG_AFS_FS is not set 1470# CONFIG_AFS_FS is not set
1283# CONFIG_9P_FS is not set
1284 1471
1285# 1472#
1286# Partition Types 1473# Partition Types
@@ -1302,94 +1489,93 @@ CONFIG_SOLARIS_X86_PARTITION=y
1302# CONFIG_SUN_PARTITION is not set 1489# CONFIG_SUN_PARTITION is not set
1303# CONFIG_KARMA_PARTITION is not set 1490# CONFIG_KARMA_PARTITION is not set
1304# CONFIG_EFI_PARTITION is not set 1491# CONFIG_EFI_PARTITION is not set
1305 1492# CONFIG_SYSV68_PARTITION is not set
1306#
1307# Native Language Support
1308#
1309CONFIG_NLS=y 1493CONFIG_NLS=y
1310CONFIG_NLS_DEFAULT="iso8859-1" 1494CONFIG_NLS_DEFAULT="iso8859-1"
1311# CONFIG_NLS_CODEPAGE_437 is not set 1495CONFIG_NLS_CODEPAGE_437=y
1312# CONFIG_NLS_CODEPAGE_737 is not set 1496CONFIG_NLS_CODEPAGE_737=m
1313# CONFIG_NLS_CODEPAGE_775 is not set 1497CONFIG_NLS_CODEPAGE_775=m
1314# CONFIG_NLS_CODEPAGE_850 is not set 1498CONFIG_NLS_CODEPAGE_850=y
1315# CONFIG_NLS_CODEPAGE_852 is not set 1499CONFIG_NLS_CODEPAGE_852=m
1316# CONFIG_NLS_CODEPAGE_855 is not set 1500CONFIG_NLS_CODEPAGE_855=m
1317# CONFIG_NLS_CODEPAGE_857 is not set 1501CONFIG_NLS_CODEPAGE_857=m
1318# CONFIG_NLS_CODEPAGE_860 is not set 1502CONFIG_NLS_CODEPAGE_860=m
1319# CONFIG_NLS_CODEPAGE_861 is not set 1503CONFIG_NLS_CODEPAGE_861=m
1320# CONFIG_NLS_CODEPAGE_862 is not set 1504CONFIG_NLS_CODEPAGE_862=m
1321# CONFIG_NLS_CODEPAGE_863 is not set 1505CONFIG_NLS_CODEPAGE_863=m
1322# CONFIG_NLS_CODEPAGE_864 is not set 1506CONFIG_NLS_CODEPAGE_864=m
1323# CONFIG_NLS_CODEPAGE_865 is not set 1507CONFIG_NLS_CODEPAGE_865=m
1324# CONFIG_NLS_CODEPAGE_866 is not set 1508CONFIG_NLS_CODEPAGE_866=m
1325# CONFIG_NLS_CODEPAGE_869 is not set 1509CONFIG_NLS_CODEPAGE_869=m
1326# CONFIG_NLS_CODEPAGE_936 is not set 1510CONFIG_NLS_CODEPAGE_936=m
1327# CONFIG_NLS_CODEPAGE_950 is not set 1511CONFIG_NLS_CODEPAGE_950=m
1328# CONFIG_NLS_CODEPAGE_932 is not set 1512CONFIG_NLS_CODEPAGE_932=m
1329# CONFIG_NLS_CODEPAGE_949 is not set 1513CONFIG_NLS_CODEPAGE_949=m
1330# CONFIG_NLS_CODEPAGE_874 is not set 1514CONFIG_NLS_CODEPAGE_874=m
1331# CONFIG_NLS_ISO8859_8 is not set 1515CONFIG_NLS_ISO8859_8=m
1332# CONFIG_NLS_CODEPAGE_1250 is not set 1516CONFIG_NLS_CODEPAGE_1250=m
1333# CONFIG_NLS_CODEPAGE_1251 is not set 1517CONFIG_NLS_CODEPAGE_1251=m
1334# CONFIG_NLS_ASCII is not set 1518CONFIG_NLS_ASCII=y
1335# CONFIG_NLS_ISO8859_1 is not set 1519CONFIG_NLS_ISO8859_1=y
1336# CONFIG_NLS_ISO8859_2 is not set 1520CONFIG_NLS_ISO8859_2=m
1337# CONFIG_NLS_ISO8859_3 is not set 1521CONFIG_NLS_ISO8859_3=m
1338# CONFIG_NLS_ISO8859_4 is not set 1522CONFIG_NLS_ISO8859_4=m
1339# CONFIG_NLS_ISO8859_5 is not set 1523CONFIG_NLS_ISO8859_5=m
1340# CONFIG_NLS_ISO8859_6 is not set 1524CONFIG_NLS_ISO8859_6=m
1341# CONFIG_NLS_ISO8859_7 is not set 1525CONFIG_NLS_ISO8859_7=m
1342# CONFIG_NLS_ISO8859_9 is not set 1526CONFIG_NLS_ISO8859_9=m
1343# CONFIG_NLS_ISO8859_13 is not set 1527CONFIG_NLS_ISO8859_13=m
1344# CONFIG_NLS_ISO8859_14 is not set 1528CONFIG_NLS_ISO8859_14=m
1345# CONFIG_NLS_ISO8859_15 is not set 1529CONFIG_NLS_ISO8859_15=m
1346# CONFIG_NLS_KOI8_R is not set 1530CONFIG_NLS_KOI8_R=m
1347# CONFIG_NLS_KOI8_U is not set 1531CONFIG_NLS_KOI8_U=m
1348# CONFIG_NLS_UTF8 is not set 1532CONFIG_NLS_UTF8=m
1349
1350#
1351# Distributed Lock Manager
1352#
1353# CONFIG_DLM is not set 1533# CONFIG_DLM is not set
1354 1534
1355# 1535#
1356# Profiling support
1357#
1358# CONFIG_PROFILING is not set
1359
1360#
1361# Kernel hacking 1536# Kernel hacking
1362# 1537#
1363# CONFIG_PRINTK_TIME is not set 1538# CONFIG_PRINTK_TIME is not set
1539CONFIG_ENABLE_WARN_DEPRECATED=y
1364CONFIG_ENABLE_MUST_CHECK=y 1540CONFIG_ENABLE_MUST_CHECK=y
1541CONFIG_FRAME_WARN=1024
1365CONFIG_MAGIC_SYSRQ=y 1542CONFIG_MAGIC_SYSRQ=y
1366# CONFIG_UNUSED_SYMBOLS is not set 1543# CONFIG_UNUSED_SYMBOLS is not set
1367# CONFIG_DEBUG_FS is not set 1544# CONFIG_DEBUG_FS is not set
1368# CONFIG_HEADERS_CHECK is not set 1545# CONFIG_HEADERS_CHECK is not set
1369CONFIG_DEBUG_KERNEL=y 1546CONFIG_DEBUG_KERNEL=y
1370# CONFIG_DEBUG_SHIRQ is not set 1547# CONFIG_DEBUG_SHIRQ is not set
1371CONFIG_LOG_BUF_SHIFT=16
1372CONFIG_DETECT_SOFTLOCKUP=y 1548CONFIG_DETECT_SOFTLOCKUP=y
1549CONFIG_SCHED_DEBUG=y
1373# CONFIG_SCHEDSTATS is not set 1550# CONFIG_SCHEDSTATS is not set
1374# CONFIG_TIMER_STATS is not set 1551# CONFIG_TIMER_STATS is not set
1552# CONFIG_DEBUG_OBJECTS is not set
1375# CONFIG_DEBUG_SLAB is not set 1553# CONFIG_DEBUG_SLAB is not set
1376# CONFIG_DEBUG_RT_MUTEXES is not set 1554# CONFIG_DEBUG_RT_MUTEXES is not set
1377# CONFIG_RT_MUTEX_TESTER is not set 1555# CONFIG_RT_MUTEX_TESTER is not set
1378# CONFIG_DEBUG_SPINLOCK is not set 1556# CONFIG_DEBUG_SPINLOCK is not set
1379CONFIG_DEBUG_MUTEXES=y 1557CONFIG_DEBUG_MUTEXES=y
1558# CONFIG_DEBUG_LOCK_ALLOC is not set
1559# CONFIG_PROVE_LOCKING is not set
1560# CONFIG_LOCK_STAT is not set
1380# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1561# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1381# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1562# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1382# CONFIG_DEBUG_KOBJECT is not set 1563# CONFIG_DEBUG_KOBJECT is not set
1383CONFIG_DEBUG_BUGVERBOSE=y 1564CONFIG_DEBUG_BUGVERBOSE=y
1384CONFIG_DEBUG_INFO=y 1565CONFIG_DEBUG_INFO=y
1385# CONFIG_DEBUG_VM is not set 1566# CONFIG_DEBUG_VM is not set
1567# CONFIG_DEBUG_WRITECOUNT is not set
1386# CONFIG_DEBUG_LIST is not set 1568# CONFIG_DEBUG_LIST is not set
1569# CONFIG_DEBUG_SG is not set
1387CONFIG_FRAME_POINTER=y 1570CONFIG_FRAME_POINTER=y
1388CONFIG_FORCED_INLINING=y 1571# CONFIG_BOOT_PRINTK_DELAY is not set
1389# CONFIG_RCU_TORTURE_TEST is not set 1572# CONFIG_RCU_TORTURE_TEST is not set
1573# CONFIG_BACKTRACE_SELF_TEST is not set
1390# CONFIG_FAULT_INJECTION is not set 1574# CONFIG_FAULT_INJECTION is not set
1575# CONFIG_SAMPLES is not set
1391CONFIG_DEBUG_USER=y 1576CONFIG_DEBUG_USER=y
1392# CONFIG_DEBUG_ERRORS is not set 1577CONFIG_DEBUG_ERRORS=y
1578# CONFIG_DEBUG_STACK_USAGE is not set
1393CONFIG_DEBUG_LL=y 1579CONFIG_DEBUG_LL=y
1394# CONFIG_DEBUG_ICEDCC is not set 1580# CONFIG_DEBUG_ICEDCC is not set
1395CONFIG_DEBUG_S3C_PORT=y 1581CONFIG_DEBUG_S3C_PORT=y
@@ -1400,21 +1586,100 @@ CONFIG_DEBUG_S3C_UART=0
1400# 1586#
1401# CONFIG_KEYS is not set 1587# CONFIG_KEYS is not set
1402# CONFIG_SECURITY is not set 1588# CONFIG_SECURITY is not set
1589# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1590CONFIG_CRYPTO=y
1591
1592#
1593# Crypto core or helper
1594#
1595CONFIG_CRYPTO_ALGAPI=m
1596CONFIG_CRYPTO_AEAD=m
1597CONFIG_CRYPTO_BLKCIPHER=m
1598CONFIG_CRYPTO_HASH=m
1599CONFIG_CRYPTO_MANAGER=m
1600# CONFIG_CRYPTO_GF128MUL is not set
1601# CONFIG_CRYPTO_NULL is not set
1602# CONFIG_CRYPTO_CRYPTD is not set
1603CONFIG_CRYPTO_AUTHENC=m
1604# CONFIG_CRYPTO_TEST is not set
1605
1606#
1607# Authenticated Encryption with Associated Data
1608#
1609# CONFIG_CRYPTO_CCM is not set
1610# CONFIG_CRYPTO_GCM is not set
1611# CONFIG_CRYPTO_SEQIV is not set
1612
1613#
1614# Block modes
1615#
1616CONFIG_CRYPTO_CBC=m
1617# CONFIG_CRYPTO_CTR is not set
1618# CONFIG_CRYPTO_CTS is not set
1619CONFIG_CRYPTO_ECB=m
1620# CONFIG_CRYPTO_LRW is not set
1621# CONFIG_CRYPTO_PCBC is not set
1622# CONFIG_CRYPTO_XTS is not set
1623
1624#
1625# Hash modes
1626#
1627CONFIG_CRYPTO_HMAC=m
1628# CONFIG_CRYPTO_XCBC is not set
1629
1630#
1631# Digest
1632#
1633# CONFIG_CRYPTO_CRC32C is not set
1634# CONFIG_CRYPTO_MD4 is not set
1635CONFIG_CRYPTO_MD5=m
1636# CONFIG_CRYPTO_MICHAEL_MIC is not set
1637CONFIG_CRYPTO_SHA1=m
1638# CONFIG_CRYPTO_SHA256 is not set
1639# CONFIG_CRYPTO_SHA512 is not set
1640# CONFIG_CRYPTO_TGR192 is not set
1641# CONFIG_CRYPTO_WP512 is not set
1642
1643#
1644# Ciphers
1645#
1646CONFIG_CRYPTO_AES=m
1647# CONFIG_CRYPTO_ANUBIS is not set
1648CONFIG_CRYPTO_ARC4=m
1649# CONFIG_CRYPTO_BLOWFISH is not set
1650# CONFIG_CRYPTO_CAMELLIA is not set
1651# CONFIG_CRYPTO_CAST5 is not set
1652# CONFIG_CRYPTO_CAST6 is not set
1653CONFIG_CRYPTO_DES=m
1654# CONFIG_CRYPTO_FCRYPT is not set
1655# CONFIG_CRYPTO_KHAZAD is not set
1656# CONFIG_CRYPTO_SALSA20 is not set
1657# CONFIG_CRYPTO_SEED is not set
1658# CONFIG_CRYPTO_SERPENT is not set
1659# CONFIG_CRYPTO_TEA is not set
1660# CONFIG_CRYPTO_TWOFISH is not set
1403 1661
1404# 1662#
1405# Cryptographic options 1663# Compression
1406# 1664#
1407# CONFIG_CRYPTO is not set 1665CONFIG_CRYPTO_DEFLATE=m
1666# CONFIG_CRYPTO_LZO is not set
1667CONFIG_CRYPTO_HW=y
1408 1668
1409# 1669#
1410# Library routines 1670# Library routines
1411# 1671#
1412CONFIG_BITREVERSE=y 1672CONFIG_BITREVERSE=y
1673# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1674# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1413# CONFIG_CRC_CCITT is not set 1675# CONFIG_CRC_CCITT is not set
1414# CONFIG_CRC16 is not set 1676# CONFIG_CRC16 is not set
1677CONFIG_CRC_ITU_T=m
1415CONFIG_CRC32=y 1678CONFIG_CRC32=y
1679# CONFIG_CRC7 is not set
1416# CONFIG_LIBCRC32C is not set 1680# CONFIG_LIBCRC32C is not set
1417CONFIG_ZLIB_INFLATE=y 1681CONFIG_ZLIB_INFLATE=y
1418CONFIG_ZLIB_DEFLATE=y 1682CONFIG_ZLIB_DEFLATE=y
1419CONFIG_PLIST=y 1683CONFIG_PLIST=y
1420CONFIG_HAS_IOMEM=y 1684CONFIG_HAS_IOMEM=y
1685CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/sam9_l9260_defconfig b/arch/arm/configs/sam9_l9260_defconfig
index 484dc9739dfc..8688362bcf7b 100644
--- a/arch/arm/configs/sam9_l9260_defconfig
+++ b/arch/arm/configs/sam9_l9260_defconfig
@@ -211,7 +211,6 @@ CONFIG_ARM_THUMB=y
211# 211#
212# CONFIG_TICK_ONESHOT is not set 212# CONFIG_TICK_ONESHOT is not set
213CONFIG_PREEMPT=y 213CONFIG_PREEMPT=y
214# CONFIG_NO_IDLE_HZ is not set
215CONFIG_HZ=100 214CONFIG_HZ=100
216# CONFIG_AEABI is not set 215# CONFIG_AEABI is not set
217# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 216# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
index aa7a01179500..7d59fb1f1cea 100644
--- a/arch/arm/configs/spitz_defconfig
+++ b/arch/arm/configs/spitz_defconfig
@@ -164,7 +164,6 @@ CONFIG_PCMCIA_PXA2XX=y
164# Kernel Features 164# Kernel Features
165# 165#
166CONFIG_PREEMPT=y 166CONFIG_PREEMPT=y
167# CONFIG_NO_IDLE_HZ is not set
168# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 167# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
169CONFIG_SELECT_MEMORY_MODEL=y 168CONFIG_SELECT_MEMORY_MODEL=y
170CONFIG_FLATMEM_MANUAL=y 169CONFIG_FLATMEM_MANUAL=y
diff --git a/arch/arm/configs/tct_hammer_defconfig b/arch/arm/configs/tct_hammer_defconfig
index 576b8339f0d6..07dfb98df4f0 100644
--- a/arch/arm/configs/tct_hammer_defconfig
+++ b/arch/arm/configs/tct_hammer_defconfig
@@ -247,7 +247,6 @@ CONFIG_ARM_THUMB=y
247# 247#
248# CONFIG_TICK_ONESHOT is not set 248# CONFIG_TICK_ONESHOT is not set
249# CONFIG_PREEMPT is not set 249# CONFIG_PREEMPT is not set
250# CONFIG_NO_IDLE_HZ is not set
251CONFIG_HZ=200 250CONFIG_HZ=200
252# CONFIG_AEABI is not set 251# CONFIG_AEABI is not set
253# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 252# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/trizeps4_defconfig b/arch/arm/configs/trizeps4_defconfig
index 6db6392806f9..8b7a431a8bfc 100644
--- a/arch/arm/configs/trizeps4_defconfig
+++ b/arch/arm/configs/trizeps4_defconfig
@@ -195,7 +195,6 @@ CONFIG_PCMCIA_PXA2XX=y
195# Kernel Features 195# Kernel Features
196# 196#
197CONFIG_PREEMPT=y 197CONFIG_PREEMPT=y
198# CONFIG_NO_IDLE_HZ is not set
199CONFIG_HZ=100 198CONFIG_HZ=100
200CONFIG_AEABI=y 199CONFIG_AEABI=y
201CONFIG_OABI_COMPAT=y 200CONFIG_OABI_COMPAT=y
diff --git a/arch/arm/configs/usb-a9260_defconfig b/arch/arm/configs/usb-a9260_defconfig
new file mode 100644
index 000000000000..3680bd2df26d
--- /dev/null
+++ b/arch/arm/configs/usb-a9260_defconfig
@@ -0,0 +1,1142 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24
4# Tue Apr 15 11:39:35 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51# CONFIG_SYSFS_DEPRECATED is not set
52# CONFIG_RELAY is not set
53# CONFIG_BLK_DEV_INITRD is not set
54# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
55CONFIG_SYSCTL=y
56# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_KALLSYMS=y
60# CONFIG_KALLSYMS_ALL is not set
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y
71CONFIG_EVENTFD=y
72CONFIG_SHMEM=y
73CONFIG_VM_EVENT_COUNTERS=y
74CONFIG_SLAB=y
75# CONFIG_SLUB is not set
76# CONFIG_SLOB is not set
77CONFIG_SLABINFO=y
78CONFIG_RT_MUTEXES=y
79# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0
81CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y
87CONFIG_BLOCK=y
88# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set
91# CONFIG_BLK_DEV_BSG is not set
92
93#
94# IO Schedulers
95#
96CONFIG_IOSCHED_NOOP=y
97CONFIG_IOSCHED_AS=y
98# CONFIG_IOSCHED_DEADLINE is not set
99# CONFIG_IOSCHED_CFQ is not set
100CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_DEADLINE is not set
102# CONFIG_DEFAULT_CFQ is not set
103# CONFIG_DEFAULT_NOOP is not set
104CONFIG_DEFAULT_IOSCHED="anticipatory"
105
106#
107# System Type
108#
109# CONFIG_ARCH_AAEC2000 is not set
110# CONFIG_ARCH_INTEGRATOR is not set
111# CONFIG_ARCH_REALVIEW is not set
112# CONFIG_ARCH_VERSATILE is not set
113CONFIG_ARCH_AT91=y
114# CONFIG_ARCH_CLPS7500 is not set
115# CONFIG_ARCH_CLPS711X is not set
116# CONFIG_ARCH_CO285 is not set
117# CONFIG_ARCH_EBSA110 is not set
118# CONFIG_ARCH_EP93XX is not set
119# CONFIG_ARCH_FOOTBRIDGE is not set
120# CONFIG_ARCH_NETX is not set
121# CONFIG_ARCH_H720X is not set
122# CONFIG_ARCH_IMX is not set
123# CONFIG_ARCH_IOP13XX is not set
124# CONFIG_ARCH_IOP32X is not set
125# CONFIG_ARCH_IOP33X is not set
126# CONFIG_ARCH_IXP23XX is not set
127# CONFIG_ARCH_IXP2000 is not set
128# CONFIG_ARCH_IXP4XX is not set
129# CONFIG_ARCH_L7200 is not set
130# CONFIG_ARCH_KS8695 is not set
131# CONFIG_ARCH_NS9XXX is not set
132# CONFIG_ARCH_MXC is not set
133# CONFIG_ARCH_PNX4008 is not set
134# CONFIG_ARCH_PXA is not set
135# CONFIG_ARCH_RPC is not set
136# CONFIG_ARCH_SA1100 is not set
137# CONFIG_ARCH_S3C2410 is not set
138# CONFIG_ARCH_SHARK is not set
139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
141# CONFIG_ARCH_OMAP is not set
142
143#
144# Boot options
145#
146
147#
148# Power management
149#
150
151#
152# Atmel AT91 System-on-Chip
153#
154# CONFIG_ARCH_AT91RM9200 is not set
155CONFIG_ARCH_AT91SAM9260=y
156# CONFIG_ARCH_AT91SAM9261 is not set
157# CONFIG_ARCH_AT91SAM9263 is not set
158# CONFIG_ARCH_AT91SAM9RL is not set
159# CONFIG_ARCH_AT91CAP9 is not set
160# CONFIG_ARCH_AT91X40 is not set
161CONFIG_AT91_PMC_UNIT=y
162
163#
164# AT91SAM9260 Variants
165#
166# CONFIG_ARCH_AT91SAM9260_SAM9XE is not set
167
168#
169# AT91SAM9260 / AT91SAM9XE Board Type
170#
171# CONFIG_MACH_AT91SAM9260EK is not set
172# CONFIG_MACH_CAM60 is not set
173# CONFIG_MACH_SAM9_L9260 is not set
174CONFIG_MACH_USB_A9260=y
175# CONFIG_MACH_QIL_A9260 is not set
176
177#
178# AT91 Board Options
179#
180
181#
182# AT91 Feature Selections
183#
184# CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set
185CONFIG_AT91_SLOW_CLOCK=y
186CONFIG_AT91_TIMER_HZ=100
187CONFIG_AT91_EARLY_DBGU=y
188# CONFIG_AT91_EARLY_USART0 is not set
189# CONFIG_AT91_EARLY_USART1 is not set
190# CONFIG_AT91_EARLY_USART2 is not set
191# CONFIG_AT91_EARLY_USART3 is not set
192# CONFIG_AT91_EARLY_USART4 is not set
193# CONFIG_AT91_EARLY_USART5 is not set
194
195#
196# Processor Type
197#
198CONFIG_CPU_32=y
199CONFIG_CPU_ARM926T=y
200CONFIG_CPU_32v5=y
201CONFIG_CPU_ABRT_EV5TJ=y
202CONFIG_CPU_CACHE_VIVT=y
203CONFIG_CPU_COPY_V4WB=y
204CONFIG_CPU_TLB_V4WBI=y
205CONFIG_CPU_CP15=y
206CONFIG_CPU_CP15_MMU=y
207
208#
209# Processor Features
210#
211# CONFIG_ARM_THUMB is not set
212# CONFIG_CPU_ICACHE_DISABLE is not set
213# CONFIG_CPU_DCACHE_DISABLE is not set
214# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
215# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
216# CONFIG_OUTER_CACHE is not set
217
218#
219# Bus support
220#
221# CONFIG_PCI_SYSCALL is not set
222# CONFIG_ARCH_SUPPORTS_MSI is not set
223# CONFIG_PCCARD is not set
224
225#
226# Kernel Features
227#
228# CONFIG_TICK_ONESHOT is not set
229# CONFIG_NO_HZ is not set
230# CONFIG_HIGH_RES_TIMERS is not set
231CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
232# CONFIG_PREEMPT is not set
233CONFIG_HZ=100
234CONFIG_AEABI=y
235CONFIG_OABI_COMPAT=y
236# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
237CONFIG_SELECT_MEMORY_MODEL=y
238CONFIG_FLATMEM_MANUAL=y
239# CONFIG_DISCONTIGMEM_MANUAL is not set
240# CONFIG_SPARSEMEM_MANUAL is not set
241CONFIG_FLATMEM=y
242CONFIG_FLAT_NODE_MEM_MAP=y
243# CONFIG_SPARSEMEM_STATIC is not set
244# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
245CONFIG_SPLIT_PTLOCK_CPUS=4096
246# CONFIG_RESOURCES_64BIT is not set
247CONFIG_ZONE_DMA_FLAG=1
248CONFIG_BOUNCE=y
249CONFIG_VIRT_TO_BUS=y
250# CONFIG_LEDS is not set
251CONFIG_ALIGNMENT_TRAP=y
252
253#
254# Boot options
255#
256CONFIG_ZBOOT_ROM_TEXT=0x0
257CONFIG_ZBOOT_ROM_BSS=0x0
258CONFIG_CMDLINE="mem=64M console=ttyS0,115200"
259# CONFIG_XIP_KERNEL is not set
260# CONFIG_KEXEC is not set
261
262#
263# Floating point emulation
264#
265
266#
267# At least one emulation must be selected
268#
269CONFIG_FPE_NWFPE=y
270# CONFIG_FPE_NWFPE_XP is not set
271# CONFIG_FPE_FASTFPE is not set
272# CONFIG_VFP is not set
273
274#
275# Userspace binary formats
276#
277CONFIG_BINFMT_ELF=y
278# CONFIG_BINFMT_AOUT is not set
279# CONFIG_BINFMT_MISC is not set
280
281#
282# Power management options
283#
284CONFIG_PM=y
285# CONFIG_PM_LEGACY is not set
286# CONFIG_PM_DEBUG is not set
287CONFIG_PM_SLEEP=y
288CONFIG_SUSPEND_UP_POSSIBLE=y
289CONFIG_SUSPEND=y
290# CONFIG_APM_EMULATION is not set
291
292#
293# Networking
294#
295CONFIG_NET=y
296
297#
298# Networking options
299#
300CONFIG_PACKET=y
301# CONFIG_PACKET_MMAP is not set
302CONFIG_UNIX=y
303# CONFIG_NET_KEY is not set
304CONFIG_INET=y
305CONFIG_IP_MULTICAST=y
306CONFIG_IP_ADVANCED_ROUTER=y
307CONFIG_ASK_IP_FIB_HASH=y
308# CONFIG_IP_FIB_TRIE is not set
309CONFIG_IP_FIB_HASH=y
310# CONFIG_IP_MULTIPLE_TABLES is not set
311# CONFIG_IP_ROUTE_MULTIPATH is not set
312CONFIG_IP_ROUTE_VERBOSE=y
313CONFIG_IP_PNP=y
314# CONFIG_IP_PNP_DHCP is not set
315CONFIG_IP_PNP_BOOTP=y
316CONFIG_IP_PNP_RARP=y
317# CONFIG_NET_IPIP is not set
318# CONFIG_NET_IPGRE is not set
319CONFIG_IP_MROUTE=y
320CONFIG_IP_PIMSM_V1=y
321CONFIG_IP_PIMSM_V2=y
322# CONFIG_ARPD is not set
323# CONFIG_SYN_COOKIES is not set
324# CONFIG_INET_AH is not set
325# CONFIG_INET_ESP is not set
326# CONFIG_INET_IPCOMP is not set
327# CONFIG_INET_XFRM_TUNNEL is not set
328# CONFIG_INET_TUNNEL is not set
329# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
330# CONFIG_INET_XFRM_MODE_TUNNEL is not set
331# CONFIG_INET_XFRM_MODE_BEET is not set
332# CONFIG_INET_LRO is not set
333# CONFIG_INET_DIAG is not set
334# CONFIG_TCP_CONG_ADVANCED is not set
335CONFIG_TCP_CONG_CUBIC=y
336CONFIG_DEFAULT_TCP_CONG="cubic"
337# CONFIG_TCP_MD5SIG is not set
338# CONFIG_IPV6 is not set
339# CONFIG_INET6_XFRM_TUNNEL is not set
340# CONFIG_INET6_TUNNEL is not set
341# CONFIG_NETWORK_SECMARK is not set
342# CONFIG_NETFILTER is not set
343# CONFIG_IP_DCCP is not set
344# CONFIG_IP_SCTP is not set
345# CONFIG_TIPC is not set
346# CONFIG_ATM is not set
347# CONFIG_BRIDGE is not set
348# CONFIG_VLAN_8021Q is not set
349# CONFIG_DECNET is not set
350# CONFIG_LLC2 is not set
351# CONFIG_IPX is not set
352# CONFIG_ATALK is not set
353# CONFIG_X25 is not set
354# CONFIG_LAPB is not set
355# CONFIG_ECONET is not set
356# CONFIG_WAN_ROUTER is not set
357# CONFIG_NET_SCHED is not set
358
359#
360# Network testing
361#
362# CONFIG_NET_PKTGEN is not set
363# CONFIG_HAMRADIO is not set
364# CONFIG_IRDA is not set
365# CONFIG_BT is not set
366# CONFIG_AF_RXRPC is not set
367
368#
369# Wireless
370#
371# CONFIG_CFG80211 is not set
372# CONFIG_WIRELESS_EXT is not set
373# CONFIG_MAC80211 is not set
374# CONFIG_IEEE80211 is not set
375# CONFIG_RFKILL is not set
376# CONFIG_NET_9P is not set
377
378#
379# Device Drivers
380#
381
382#
383# Generic Driver Options
384#
385CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
386CONFIG_STANDALONE=y
387CONFIG_PREVENT_FIRMWARE_BUILD=y
388# CONFIG_FW_LOADER is not set
389# CONFIG_DEBUG_DRIVER is not set
390# CONFIG_DEBUG_DEVRES is not set
391# CONFIG_SYS_HYPERVISOR is not set
392# CONFIG_CONNECTOR is not set
393CONFIG_MTD=y
394# CONFIG_MTD_DEBUG is not set
395# CONFIG_MTD_CONCAT is not set
396CONFIG_MTD_PARTITIONS=y
397# CONFIG_MTD_REDBOOT_PARTS is not set
398CONFIG_MTD_CMDLINE_PARTS=y
399# CONFIG_MTD_AFS_PARTS is not set
400
401#
402# User Modules And Translation Layers
403#
404CONFIG_MTD_CHAR=y
405CONFIG_MTD_BLKDEVS=y
406CONFIG_MTD_BLOCK=y
407# CONFIG_FTL is not set
408# CONFIG_NFTL is not set
409# CONFIG_INFTL is not set
410# CONFIG_RFD_FTL is not set
411# CONFIG_SSFDC is not set
412# CONFIG_MTD_OOPS is not set
413
414#
415# RAM/ROM/Flash chip drivers
416#
417# CONFIG_MTD_CFI is not set
418# CONFIG_MTD_JEDECPROBE is not set
419CONFIG_MTD_MAP_BANK_WIDTH_1=y
420CONFIG_MTD_MAP_BANK_WIDTH_2=y
421CONFIG_MTD_MAP_BANK_WIDTH_4=y
422# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
423# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
424# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
425CONFIG_MTD_CFI_I1=y
426CONFIG_MTD_CFI_I2=y
427# CONFIG_MTD_CFI_I4 is not set
428# CONFIG_MTD_CFI_I8 is not set
429# CONFIG_MTD_RAM is not set
430# CONFIG_MTD_ROM is not set
431# CONFIG_MTD_ABSENT is not set
432
433#
434# Mapping drivers for chip access
435#
436# CONFIG_MTD_COMPLEX_MAPPINGS is not set
437# CONFIG_MTD_PLATRAM is not set
438
439#
440# Self-contained MTD device drivers
441#
442CONFIG_MTD_DATAFLASH=y
443# CONFIG_MTD_M25P80 is not set
444# CONFIG_MTD_SLRAM is not set
445# CONFIG_MTD_PHRAM is not set
446# CONFIG_MTD_MTDRAM is not set
447# CONFIG_MTD_BLOCK2MTD is not set
448
449#
450# Disk-On-Chip Device Drivers
451#
452# CONFIG_MTD_DOC2000 is not set
453# CONFIG_MTD_DOC2001 is not set
454# CONFIG_MTD_DOC2001PLUS is not set
455CONFIG_MTD_NAND=y
456# CONFIG_MTD_NAND_VERIFY_WRITE is not set
457# CONFIG_MTD_NAND_ECC_SMC is not set
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y
460# CONFIG_MTD_NAND_DISKONCHIP is not set
461CONFIG_MTD_NAND_AT91=y
462CONFIG_MTD_NAND_AT91_ECC_SOFT=y
463# CONFIG_MTD_NAND_AT91_ECC_HW is not set
464# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
465# CONFIG_MTD_NAND_NANDSIM is not set
466# CONFIG_MTD_NAND_PLATFORM is not set
467# CONFIG_MTD_ALAUDA is not set
468# CONFIG_MTD_ONENAND is not set
469
470#
471# UBI - Unsorted block images
472#
473# CONFIG_MTD_UBI is not set
474# CONFIG_PARPORT is not set
475CONFIG_BLK_DEV=y
476# CONFIG_BLK_DEV_COW_COMMON is not set
477CONFIG_BLK_DEV_LOOP=y
478# CONFIG_BLK_DEV_CRYPTOLOOP is not set
479# CONFIG_BLK_DEV_NBD is not set
480# CONFIG_BLK_DEV_UB is not set
481# CONFIG_BLK_DEV_RAM is not set
482# CONFIG_CDROM_PKTCDVD is not set
483# CONFIG_ATA_OVER_ETH is not set
484# CONFIG_MISC_DEVICES is not set
485
486#
487# SCSI device support
488#
489# CONFIG_RAID_ATTRS is not set
490CONFIG_SCSI=y
491CONFIG_SCSI_DMA=y
492# CONFIG_SCSI_TGT is not set
493# CONFIG_SCSI_NETLINK is not set
494CONFIG_SCSI_PROC_FS=y
495
496#
497# SCSI support type (disk, tape, CD-ROM)
498#
499CONFIG_BLK_DEV_SD=y
500# CONFIG_CHR_DEV_ST is not set
501# CONFIG_CHR_DEV_OSST is not set
502# CONFIG_BLK_DEV_SR is not set
503# CONFIG_CHR_DEV_SG is not set
504# CONFIG_CHR_DEV_SCH is not set
505
506#
507# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
508#
509CONFIG_SCSI_MULTI_LUN=y
510# CONFIG_SCSI_CONSTANTS is not set
511# CONFIG_SCSI_LOGGING is not set
512# CONFIG_SCSI_SCAN_ASYNC is not set
513CONFIG_SCSI_WAIT_SCAN=m
514
515#
516# SCSI Transports
517#
518# CONFIG_SCSI_SPI_ATTRS is not set
519# CONFIG_SCSI_FC_ATTRS is not set
520# CONFIG_SCSI_ISCSI_ATTRS is not set
521# CONFIG_SCSI_SAS_LIBSAS is not set
522# CONFIG_SCSI_SRP_ATTRS is not set
523CONFIG_SCSI_LOWLEVEL=y
524# CONFIG_ISCSI_TCP is not set
525# CONFIG_SCSI_DEBUG is not set
526# CONFIG_ATA is not set
527# CONFIG_MD is not set
528CONFIG_NETDEVICES=y
529# CONFIG_NETDEVICES_MULTIQUEUE is not set
530# CONFIG_DUMMY is not set
531# CONFIG_BONDING is not set
532# CONFIG_MACVLAN is not set
533# CONFIG_EQUALIZER is not set
534# CONFIG_TUN is not set
535# CONFIG_VETH is not set
536CONFIG_PHYLIB=y
537
538#
539# MII PHY device drivers
540#
541# CONFIG_MARVELL_PHY is not set
542# CONFIG_DAVICOM_PHY is not set
543# CONFIG_QSEMI_PHY is not set
544# CONFIG_LXT_PHY is not set
545# CONFIG_CICADA_PHY is not set
546# CONFIG_VITESSE_PHY is not set
547# CONFIG_SMSC_PHY is not set
548# CONFIG_BROADCOM_PHY is not set
549# CONFIG_ICPLUS_PHY is not set
550# CONFIG_FIXED_PHY is not set
551# CONFIG_MDIO_BITBANG is not set
552CONFIG_NET_ETHERNET=y
553CONFIG_MII=y
554CONFIG_MACB=y
555# CONFIG_AX88796 is not set
556# CONFIG_SMC91X is not set
557# CONFIG_DM9000 is not set
558# CONFIG_IBM_NEW_EMAC_ZMII is not set
559# CONFIG_IBM_NEW_EMAC_RGMII is not set
560# CONFIG_IBM_NEW_EMAC_TAH is not set
561# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
562# CONFIG_B44 is not set
563CONFIG_NETDEV_1000=y
564CONFIG_NETDEV_10000=y
565
566#
567# Wireless LAN
568#
569# CONFIG_WLAN_PRE80211 is not set
570# CONFIG_WLAN_80211 is not set
571
572#
573# USB Network Adapters
574#
575# CONFIG_USB_CATC is not set
576# CONFIG_USB_KAWETH is not set
577# CONFIG_USB_PEGASUS is not set
578# CONFIG_USB_RTL8150 is not set
579# CONFIG_USB_USBNET is not set
580# CONFIG_WAN is not set
581# CONFIG_PPP is not set
582# CONFIG_SLIP is not set
583# CONFIG_SHAPER is not set
584# CONFIG_NETCONSOLE is not set
585# CONFIG_NETPOLL is not set
586# CONFIG_NET_POLL_CONTROLLER is not set
587# CONFIG_ISDN is not set
588
589#
590# Input device support
591#
592CONFIG_INPUT=y
593# CONFIG_INPUT_FF_MEMLESS is not set
594# CONFIG_INPUT_POLLDEV is not set
595
596#
597# Userland interfaces
598#
599CONFIG_INPUT_MOUSEDEV=y
600# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
601CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
602CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
603# CONFIG_INPUT_JOYDEV is not set
604CONFIG_INPUT_EVDEV=y
605CONFIG_INPUT_EVBUG=y
606
607#
608# Input Device Drivers
609#
610CONFIG_INPUT_KEYBOARD=y
611# CONFIG_KEYBOARD_ATKBD is not set
612# CONFIG_KEYBOARD_SUNKBD is not set
613# CONFIG_KEYBOARD_LKKBD is not set
614# CONFIG_KEYBOARD_XTKBD is not set
615# CONFIG_KEYBOARD_NEWTON is not set
616# CONFIG_KEYBOARD_STOWAWAY is not set
617CONFIG_KEYBOARD_GPIO=y
618# CONFIG_INPUT_MOUSE is not set
619# CONFIG_INPUT_JOYSTICK is not set
620# CONFIG_INPUT_TABLET is not set
621# CONFIG_INPUT_TOUCHSCREEN is not set
622# CONFIG_INPUT_MISC is not set
623
624#
625# Hardware I/O ports
626#
627# CONFIG_SERIO is not set
628# CONFIG_GAMEPORT is not set
629
630#
631# Character devices
632#
633CONFIG_VT=y
634CONFIG_VT_CONSOLE=y
635CONFIG_HW_CONSOLE=y
636# CONFIG_VT_HW_CONSOLE_BINDING is not set
637# CONFIG_SERIAL_NONSTANDARD is not set
638
639#
640# Serial drivers
641#
642# CONFIG_SERIAL_8250 is not set
643
644#
645# Non-8250 serial port support
646#
647CONFIG_SERIAL_ATMEL=y
648CONFIG_SERIAL_ATMEL_CONSOLE=y
649# CONFIG_SERIAL_ATMEL_TTYAT is not set
650CONFIG_SERIAL_CORE=y
651CONFIG_SERIAL_CORE_CONSOLE=y
652CONFIG_UNIX98_PTYS=y
653CONFIG_LEGACY_PTYS=y
654CONFIG_LEGACY_PTY_COUNT=256
655# CONFIG_IPMI_HANDLER is not set
656CONFIG_HW_RANDOM=y
657# CONFIG_NVRAM is not set
658# CONFIG_R3964 is not set
659# CONFIG_RAW_DRIVER is not set
660# CONFIG_TCG_TPM is not set
661# CONFIG_I2C is not set
662
663#
664# SPI support
665#
666CONFIG_SPI=y
667# CONFIG_SPI_DEBUG is not set
668CONFIG_SPI_MASTER=y
669
670#
671# SPI Master Controller Drivers
672#
673CONFIG_SPI_ATMEL=y
674# CONFIG_SPI_BITBANG is not set
675
676#
677# SPI Protocol Masters
678#
679# CONFIG_SPI_AT25 is not set
680# CONFIG_SPI_SPIDEV is not set
681# CONFIG_SPI_TLE62X0 is not set
682# CONFIG_W1 is not set
683# CONFIG_POWER_SUPPLY is not set
684# CONFIG_HWMON is not set
685# CONFIG_WATCHDOG is not set
686
687#
688# Sonics Silicon Backplane
689#
690CONFIG_SSB_POSSIBLE=y
691# CONFIG_SSB is not set
692
693#
694# Multifunction device drivers
695#
696# CONFIG_MFD_SM501 is not set
697
698#
699# Multimedia devices
700#
701# CONFIG_VIDEO_DEV is not set
702# CONFIG_DVB_CORE is not set
703# CONFIG_DAB is not set
704
705#
706# Graphics support
707#
708# CONFIG_VGASTATE is not set
709# CONFIG_VIDEO_OUTPUT_CONTROL is not set
710# CONFIG_FB is not set
711# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
712
713#
714# Display device support
715#
716# CONFIG_DISPLAY_SUPPORT is not set
717
718#
719# Console display driver support
720#
721# CONFIG_VGA_CONSOLE is not set
722CONFIG_DUMMY_CONSOLE=y
723
724#
725# Sound
726#
727# CONFIG_SOUND is not set
728CONFIG_HID_SUPPORT=y
729CONFIG_HID=y
730# CONFIG_HID_DEBUG is not set
731# CONFIG_HIDRAW is not set
732
733#
734# USB Input Devices
735#
736# CONFIG_USB_HID is not set
737
738#
739# USB HID Boot Protocol drivers
740#
741# CONFIG_USB_KBD is not set
742# CONFIG_USB_MOUSE is not set
743CONFIG_USB_SUPPORT=y
744CONFIG_USB_ARCH_HAS_HCD=y
745CONFIG_USB_ARCH_HAS_OHCI=y
746# CONFIG_USB_ARCH_HAS_EHCI is not set
747CONFIG_USB=y
748# CONFIG_USB_DEBUG is not set
749
750#
751# Miscellaneous USB options
752#
753CONFIG_USB_DEVICEFS=y
754CONFIG_USB_DEVICE_CLASS=y
755# CONFIG_USB_DYNAMIC_MINORS is not set
756# CONFIG_USB_SUSPEND is not set
757# CONFIG_USB_PERSIST is not set
758# CONFIG_USB_OTG is not set
759
760#
761# USB Host Controller Drivers
762#
763# CONFIG_USB_ISP116X_HCD is not set
764CONFIG_USB_OHCI_HCD=y
765# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
766# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
767CONFIG_USB_OHCI_LITTLE_ENDIAN=y
768# CONFIG_USB_SL811_HCD is not set
769# CONFIG_USB_R8A66597_HCD is not set
770
771#
772# USB Device Class drivers
773#
774# CONFIG_USB_ACM is not set
775# CONFIG_USB_PRINTER is not set
776
777#
778# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
779#
780
781#
782# may also be needed; see USB_STORAGE Help for more information
783#
784CONFIG_USB_STORAGE=y
785# CONFIG_USB_STORAGE_DEBUG is not set
786# CONFIG_USB_STORAGE_DATAFAB is not set
787# CONFIG_USB_STORAGE_FREECOM is not set
788# CONFIG_USB_STORAGE_ISD200 is not set
789# CONFIG_USB_STORAGE_DPCM is not set
790# CONFIG_USB_STORAGE_USBAT is not set
791# CONFIG_USB_STORAGE_SDDR09 is not set
792# CONFIG_USB_STORAGE_SDDR55 is not set
793# CONFIG_USB_STORAGE_JUMPSHOT is not set
794# CONFIG_USB_STORAGE_ALAUDA is not set
795# CONFIG_USB_STORAGE_KARMA is not set
796# CONFIG_USB_LIBUSUAL is not set
797
798#
799# USB Imaging devices
800#
801# CONFIG_USB_MDC800 is not set
802# CONFIG_USB_MICROTEK is not set
803CONFIG_USB_MON=y
804
805#
806# USB port drivers
807#
808
809#
810# USB Serial Converter support
811#
812# CONFIG_USB_SERIAL is not set
813
814#
815# USB Miscellaneous drivers
816#
817# CONFIG_USB_EMI62 is not set
818# CONFIG_USB_EMI26 is not set
819# CONFIG_USB_ADUTUX is not set
820# CONFIG_USB_AUERSWALD is not set
821# CONFIG_USB_RIO500 is not set
822# CONFIG_USB_LEGOTOWER is not set
823# CONFIG_USB_LCD is not set
824# CONFIG_USB_BERRY_CHARGE is not set
825# CONFIG_USB_LED is not set
826# CONFIG_USB_CYPRESS_CY7C63 is not set
827# CONFIG_USB_CYTHERM is not set
828# CONFIG_USB_PHIDGET is not set
829# CONFIG_USB_IDMOUSE is not set
830# CONFIG_USB_FTDI_ELAN is not set
831# CONFIG_USB_APPLEDISPLAY is not set
832# CONFIG_USB_LD is not set
833# CONFIG_USB_TRANCEVIBRATOR is not set
834# CONFIG_USB_IOWARRIOR is not set
835# CONFIG_USB_TEST is not set
836
837#
838# USB DSL modem support
839#
840
841#
842# USB Gadget Support
843#
844CONFIG_USB_GADGET=y
845# CONFIG_USB_GADGET_DEBUG is not set
846# CONFIG_USB_GADGET_DEBUG_FILES is not set
847CONFIG_USB_GADGET_SELECTED=y
848# CONFIG_USB_GADGET_AMD5536UDC is not set
849# CONFIG_USB_GADGET_ATMEL_USBA is not set
850# CONFIG_USB_GADGET_FSL_USB2 is not set
851# CONFIG_USB_GADGET_NET2280 is not set
852# CONFIG_USB_GADGET_PXA2XX is not set
853# CONFIG_USB_GADGET_M66592 is not set
854# CONFIG_USB_GADGET_GOKU is not set
855# CONFIG_USB_GADGET_LH7A40X is not set
856# CONFIG_USB_GADGET_OMAP is not set
857# CONFIG_USB_GADGET_S3C2410 is not set
858CONFIG_USB_GADGET_AT91=y
859CONFIG_USB_AT91=y
860# CONFIG_USB_GADGET_DUMMY_HCD is not set
861# CONFIG_USB_GADGET_DUALSPEED is not set
862# CONFIG_USB_ZERO is not set
863CONFIG_USB_ETH=y
864CONFIG_USB_ETH_RNDIS=y
865# CONFIG_USB_GADGETFS is not set
866# CONFIG_USB_FILE_STORAGE is not set
867# CONFIG_USB_G_SERIAL is not set
868# CONFIG_USB_MIDI_GADGET is not set
869# CONFIG_MMC is not set
870CONFIG_NEW_LEDS=y
871CONFIG_LEDS_CLASS=y
872
873#
874# LED drivers
875#
876CONFIG_LEDS_GPIO=y
877
878#
879# LED Triggers
880#
881CONFIG_LEDS_TRIGGERS=y
882# CONFIG_LEDS_TRIGGER_TIMER is not set
883CONFIG_LEDS_TRIGGER_HEARTBEAT=y
884CONFIG_RTC_LIB=y
885# CONFIG_RTC_CLASS is not set
886
887#
888# File systems
889#
890CONFIG_EXT2_FS=y
891# CONFIG_EXT2_FS_XATTR is not set
892# CONFIG_EXT2_FS_XIP is not set
893# CONFIG_EXT3_FS is not set
894# CONFIG_EXT4DEV_FS is not set
895# CONFIG_REISERFS_FS is not set
896# CONFIG_JFS_FS is not set
897CONFIG_FS_POSIX_ACL=y
898# CONFIG_XFS_FS is not set
899# CONFIG_GFS2_FS is not set
900# CONFIG_OCFS2_FS is not set
901# CONFIG_MINIX_FS is not set
902# CONFIG_ROMFS_FS is not set
903CONFIG_INOTIFY=y
904CONFIG_INOTIFY_USER=y
905# CONFIG_QUOTA is not set
906CONFIG_DNOTIFY=y
907# CONFIG_AUTOFS_FS is not set
908# CONFIG_AUTOFS4_FS is not set
909CONFIG_FUSE_FS=m
910
911#
912# CD-ROM/DVD Filesystems
913#
914# CONFIG_ISO9660_FS is not set
915# CONFIG_UDF_FS is not set
916
917#
918# DOS/FAT/NT Filesystems
919#
920CONFIG_FAT_FS=y
921# CONFIG_MSDOS_FS is not set
922CONFIG_VFAT_FS=y
923CONFIG_FAT_DEFAULT_CODEPAGE=437
924CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
925# CONFIG_NTFS_FS is not set
926
927#
928# Pseudo filesystems
929#
930CONFIG_PROC_FS=y
931CONFIG_PROC_SYSCTL=y
932CONFIG_SYSFS=y
933CONFIG_TMPFS=y
934# CONFIG_TMPFS_POSIX_ACL is not set
935# CONFIG_HUGETLB_PAGE is not set
936# CONFIG_CONFIGFS_FS is not set
937
938#
939# Miscellaneous filesystems
940#
941# CONFIG_ADFS_FS is not set
942# CONFIG_AFFS_FS is not set
943# CONFIG_HFS_FS is not set
944# CONFIG_HFSPLUS_FS is not set
945# CONFIG_BEFS_FS is not set
946# CONFIG_BFS_FS is not set
947# CONFIG_EFS_FS is not set
948CONFIG_JFFS2_FS=y
949CONFIG_JFFS2_FS_DEBUG=0
950CONFIG_JFFS2_FS_WRITEBUFFER=y
951# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
952# CONFIG_JFFS2_SUMMARY is not set
953# CONFIG_JFFS2_FS_XATTR is not set
954# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
955CONFIG_JFFS2_ZLIB=y
956# CONFIG_JFFS2_LZO is not set
957CONFIG_JFFS2_RTIME=y
958# CONFIG_JFFS2_RUBIN is not set
959# CONFIG_CRAMFS is not set
960# CONFIG_VXFS_FS is not set
961# CONFIG_HPFS_FS is not set
962# CONFIG_QNX4FS_FS is not set
963# CONFIG_SYSV_FS is not set
964# CONFIG_UFS_FS is not set
965CONFIG_NETWORK_FILESYSTEMS=y
966CONFIG_NFS_FS=y
967CONFIG_NFS_V3=y
968CONFIG_NFS_V3_ACL=y
969CONFIG_NFS_V4=y
970# CONFIG_NFS_DIRECTIO is not set
971# CONFIG_NFSD is not set
972CONFIG_ROOT_NFS=y
973CONFIG_LOCKD=y
974CONFIG_LOCKD_V4=y
975CONFIG_NFS_ACL_SUPPORT=y
976CONFIG_NFS_COMMON=y
977CONFIG_SUNRPC=y
978CONFIG_SUNRPC_GSS=y
979# CONFIG_SUNRPC_BIND34 is not set
980CONFIG_RPCSEC_GSS_KRB5=y
981# CONFIG_RPCSEC_GSS_SPKM3 is not set
982# CONFIG_SMB_FS is not set
983# CONFIG_CIFS is not set
984# CONFIG_NCP_FS is not set
985# CONFIG_CODA_FS is not set
986# CONFIG_AFS_FS is not set
987
988#
989# Partition Types
990#
991# CONFIG_PARTITION_ADVANCED is not set
992CONFIG_MSDOS_PARTITION=y
993CONFIG_NLS=y
994CONFIG_NLS_DEFAULT="iso8859-1"
995CONFIG_NLS_CODEPAGE_437=y
996# CONFIG_NLS_CODEPAGE_737 is not set
997# CONFIG_NLS_CODEPAGE_775 is not set
998CONFIG_NLS_CODEPAGE_850=y
999# CONFIG_NLS_CODEPAGE_852 is not set
1000# CONFIG_NLS_CODEPAGE_855 is not set
1001# CONFIG_NLS_CODEPAGE_857 is not set
1002# CONFIG_NLS_CODEPAGE_860 is not set
1003# CONFIG_NLS_CODEPAGE_861 is not set
1004# CONFIG_NLS_CODEPAGE_862 is not set
1005# CONFIG_NLS_CODEPAGE_863 is not set
1006# CONFIG_NLS_CODEPAGE_864 is not set
1007# CONFIG_NLS_CODEPAGE_865 is not set
1008# CONFIG_NLS_CODEPAGE_866 is not set
1009# CONFIG_NLS_CODEPAGE_869 is not set
1010# CONFIG_NLS_CODEPAGE_936 is not set
1011# CONFIG_NLS_CODEPAGE_950 is not set
1012# CONFIG_NLS_CODEPAGE_932 is not set
1013# CONFIG_NLS_CODEPAGE_949 is not set
1014# CONFIG_NLS_CODEPAGE_874 is not set
1015# CONFIG_NLS_ISO8859_8 is not set
1016# CONFIG_NLS_CODEPAGE_1250 is not set
1017# CONFIG_NLS_CODEPAGE_1251 is not set
1018# CONFIG_NLS_ASCII is not set
1019CONFIG_NLS_ISO8859_1=y
1020# CONFIG_NLS_ISO8859_2 is not set
1021# CONFIG_NLS_ISO8859_3 is not set
1022# CONFIG_NLS_ISO8859_4 is not set
1023# CONFIG_NLS_ISO8859_5 is not set
1024# CONFIG_NLS_ISO8859_6 is not set
1025# CONFIG_NLS_ISO8859_7 is not set
1026# CONFIG_NLS_ISO8859_9 is not set
1027# CONFIG_NLS_ISO8859_13 is not set
1028# CONFIG_NLS_ISO8859_14 is not set
1029# CONFIG_NLS_ISO8859_15 is not set
1030# CONFIG_NLS_KOI8_R is not set
1031# CONFIG_NLS_KOI8_U is not set
1032# CONFIG_NLS_UTF8 is not set
1033# CONFIG_DLM is not set
1034# CONFIG_INSTRUMENTATION is not set
1035
1036#
1037# Kernel hacking
1038#
1039# CONFIG_PRINTK_TIME is not set
1040CONFIG_ENABLE_WARN_DEPRECATED=y
1041CONFIG_ENABLE_MUST_CHECK=y
1042# CONFIG_MAGIC_SYSRQ is not set
1043# CONFIG_UNUSED_SYMBOLS is not set
1044# CONFIG_DEBUG_FS is not set
1045# CONFIG_HEADERS_CHECK is not set
1046CONFIG_DEBUG_KERNEL=y
1047# CONFIG_DEBUG_SHIRQ is not set
1048CONFIG_DETECT_SOFTLOCKUP=y
1049CONFIG_SCHED_DEBUG=y
1050# CONFIG_SCHEDSTATS is not set
1051# CONFIG_TIMER_STATS is not set
1052# CONFIG_DEBUG_SLAB is not set
1053# CONFIG_DEBUG_RT_MUTEXES is not set
1054# CONFIG_RT_MUTEX_TESTER is not set
1055# CONFIG_DEBUG_SPINLOCK is not set
1056# CONFIG_DEBUG_MUTEXES is not set
1057# CONFIG_DEBUG_LOCK_ALLOC is not set
1058# CONFIG_PROVE_LOCKING is not set
1059# CONFIG_LOCK_STAT is not set
1060# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1061# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1062# CONFIG_DEBUG_KOBJECT is not set
1063CONFIG_DEBUG_BUGVERBOSE=y
1064# CONFIG_DEBUG_INFO is not set
1065# CONFIG_DEBUG_VM is not set
1066# CONFIG_DEBUG_LIST is not set
1067# CONFIG_DEBUG_SG is not set
1068CONFIG_FRAME_POINTER=y
1069CONFIG_FORCED_INLINING=y
1070# CONFIG_BOOT_PRINTK_DELAY is not set
1071# CONFIG_RCU_TORTURE_TEST is not set
1072# CONFIG_FAULT_INJECTION is not set
1073# CONFIG_SAMPLES is not set
1074CONFIG_DEBUG_USER=y
1075# CONFIG_DEBUG_ERRORS is not set
1076CONFIG_DEBUG_LL=y
1077# CONFIG_DEBUG_ICEDCC is not set
1078
1079#
1080# Security options
1081#
1082# CONFIG_KEYS is not set
1083# CONFIG_SECURITY is not set
1084# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1085CONFIG_CRYPTO=y
1086CONFIG_CRYPTO_ALGAPI=y
1087CONFIG_CRYPTO_BLKCIPHER=y
1088CONFIG_CRYPTO_MANAGER=y
1089# CONFIG_CRYPTO_HMAC is not set
1090# CONFIG_CRYPTO_XCBC is not set
1091# CONFIG_CRYPTO_NULL is not set
1092# CONFIG_CRYPTO_MD4 is not set
1093CONFIG_CRYPTO_MD5=y
1094# CONFIG_CRYPTO_SHA1 is not set
1095# CONFIG_CRYPTO_SHA256 is not set
1096# CONFIG_CRYPTO_SHA512 is not set
1097# CONFIG_CRYPTO_WP512 is not set
1098# CONFIG_CRYPTO_TGR192 is not set
1099# CONFIG_CRYPTO_GF128MUL is not set
1100# CONFIG_CRYPTO_ECB is not set
1101CONFIG_CRYPTO_CBC=y
1102# CONFIG_CRYPTO_PCBC is not set
1103# CONFIG_CRYPTO_LRW is not set
1104# CONFIG_CRYPTO_XTS is not set
1105# CONFIG_CRYPTO_CRYPTD is not set
1106CONFIG_CRYPTO_DES=y
1107# CONFIG_CRYPTO_FCRYPT is not set
1108# CONFIG_CRYPTO_BLOWFISH is not set
1109# CONFIG_CRYPTO_TWOFISH is not set
1110# CONFIG_CRYPTO_SERPENT is not set
1111# CONFIG_CRYPTO_AES is not set
1112# CONFIG_CRYPTO_CAST5 is not set
1113# CONFIG_CRYPTO_CAST6 is not set
1114# CONFIG_CRYPTO_TEA is not set
1115# CONFIG_CRYPTO_ARC4 is not set
1116# CONFIG_CRYPTO_KHAZAD is not set
1117# CONFIG_CRYPTO_ANUBIS is not set
1118# CONFIG_CRYPTO_SEED is not set
1119# CONFIG_CRYPTO_DEFLATE is not set
1120# CONFIG_CRYPTO_MICHAEL_MIC is not set
1121# CONFIG_CRYPTO_CRC32C is not set
1122# CONFIG_CRYPTO_CAMELLIA is not set
1123# CONFIG_CRYPTO_TEST is not set
1124# CONFIG_CRYPTO_AUTHENC is not set
1125# CONFIG_CRYPTO_HW is not set
1126
1127#
1128# Library routines
1129#
1130CONFIG_BITREVERSE=y
1131# CONFIG_CRC_CCITT is not set
1132# CONFIG_CRC16 is not set
1133# CONFIG_CRC_ITU_T is not set
1134CONFIG_CRC32=y
1135# CONFIG_CRC7 is not set
1136# CONFIG_LIBCRC32C is not set
1137CONFIG_ZLIB_INFLATE=y
1138CONFIG_ZLIB_DEFLATE=y
1139CONFIG_PLIST=y
1140CONFIG_HAS_IOMEM=y
1141CONFIG_HAS_IOPORT=y
1142CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/usb-a9263_defconfig b/arch/arm/configs/usb-a9263_defconfig
new file mode 100644
index 000000000000..48d455bc7363
--- /dev/null
+++ b/arch/arm/configs/usb-a9263_defconfig
@@ -0,0 +1,1134 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24
4# Tue Apr 15 11:15:19 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51# CONFIG_SYSFS_DEPRECATED is not set
52# CONFIG_RELAY is not set
53# CONFIG_BLK_DEV_INITRD is not set
54# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
55CONFIG_SYSCTL=y
56# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_KALLSYMS=y
60# CONFIG_KALLSYMS_ALL is not set
61# CONFIG_KALLSYMS_EXTRA_PASS is not set
62CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y
64CONFIG_BUG=y
65CONFIG_ELF_CORE=y
66CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y
71CONFIG_EVENTFD=y
72CONFIG_SHMEM=y
73CONFIG_VM_EVENT_COUNTERS=y
74CONFIG_SLAB=y
75# CONFIG_SLUB is not set
76# CONFIG_SLOB is not set
77CONFIG_SLABINFO=y
78CONFIG_RT_MUTEXES=y
79# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0
81CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y
87CONFIG_BLOCK=y
88# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set
91# CONFIG_BLK_DEV_BSG is not set
92
93#
94# IO Schedulers
95#
96CONFIG_IOSCHED_NOOP=y
97CONFIG_IOSCHED_AS=y
98# CONFIG_IOSCHED_DEADLINE is not set
99# CONFIG_IOSCHED_CFQ is not set
100CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_DEADLINE is not set
102# CONFIG_DEFAULT_CFQ is not set
103# CONFIG_DEFAULT_NOOP is not set
104CONFIG_DEFAULT_IOSCHED="anticipatory"
105
106#
107# System Type
108#
109# CONFIG_ARCH_AAEC2000 is not set
110# CONFIG_ARCH_INTEGRATOR is not set
111# CONFIG_ARCH_REALVIEW is not set
112# CONFIG_ARCH_VERSATILE is not set
113CONFIG_ARCH_AT91=y
114# CONFIG_ARCH_CLPS7500 is not set
115# CONFIG_ARCH_CLPS711X is not set
116# CONFIG_ARCH_CO285 is not set
117# CONFIG_ARCH_EBSA110 is not set
118# CONFIG_ARCH_EP93XX is not set
119# CONFIG_ARCH_FOOTBRIDGE is not set
120# CONFIG_ARCH_NETX is not set
121# CONFIG_ARCH_H720X is not set
122# CONFIG_ARCH_IMX is not set
123# CONFIG_ARCH_IOP13XX is not set
124# CONFIG_ARCH_IOP32X is not set
125# CONFIG_ARCH_IOP33X is not set
126# CONFIG_ARCH_IXP23XX is not set
127# CONFIG_ARCH_IXP2000 is not set
128# CONFIG_ARCH_IXP4XX is not set
129# CONFIG_ARCH_L7200 is not set
130# CONFIG_ARCH_KS8695 is not set
131# CONFIG_ARCH_NS9XXX is not set
132# CONFIG_ARCH_MXC is not set
133# CONFIG_ARCH_PNX4008 is not set
134# CONFIG_ARCH_PXA is not set
135# CONFIG_ARCH_RPC is not set
136# CONFIG_ARCH_SA1100 is not set
137# CONFIG_ARCH_S3C2410 is not set
138# CONFIG_ARCH_SHARK is not set
139# CONFIG_ARCH_LH7A40X is not set
140# CONFIG_ARCH_DAVINCI is not set
141# CONFIG_ARCH_OMAP is not set
142
143#
144# Boot options
145#
146
147#
148# Power management
149#
150
151#
152# Atmel AT91 System-on-Chip
153#
154# CONFIG_ARCH_AT91RM9200 is not set
155# CONFIG_ARCH_AT91SAM9260 is not set
156# CONFIG_ARCH_AT91SAM9261 is not set
157CONFIG_ARCH_AT91SAM9263=y
158# CONFIG_ARCH_AT91SAM9RL is not set
159# CONFIG_ARCH_AT91CAP9 is not set
160# CONFIG_ARCH_AT91X40 is not set
161CONFIG_AT91_PMC_UNIT=y
162
163#
164# AT91SAM9263 Board Type
165#
166# CONFIG_MACH_AT91SAM9263EK is not set
167CONFIG_MACH_USB_A9263=y
168
169#
170# AT91 Board Options
171#
172
173#
174# AT91 Feature Selections
175#
176# CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set
177CONFIG_AT91_SLOW_CLOCK=y
178CONFIG_AT91_TIMER_HZ=100
179CONFIG_AT91_EARLY_DBGU=y
180# CONFIG_AT91_EARLY_USART0 is not set
181# CONFIG_AT91_EARLY_USART1 is not set
182# CONFIG_AT91_EARLY_USART2 is not set
183# CONFIG_AT91_EARLY_USART3 is not set
184# CONFIG_AT91_EARLY_USART4 is not set
185# CONFIG_AT91_EARLY_USART5 is not set
186
187#
188# Processor Type
189#
190CONFIG_CPU_32=y
191CONFIG_CPU_ARM926T=y
192CONFIG_CPU_32v5=y
193CONFIG_CPU_ABRT_EV5TJ=y
194CONFIG_CPU_CACHE_VIVT=y
195CONFIG_CPU_COPY_V4WB=y
196CONFIG_CPU_TLB_V4WBI=y
197CONFIG_CPU_CP15=y
198CONFIG_CPU_CP15_MMU=y
199
200#
201# Processor Features
202#
203# CONFIG_ARM_THUMB is not set
204# CONFIG_CPU_ICACHE_DISABLE is not set
205# CONFIG_CPU_DCACHE_DISABLE is not set
206# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
207# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
208# CONFIG_OUTER_CACHE is not set
209
210#
211# Bus support
212#
213# CONFIG_PCI_SYSCALL is not set
214# CONFIG_ARCH_SUPPORTS_MSI is not set
215# CONFIG_PCCARD is not set
216
217#
218# Kernel Features
219#
220# CONFIG_TICK_ONESHOT is not set
221# CONFIG_NO_HZ is not set
222# CONFIG_HIGH_RES_TIMERS is not set
223CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
224# CONFIG_PREEMPT is not set
225CONFIG_HZ=100
226CONFIG_AEABI=y
227CONFIG_OABI_COMPAT=y
228# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
229CONFIG_SELECT_MEMORY_MODEL=y
230CONFIG_FLATMEM_MANUAL=y
231# CONFIG_DISCONTIGMEM_MANUAL is not set
232# CONFIG_SPARSEMEM_MANUAL is not set
233CONFIG_FLATMEM=y
234CONFIG_FLAT_NODE_MEM_MAP=y
235# CONFIG_SPARSEMEM_STATIC is not set
236# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
237CONFIG_SPLIT_PTLOCK_CPUS=4096
238# CONFIG_RESOURCES_64BIT is not set
239CONFIG_ZONE_DMA_FLAG=1
240CONFIG_BOUNCE=y
241CONFIG_VIRT_TO_BUS=y
242# CONFIG_LEDS is not set
243CONFIG_ALIGNMENT_TRAP=y
244
245#
246# Boot options
247#
248CONFIG_ZBOOT_ROM_TEXT=0x0
249CONFIG_ZBOOT_ROM_BSS=0x0
250CONFIG_CMDLINE="mem=64M console=ttyS0,115200"
251# CONFIG_XIP_KERNEL is not set
252# CONFIG_KEXEC is not set
253
254#
255# Floating point emulation
256#
257
258#
259# At least one emulation must be selected
260#
261CONFIG_FPE_NWFPE=y
262# CONFIG_FPE_NWFPE_XP is not set
263# CONFIG_FPE_FASTFPE is not set
264# CONFIG_VFP is not set
265
266#
267# Userspace binary formats
268#
269CONFIG_BINFMT_ELF=y
270# CONFIG_BINFMT_AOUT is not set
271# CONFIG_BINFMT_MISC is not set
272
273#
274# Power management options
275#
276CONFIG_PM=y
277# CONFIG_PM_LEGACY is not set
278# CONFIG_PM_DEBUG is not set
279CONFIG_PM_SLEEP=y
280CONFIG_SUSPEND_UP_POSSIBLE=y
281CONFIG_SUSPEND=y
282# CONFIG_APM_EMULATION is not set
283
284#
285# Networking
286#
287CONFIG_NET=y
288
289#
290# Networking options
291#
292CONFIG_PACKET=y
293# CONFIG_PACKET_MMAP is not set
294CONFIG_UNIX=y
295# CONFIG_NET_KEY is not set
296CONFIG_INET=y
297CONFIG_IP_MULTICAST=y
298CONFIG_IP_ADVANCED_ROUTER=y
299CONFIG_ASK_IP_FIB_HASH=y
300# CONFIG_IP_FIB_TRIE is not set
301CONFIG_IP_FIB_HASH=y
302# CONFIG_IP_MULTIPLE_TABLES is not set
303# CONFIG_IP_ROUTE_MULTIPATH is not set
304CONFIG_IP_ROUTE_VERBOSE=y
305CONFIG_IP_PNP=y
306# CONFIG_IP_PNP_DHCP is not set
307CONFIG_IP_PNP_BOOTP=y
308CONFIG_IP_PNP_RARP=y
309# CONFIG_NET_IPIP is not set
310# CONFIG_NET_IPGRE is not set
311CONFIG_IP_MROUTE=y
312CONFIG_IP_PIMSM_V1=y
313CONFIG_IP_PIMSM_V2=y
314# CONFIG_ARPD is not set
315# CONFIG_SYN_COOKIES is not set
316# CONFIG_INET_AH is not set
317# CONFIG_INET_ESP is not set
318# CONFIG_INET_IPCOMP is not set
319# CONFIG_INET_XFRM_TUNNEL is not set
320# CONFIG_INET_TUNNEL is not set
321# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
322# CONFIG_INET_XFRM_MODE_TUNNEL is not set
323# CONFIG_INET_XFRM_MODE_BEET is not set
324# CONFIG_INET_LRO is not set
325# CONFIG_INET_DIAG is not set
326# CONFIG_TCP_CONG_ADVANCED is not set
327CONFIG_TCP_CONG_CUBIC=y
328CONFIG_DEFAULT_TCP_CONG="cubic"
329# CONFIG_TCP_MD5SIG is not set
330# CONFIG_IPV6 is not set
331# CONFIG_INET6_XFRM_TUNNEL is not set
332# CONFIG_INET6_TUNNEL is not set
333# CONFIG_NETWORK_SECMARK is not set
334# CONFIG_NETFILTER is not set
335# CONFIG_IP_DCCP is not set
336# CONFIG_IP_SCTP is not set
337# CONFIG_TIPC is not set
338# CONFIG_ATM is not set
339# CONFIG_BRIDGE is not set
340# CONFIG_VLAN_8021Q is not set
341# CONFIG_DECNET is not set
342# CONFIG_LLC2 is not set
343# CONFIG_IPX is not set
344# CONFIG_ATALK is not set
345# CONFIG_X25 is not set
346# CONFIG_LAPB is not set
347# CONFIG_ECONET is not set
348# CONFIG_WAN_ROUTER is not set
349# CONFIG_NET_SCHED is not set
350
351#
352# Network testing
353#
354# CONFIG_NET_PKTGEN is not set
355# CONFIG_HAMRADIO is not set
356# CONFIG_IRDA is not set
357# CONFIG_BT is not set
358# CONFIG_AF_RXRPC is not set
359
360#
361# Wireless
362#
363# CONFIG_CFG80211 is not set
364# CONFIG_WIRELESS_EXT is not set
365# CONFIG_MAC80211 is not set
366# CONFIG_IEEE80211 is not set
367# CONFIG_RFKILL is not set
368# CONFIG_NET_9P is not set
369
370#
371# Device Drivers
372#
373
374#
375# Generic Driver Options
376#
377CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
378CONFIG_STANDALONE=y
379CONFIG_PREVENT_FIRMWARE_BUILD=y
380# CONFIG_FW_LOADER is not set
381# CONFIG_DEBUG_DRIVER is not set
382# CONFIG_DEBUG_DEVRES is not set
383# CONFIG_SYS_HYPERVISOR is not set
384# CONFIG_CONNECTOR is not set
385CONFIG_MTD=y
386# CONFIG_MTD_DEBUG is not set
387# CONFIG_MTD_CONCAT is not set
388CONFIG_MTD_PARTITIONS=y
389# CONFIG_MTD_REDBOOT_PARTS is not set
390CONFIG_MTD_CMDLINE_PARTS=y
391# CONFIG_MTD_AFS_PARTS is not set
392
393#
394# User Modules And Translation Layers
395#
396CONFIG_MTD_CHAR=y
397CONFIG_MTD_BLKDEVS=y
398CONFIG_MTD_BLOCK=y
399# CONFIG_FTL is not set
400# CONFIG_NFTL is not set
401# CONFIG_INFTL is not set
402# CONFIG_RFD_FTL is not set
403# CONFIG_SSFDC is not set
404# CONFIG_MTD_OOPS is not set
405
406#
407# RAM/ROM/Flash chip drivers
408#
409# CONFIG_MTD_CFI is not set
410# CONFIG_MTD_JEDECPROBE is not set
411CONFIG_MTD_MAP_BANK_WIDTH_1=y
412CONFIG_MTD_MAP_BANK_WIDTH_2=y
413CONFIG_MTD_MAP_BANK_WIDTH_4=y
414# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
415# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
416# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
417CONFIG_MTD_CFI_I1=y
418CONFIG_MTD_CFI_I2=y
419# CONFIG_MTD_CFI_I4 is not set
420# CONFIG_MTD_CFI_I8 is not set
421# CONFIG_MTD_RAM is not set
422# CONFIG_MTD_ROM is not set
423# CONFIG_MTD_ABSENT is not set
424
425#
426# Mapping drivers for chip access
427#
428# CONFIG_MTD_COMPLEX_MAPPINGS is not set
429# CONFIG_MTD_PLATRAM is not set
430
431#
432# Self-contained MTD device drivers
433#
434CONFIG_MTD_DATAFLASH=y
435# CONFIG_MTD_M25P80 is not set
436# CONFIG_MTD_SLRAM is not set
437# CONFIG_MTD_PHRAM is not set
438# CONFIG_MTD_MTDRAM is not set
439# CONFIG_MTD_BLOCK2MTD is not set
440
441#
442# Disk-On-Chip Device Drivers
443#
444# CONFIG_MTD_DOC2000 is not set
445# CONFIG_MTD_DOC2001 is not set
446# CONFIG_MTD_DOC2001PLUS is not set
447CONFIG_MTD_NAND=y
448# CONFIG_MTD_NAND_VERIFY_WRITE is not set
449# CONFIG_MTD_NAND_ECC_SMC is not set
450# CONFIG_MTD_NAND_MUSEUM_IDS is not set
451CONFIG_MTD_NAND_IDS=y
452# CONFIG_MTD_NAND_DISKONCHIP is not set
453CONFIG_MTD_NAND_AT91=y
454CONFIG_MTD_NAND_AT91_ECC_SOFT=y
455# CONFIG_MTD_NAND_AT91_ECC_HW is not set
456# CONFIG_MTD_NAND_AT91_ECC_NONE is not set
457# CONFIG_MTD_NAND_NANDSIM is not set
458# CONFIG_MTD_NAND_PLATFORM is not set
459# CONFIG_MTD_ALAUDA is not set
460# CONFIG_MTD_ONENAND is not set
461
462#
463# UBI - Unsorted block images
464#
465# CONFIG_MTD_UBI is not set
466# CONFIG_PARPORT is not set
467CONFIG_BLK_DEV=y
468# CONFIG_BLK_DEV_COW_COMMON is not set
469CONFIG_BLK_DEV_LOOP=y
470# CONFIG_BLK_DEV_CRYPTOLOOP is not set
471# CONFIG_BLK_DEV_NBD is not set
472# CONFIG_BLK_DEV_UB is not set
473# CONFIG_BLK_DEV_RAM is not set
474# CONFIG_CDROM_PKTCDVD is not set
475# CONFIG_ATA_OVER_ETH is not set
476# CONFIG_MISC_DEVICES is not set
477
478#
479# SCSI device support
480#
481# CONFIG_RAID_ATTRS is not set
482CONFIG_SCSI=y
483CONFIG_SCSI_DMA=y
484# CONFIG_SCSI_TGT is not set
485# CONFIG_SCSI_NETLINK is not set
486CONFIG_SCSI_PROC_FS=y
487
488#
489# SCSI support type (disk, tape, CD-ROM)
490#
491CONFIG_BLK_DEV_SD=y
492# CONFIG_CHR_DEV_ST is not set
493# CONFIG_CHR_DEV_OSST is not set
494# CONFIG_BLK_DEV_SR is not set
495# CONFIG_CHR_DEV_SG is not set
496# CONFIG_CHR_DEV_SCH is not set
497
498#
499# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
500#
501CONFIG_SCSI_MULTI_LUN=y
502# CONFIG_SCSI_CONSTANTS is not set
503# CONFIG_SCSI_LOGGING is not set
504# CONFIG_SCSI_SCAN_ASYNC is not set
505CONFIG_SCSI_WAIT_SCAN=m
506
507#
508# SCSI Transports
509#
510# CONFIG_SCSI_SPI_ATTRS is not set
511# CONFIG_SCSI_FC_ATTRS is not set
512# CONFIG_SCSI_ISCSI_ATTRS is not set
513# CONFIG_SCSI_SAS_LIBSAS is not set
514# CONFIG_SCSI_SRP_ATTRS is not set
515CONFIG_SCSI_LOWLEVEL=y
516# CONFIG_ISCSI_TCP is not set
517# CONFIG_SCSI_DEBUG is not set
518# CONFIG_ATA is not set
519# CONFIG_MD is not set
520CONFIG_NETDEVICES=y
521# CONFIG_NETDEVICES_MULTIQUEUE is not set
522# CONFIG_DUMMY is not set
523# CONFIG_BONDING is not set
524# CONFIG_MACVLAN is not set
525# CONFIG_EQUALIZER is not set
526# CONFIG_TUN is not set
527# CONFIG_VETH is not set
528CONFIG_PHYLIB=y
529
530#
531# MII PHY device drivers
532#
533# CONFIG_MARVELL_PHY is not set
534# CONFIG_DAVICOM_PHY is not set
535# CONFIG_QSEMI_PHY is not set
536# CONFIG_LXT_PHY is not set
537# CONFIG_CICADA_PHY is not set
538# CONFIG_VITESSE_PHY is not set
539# CONFIG_SMSC_PHY is not set
540# CONFIG_BROADCOM_PHY is not set
541# CONFIG_ICPLUS_PHY is not set
542# CONFIG_FIXED_PHY is not set
543# CONFIG_MDIO_BITBANG is not set
544CONFIG_NET_ETHERNET=y
545CONFIG_MII=y
546CONFIG_MACB=y
547# CONFIG_AX88796 is not set
548# CONFIG_SMC91X is not set
549# CONFIG_DM9000 is not set
550# CONFIG_IBM_NEW_EMAC_ZMII is not set
551# CONFIG_IBM_NEW_EMAC_RGMII is not set
552# CONFIG_IBM_NEW_EMAC_TAH is not set
553# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
554# CONFIG_B44 is not set
555CONFIG_NETDEV_1000=y
556CONFIG_NETDEV_10000=y
557
558#
559# Wireless LAN
560#
561# CONFIG_WLAN_PRE80211 is not set
562# CONFIG_WLAN_80211 is not set
563
564#
565# USB Network Adapters
566#
567# CONFIG_USB_CATC is not set
568# CONFIG_USB_KAWETH is not set
569# CONFIG_USB_PEGASUS is not set
570# CONFIG_USB_RTL8150 is not set
571# CONFIG_USB_USBNET is not set
572# CONFIG_WAN is not set
573# CONFIG_PPP is not set
574# CONFIG_SLIP is not set
575# CONFIG_SHAPER is not set
576# CONFIG_NETCONSOLE is not set
577# CONFIG_NETPOLL is not set
578# CONFIG_NET_POLL_CONTROLLER is not set
579# CONFIG_ISDN is not set
580
581#
582# Input device support
583#
584CONFIG_INPUT=y
585# CONFIG_INPUT_FF_MEMLESS is not set
586# CONFIG_INPUT_POLLDEV is not set
587
588#
589# Userland interfaces
590#
591CONFIG_INPUT_MOUSEDEV=y
592# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
593CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
594CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
595# CONFIG_INPUT_JOYDEV is not set
596CONFIG_INPUT_EVDEV=y
597CONFIG_INPUT_EVBUG=y
598
599#
600# Input Device Drivers
601#
602CONFIG_INPUT_KEYBOARD=y
603# CONFIG_KEYBOARD_ATKBD is not set
604# CONFIG_KEYBOARD_SUNKBD is not set
605# CONFIG_KEYBOARD_LKKBD is not set
606# CONFIG_KEYBOARD_XTKBD is not set
607# CONFIG_KEYBOARD_NEWTON is not set
608# CONFIG_KEYBOARD_STOWAWAY is not set
609CONFIG_KEYBOARD_GPIO=y
610# CONFIG_INPUT_MOUSE is not set
611# CONFIG_INPUT_JOYSTICK is not set
612# CONFIG_INPUT_TABLET is not set
613# CONFIG_INPUT_TOUCHSCREEN is not set
614# CONFIG_INPUT_MISC is not set
615
616#
617# Hardware I/O ports
618#
619# CONFIG_SERIO is not set
620# CONFIG_GAMEPORT is not set
621
622#
623# Character devices
624#
625CONFIG_VT=y
626CONFIG_VT_CONSOLE=y
627CONFIG_HW_CONSOLE=y
628# CONFIG_VT_HW_CONSOLE_BINDING is not set
629# CONFIG_SERIAL_NONSTANDARD is not set
630
631#
632# Serial drivers
633#
634# CONFIG_SERIAL_8250 is not set
635
636#
637# Non-8250 serial port support
638#
639CONFIG_SERIAL_ATMEL=y
640CONFIG_SERIAL_ATMEL_CONSOLE=y
641# CONFIG_SERIAL_ATMEL_TTYAT is not set
642CONFIG_SERIAL_CORE=y
643CONFIG_SERIAL_CORE_CONSOLE=y
644CONFIG_UNIX98_PTYS=y
645CONFIG_LEGACY_PTYS=y
646CONFIG_LEGACY_PTY_COUNT=256
647# CONFIG_IPMI_HANDLER is not set
648CONFIG_HW_RANDOM=y
649# CONFIG_NVRAM is not set
650# CONFIG_R3964 is not set
651# CONFIG_RAW_DRIVER is not set
652# CONFIG_TCG_TPM is not set
653# CONFIG_I2C is not set
654
655#
656# SPI support
657#
658CONFIG_SPI=y
659# CONFIG_SPI_DEBUG is not set
660CONFIG_SPI_MASTER=y
661
662#
663# SPI Master Controller Drivers
664#
665CONFIG_SPI_ATMEL=y
666# CONFIG_SPI_BITBANG is not set
667
668#
669# SPI Protocol Masters
670#
671# CONFIG_SPI_AT25 is not set
672# CONFIG_SPI_SPIDEV is not set
673# CONFIG_SPI_TLE62X0 is not set
674# CONFIG_W1 is not set
675# CONFIG_POWER_SUPPLY is not set
676# CONFIG_HWMON is not set
677# CONFIG_WATCHDOG is not set
678
679#
680# Sonics Silicon Backplane
681#
682CONFIG_SSB_POSSIBLE=y
683# CONFIG_SSB is not set
684
685#
686# Multifunction device drivers
687#
688# CONFIG_MFD_SM501 is not set
689
690#
691# Multimedia devices
692#
693# CONFIG_VIDEO_DEV is not set
694# CONFIG_DVB_CORE is not set
695# CONFIG_DAB is not set
696
697#
698# Graphics support
699#
700# CONFIG_VGASTATE is not set
701# CONFIG_VIDEO_OUTPUT_CONTROL is not set
702# CONFIG_FB is not set
703# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
704
705#
706# Display device support
707#
708# CONFIG_DISPLAY_SUPPORT is not set
709
710#
711# Console display driver support
712#
713# CONFIG_VGA_CONSOLE is not set
714CONFIG_DUMMY_CONSOLE=y
715
716#
717# Sound
718#
719# CONFIG_SOUND is not set
720CONFIG_HID_SUPPORT=y
721CONFIG_HID=y
722# CONFIG_HID_DEBUG is not set
723# CONFIG_HIDRAW is not set
724
725#
726# USB Input Devices
727#
728# CONFIG_USB_HID is not set
729
730#
731# USB HID Boot Protocol drivers
732#
733# CONFIG_USB_KBD is not set
734# CONFIG_USB_MOUSE is not set
735CONFIG_USB_SUPPORT=y
736CONFIG_USB_ARCH_HAS_HCD=y
737CONFIG_USB_ARCH_HAS_OHCI=y
738# CONFIG_USB_ARCH_HAS_EHCI is not set
739CONFIG_USB=y
740# CONFIG_USB_DEBUG is not set
741
742#
743# Miscellaneous USB options
744#
745CONFIG_USB_DEVICEFS=y
746CONFIG_USB_DEVICE_CLASS=y
747# CONFIG_USB_DYNAMIC_MINORS is not set
748# CONFIG_USB_SUSPEND is not set
749# CONFIG_USB_PERSIST is not set
750# CONFIG_USB_OTG is not set
751
752#
753# USB Host Controller Drivers
754#
755# CONFIG_USB_ISP116X_HCD is not set
756CONFIG_USB_OHCI_HCD=y
757# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
758# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
759CONFIG_USB_OHCI_LITTLE_ENDIAN=y
760# CONFIG_USB_SL811_HCD is not set
761# CONFIG_USB_R8A66597_HCD is not set
762
763#
764# USB Device Class drivers
765#
766# CONFIG_USB_ACM is not set
767# CONFIG_USB_PRINTER is not set
768
769#
770# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
771#
772
773#
774# may also be needed; see USB_STORAGE Help for more information
775#
776CONFIG_USB_STORAGE=y
777# CONFIG_USB_STORAGE_DEBUG is not set
778# CONFIG_USB_STORAGE_DATAFAB is not set
779# CONFIG_USB_STORAGE_FREECOM is not set
780# CONFIG_USB_STORAGE_ISD200 is not set
781# CONFIG_USB_STORAGE_DPCM is not set
782# CONFIG_USB_STORAGE_USBAT is not set
783# CONFIG_USB_STORAGE_SDDR09 is not set
784# CONFIG_USB_STORAGE_SDDR55 is not set
785# CONFIG_USB_STORAGE_JUMPSHOT is not set
786# CONFIG_USB_STORAGE_ALAUDA is not set
787# CONFIG_USB_STORAGE_KARMA is not set
788# CONFIG_USB_LIBUSUAL is not set
789
790#
791# USB Imaging devices
792#
793# CONFIG_USB_MDC800 is not set
794# CONFIG_USB_MICROTEK is not set
795CONFIG_USB_MON=y
796
797#
798# USB port drivers
799#
800
801#
802# USB Serial Converter support
803#
804# CONFIG_USB_SERIAL is not set
805
806#
807# USB Miscellaneous drivers
808#
809# CONFIG_USB_EMI62 is not set
810# CONFIG_USB_EMI26 is not set
811# CONFIG_USB_ADUTUX is not set
812# CONFIG_USB_AUERSWALD is not set
813# CONFIG_USB_RIO500 is not set
814# CONFIG_USB_LEGOTOWER is not set
815# CONFIG_USB_LCD is not set
816# CONFIG_USB_BERRY_CHARGE is not set
817# CONFIG_USB_LED is not set
818# CONFIG_USB_CYPRESS_CY7C63 is not set
819# CONFIG_USB_CYTHERM is not set
820# CONFIG_USB_PHIDGET is not set
821# CONFIG_USB_IDMOUSE is not set
822# CONFIG_USB_FTDI_ELAN is not set
823# CONFIG_USB_APPLEDISPLAY is not set
824# CONFIG_USB_LD is not set
825# CONFIG_USB_TRANCEVIBRATOR is not set
826# CONFIG_USB_IOWARRIOR is not set
827# CONFIG_USB_TEST is not set
828
829#
830# USB DSL modem support
831#
832
833#
834# USB Gadget Support
835#
836CONFIG_USB_GADGET=y
837# CONFIG_USB_GADGET_DEBUG is not set
838# CONFIG_USB_GADGET_DEBUG_FILES is not set
839CONFIG_USB_GADGET_SELECTED=y
840# CONFIG_USB_GADGET_AMD5536UDC is not set
841# CONFIG_USB_GADGET_ATMEL_USBA is not set
842# CONFIG_USB_GADGET_FSL_USB2 is not set
843# CONFIG_USB_GADGET_NET2280 is not set
844# CONFIG_USB_GADGET_PXA2XX is not set
845# CONFIG_USB_GADGET_M66592 is not set
846# CONFIG_USB_GADGET_GOKU is not set
847# CONFIG_USB_GADGET_LH7A40X is not set
848# CONFIG_USB_GADGET_OMAP is not set
849# CONFIG_USB_GADGET_S3C2410 is not set
850CONFIG_USB_GADGET_AT91=y
851CONFIG_USB_AT91=y
852# CONFIG_USB_GADGET_DUMMY_HCD is not set
853# CONFIG_USB_GADGET_DUALSPEED is not set
854# CONFIG_USB_ZERO is not set
855CONFIG_USB_ETH=y
856CONFIG_USB_ETH_RNDIS=y
857# CONFIG_USB_GADGETFS is not set
858# CONFIG_USB_FILE_STORAGE is not set
859# CONFIG_USB_G_SERIAL is not set
860# CONFIG_USB_MIDI_GADGET is not set
861# CONFIG_MMC is not set
862CONFIG_NEW_LEDS=y
863CONFIG_LEDS_CLASS=y
864
865#
866# LED drivers
867#
868CONFIG_LEDS_GPIO=y
869
870#
871# LED Triggers
872#
873CONFIG_LEDS_TRIGGERS=y
874# CONFIG_LEDS_TRIGGER_TIMER is not set
875CONFIG_LEDS_TRIGGER_HEARTBEAT=y
876CONFIG_RTC_LIB=y
877# CONFIG_RTC_CLASS is not set
878
879#
880# File systems
881#
882CONFIG_EXT2_FS=y
883# CONFIG_EXT2_FS_XATTR is not set
884# CONFIG_EXT2_FS_XIP is not set
885# CONFIG_EXT3_FS is not set
886# CONFIG_EXT4DEV_FS is not set
887# CONFIG_REISERFS_FS is not set
888# CONFIG_JFS_FS is not set
889CONFIG_FS_POSIX_ACL=y
890# CONFIG_XFS_FS is not set
891# CONFIG_GFS2_FS is not set
892# CONFIG_OCFS2_FS is not set
893# CONFIG_MINIX_FS is not set
894# CONFIG_ROMFS_FS is not set
895CONFIG_INOTIFY=y
896CONFIG_INOTIFY_USER=y
897# CONFIG_QUOTA is not set
898CONFIG_DNOTIFY=y
899# CONFIG_AUTOFS_FS is not set
900# CONFIG_AUTOFS4_FS is not set
901CONFIG_FUSE_FS=m
902
903#
904# CD-ROM/DVD Filesystems
905#
906# CONFIG_ISO9660_FS is not set
907# CONFIG_UDF_FS is not set
908
909#
910# DOS/FAT/NT Filesystems
911#
912CONFIG_FAT_FS=y
913# CONFIG_MSDOS_FS is not set
914CONFIG_VFAT_FS=y
915CONFIG_FAT_DEFAULT_CODEPAGE=437
916CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
917# CONFIG_NTFS_FS is not set
918
919#
920# Pseudo filesystems
921#
922CONFIG_PROC_FS=y
923CONFIG_PROC_SYSCTL=y
924CONFIG_SYSFS=y
925CONFIG_TMPFS=y
926# CONFIG_TMPFS_POSIX_ACL is not set
927# CONFIG_HUGETLB_PAGE is not set
928# CONFIG_CONFIGFS_FS is not set
929
930#
931# Miscellaneous filesystems
932#
933# CONFIG_ADFS_FS is not set
934# CONFIG_AFFS_FS is not set
935# CONFIG_HFS_FS is not set
936# CONFIG_HFSPLUS_FS is not set
937# CONFIG_BEFS_FS is not set
938# CONFIG_BFS_FS is not set
939# CONFIG_EFS_FS is not set
940CONFIG_JFFS2_FS=y
941CONFIG_JFFS2_FS_DEBUG=0
942CONFIG_JFFS2_FS_WRITEBUFFER=y
943# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
944# CONFIG_JFFS2_SUMMARY is not set
945# CONFIG_JFFS2_FS_XATTR is not set
946# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
947CONFIG_JFFS2_ZLIB=y
948# CONFIG_JFFS2_LZO is not set
949CONFIG_JFFS2_RTIME=y
950# CONFIG_JFFS2_RUBIN is not set
951# CONFIG_CRAMFS is not set
952# CONFIG_VXFS_FS is not set
953# CONFIG_HPFS_FS is not set
954# CONFIG_QNX4FS_FS is not set
955# CONFIG_SYSV_FS is not set
956# CONFIG_UFS_FS is not set
957CONFIG_NETWORK_FILESYSTEMS=y
958CONFIG_NFS_FS=y
959CONFIG_NFS_V3=y
960CONFIG_NFS_V3_ACL=y
961CONFIG_NFS_V4=y
962# CONFIG_NFS_DIRECTIO is not set
963# CONFIG_NFSD is not set
964CONFIG_ROOT_NFS=y
965CONFIG_LOCKD=y
966CONFIG_LOCKD_V4=y
967CONFIG_NFS_ACL_SUPPORT=y
968CONFIG_NFS_COMMON=y
969CONFIG_SUNRPC=y
970CONFIG_SUNRPC_GSS=y
971# CONFIG_SUNRPC_BIND34 is not set
972CONFIG_RPCSEC_GSS_KRB5=y
973# CONFIG_RPCSEC_GSS_SPKM3 is not set
974# CONFIG_SMB_FS is not set
975# CONFIG_CIFS is not set
976# CONFIG_NCP_FS is not set
977# CONFIG_CODA_FS is not set
978# CONFIG_AFS_FS is not set
979
980#
981# Partition Types
982#
983# CONFIG_PARTITION_ADVANCED is not set
984CONFIG_MSDOS_PARTITION=y
985CONFIG_NLS=y
986CONFIG_NLS_DEFAULT="iso8859-1"
987CONFIG_NLS_CODEPAGE_437=y
988# CONFIG_NLS_CODEPAGE_737 is not set
989# CONFIG_NLS_CODEPAGE_775 is not set
990CONFIG_NLS_CODEPAGE_850=y
991# CONFIG_NLS_CODEPAGE_852 is not set
992# CONFIG_NLS_CODEPAGE_855 is not set
993# CONFIG_NLS_CODEPAGE_857 is not set
994# CONFIG_NLS_CODEPAGE_860 is not set
995# CONFIG_NLS_CODEPAGE_861 is not set
996# CONFIG_NLS_CODEPAGE_862 is not set
997# CONFIG_NLS_CODEPAGE_863 is not set
998# CONFIG_NLS_CODEPAGE_864 is not set
999# CONFIG_NLS_CODEPAGE_865 is not set
1000# CONFIG_NLS_CODEPAGE_866 is not set
1001# CONFIG_NLS_CODEPAGE_869 is not set
1002# CONFIG_NLS_CODEPAGE_936 is not set
1003# CONFIG_NLS_CODEPAGE_950 is not set
1004# CONFIG_NLS_CODEPAGE_932 is not set
1005# CONFIG_NLS_CODEPAGE_949 is not set
1006# CONFIG_NLS_CODEPAGE_874 is not set
1007# CONFIG_NLS_ISO8859_8 is not set
1008# CONFIG_NLS_CODEPAGE_1250 is not set
1009# CONFIG_NLS_CODEPAGE_1251 is not set
1010# CONFIG_NLS_ASCII is not set
1011CONFIG_NLS_ISO8859_1=y
1012# CONFIG_NLS_ISO8859_2 is not set
1013# CONFIG_NLS_ISO8859_3 is not set
1014# CONFIG_NLS_ISO8859_4 is not set
1015# CONFIG_NLS_ISO8859_5 is not set
1016# CONFIG_NLS_ISO8859_6 is not set
1017# CONFIG_NLS_ISO8859_7 is not set
1018# CONFIG_NLS_ISO8859_9 is not set
1019# CONFIG_NLS_ISO8859_13 is not set
1020# CONFIG_NLS_ISO8859_14 is not set
1021# CONFIG_NLS_ISO8859_15 is not set
1022# CONFIG_NLS_KOI8_R is not set
1023# CONFIG_NLS_KOI8_U is not set
1024# CONFIG_NLS_UTF8 is not set
1025# CONFIG_DLM is not set
1026# CONFIG_INSTRUMENTATION is not set
1027
1028#
1029# Kernel hacking
1030#
1031# CONFIG_PRINTK_TIME is not set
1032CONFIG_ENABLE_WARN_DEPRECATED=y
1033CONFIG_ENABLE_MUST_CHECK=y
1034# CONFIG_MAGIC_SYSRQ is not set
1035# CONFIG_UNUSED_SYMBOLS is not set
1036# CONFIG_DEBUG_FS is not set
1037# CONFIG_HEADERS_CHECK is not set
1038CONFIG_DEBUG_KERNEL=y
1039# CONFIG_DEBUG_SHIRQ is not set
1040CONFIG_DETECT_SOFTLOCKUP=y
1041CONFIG_SCHED_DEBUG=y
1042# CONFIG_SCHEDSTATS is not set
1043# CONFIG_TIMER_STATS is not set
1044# CONFIG_DEBUG_SLAB is not set
1045# CONFIG_DEBUG_RT_MUTEXES is not set
1046# CONFIG_RT_MUTEX_TESTER is not set
1047# CONFIG_DEBUG_SPINLOCK is not set
1048# CONFIG_DEBUG_MUTEXES is not set
1049# CONFIG_DEBUG_LOCK_ALLOC is not set
1050# CONFIG_PROVE_LOCKING is not set
1051# CONFIG_LOCK_STAT is not set
1052# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1053# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1054# CONFIG_DEBUG_KOBJECT is not set
1055CONFIG_DEBUG_BUGVERBOSE=y
1056# CONFIG_DEBUG_INFO is not set
1057# CONFIG_DEBUG_VM is not set
1058# CONFIG_DEBUG_LIST is not set
1059# CONFIG_DEBUG_SG is not set
1060CONFIG_FRAME_POINTER=y
1061CONFIG_FORCED_INLINING=y
1062# CONFIG_BOOT_PRINTK_DELAY is not set
1063# CONFIG_RCU_TORTURE_TEST is not set
1064# CONFIG_FAULT_INJECTION is not set
1065# CONFIG_SAMPLES is not set
1066CONFIG_DEBUG_USER=y
1067# CONFIG_DEBUG_ERRORS is not set
1068CONFIG_DEBUG_LL=y
1069# CONFIG_DEBUG_ICEDCC is not set
1070
1071#
1072# Security options
1073#
1074# CONFIG_KEYS is not set
1075# CONFIG_SECURITY is not set
1076# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1077CONFIG_CRYPTO=y
1078CONFIG_CRYPTO_ALGAPI=y
1079CONFIG_CRYPTO_BLKCIPHER=y
1080CONFIG_CRYPTO_MANAGER=y
1081# CONFIG_CRYPTO_HMAC is not set
1082# CONFIG_CRYPTO_XCBC is not set
1083# CONFIG_CRYPTO_NULL is not set
1084# CONFIG_CRYPTO_MD4 is not set
1085CONFIG_CRYPTO_MD5=y
1086# CONFIG_CRYPTO_SHA1 is not set
1087# CONFIG_CRYPTO_SHA256 is not set
1088# CONFIG_CRYPTO_SHA512 is not set
1089# CONFIG_CRYPTO_WP512 is not set
1090# CONFIG_CRYPTO_TGR192 is not set
1091# CONFIG_CRYPTO_GF128MUL is not set
1092# CONFIG_CRYPTO_ECB is not set
1093CONFIG_CRYPTO_CBC=y
1094# CONFIG_CRYPTO_PCBC is not set
1095# CONFIG_CRYPTO_LRW is not set
1096# CONFIG_CRYPTO_XTS is not set
1097# CONFIG_CRYPTO_CRYPTD is not set
1098CONFIG_CRYPTO_DES=y
1099# CONFIG_CRYPTO_FCRYPT is not set
1100# CONFIG_CRYPTO_BLOWFISH is not set
1101# CONFIG_CRYPTO_TWOFISH is not set
1102# CONFIG_CRYPTO_SERPENT is not set
1103# CONFIG_CRYPTO_AES is not set
1104# CONFIG_CRYPTO_CAST5 is not set
1105# CONFIG_CRYPTO_CAST6 is not set
1106# CONFIG_CRYPTO_TEA is not set
1107# CONFIG_CRYPTO_ARC4 is not set
1108# CONFIG_CRYPTO_KHAZAD is not set
1109# CONFIG_CRYPTO_ANUBIS is not set
1110# CONFIG_CRYPTO_SEED is not set
1111# CONFIG_CRYPTO_DEFLATE is not set
1112# CONFIG_CRYPTO_MICHAEL_MIC is not set
1113# CONFIG_CRYPTO_CRC32C is not set
1114# CONFIG_CRYPTO_CAMELLIA is not set
1115# CONFIG_CRYPTO_TEST is not set
1116# CONFIG_CRYPTO_AUTHENC is not set
1117# CONFIG_CRYPTO_HW is not set
1118
1119#
1120# Library routines
1121#
1122CONFIG_BITREVERSE=y
1123# CONFIG_CRC_CCITT is not set
1124# CONFIG_CRC16 is not set
1125# CONFIG_CRC_ITU_T is not set
1126CONFIG_CRC32=y
1127# CONFIG_CRC7 is not set
1128# CONFIG_LIBCRC32C is not set
1129CONFIG_ZLIB_INFLATE=y
1130CONFIG_ZLIB_DEFLATE=y
1131CONFIG_PLIST=y
1132CONFIG_HAS_IOMEM=y
1133CONFIG_HAS_IOPORT=y
1134CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index 48dca69addae..8355f88f7292 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -151,7 +151,6 @@ CONFIG_ARM_AMBA=y
151# Kernel Features 151# Kernel Features
152# 152#
153# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154# CONFIG_NO_IDLE_HZ is not set
155CONFIG_HZ=100 154CONFIG_HZ=100
156# CONFIG_AEABI is not set 155# CONFIG_AEABI is not set
157# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 156# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
diff --git a/arch/arm/configs/cm_x270_defconfig b/arch/arm/configs/xm_x270_defconfig
index 5cab08397ae7..aa40d91ce599 100644
--- a/arch/arm/configs/cm_x270_defconfig
+++ b/arch/arm/configs/xm_x270_defconfig
@@ -1,13 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22 3# Linux kernel version: 2.6.25
4# Wed Jul 18 14:11:48 2007 4# Sun May 11 15:12:52 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y 8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y 9CONFIG_GENERIC_TIME=y
10# CONFIG_GENERIC_CLOCKEVENTS is not set 10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y 11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set 12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
@@ -21,21 +21,18 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y 22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y 23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
24CONFIG_ZONE_DMA=y 25CONFIG_ZONE_DMA=y
25CONFIG_ARCH_MTD_XIP=y 26CONFIG_ARCH_MTD_XIP=y
26CONFIG_VECTORS_BASE=0xffff0000 27CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28 29
29# 30#
30# Code maturity level options 31# General setup
31# 32#
32CONFIG_EXPERIMENTAL=y 33CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y 34CONFIG_BROKEN_ON_SMP=y
34CONFIG_INIT_ENV_ARG_LIMIT=32 35CONFIG_INIT_ENV_ARG_LIMIT=32
35
36#
37# General setup
38#
39CONFIG_LOCALVERSION="" 36CONFIG_LOCALVERSION=""
40# CONFIG_LOCALVERSION_AUTO is not set 37# CONFIG_LOCALVERSION_AUTO is not set
41CONFIG_SWAP=y 38CONFIG_SWAP=y
@@ -44,13 +41,20 @@ CONFIG_SYSVIPC_SYSCTL=y
44# CONFIG_POSIX_MQUEUE is not set 41# CONFIG_POSIX_MQUEUE is not set
45# CONFIG_BSD_PROCESS_ACCT is not set 42# CONFIG_BSD_PROCESS_ACCT is not set
46# CONFIG_TASKSTATS is not set 43# CONFIG_TASKSTATS is not set
47# CONFIG_USER_NS is not set
48# CONFIG_AUDIT is not set 44# CONFIG_AUDIT is not set
49CONFIG_IKCONFIG=y 45CONFIG_IKCONFIG=y
50CONFIG_IKCONFIG_PROC=y 46CONFIG_IKCONFIG_PROC=y
51CONFIG_LOG_BUF_SHIFT=17 47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49CONFIG_GROUP_SCHED=y
50CONFIG_FAIR_GROUP_SCHED=y
51# CONFIG_RT_GROUP_SCHED is not set
52CONFIG_USER_SCHED=y
53# CONFIG_CGROUP_SCHED is not set
52CONFIG_SYSFS_DEPRECATED=y 54CONFIG_SYSFS_DEPRECATED=y
55CONFIG_SYSFS_DEPRECATED_V2=y
53# CONFIG_RELAY is not set 56# CONFIG_RELAY is not set
57# CONFIG_NAMESPACES is not set
54CONFIG_BLK_DEV_INITRD=y 58CONFIG_BLK_DEV_INITRD=y
55CONFIG_INITRAMFS_SOURCE="" 59CONFIG_INITRAMFS_SOURCE=""
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y 60CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -58,6 +62,7 @@ CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y 62CONFIG_EMBEDDED=y
59CONFIG_UID16=y 63CONFIG_UID16=y
60CONFIG_SYSCTL_SYSCALL=y 64CONFIG_SYSCTL_SYSCALL=y
65CONFIG_SYSCTL_SYSCALL_CHECK=y
61CONFIG_KALLSYMS=y 66CONFIG_KALLSYMS=y
62# CONFIG_KALLSYMS_ALL is not set 67# CONFIG_KALLSYMS_ALL is not set
63# CONFIG_KALLSYMS_EXTRA_PASS is not set 68# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -65,24 +70,34 @@ CONFIG_HOTPLUG=y
65CONFIG_PRINTK=y 70CONFIG_PRINTK=y
66CONFIG_BUG=y 71CONFIG_BUG=y
67CONFIG_ELF_CORE=y 72CONFIG_ELF_CORE=y
73# CONFIG_COMPAT_BRK is not set
68CONFIG_BASE_FULL=y 74CONFIG_BASE_FULL=y
69CONFIG_FUTEX=y 75CONFIG_FUTEX=y
70CONFIG_ANON_INODES=y 76CONFIG_ANON_INODES=y
71# CONFIG_EPOLL is not set 77CONFIG_EPOLL=y
72# CONFIG_SIGNALFD is not set 78CONFIG_SIGNALFD=y
73# CONFIG_TIMERFD is not set 79CONFIG_TIMERFD=y
74# CONFIG_EVENTFD is not set 80CONFIG_EVENTFD=y
75CONFIG_SHMEM=y 81CONFIG_SHMEM=y
76CONFIG_VM_EVENT_COUNTERS=y 82# CONFIG_VM_EVENT_COUNTERS is not set
77CONFIG_SLAB=y 83# CONFIG_SLUB_DEBUG is not set
78# CONFIG_SLUB is not set 84# CONFIG_SLAB is not set
85CONFIG_SLUB=y
79# CONFIG_SLOB is not set 86# CONFIG_SLOB is not set
87# CONFIG_PROFILING is not set
88# CONFIG_MARKERS is not set
89CONFIG_HAVE_OPROFILE=y
90# CONFIG_KPROBES is not set
91CONFIG_HAVE_KPROBES=y
92CONFIG_HAVE_KRETPROBES=y
93# CONFIG_HAVE_DMA_ATTRS is not set
94# CONFIG_PROC_PAGE_MONITOR is not set
80CONFIG_RT_MUTEXES=y 95CONFIG_RT_MUTEXES=y
81# CONFIG_TINY_SHMEM is not set 96# CONFIG_TINY_SHMEM is not set
82CONFIG_BASE_SMALL=0 97CONFIG_BASE_SMALL=0
83CONFIG_MODULES=y 98CONFIG_MODULES=y
84CONFIG_MODULE_UNLOAD=y 99CONFIG_MODULE_UNLOAD=y
85CONFIG_MODULE_FORCE_UNLOAD=y 100# CONFIG_MODULE_FORCE_UNLOAD is not set
86# CONFIG_MODVERSIONS is not set 101# CONFIG_MODVERSIONS is not set
87# CONFIG_MODULE_SRCVERSION_ALL is not set 102# CONFIG_MODULE_SRCVERSION_ALL is not set
88CONFIG_KMOD=y 103CONFIG_KMOD=y
@@ -99,11 +114,12 @@ CONFIG_IOSCHED_NOOP=y
99CONFIG_IOSCHED_AS=y 114CONFIG_IOSCHED_AS=y
100CONFIG_IOSCHED_DEADLINE=y 115CONFIG_IOSCHED_DEADLINE=y
101CONFIG_IOSCHED_CFQ=y 116CONFIG_IOSCHED_CFQ=y
102CONFIG_DEFAULT_AS=y 117# CONFIG_DEFAULT_AS is not set
103# CONFIG_DEFAULT_DEADLINE is not set 118# CONFIG_DEFAULT_DEADLINE is not set
104# CONFIG_DEFAULT_CFQ is not set 119CONFIG_DEFAULT_CFQ=y
105# CONFIG_DEFAULT_NOOP is not set 120# CONFIG_DEFAULT_NOOP is not set
106CONFIG_DEFAULT_IOSCHED="anticipatory" 121CONFIG_DEFAULT_IOSCHED="cfq"
122CONFIG_CLASSIC_RCU=y
107 123
108# 124#
109# System Type 125# System Type
@@ -131,6 +147,8 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
131# CONFIG_ARCH_L7200 is not set 147# CONFIG_ARCH_L7200 is not set
132# CONFIG_ARCH_KS8695 is not set 148# CONFIG_ARCH_KS8695 is not set
133# CONFIG_ARCH_NS9XXX is not set 149# CONFIG_ARCH_NS9XXX is not set
150# CONFIG_ARCH_MXC is not set
151# CONFIG_ARCH_ORION5X is not set
134# CONFIG_ARCH_PNX4008 is not set 152# CONFIG_ARCH_PNX4008 is not set
135CONFIG_ARCH_PXA=y 153CONFIG_ARCH_PXA=y
136# CONFIG_ARCH_RPC is not set 154# CONFIG_ARCH_RPC is not set
@@ -140,19 +158,41 @@ CONFIG_ARCH_PXA=y
140# CONFIG_ARCH_LH7A40X is not set 158# CONFIG_ARCH_LH7A40X is not set
141# CONFIG_ARCH_DAVINCI is not set 159# CONFIG_ARCH_DAVINCI is not set
142# CONFIG_ARCH_OMAP is not set 160# CONFIG_ARCH_OMAP is not set
161# CONFIG_ARCH_MSM7X00A is not set
143CONFIG_DMABOUNCE=y 162CONFIG_DMABOUNCE=y
144 163
145# 164#
146# Intel PXA2xx Implementations 165# Intel PXA2xx/PXA3xx Implementations
147# 166#
167
168#
169# Select target boards
170#
171# CONFIG_ARCH_GUMSTIX is not set
148# CONFIG_ARCH_LUBBOCK is not set 172# CONFIG_ARCH_LUBBOCK is not set
149# CONFIG_MACH_LOGICPD_PXA270 is not set 173# CONFIG_MACH_LOGICPD_PXA270 is not set
150# CONFIG_MACH_MAINSTONE is not set 174# CONFIG_MACH_MAINSTONE is not set
151# CONFIG_ARCH_PXA_IDP is not set 175# CONFIG_ARCH_PXA_IDP is not set
152# CONFIG_PXA_SHARPSL is not set 176# CONFIG_PXA_SHARPSL is not set
177# CONFIG_ARCH_PXA_ESERIES is not set
153# CONFIG_MACH_TRIZEPS4 is not set 178# CONFIG_MACH_TRIZEPS4 is not set
179CONFIG_MACH_EM_X270=y
180# CONFIG_MACH_COLIBRI is not set
181# CONFIG_MACH_ZYLONITE is not set
182# CONFIG_MACH_LITTLETON is not set
154CONFIG_MACH_ARMCORE=y 183CONFIG_MACH_ARMCORE=y
184# CONFIG_MACH_MAGICIAN is not set
185# CONFIG_MACH_PCM027 is not set
155CONFIG_PXA27x=y 186CONFIG_PXA27x=y
187# CONFIG_PXA_PWM is not set
188
189#
190# Boot options
191#
192
193#
194# Power management
195#
156 196
157# 197#
158# Processor Type 198# Processor Type
@@ -161,6 +201,7 @@ CONFIG_CPU_32=y
161CONFIG_CPU_XSCALE=y 201CONFIG_CPU_XSCALE=y
162CONFIG_CPU_32v5=y 202CONFIG_CPU_32v5=y
163CONFIG_CPU_ABRT_EV5T=y 203CONFIG_CPU_ABRT_EV5T=y
204CONFIG_CPU_PABRT_NOIFAR=y
164CONFIG_CPU_CACHE_VIVT=y 205CONFIG_CPU_CACHE_VIVT=y
165CONFIG_CPU_TLB_V4WBI=y 206CONFIG_CPU_TLB_V4WBI=y
166CONFIG_CPU_CP15=y 207CONFIG_CPU_CP15=y
@@ -182,21 +223,40 @@ CONFIG_PCI=y
182CONFIG_PCI_SYSCALL=y 223CONFIG_PCI_SYSCALL=y
183CONFIG_PCI_HOST_ITE8152=y 224CONFIG_PCI_HOST_ITE8152=y
184# CONFIG_ARCH_SUPPORTS_MSI is not set 225# CONFIG_ARCH_SUPPORTS_MSI is not set
226CONFIG_PCI_LEGACY=y
185# CONFIG_PCI_DEBUG is not set 227# CONFIG_PCI_DEBUG is not set
228CONFIG_PCCARD=m
229# CONFIG_PCMCIA_DEBUG is not set
230CONFIG_PCMCIA=m
231CONFIG_PCMCIA_LOAD_CIS=y
232CONFIG_PCMCIA_IOCTL=y
233CONFIG_CARDBUS=y
186 234
187# 235#
188# PCCARD (PCMCIA/CardBus) support 236# PC-card bridges
189# 237#
190# CONFIG_PCCARD is not set 238CONFIG_YENTA=m
239# CONFIG_YENTA_O2 is not set
240# CONFIG_YENTA_RICOH is not set
241CONFIG_YENTA_TI=y
242# CONFIG_YENTA_ENE_TUNE is not set
243# CONFIG_YENTA_TOSHIBA is not set
244# CONFIG_PD6729 is not set
245# CONFIG_I82092 is not set
246CONFIG_PCMCIA_PXA2XX=m
247CONFIG_PCCARD_NONSTATIC=m
191 248
192# 249#
193# Kernel Features 250# Kernel Features
194# 251#
195# CONFIG_TICK_ONESHOT is not set 252CONFIG_TICK_ONESHOT=y
253CONFIG_NO_HZ=y
254# CONFIG_HIGH_RES_TIMERS is not set
255CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
196# CONFIG_PREEMPT is not set 256# CONFIG_PREEMPT is not set
197# CONFIG_NO_IDLE_HZ is not set
198CONFIG_HZ=100 257CONFIG_HZ=100
199# CONFIG_AEABI is not set 258CONFIG_AEABI=y
259CONFIG_OABI_COMPAT=y
200# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 260# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
201CONFIG_SELECT_MEMORY_MODEL=y 261CONFIG_SELECT_MEMORY_MODEL=y
202CONFIG_FLATMEM_MANUAL=y 262CONFIG_FLATMEM_MANUAL=y
@@ -205,6 +265,8 @@ CONFIG_FLATMEM_MANUAL=y
205CONFIG_FLATMEM=y 265CONFIG_FLATMEM=y
206CONFIG_FLAT_NODE_MEM_MAP=y 266CONFIG_FLAT_NODE_MEM_MAP=y
207# CONFIG_SPARSEMEM_STATIC is not set 267# CONFIG_SPARSEMEM_STATIC is not set
268# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
269CONFIG_PAGEFLAGS_EXTENDED=y
208CONFIG_SPLIT_PTLOCK_CPUS=4096 270CONFIG_SPLIT_PTLOCK_CPUS=4096
209# CONFIG_RESOURCES_64BIT is not set 271# CONFIG_RESOURCES_64BIT is not set
210CONFIG_ZONE_DMA_FLAG=1 272CONFIG_ZONE_DMA_FLAG=1
@@ -217,11 +279,16 @@ CONFIG_ALIGNMENT_TRAP=y
217# 279#
218CONFIG_ZBOOT_ROM_TEXT=0x0 280CONFIG_ZBOOT_ROM_TEXT=0x0
219CONFIG_ZBOOT_ROM_BSS=0x0 281CONFIG_ZBOOT_ROM_BSS=0x0
220CONFIG_CMDLINE="" 282CONFIG_CMDLINE="root=1f03 mem=32M"
221# CONFIG_XIP_KERNEL is not set 283# CONFIG_XIP_KERNEL is not set
222# CONFIG_KEXEC is not set 284# CONFIG_KEXEC is not set
223 285
224# 286#
287# CPU Frequency scaling
288#
289# CONFIG_CPU_FREQ is not set
290
291#
225# Floating point emulation 292# Floating point emulation
226# 293#
227 294
@@ -238,16 +305,17 @@ CONFIG_FPE_NWFPE=y
238CONFIG_BINFMT_ELF=y 305CONFIG_BINFMT_ELF=y
239# CONFIG_BINFMT_AOUT is not set 306# CONFIG_BINFMT_AOUT is not set
240# CONFIG_BINFMT_MISC is not set 307# CONFIG_BINFMT_MISC is not set
241# CONFIG_ARTHUR is not set
242 308
243# 309#
244# Power management options 310# Power management options
245# 311#
246CONFIG_PM=y 312CONFIG_PM=y
247# CONFIG_PM_LEGACY is not set
248# CONFIG_PM_DEBUG is not set 313# CONFIG_PM_DEBUG is not set
249# CONFIG_PM_SYSFS_DEPRECATED is not set 314CONFIG_PM_SLEEP=y
250# CONFIG_APM_EMULATION is not set 315CONFIG_SUSPEND=y
316CONFIG_SUSPEND_FREEZER=y
317CONFIG_APM_EMULATION=m
318CONFIG_ARCH_SUSPEND_POSSIBLE=y
251 319
252# 320#
253# Networking 321# Networking
@@ -258,15 +326,16 @@ CONFIG_NET=y
258# Networking options 326# Networking options
259# 327#
260CONFIG_PACKET=y 328CONFIG_PACKET=y
261# CONFIG_PACKET_MMAP is not set 329CONFIG_PACKET_MMAP=y
262CONFIG_UNIX=y 330CONFIG_UNIX=y
263CONFIG_XFRM=y 331CONFIG_XFRM=y
264# CONFIG_XFRM_USER is not set 332# CONFIG_XFRM_USER is not set
265# CONFIG_XFRM_SUB_POLICY is not set 333# CONFIG_XFRM_SUB_POLICY is not set
266# CONFIG_XFRM_MIGRATE is not set 334# CONFIG_XFRM_MIGRATE is not set
335# CONFIG_XFRM_STATISTICS is not set
267# CONFIG_NET_KEY is not set 336# CONFIG_NET_KEY is not set
268CONFIG_INET=y 337CONFIG_INET=y
269# CONFIG_IP_MULTICAST is not set 338CONFIG_IP_MULTICAST=y
270# CONFIG_IP_ADVANCED_ROUTER is not set 339# CONFIG_IP_ADVANCED_ROUTER is not set
271CONFIG_IP_FIB_HASH=y 340CONFIG_IP_FIB_HASH=y
272CONFIG_IP_PNP=y 341CONFIG_IP_PNP=y
@@ -275,6 +344,7 @@ CONFIG_IP_PNP_BOOTP=y
275# CONFIG_IP_PNP_RARP is not set 344# CONFIG_IP_PNP_RARP is not set
276# CONFIG_NET_IPIP is not set 345# CONFIG_NET_IPIP is not set
277# CONFIG_NET_IPGRE is not set 346# CONFIG_NET_IPGRE is not set
347# CONFIG_IP_MROUTE is not set
278# CONFIG_ARPD is not set 348# CONFIG_ARPD is not set
279# CONFIG_SYN_COOKIES is not set 349# CONFIG_SYN_COOKIES is not set
280# CONFIG_INET_AH is not set 350# CONFIG_INET_AH is not set
@@ -285,15 +355,13 @@ CONFIG_IP_PNP_BOOTP=y
285CONFIG_INET_XFRM_MODE_TRANSPORT=y 355CONFIG_INET_XFRM_MODE_TRANSPORT=y
286CONFIG_INET_XFRM_MODE_TUNNEL=y 356CONFIG_INET_XFRM_MODE_TUNNEL=y
287CONFIG_INET_XFRM_MODE_BEET=y 357CONFIG_INET_XFRM_MODE_BEET=y
288CONFIG_INET_DIAG=y 358# CONFIG_INET_LRO is not set
289CONFIG_INET_TCP_DIAG=y 359# CONFIG_INET_DIAG is not set
290# CONFIG_TCP_CONG_ADVANCED is not set 360# CONFIG_TCP_CONG_ADVANCED is not set
291CONFIG_TCP_CONG_CUBIC=y 361CONFIG_TCP_CONG_CUBIC=y
292CONFIG_DEFAULT_TCP_CONG="cubic" 362CONFIG_DEFAULT_TCP_CONG="cubic"
293# CONFIG_TCP_MD5SIG is not set 363# CONFIG_TCP_MD5SIG is not set
294# CONFIG_IPV6 is not set 364# CONFIG_IPV6 is not set
295# CONFIG_INET6_XFRM_TUNNEL is not set
296# CONFIG_INET6_TUNNEL is not set
297# CONFIG_NETWORK_SECMARK is not set 365# CONFIG_NETWORK_SECMARK is not set
298# CONFIG_NETFILTER is not set 366# CONFIG_NETFILTER is not set
299# CONFIG_IP_DCCP is not set 367# CONFIG_IP_DCCP is not set
@@ -310,10 +378,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
310# CONFIG_LAPB is not set 378# CONFIG_LAPB is not set
311# CONFIG_ECONET is not set 379# CONFIG_ECONET is not set
312# CONFIG_WAN_ROUTER is not set 380# CONFIG_WAN_ROUTER is not set
313
314#
315# QoS and/or fair queueing
316#
317# CONFIG_NET_SCHED is not set 381# CONFIG_NET_SCHED is not set
318 382
319# 383#
@@ -321,8 +385,33 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
321# 385#
322# CONFIG_NET_PKTGEN is not set 386# CONFIG_NET_PKTGEN is not set
323# CONFIG_HAMRADIO is not set 387# CONFIG_HAMRADIO is not set
388# CONFIG_CAN is not set
324# CONFIG_IRDA is not set 389# CONFIG_IRDA is not set
325# CONFIG_BT is not set 390CONFIG_BT=m
391CONFIG_BT_L2CAP=m
392CONFIG_BT_SCO=m
393CONFIG_BT_RFCOMM=m
394# CONFIG_BT_RFCOMM_TTY is not set
395CONFIG_BT_BNEP=m
396# CONFIG_BT_BNEP_MC_FILTER is not set
397# CONFIG_BT_BNEP_PROTO_FILTER is not set
398CONFIG_BT_HIDP=m
399
400#
401# Bluetooth device drivers
402#
403CONFIG_BT_HCIUSB=m
404CONFIG_BT_HCIUSB_SCO=y
405# CONFIG_BT_HCIBTSDIO is not set
406# CONFIG_BT_HCIUART is not set
407# CONFIG_BT_HCIBCM203X is not set
408# CONFIG_BT_HCIBPA10X is not set
409# CONFIG_BT_HCIBFUSB is not set
410# CONFIG_BT_HCIDTL1 is not set
411# CONFIG_BT_HCIBT3C is not set
412# CONFIG_BT_HCIBLUECARD is not set
413# CONFIG_BT_HCIBTUART is not set
414# CONFIG_BT_HCIVHCI is not set
326# CONFIG_AF_RXRPC is not set 415# CONFIG_AF_RXRPC is not set
327 416
328# 417#
@@ -331,12 +420,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
331# CONFIG_CFG80211 is not set 420# CONFIG_CFG80211 is not set
332CONFIG_WIRELESS_EXT=y 421CONFIG_WIRELESS_EXT=y
333# CONFIG_MAC80211 is not set 422# CONFIG_MAC80211 is not set
334CONFIG_IEEE80211=m 423# CONFIG_IEEE80211 is not set
335# CONFIG_IEEE80211_DEBUG is not set
336CONFIG_IEEE80211_CRYPT_WEP=m
337CONFIG_IEEE80211_CRYPT_CCMP=m
338# CONFIG_IEEE80211_CRYPT_TKIP is not set
339# CONFIG_IEEE80211_SOFTMAC is not set
340# CONFIG_RFKILL is not set 424# CONFIG_RFKILL is not set
341# CONFIG_NET_9P is not set 425# CONFIG_NET_9P is not set
342 426
@@ -347,38 +431,47 @@ CONFIG_IEEE80211_CRYPT_CCMP=m
347# 431#
348# Generic Driver Options 432# Generic Driver Options
349# 433#
434CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
350CONFIG_STANDALONE=y 435CONFIG_STANDALONE=y
351CONFIG_PREVENT_FIRMWARE_BUILD=y 436CONFIG_PREVENT_FIRMWARE_BUILD=y
352CONFIG_FW_LOADER=y 437CONFIG_FW_LOADER=m
353# CONFIG_DEBUG_DRIVER is not set 438# CONFIG_DEBUG_DRIVER is not set
354# CONFIG_DEBUG_DEVRES is not set 439# CONFIG_DEBUG_DEVRES is not set
355# CONFIG_SYS_HYPERVISOR is not set 440# CONFIG_SYS_HYPERVISOR is not set
356# CONFIG_CONNECTOR is not set 441# CONFIG_CONNECTOR is not set
357CONFIG_MTD=m 442CONFIG_MTD=y
358# CONFIG_MTD_DEBUG is not set 443# CONFIG_MTD_DEBUG is not set
359# CONFIG_MTD_CONCAT is not set 444# CONFIG_MTD_CONCAT is not set
360CONFIG_MTD_PARTITIONS=y 445CONFIG_MTD_PARTITIONS=y
361# CONFIG_MTD_REDBOOT_PARTS is not set 446# CONFIG_MTD_REDBOOT_PARTS is not set
447CONFIG_MTD_CMDLINE_PARTS=y
362# CONFIG_MTD_AFS_PARTS is not set 448# CONFIG_MTD_AFS_PARTS is not set
449# CONFIG_MTD_AR7_PARTS is not set
363 450
364# 451#
365# User Modules And Translation Layers 452# User Modules And Translation Layers
366# 453#
367CONFIG_MTD_CHAR=m 454CONFIG_MTD_CHAR=y
368CONFIG_MTD_BLKDEVS=m 455CONFIG_MTD_BLKDEVS=y
369CONFIG_MTD_BLOCK=m 456CONFIG_MTD_BLOCK=y
370# CONFIG_MTD_BLOCK_RO is not set
371# CONFIG_FTL is not set 457# CONFIG_FTL is not set
372# CONFIG_NFTL is not set 458# CONFIG_NFTL is not set
373# CONFIG_INFTL is not set 459# CONFIG_INFTL is not set
374# CONFIG_RFD_FTL is not set 460# CONFIG_RFD_FTL is not set
375# CONFIG_SSFDC is not set 461# CONFIG_SSFDC is not set
462# CONFIG_MTD_OOPS is not set
376 463
377# 464#
378# RAM/ROM/Flash chip drivers 465# RAM/ROM/Flash chip drivers
379# 466#
380# CONFIG_MTD_CFI is not set 467CONFIG_MTD_CFI=y
381# CONFIG_MTD_JEDECPROBE is not set 468CONFIG_MTD_JEDECPROBE=y
469CONFIG_MTD_GEN_PROBE=y
470CONFIG_MTD_CFI_ADV_OPTIONS=y
471CONFIG_MTD_CFI_NOSWAP=y
472# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
473# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
474# CONFIG_MTD_CFI_GEOMETRY is not set
382CONFIG_MTD_MAP_BANK_WIDTH_1=y 475CONFIG_MTD_MAP_BANK_WIDTH_1=y
383CONFIG_MTD_MAP_BANK_WIDTH_2=y 476CONFIG_MTD_MAP_BANK_WIDTH_2=y
384CONFIG_MTD_MAP_BANK_WIDTH_4=y 477CONFIG_MTD_MAP_BANK_WIDTH_4=y
@@ -389,15 +482,29 @@ CONFIG_MTD_CFI_I1=y
389CONFIG_MTD_CFI_I2=y 482CONFIG_MTD_CFI_I2=y
390# CONFIG_MTD_CFI_I4 is not set 483# CONFIG_MTD_CFI_I4 is not set
391# CONFIG_MTD_CFI_I8 is not set 484# CONFIG_MTD_CFI_I8 is not set
485# CONFIG_MTD_OTP is not set
486CONFIG_MTD_CFI_INTELEXT=y
487CONFIG_MTD_CFI_AMDSTD=y
488CONFIG_MTD_CFI_STAA=y
489CONFIG_MTD_CFI_UTIL=y
392# CONFIG_MTD_RAM is not set 490# CONFIG_MTD_RAM is not set
393# CONFIG_MTD_ROM is not set 491# CONFIG_MTD_ROM is not set
394# CONFIG_MTD_ABSENT is not set 492# CONFIG_MTD_ABSENT is not set
493# CONFIG_MTD_XIP is not set
395 494
396# 495#
397# Mapping drivers for chip access 496# Mapping drivers for chip access
398# 497#
399# CONFIG_MTD_COMPLEX_MAPPINGS is not set 498# CONFIG_MTD_COMPLEX_MAPPINGS is not set
499CONFIG_MTD_PHYSMAP=y
500CONFIG_MTD_PHYSMAP_START=0x0
501CONFIG_MTD_PHYSMAP_LEN=0x400000
502CONFIG_MTD_PHYSMAP_BANKWIDTH=2
503CONFIG_MTD_PXA2XX=y
504# CONFIG_MTD_ARM_INTEGRATOR is not set
505# CONFIG_MTD_IMPA7 is not set
400# CONFIG_MTD_SHARP_SL is not set 506# CONFIG_MTD_SHARP_SL is not set
507# CONFIG_MTD_INTEL_VR_NOR is not set
401# CONFIG_MTD_PLATRAM is not set 508# CONFIG_MTD_PLATRAM is not set
402 509
403# 510#
@@ -415,18 +522,19 @@ CONFIG_MTD_CFI_I2=y
415# CONFIG_MTD_DOC2000 is not set 522# CONFIG_MTD_DOC2000 is not set
416# CONFIG_MTD_DOC2001 is not set 523# CONFIG_MTD_DOC2001 is not set
417# CONFIG_MTD_DOC2001PLUS is not set 524# CONFIG_MTD_DOC2001PLUS is not set
418CONFIG_MTD_NAND=m 525CONFIG_MTD_NAND=y
419# CONFIG_MTD_NAND_VERIFY_WRITE is not set 526# CONFIG_MTD_NAND_VERIFY_WRITE is not set
420# CONFIG_MTD_NAND_ECC_SMC is not set 527# CONFIG_MTD_NAND_ECC_SMC is not set
421# CONFIG_MTD_NAND_MUSEUM_IDS is not set 528# CONFIG_MTD_NAND_MUSEUM_IDS is not set
422# CONFIG_MTD_NAND_H1900 is not set 529# CONFIG_MTD_NAND_H1900 is not set
423CONFIG_MTD_NAND_IDS=m 530CONFIG_MTD_NAND_IDS=y
424# CONFIG_MTD_NAND_DISKONCHIP is not set 531# CONFIG_MTD_NAND_DISKONCHIP is not set
425# CONFIG_MTD_NAND_SHARPSL is not set 532# CONFIG_MTD_NAND_SHARPSL is not set
426# CONFIG_MTD_NAND_CAFE is not set 533# CONFIG_MTD_NAND_CAFE is not set
427CONFIG_MTD_NAND_CM_X270=m 534CONFIG_MTD_NAND_CM_X270=y
428# CONFIG_MTD_NAND_NANDSIM is not set 535# CONFIG_MTD_NAND_NANDSIM is not set
429# CONFIG_MTD_NAND_PLATFORM is not set 536CONFIG_MTD_NAND_PLATFORM=y
537# CONFIG_MTD_ALAUDA is not set
430# CONFIG_MTD_ONENAND is not set 538# CONFIG_MTD_ONENAND is not set
431 539
432# 540#
@@ -447,36 +555,13 @@ CONFIG_BLK_DEV_LOOP=y
447# CONFIG_BLK_DEV_UB is not set 555# CONFIG_BLK_DEV_UB is not set
448CONFIG_BLK_DEV_RAM=y 556CONFIG_BLK_DEV_RAM=y
449CONFIG_BLK_DEV_RAM_COUNT=16 557CONFIG_BLK_DEV_RAM_COUNT=16
450CONFIG_BLK_DEV_RAM_SIZE=12000 558CONFIG_BLK_DEV_RAM_SIZE=4096
451CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 559# CONFIG_BLK_DEV_XIP is not set
452# CONFIG_CDROM_PKTCDVD is not set 560# CONFIG_CDROM_PKTCDVD is not set
453# CONFIG_ATA_OVER_ETH is not set 561# CONFIG_ATA_OVER_ETH is not set
454CONFIG_IDE=m 562# CONFIG_MISC_DEVICES is not set
455CONFIG_IDE_MAX_HWIFS=4 563CONFIG_HAVE_IDE=y
456CONFIG_BLK_DEV_IDE=m 564# CONFIG_IDE is not set
457
458#
459# Please see Documentation/ide.txt for help/info on IDE drives
460#
461# CONFIG_BLK_DEV_IDE_SATA is not set
462CONFIG_BLK_DEV_IDEDISK=m
463# CONFIG_IDEDISK_MULTI_MODE is not set
464CONFIG_BLK_DEV_IDECD=m
465# CONFIG_BLK_DEV_IDETAPE is not set
466# CONFIG_BLK_DEV_IDEFLOPPY is not set
467# CONFIG_BLK_DEV_IDESCSI is not set
468# CONFIG_IDE_TASK_IOCTL is not set
469CONFIG_IDE_PROC_FS=y
470
471#
472# IDE chipset support/bugfixes
473#
474# CONFIG_IDE_GENERIC is not set
475# CONFIG_BLK_DEV_IDEPCI is not set
476# CONFIG_IDEPCI_PCIBUS_ORDER is not set
477# CONFIG_IDE_ARM is not set
478# CONFIG_BLK_DEV_IDEDMA is not set
479# CONFIG_BLK_DEV_HD is not set
480 565
481# 566#
482# SCSI device support 567# SCSI device support
@@ -486,7 +571,7 @@ CONFIG_SCSI=y
486CONFIG_SCSI_DMA=y 571CONFIG_SCSI_DMA=y
487# CONFIG_SCSI_TGT is not set 572# CONFIG_SCSI_TGT is not set
488# CONFIG_SCSI_NETLINK is not set 573# CONFIG_SCSI_NETLINK is not set
489# CONFIG_SCSI_PROC_FS is not set 574CONFIG_SCSI_PROC_FS=y
490 575
491# 576#
492# SCSI support type (disk, tape, CD-ROM) 577# SCSI support type (disk, tape, CD-ROM)
@@ -513,12 +598,9 @@ CONFIG_SCSI_WAIT_SCAN=m
513# CONFIG_SCSI_SPI_ATTRS is not set 598# CONFIG_SCSI_SPI_ATTRS is not set
514# CONFIG_SCSI_FC_ATTRS is not set 599# CONFIG_SCSI_FC_ATTRS is not set
515# CONFIG_SCSI_ISCSI_ATTRS is not set 600# CONFIG_SCSI_ISCSI_ATTRS is not set
516# CONFIG_SCSI_SAS_ATTRS is not set
517# CONFIG_SCSI_SAS_LIBSAS is not set 601# CONFIG_SCSI_SAS_LIBSAS is not set
518 602# CONFIG_SCSI_SRP_ATTRS is not set
519# 603CONFIG_SCSI_LOWLEVEL=y
520# SCSI low-level drivers
521#
522# CONFIG_ISCSI_TCP is not set 604# CONFIG_ISCSI_TCP is not set
523# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 605# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
524# CONFIG_SCSI_3W_9XXX is not set 606# CONFIG_SCSI_3W_9XXX is not set
@@ -529,6 +611,7 @@ CONFIG_SCSI_WAIT_SCAN=m
529# CONFIG_SCSI_AIC79XX is not set 611# CONFIG_SCSI_AIC79XX is not set
530# CONFIG_SCSI_AIC94XX is not set 612# CONFIG_SCSI_AIC94XX is not set
531# CONFIG_SCSI_DPT_I2O is not set 613# CONFIG_SCSI_DPT_I2O is not set
614# CONFIG_SCSI_ADVANSYS is not set
532# CONFIG_SCSI_ARCMSR is not set 615# CONFIG_SCSI_ARCMSR is not set
533# CONFIG_MEGARAID_NEWGEN is not set 616# CONFIG_MEGARAID_NEWGEN is not set
534# CONFIG_MEGARAID_LEGACY is not set 617# CONFIG_MEGARAID_LEGACY is not set
@@ -539,8 +622,10 @@ CONFIG_SCSI_WAIT_SCAN=m
539# CONFIG_SCSI_IPS is not set 622# CONFIG_SCSI_IPS is not set
540# CONFIG_SCSI_INITIO is not set 623# CONFIG_SCSI_INITIO is not set
541# CONFIG_SCSI_INIA100 is not set 624# CONFIG_SCSI_INIA100 is not set
625# CONFIG_SCSI_MVSAS is not set
542# CONFIG_SCSI_STEX is not set 626# CONFIG_SCSI_STEX is not set
543# CONFIG_SCSI_SYM53C8XX_2 is not set 627# CONFIG_SCSI_SYM53C8XX_2 is not set
628# CONFIG_SCSI_IPR is not set
544# CONFIG_SCSI_QLOGIC_1280 is not set 629# CONFIG_SCSI_QLOGIC_1280 is not set
545# CONFIG_SCSI_QLA_FC is not set 630# CONFIG_SCSI_QLA_FC is not set
546# CONFIG_SCSI_QLA_ISCSI is not set 631# CONFIG_SCSI_QLA_ISCSI is not set
@@ -550,16 +635,69 @@ CONFIG_SCSI_WAIT_SCAN=m
550# CONFIG_SCSI_NSP32 is not set 635# CONFIG_SCSI_NSP32 is not set
551# CONFIG_SCSI_DEBUG is not set 636# CONFIG_SCSI_DEBUG is not set
552# CONFIG_SCSI_SRP is not set 637# CONFIG_SCSI_SRP is not set
553# CONFIG_ATA is not set 638# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
639CONFIG_ATA=m
640# CONFIG_ATA_NONSTANDARD is not set
641# CONFIG_SATA_PMP is not set
642# CONFIG_SATA_AHCI is not set
643# CONFIG_SATA_SIL24 is not set
644CONFIG_ATA_SFF=y
645# CONFIG_SATA_SVW is not set
646# CONFIG_ATA_PIIX is not set
647# CONFIG_SATA_MV is not set
648# CONFIG_SATA_NV is not set
649# CONFIG_PDC_ADMA is not set
650# CONFIG_SATA_QSTOR is not set
651# CONFIG_SATA_PROMISE is not set
652# CONFIG_SATA_SX4 is not set
653# CONFIG_SATA_SIL is not set
654# CONFIG_SATA_SIS is not set
655# CONFIG_SATA_ULI is not set
656# CONFIG_SATA_VIA is not set
657# CONFIG_SATA_VITESSE is not set
658# CONFIG_SATA_INIC162X is not set
659# CONFIG_PATA_ALI is not set
660# CONFIG_PATA_AMD is not set
661# CONFIG_PATA_ARTOP is not set
662# CONFIG_PATA_ATIIXP is not set
663# CONFIG_PATA_CMD640_PCI is not set
664# CONFIG_PATA_CMD64X is not set
665# CONFIG_PATA_CS5520 is not set
666# CONFIG_PATA_CS5530 is not set
667# CONFIG_PATA_CYPRESS is not set
668# CONFIG_PATA_EFAR is not set
669# CONFIG_ATA_GENERIC is not set
670# CONFIG_PATA_HPT366 is not set
671# CONFIG_PATA_HPT37X is not set
672# CONFIG_PATA_HPT3X2N is not set
673# CONFIG_PATA_HPT3X3 is not set
674# CONFIG_PATA_IT821X is not set
675# CONFIG_PATA_IT8213 is not set
676# CONFIG_PATA_JMICRON is not set
677# CONFIG_PATA_TRIFLEX is not set
678# CONFIG_PATA_MARVELL is not set
679# CONFIG_PATA_MPIIX is not set
680# CONFIG_PATA_OLDPIIX is not set
681# CONFIG_PATA_NETCELL is not set
682# CONFIG_PATA_NINJA32 is not set
683# CONFIG_PATA_NS87410 is not set
684# CONFIG_PATA_NS87415 is not set
685# CONFIG_PATA_OPTI is not set
686# CONFIG_PATA_OPTIDMA is not set
687CONFIG_PATA_PCMCIA=m
688# CONFIG_PATA_PDC_OLD is not set
689# CONFIG_PATA_RADISYS is not set
690# CONFIG_PATA_RZ1000 is not set
691# CONFIG_PATA_SC1200 is not set
692# CONFIG_PATA_SERVERWORKS is not set
693# CONFIG_PATA_PDC2027X is not set
694# CONFIG_PATA_SIL680 is not set
695# CONFIG_PATA_SIS is not set
696# CONFIG_PATA_VIA is not set
697# CONFIG_PATA_WINBOND is not set
698# CONFIG_PATA_PLATFORM is not set
554# CONFIG_MD is not set 699# CONFIG_MD is not set
555
556#
557# Fusion MPT device support
558#
559# CONFIG_FUSION is not set 700# CONFIG_FUSION is not set
560# CONFIG_FUSION_SPI is not set
561# CONFIG_FUSION_FC is not set
562# CONFIG_FUSION_SAS is not set
563 701
564# 702#
565# IEEE 1394 (FireWire) support 703# IEEE 1394 (FireWire) support
@@ -574,6 +712,7 @@ CONFIG_NETDEVICES=y
574# CONFIG_MACVLAN is not set 712# CONFIG_MACVLAN is not set
575# CONFIG_EQUALIZER is not set 713# CONFIG_EQUALIZER is not set
576# CONFIG_TUN is not set 714# CONFIG_TUN is not set
715# CONFIG_VETH is not set
577# CONFIG_ARCNET is not set 716# CONFIG_ARCNET is not set
578# CONFIG_PHYLIB is not set 717# CONFIG_PHYLIB is not set
579CONFIG_NET_ETHERNET=y 718CONFIG_NET_ETHERNET=y
@@ -585,64 +724,65 @@ CONFIG_MII=y
585# CONFIG_NET_VENDOR_3COM is not set 724# CONFIG_NET_VENDOR_3COM is not set
586# CONFIG_SMC91X is not set 725# CONFIG_SMC91X is not set
587CONFIG_DM9000=y 726CONFIG_DM9000=y
727CONFIG_DM9000_DEBUGLEVEL=1
588# CONFIG_SMC911X is not set 728# CONFIG_SMC911X is not set
589# CONFIG_NET_TULIP is not set 729# CONFIG_NET_TULIP is not set
590# CONFIG_HP100 is not set 730# CONFIG_HP100 is not set
731# CONFIG_IBM_NEW_EMAC_ZMII is not set
732# CONFIG_IBM_NEW_EMAC_RGMII is not set
733# CONFIG_IBM_NEW_EMAC_TAH is not set
734# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
591CONFIG_NET_PCI=y 735CONFIG_NET_PCI=y
592# CONFIG_PCNET32 is not set 736# CONFIG_PCNET32 is not set
593# CONFIG_AMD8111_ETH is not set 737# CONFIG_AMD8111_ETH is not set
594# CONFIG_ADAPTEC_STARFIRE is not set 738# CONFIG_ADAPTEC_STARFIRE is not set
595# CONFIG_B44 is not set 739# CONFIG_B44 is not set
596# CONFIG_FORCEDETH is not set 740# CONFIG_FORCEDETH is not set
597# CONFIG_DGRS is not set
598# CONFIG_EEPRO100 is not set 741# CONFIG_EEPRO100 is not set
599# CONFIG_E100 is not set 742# CONFIG_E100 is not set
600# CONFIG_FEALNX is not set 743# CONFIG_FEALNX is not set
601# CONFIG_NATSEMI is not set 744# CONFIG_NATSEMI is not set
602# CONFIG_NE2K_PCI is not set 745# CONFIG_NE2K_PCI is not set
603# CONFIG_8139CP is not set 746# CONFIG_8139CP is not set
604CONFIG_8139TOO=m 747CONFIG_8139TOO=y
605# CONFIG_8139TOO_PIO is not set 748# CONFIG_8139TOO_PIO is not set
606# CONFIG_8139TOO_TUNE_TWISTER is not set 749# CONFIG_8139TOO_TUNE_TWISTER is not set
607# CONFIG_8139TOO_8129 is not set 750# CONFIG_8139TOO_8129 is not set
608# CONFIG_8139_OLD_RX_RESET is not set 751# CONFIG_8139_OLD_RX_RESET is not set
752# CONFIG_R6040 is not set
609# CONFIG_SIS900 is not set 753# CONFIG_SIS900 is not set
610# CONFIG_EPIC100 is not set 754# CONFIG_EPIC100 is not set
611# CONFIG_SUNDANCE is not set 755# CONFIG_SUNDANCE is not set
612# CONFIG_TLAN is not set 756# CONFIG_TLAN is not set
613# CONFIG_VIA_RHINE is not set 757# CONFIG_VIA_RHINE is not set
614# CONFIG_SC92031 is not set 758# CONFIG_SC92031 is not set
615CONFIG_NETDEV_1000=y 759# CONFIG_NETDEV_1000 is not set
616# CONFIG_ACENIC is not set 760# CONFIG_NETDEV_10000 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_VIA_VELOCITY is not set
627# CONFIG_TIGON3 is not set
628# CONFIG_BNX2 is not set
629# CONFIG_QLA3XXX is not set
630# CONFIG_ATL1 is not set
631CONFIG_NETDEV_10000=y
632# CONFIG_CHELSIO_T1 is not set
633# CONFIG_CHELSIO_T3 is not set
634# CONFIG_IXGB is not set
635# CONFIG_S2IO is not set
636# CONFIG_MYRI10GE is not set
637# CONFIG_NETXEN_NIC is not set
638# CONFIG_MLX4_CORE is not set
639# CONFIG_TR is not set 761# CONFIG_TR is not set
640 762
641# 763#
642# Wireless LAN 764# Wireless LAN
643# 765#
644# CONFIG_WLAN_PRE80211 is not set 766# CONFIG_WLAN_PRE80211 is not set
645# CONFIG_WLAN_80211 is not set 767CONFIG_WLAN_80211=y
768# CONFIG_PCMCIA_RAYCS is not set
769# CONFIG_IPW2100 is not set
770# CONFIG_IPW2200 is not set
771CONFIG_LIBERTAS=m
772# CONFIG_LIBERTAS_USB is not set
773# CONFIG_LIBERTAS_CS is not set
774CONFIG_LIBERTAS_SDIO=m
775# CONFIG_LIBERTAS_DEBUG is not set
776# CONFIG_HERMES is not set
777# CONFIG_ATMEL is not set
778# CONFIG_AIRO_CS is not set
779# CONFIG_PCMCIA_WL3501 is not set
780# CONFIG_PRISM54 is not set
781# CONFIG_USB_ZD1201 is not set
782# CONFIG_USB_NET_RNDIS_WLAN is not set
783# CONFIG_IWLWIFI is not set
784# CONFIG_IWLWIFI_LEDS is not set
785# CONFIG_HOSTAP is not set
646 786
647# 787#
648# USB Network Adapters 788# USB Network Adapters
@@ -651,15 +791,24 @@ CONFIG_NETDEV_10000=y
651# CONFIG_USB_KAWETH is not set 791# CONFIG_USB_KAWETH is not set
652# CONFIG_USB_PEGASUS is not set 792# CONFIG_USB_PEGASUS is not set
653# CONFIG_USB_RTL8150 is not set 793# CONFIG_USB_RTL8150 is not set
654# CONFIG_USB_USBNET_MII is not set
655# CONFIG_USB_USBNET is not set 794# CONFIG_USB_USBNET is not set
795# CONFIG_NET_PCMCIA is not set
656# CONFIG_WAN is not set 796# CONFIG_WAN is not set
657# CONFIG_FDDI is not set 797# CONFIG_FDDI is not set
658# CONFIG_HIPPI is not set 798# CONFIG_HIPPI is not set
659# CONFIG_PPP is not set 799CONFIG_PPP=m
800CONFIG_PPP_MULTILINK=y
801CONFIG_PPP_FILTER=y
802CONFIG_PPP_ASYNC=m
803# CONFIG_PPP_SYNC_TTY is not set
804CONFIG_PPP_DEFLATE=m
805CONFIG_PPP_BSDCOMP=m
806# CONFIG_PPP_MPPE is not set
807# CONFIG_PPPOE is not set
808# CONFIG_PPPOL2TP is not set
660# CONFIG_SLIP is not set 809# CONFIG_SLIP is not set
810CONFIG_SLHC=m
661# CONFIG_NET_FC is not set 811# CONFIG_NET_FC is not set
662# CONFIG_SHAPER is not set
663# CONFIG_NETCONSOLE is not set 812# CONFIG_NETCONSOLE is not set
664# CONFIG_NETPOLL is not set 813# CONFIG_NETPOLL is not set
665# CONFIG_NET_POLL_CONTROLLER is not set 814# CONFIG_NET_POLL_CONTROLLER is not set
@@ -675,20 +824,32 @@ CONFIG_INPUT=y
675# 824#
676# Userland interfaces 825# Userland interfaces
677# 826#
678# CONFIG_INPUT_MOUSEDEV is not set 827CONFIG_INPUT_MOUSEDEV=y
828CONFIG_INPUT_MOUSEDEV_PSAUX=y
829CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
830CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
679# CONFIG_INPUT_JOYDEV is not set 831# CONFIG_INPUT_JOYDEV is not set
680# CONFIG_INPUT_TSDEV is not set
681CONFIG_INPUT_EVDEV=y 832CONFIG_INPUT_EVDEV=y
682# CONFIG_INPUT_EVBUG is not set 833# CONFIG_INPUT_EVBUG is not set
834# CONFIG_INPUT_APMPOWER is not set
683 835
684# 836#
685# Input Device Drivers 837# Input Device Drivers
686# 838#
687# CONFIG_INPUT_KEYBOARD is not set 839CONFIG_INPUT_KEYBOARD=y
840CONFIG_KEYBOARD_ATKBD=y
841# CONFIG_KEYBOARD_SUNKBD is not set
842# CONFIG_KEYBOARD_LKKBD is not set
843# CONFIG_KEYBOARD_XTKBD is not set
844# CONFIG_KEYBOARD_NEWTON is not set
845# CONFIG_KEYBOARD_STOWAWAY is not set
846CONFIG_KEYBOARD_PXA27x=m
847# CONFIG_KEYBOARD_GPIO is not set
688# CONFIG_INPUT_MOUSE is not set 848# CONFIG_INPUT_MOUSE is not set
689# CONFIG_INPUT_JOYSTICK is not set 849# CONFIG_INPUT_JOYSTICK is not set
690# CONFIG_INPUT_TABLET is not set 850# CONFIG_INPUT_TABLET is not set
691CONFIG_INPUT_TOUCHSCREEN=y 851CONFIG_INPUT_TOUCHSCREEN=y
852# CONFIG_TOUCHSCREEN_FUJITSU is not set
692# CONFIG_TOUCHSCREEN_GUNZE is not set 853# CONFIG_TOUCHSCREEN_GUNZE is not set
693# CONFIG_TOUCHSCREEN_ELO is not set 854# CONFIG_TOUCHSCREEN_ELO is not set
694# CONFIG_TOUCHSCREEN_MTOUCH is not set 855# CONFIG_TOUCHSCREEN_MTOUCH is not set
@@ -697,13 +858,22 @@ CONFIG_INPUT_TOUCHSCREEN=y
697# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set 858# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
698# CONFIG_TOUCHSCREEN_TOUCHWIN is not set 859# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
699CONFIG_TOUCHSCREEN_UCB1400=m 860CONFIG_TOUCHSCREEN_UCB1400=m
861CONFIG_TOUCHSCREEN_WM97XX=m
862# CONFIG_TOUCHSCREEN_WM9705 is not set
863CONFIG_TOUCHSCREEN_WM9712=y
864# CONFIG_TOUCHSCREEN_WM9713 is not set
865# CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE is not set
700# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set 866# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
701# CONFIG_INPUT_MISC is not set 867# CONFIG_INPUT_MISC is not set
702 868
703# 869#
704# Hardware I/O ports 870# Hardware I/O ports
705# 871#
706# CONFIG_SERIO is not set 872CONFIG_SERIO=y
873# CONFIG_SERIO_SERPORT is not set
874# CONFIG_SERIO_PCIPS2 is not set
875CONFIG_SERIO_LIBPS2=y
876# CONFIG_SERIO_RAW is not set
707# CONFIG_GAMEPORT is not set 877# CONFIG_GAMEPORT is not set
708 878
709# 879#
@@ -713,7 +883,9 @@ CONFIG_VT=y
713CONFIG_VT_CONSOLE=y 883CONFIG_VT_CONSOLE=y
714CONFIG_HW_CONSOLE=y 884CONFIG_HW_CONSOLE=y
715# CONFIG_VT_HW_CONSOLE_BINDING is not set 885# CONFIG_VT_HW_CONSOLE_BINDING is not set
886CONFIG_DEVKMEM=y
716# CONFIG_SERIAL_NONSTANDARD is not set 887# CONFIG_SERIAL_NONSTANDARD is not set
888# CONFIG_NOZOMI is not set
717 889
718# 890#
719# Serial drivers 891# Serial drivers
@@ -730,83 +902,141 @@ CONFIG_SERIAL_CORE_CONSOLE=y
730# CONFIG_SERIAL_JSM is not set 902# CONFIG_SERIAL_JSM is not set
731CONFIG_UNIX98_PTYS=y 903CONFIG_UNIX98_PTYS=y
732CONFIG_LEGACY_PTYS=y 904CONFIG_LEGACY_PTYS=y
733CONFIG_LEGACY_PTY_COUNT=256 905CONFIG_LEGACY_PTY_COUNT=16
734# CONFIG_IPMI_HANDLER is not set 906# CONFIG_IPMI_HANDLER is not set
735# CONFIG_WATCHDOG is not set 907# CONFIG_HW_RANDOM is not set
736CONFIG_HW_RANDOM=m
737# CONFIG_NVRAM is not set 908# CONFIG_NVRAM is not set
738# CONFIG_R3964 is not set 909# CONFIG_R3964 is not set
739# CONFIG_APPLICOM is not set 910# CONFIG_APPLICOM is not set
740# CONFIG_DRM is not set 911
912#
913# PCMCIA character devices
914#
915# CONFIG_SYNCLINK_CS is not set
916# CONFIG_CARDMAN_4000 is not set
917# CONFIG_CARDMAN_4040 is not set
918# CONFIG_IPWIRELESS is not set
741# CONFIG_RAW_DRIVER is not set 919# CONFIG_RAW_DRIVER is not set
742# CONFIG_TCG_TPM is not set 920# CONFIG_TCG_TPM is not set
743CONFIG_DEVPORT=y 921CONFIG_DEVPORT=y
744# CONFIG_I2C is not set 922CONFIG_I2C=y
923CONFIG_I2C_BOARDINFO=y
924CONFIG_I2C_CHARDEV=m
925
926#
927# I2C Hardware Bus support
928#
929# CONFIG_I2C_ALI1535 is not set
930# CONFIG_I2C_ALI1563 is not set
931# CONFIG_I2C_ALI15X3 is not set
932# CONFIG_I2C_AMD756 is not set
933# CONFIG_I2C_AMD8111 is not set
934# CONFIG_I2C_GPIO is not set
935# CONFIG_I2C_I801 is not set
936# CONFIG_I2C_I810 is not set
937CONFIG_I2C_PXA=y
938# CONFIG_I2C_PXA_SLAVE is not set
939# CONFIG_I2C_PIIX4 is not set
940# CONFIG_I2C_NFORCE2 is not set
941# CONFIG_I2C_OCORES is not set
942# CONFIG_I2C_PARPORT_LIGHT is not set
943# CONFIG_I2C_PROSAVAGE is not set
944# CONFIG_I2C_SAVAGE4 is not set
945# CONFIG_I2C_SIMTEC is not set
946# CONFIG_I2C_SIS5595 is not set
947# CONFIG_I2C_SIS630 is not set
948# CONFIG_I2C_SIS96X is not set
949# CONFIG_I2C_TAOS_EVM is not set
950# CONFIG_I2C_STUB is not set
951# CONFIG_I2C_TINY_USB is not set
952# CONFIG_I2C_VIA is not set
953# CONFIG_I2C_VIAPRO is not set
954# CONFIG_I2C_VOODOO3 is not set
955# CONFIG_I2C_PCA_PLATFORM is not set
956
957#
958# Miscellaneous I2C Chip support
959#
960# CONFIG_DS1682 is not set
961# CONFIG_SENSORS_EEPROM is not set
962# CONFIG_SENSORS_PCF8574 is not set
963# CONFIG_PCF8575 is not set
964# CONFIG_SENSORS_PCF8591 is not set
965# CONFIG_TPS65010 is not set
966# CONFIG_SENSORS_MAX6875 is not set
967# CONFIG_SENSORS_TSL2550 is not set
968# CONFIG_I2C_DEBUG_CORE is not set
969# CONFIG_I2C_DEBUG_ALGO is not set
970# CONFIG_I2C_DEBUG_BUS is not set
971# CONFIG_I2C_DEBUG_CHIP is not set
972# CONFIG_SPI is not set
973CONFIG_HAVE_GPIO_LIB=y
745 974
746# 975#
747# SPI support 976# GPIO Support
748# 977#
749# CONFIG_SPI is not set 978# CONFIG_DEBUG_GPIO is not set
750# CONFIG_SPI_MASTER is not set
751# CONFIG_W1 is not set
752# CONFIG_HWMON is not set
753CONFIG_MISC_DEVICES=y
754# CONFIG_PHANTOM is not set
755# CONFIG_EEPROM_93CX6 is not set
756# CONFIG_SGI_IOC4 is not set
757# CONFIG_TIFM_CORE is not set
758 979
759# 980#
760# Multifunction device drivers 981# I2C GPIO expanders:
761# 982#
762# CONFIG_MFD_SM501 is not set 983# CONFIG_GPIO_PCA953X is not set
984# CONFIG_GPIO_PCF857X is not set
763 985
764# 986#
765# LED devices 987# SPI GPIO expanders:
766# 988#
767CONFIG_NEW_LEDS=y 989# CONFIG_W1 is not set
768CONFIG_LEDS_CLASS=y 990# CONFIG_POWER_SUPPLY is not set
991# CONFIG_HWMON is not set
992# CONFIG_WATCHDOG is not set
769 993
770# 994#
771# LED drivers 995# Sonics Silicon Backplane
772# 996#
773CONFIG_LEDS_CM_X270=y 997CONFIG_SSB_POSSIBLE=y
998# CONFIG_SSB is not set
774 999
775# 1000#
776# LED Triggers 1001# Multifunction device drivers
777# 1002#
778CONFIG_LEDS_TRIGGERS=y 1003# CONFIG_MFD_SM501 is not set
779# CONFIG_LEDS_TRIGGER_TIMER is not set 1004# CONFIG_MFD_ASIC3 is not set
780# CONFIG_LEDS_TRIGGER_IDE_DISK is not set 1005# CONFIG_HTC_EGPIO is not set
781CONFIG_LEDS_TRIGGER_HEARTBEAT=y 1006# CONFIG_HTC_PASIC3 is not set
782 1007
783# 1008#
784# Multimedia devices 1009# Multimedia devices
785# 1010#
1011
1012#
1013# Multimedia core support
1014#
786# CONFIG_VIDEO_DEV is not set 1015# CONFIG_VIDEO_DEV is not set
787# CONFIG_DVB_CORE is not set 1016# CONFIG_DVB_CORE is not set
788CONFIG_DAB=y
789# CONFIG_USB_DABUSB is not set
790 1017
791# 1018#
792# Graphics support 1019# Multimedia drivers
793# 1020#
794# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1021# CONFIG_DAB is not set
795 1022
796# 1023#
797# Display device support 1024# Graphics support
798# 1025#
799# CONFIG_DISPLAY_SUPPORT is not set 1026# CONFIG_DRM is not set
800# CONFIG_VGASTATE is not set 1027# CONFIG_VGASTATE is not set
1028# CONFIG_VIDEO_OUTPUT_CONTROL is not set
801CONFIG_FB=y 1029CONFIG_FB=y
802# CONFIG_FIRMWARE_EDID is not set 1030# CONFIG_FIRMWARE_EDID is not set
803# CONFIG_FB_DDC is not set 1031# CONFIG_FB_DDC is not set
804CONFIG_FB_CFB_FILLRECT=y 1032CONFIG_FB_CFB_FILLRECT=y
805CONFIG_FB_CFB_COPYAREA=y 1033CONFIG_FB_CFB_COPYAREA=y
806CONFIG_FB_CFB_IMAGEBLIT=y 1034CONFIG_FB_CFB_IMAGEBLIT=y
1035# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
807# CONFIG_FB_SYS_FILLRECT is not set 1036# CONFIG_FB_SYS_FILLRECT is not set
808# CONFIG_FB_SYS_COPYAREA is not set 1037# CONFIG_FB_SYS_COPYAREA is not set
809# CONFIG_FB_SYS_IMAGEBLIT is not set 1038# CONFIG_FB_SYS_IMAGEBLIT is not set
1039# CONFIG_FB_FOREIGN_ENDIAN is not set
810# CONFIG_FB_SYS_FOPS is not set 1040# CONFIG_FB_SYS_FOPS is not set
811CONFIG_FB_DEFERRED_IO=y 1041CONFIG_FB_DEFERRED_IO=y
812# CONFIG_FB_SVGALIB is not set 1042# CONFIG_FB_SVGALIB is not set
@@ -842,9 +1072,17 @@ CONFIG_FB_DEFERRED_IO=y
842# CONFIG_FB_ARK is not set 1072# CONFIG_FB_ARK is not set
843# CONFIG_FB_PM3 is not set 1073# CONFIG_FB_PM3 is not set
844CONFIG_FB_PXA=y 1074CONFIG_FB_PXA=y
845# CONFIG_FB_PXA_PARAMETERS is not set 1075# CONFIG_FB_PXA_SMARTPANEL is not set
1076CONFIG_FB_PXA_PARAMETERS=y
846CONFIG_FB_MBX=m 1077CONFIG_FB_MBX=m
1078# CONFIG_FB_AM200EPD is not set
847# CONFIG_FB_VIRTUAL is not set 1079# CONFIG_FB_VIRTUAL is not set
1080# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1081
1082#
1083# Display device support
1084#
1085# CONFIG_DISPLAY_SUPPORT is not set
848 1086
849# 1087#
850# Console display driver support 1088# Console display driver support
@@ -904,10 +1142,12 @@ CONFIG_SND_AC97_CODEC=m
904# CONFIG_SND_AU8810 is not set 1142# CONFIG_SND_AU8810 is not set
905# CONFIG_SND_AU8820 is not set 1143# CONFIG_SND_AU8820 is not set
906# CONFIG_SND_AU8830 is not set 1144# CONFIG_SND_AU8830 is not set
1145# CONFIG_SND_AW2 is not set
907# CONFIG_SND_AZT3328 is not set 1146# CONFIG_SND_AZT3328 is not set
908# CONFIG_SND_BT87X is not set 1147# CONFIG_SND_BT87X is not set
909# CONFIG_SND_CA0106 is not set 1148# CONFIG_SND_CA0106 is not set
910# CONFIG_SND_CMIPCI is not set 1149# CONFIG_SND_CMIPCI is not set
1150# CONFIG_SND_OXYGEN is not set
911# CONFIG_SND_CS4281 is not set 1151# CONFIG_SND_CS4281 is not set
912# CONFIG_SND_CS46XX is not set 1152# CONFIG_SND_CS46XX is not set
913# CONFIG_SND_DARLA20 is not set 1153# CONFIG_SND_DARLA20 is not set
@@ -932,6 +1172,7 @@ CONFIG_SND_AC97_CODEC=m
932# CONFIG_SND_HDA_INTEL is not set 1172# CONFIG_SND_HDA_INTEL is not set
933# CONFIG_SND_HDSP is not set 1173# CONFIG_SND_HDSP is not set
934# CONFIG_SND_HDSPM is not set 1174# CONFIG_SND_HDSPM is not set
1175# CONFIG_SND_HIFIER is not set
935# CONFIG_SND_ICE1712 is not set 1176# CONFIG_SND_ICE1712 is not set
936# CONFIG_SND_ICE1724 is not set 1177# CONFIG_SND_ICE1724 is not set
937# CONFIG_SND_INTEL8X0 is not set 1178# CONFIG_SND_INTEL8X0 is not set
@@ -949,6 +1190,7 @@ CONFIG_SND_AC97_CODEC=m
949# CONFIG_SND_TRIDENT is not set 1190# CONFIG_SND_TRIDENT is not set
950# CONFIG_SND_VIA82XX is not set 1191# CONFIG_SND_VIA82XX is not set
951# CONFIG_SND_VIA82XX_MODEM is not set 1192# CONFIG_SND_VIA82XX_MODEM is not set
1193# CONFIG_SND_VIRTUOSO is not set
952# CONFIG_SND_VX222 is not set 1194# CONFIG_SND_VX222 is not set
953# CONFIG_SND_YMFPCI is not set 1195# CONFIG_SND_YMFPCI is not set
954# CONFIG_SND_AC97_POWER_SAVE is not set 1196# CONFIG_SND_AC97_POWER_SAVE is not set
@@ -966,18 +1208,33 @@ CONFIG_SND_PXA2XX_AC97=m
966# CONFIG_SND_USB_CAIAQ is not set 1208# CONFIG_SND_USB_CAIAQ is not set
967 1209
968# 1210#
1211# PCMCIA devices
1212#
1213# CONFIG_SND_VXPOCKET is not set
1214# CONFIG_SND_PDAUDIOCF is not set
1215
1216#
969# System on Chip audio support 1217# System on Chip audio support
970# 1218#
971# CONFIG_SND_SOC is not set 1219# CONFIG_SND_SOC is not set
972 1220
973# 1221#
1222# ALSA SoC audio for Freescale SOCs
1223#
1224
1225#
1226# SoC Audio for the Texas Instruments OMAP
1227#
1228
1229#
974# Open Sound System 1230# Open Sound System
975# 1231#
976# CONFIG_SOUND_PRIME is not set 1232# CONFIG_SOUND_PRIME is not set
977CONFIG_AC97_BUS=m 1233CONFIG_AC97_BUS=m
978CONFIG_HID_SUPPORT=y 1234CONFIG_HID_SUPPORT=y
979CONFIG_HID=y 1235CONFIG_HID=y
980# CONFIG_HID_DEBUG is not set 1236CONFIG_HID_DEBUG=y
1237# CONFIG_HIDRAW is not set
981 1238
982# 1239#
983# USB Input Devices 1240# USB Input Devices
@@ -992,6 +1249,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
992CONFIG_USB_ARCH_HAS_EHCI=y 1249CONFIG_USB_ARCH_HAS_EHCI=y
993CONFIG_USB=y 1250CONFIG_USB=y
994# CONFIG_USB_DEBUG is not set 1251# CONFIG_USB_DEBUG is not set
1252# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
995 1253
996# 1254#
997# Miscellaneous USB options 1255# Miscellaneous USB options
@@ -1000,8 +1258,9 @@ CONFIG_USB_DEVICEFS=y
1000# CONFIG_USB_DEVICE_CLASS is not set 1258# CONFIG_USB_DEVICE_CLASS is not set
1001# CONFIG_USB_DYNAMIC_MINORS is not set 1259# CONFIG_USB_DYNAMIC_MINORS is not set
1002# CONFIG_USB_SUSPEND is not set 1260# CONFIG_USB_SUSPEND is not set
1003# CONFIG_USB_PERSIST is not set
1004# CONFIG_USB_OTG is not set 1261# CONFIG_USB_OTG is not set
1262# CONFIG_USB_OTG_WHITELIST is not set
1263# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1005 1264
1006# 1265#
1007# USB Host Controller Drivers 1266# USB Host Controller Drivers
@@ -1033,13 +1292,16 @@ CONFIG_USB_STORAGE=y
1033# CONFIG_USB_STORAGE_DEBUG is not set 1292# CONFIG_USB_STORAGE_DEBUG is not set
1034# CONFIG_USB_STORAGE_DATAFAB is not set 1293# CONFIG_USB_STORAGE_DATAFAB is not set
1035# CONFIG_USB_STORAGE_FREECOM is not set 1294# CONFIG_USB_STORAGE_FREECOM is not set
1295# CONFIG_USB_STORAGE_ISD200 is not set
1036# CONFIG_USB_STORAGE_DPCM is not set 1296# CONFIG_USB_STORAGE_DPCM is not set
1037# CONFIG_USB_STORAGE_USBAT is not set 1297# CONFIG_USB_STORAGE_USBAT is not set
1038# CONFIG_USB_STORAGE_SDDR09 is not set 1298# CONFIG_USB_STORAGE_SDDR09 is not set
1039# CONFIG_USB_STORAGE_SDDR55 is not set 1299# CONFIG_USB_STORAGE_SDDR55 is not set
1040# CONFIG_USB_STORAGE_JUMPSHOT is not set 1300# CONFIG_USB_STORAGE_JUMPSHOT is not set
1041# CONFIG_USB_STORAGE_ALAUDA is not set 1301# CONFIG_USB_STORAGE_ALAUDA is not set
1302# CONFIG_USB_STORAGE_ONETOUCH is not set
1042# CONFIG_USB_STORAGE_KARMA is not set 1303# CONFIG_USB_STORAGE_KARMA is not set
1304# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1043# CONFIG_USB_LIBUSUAL is not set 1305# CONFIG_USB_LIBUSUAL is not set
1044 1306
1045# 1307#
@@ -1052,10 +1314,6 @@ CONFIG_USB_MON=y
1052# 1314#
1053# USB port drivers 1315# USB port drivers
1054# 1316#
1055
1056#
1057# USB Serial Converter support
1058#
1059# CONFIG_USB_SERIAL is not set 1317# CONFIG_USB_SERIAL is not set
1060 1318
1061# 1319#
@@ -1080,14 +1338,6 @@ CONFIG_USB_MON=y
1080# CONFIG_USB_TRANCEVIBRATOR is not set 1338# CONFIG_USB_TRANCEVIBRATOR is not set
1081# CONFIG_USB_IOWARRIOR is not set 1339# CONFIG_USB_IOWARRIOR is not set
1082# CONFIG_USB_TEST is not set 1340# CONFIG_USB_TEST is not set
1083
1084#
1085# USB DSL modem support
1086#
1087
1088#
1089# USB Gadget Support
1090#
1091# CONFIG_USB_GADGET is not set 1341# CONFIG_USB_GADGET is not set
1092CONFIG_MMC=m 1342CONFIG_MMC=m
1093# CONFIG_MMC_DEBUG is not set 1343# CONFIG_MMC_DEBUG is not set
@@ -1098,6 +1348,7 @@ CONFIG_MMC=m
1098# 1348#
1099CONFIG_MMC_BLOCK=m 1349CONFIG_MMC_BLOCK=m
1100CONFIG_MMC_BLOCK_BOUNCE=y 1350CONFIG_MMC_BLOCK_BOUNCE=y
1351# CONFIG_SDIO_UART is not set
1101 1352
1102# 1353#
1103# MMC/SD Host Controller Drivers 1354# MMC/SD Host Controller Drivers
@@ -1105,10 +1356,22 @@ CONFIG_MMC_BLOCK_BOUNCE=y
1105CONFIG_MMC_PXA=m 1356CONFIG_MMC_PXA=m
1106# CONFIG_MMC_SDHCI is not set 1357# CONFIG_MMC_SDHCI is not set
1107# CONFIG_MMC_TIFM_SD is not set 1358# CONFIG_MMC_TIFM_SD is not set
1359CONFIG_NEW_LEDS=y
1360CONFIG_LEDS_CLASS=y
1108 1361
1109# 1362#
1110# Real Time Clock 1363# LED drivers
1111# 1364#
1365# CONFIG_LEDS_GPIO is not set
1366CONFIG_LEDS_CM_X270=y
1367
1368#
1369# LED Triggers
1370#
1371CONFIG_LEDS_TRIGGERS=y
1372# CONFIG_LEDS_TRIGGER_TIMER is not set
1373CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1374# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
1112CONFIG_RTC_LIB=y 1375CONFIG_RTC_LIB=y
1113CONFIG_RTC_CLASS=y 1376CONFIG_RTC_CLASS=y
1114CONFIG_RTC_HCTOSYS=y 1377CONFIG_RTC_HCTOSYS=y
@@ -1125,11 +1388,32 @@ CONFIG_RTC_INTF_DEV=y
1125# CONFIG_RTC_DRV_TEST is not set 1388# CONFIG_RTC_DRV_TEST is not set
1126 1389
1127# 1390#
1391# I2C RTC drivers
1392#
1393# CONFIG_RTC_DRV_DS1307 is not set
1394# CONFIG_RTC_DRV_DS1374 is not set
1395# CONFIG_RTC_DRV_DS1672 is not set
1396# CONFIG_RTC_DRV_MAX6900 is not set
1397# CONFIG_RTC_DRV_RS5C372 is not set
1398# CONFIG_RTC_DRV_ISL1208 is not set
1399# CONFIG_RTC_DRV_X1205 is not set
1400# CONFIG_RTC_DRV_PCF8563 is not set
1401# CONFIG_RTC_DRV_PCF8583 is not set
1402# CONFIG_RTC_DRV_M41T80 is not set
1403# CONFIG_RTC_DRV_S35390A is not set
1404
1405#
1406# SPI RTC drivers
1407#
1408
1409#
1128# Platform RTC drivers 1410# Platform RTC drivers
1129# 1411#
1130# CONFIG_RTC_DRV_CMOS is not set 1412# CONFIG_RTC_DRV_CMOS is not set
1413# CONFIG_RTC_DRV_DS1511 is not set
1131# CONFIG_RTC_DRV_DS1553 is not set 1414# CONFIG_RTC_DRV_DS1553 is not set
1132# CONFIG_RTC_DRV_DS1742 is not set 1415# CONFIG_RTC_DRV_DS1742 is not set
1416# CONFIG_RTC_DRV_STK17TA8 is not set
1133# CONFIG_RTC_DRV_M48T86 is not set 1417# CONFIG_RTC_DRV_M48T86 is not set
1134# CONFIG_RTC_DRV_M48T59 is not set 1418# CONFIG_RTC_DRV_M48T59 is not set
1135CONFIG_RTC_DRV_V3020=y 1419CONFIG_RTC_DRV_V3020=y
@@ -1138,19 +1422,7 @@ CONFIG_RTC_DRV_V3020=y
1138# on-CPU RTC drivers 1422# on-CPU RTC drivers
1139# 1423#
1140CONFIG_RTC_DRV_SA1100=y 1424CONFIG_RTC_DRV_SA1100=y
1141 1425# CONFIG_UIO is not set
1142#
1143# DMA Engine support
1144#
1145# CONFIG_DMA_ENGINE is not set
1146
1147#
1148# DMA Clients
1149#
1150
1151#
1152# DMA Devices
1153#
1154 1426
1155# 1427#
1156# File systems 1428# File systems
@@ -1164,20 +1436,16 @@ CONFIG_EXT3_FS_XATTR=y
1164# CONFIG_EXT3_FS_SECURITY is not set 1436# CONFIG_EXT3_FS_SECURITY is not set
1165# CONFIG_EXT4DEV_FS is not set 1437# CONFIG_EXT4DEV_FS is not set
1166CONFIG_JBD=y 1438CONFIG_JBD=y
1167# CONFIG_JBD_DEBUG is not set
1168CONFIG_FS_MBCACHE=y 1439CONFIG_FS_MBCACHE=y
1169# CONFIG_REISERFS_FS is not set 1440# CONFIG_REISERFS_FS is not set
1170# CONFIG_JFS_FS is not set 1441# CONFIG_JFS_FS is not set
1171# CONFIG_FS_POSIX_ACL is not set 1442# CONFIG_FS_POSIX_ACL is not set
1172# CONFIG_XFS_FS is not set 1443# CONFIG_XFS_FS is not set
1173# CONFIG_GFS2_FS is not set
1174# CONFIG_OCFS2_FS is not set 1444# CONFIG_OCFS2_FS is not set
1175# CONFIG_MINIX_FS is not set 1445CONFIG_DNOTIFY=y
1176# CONFIG_ROMFS_FS is not set
1177CONFIG_INOTIFY=y 1446CONFIG_INOTIFY=y
1178CONFIG_INOTIFY_USER=y 1447CONFIG_INOTIFY_USER=y
1179# CONFIG_QUOTA is not set 1448# CONFIG_QUOTA is not set
1180CONFIG_DNOTIFY=y
1181# CONFIG_AUTOFS_FS is not set 1449# CONFIG_AUTOFS_FS is not set
1182# CONFIG_AUTOFS4_FS is not set 1450# CONFIG_AUTOFS4_FS is not set
1183# CONFIG_FUSE_FS is not set 1451# CONFIG_FUSE_FS is not set
@@ -1191,9 +1459,9 @@ CONFIG_DNOTIFY=y
1191# 1459#
1192# DOS/FAT/NT Filesystems 1460# DOS/FAT/NT Filesystems
1193# 1461#
1194CONFIG_FAT_FS=y 1462CONFIG_FAT_FS=m
1195CONFIG_MSDOS_FS=y 1463# CONFIG_MSDOS_FS is not set
1196CONFIG_VFAT_FS=y 1464CONFIG_VFAT_FS=m
1197CONFIG_FAT_DEFAULT_CODEPAGE=437 1465CONFIG_FAT_DEFAULT_CODEPAGE=437
1198CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 1466CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1199# CONFIG_NTFS_FS is not set 1467# CONFIG_NTFS_FS is not set
@@ -1207,7 +1475,6 @@ CONFIG_SYSFS=y
1207CONFIG_TMPFS=y 1475CONFIG_TMPFS=y
1208# CONFIG_TMPFS_POSIX_ACL is not set 1476# CONFIG_TMPFS_POSIX_ACL is not set
1209# CONFIG_HUGETLB_PAGE is not set 1477# CONFIG_HUGETLB_PAGE is not set
1210CONFIG_RAMFS=y
1211# CONFIG_CONFIGFS_FS is not set 1478# CONFIG_CONFIGFS_FS is not set
1212 1479
1213# 1480#
@@ -1220,22 +1487,30 @@ CONFIG_RAMFS=y
1220# CONFIG_BEFS_FS is not set 1487# CONFIG_BEFS_FS is not set
1221# CONFIG_BFS_FS is not set 1488# CONFIG_BFS_FS is not set
1222# CONFIG_EFS_FS is not set 1489# CONFIG_EFS_FS is not set
1223# CONFIG_JFFS2_FS is not set 1490CONFIG_JFFS2_FS=y
1491CONFIG_JFFS2_FS_DEBUG=0
1492CONFIG_JFFS2_FS_WRITEBUFFER=y
1493# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1494CONFIG_JFFS2_SUMMARY=y
1495# CONFIG_JFFS2_FS_XATTR is not set
1496# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1497CONFIG_JFFS2_ZLIB=y
1498# CONFIG_JFFS2_LZO is not set
1499CONFIG_JFFS2_RTIME=y
1500# CONFIG_JFFS2_RUBIN is not set
1224# CONFIG_CRAMFS is not set 1501# CONFIG_CRAMFS is not set
1225# CONFIG_VXFS_FS is not set 1502# CONFIG_VXFS_FS is not set
1503# CONFIG_MINIX_FS is not set
1226# CONFIG_HPFS_FS is not set 1504# CONFIG_HPFS_FS is not set
1227# CONFIG_QNX4FS_FS is not set 1505# CONFIG_QNX4FS_FS is not set
1506# CONFIG_ROMFS_FS is not set
1228# CONFIG_SYSV_FS is not set 1507# CONFIG_SYSV_FS is not set
1229# CONFIG_UFS_FS is not set 1508# CONFIG_UFS_FS is not set
1230 1509CONFIG_NETWORK_FILESYSTEMS=y
1231#
1232# Network File Systems
1233#
1234CONFIG_NFS_FS=y 1510CONFIG_NFS_FS=y
1235CONFIG_NFS_V3=y 1511CONFIG_NFS_V3=y
1236# CONFIG_NFS_V3_ACL is not set 1512# CONFIG_NFS_V3_ACL is not set
1237# CONFIG_NFS_V4 is not set 1513# CONFIG_NFS_V4 is not set
1238# CONFIG_NFS_DIRECTIO is not set
1239# CONFIG_NFSD is not set 1514# CONFIG_NFSD is not set
1240CONFIG_ROOT_NFS=y 1515CONFIG_ROOT_NFS=y
1241CONFIG_LOCKD=y 1516CONFIG_LOCKD=y
@@ -1245,9 +1520,13 @@ CONFIG_SUNRPC=y
1245# CONFIG_SUNRPC_BIND34 is not set 1520# CONFIG_SUNRPC_BIND34 is not set
1246# CONFIG_RPCSEC_GSS_KRB5 is not set 1521# CONFIG_RPCSEC_GSS_KRB5 is not set
1247# CONFIG_RPCSEC_GSS_SPKM3 is not set 1522# CONFIG_RPCSEC_GSS_SPKM3 is not set
1248CONFIG_SMB_FS=y 1523# CONFIG_SMB_FS is not set
1249# CONFIG_SMB_NLS_DEFAULT is not set 1524CONFIG_CIFS=m
1250# CONFIG_CIFS is not set 1525# CONFIG_CIFS_STATS is not set
1526# CONFIG_CIFS_WEAK_PW_HASH is not set
1527# CONFIG_CIFS_XATTR is not set
1528# CONFIG_CIFS_DEBUG2 is not set
1529# CONFIG_CIFS_EXPERIMENTAL is not set
1251# CONFIG_NCP_FS is not set 1530# CONFIG_NCP_FS is not set
1252# CONFIG_CODA_FS is not set 1531# CONFIG_CODA_FS is not set
1253# CONFIG_AFS_FS is not set 1532# CONFIG_AFS_FS is not set
@@ -1255,15 +1534,27 @@ CONFIG_SMB_FS=y
1255# 1534#
1256# Partition Types 1535# Partition Types
1257# 1536#
1258# CONFIG_PARTITION_ADVANCED is not set 1537CONFIG_PARTITION_ADVANCED=y
1538# CONFIG_ACORN_PARTITION is not set
1539# CONFIG_OSF_PARTITION is not set
1540# CONFIG_AMIGA_PARTITION is not set
1541# CONFIG_ATARI_PARTITION is not set
1542# CONFIG_MAC_PARTITION is not set
1259CONFIG_MSDOS_PARTITION=y 1543CONFIG_MSDOS_PARTITION=y
1260 1544# CONFIG_BSD_DISKLABEL is not set
1261# 1545# CONFIG_MINIX_SUBPARTITION is not set
1262# Native Language Support 1546# CONFIG_SOLARIS_X86_PARTITION is not set
1263# 1547# CONFIG_UNIXWARE_DISKLABEL is not set
1264CONFIG_NLS=y 1548# CONFIG_LDM_PARTITION is not set
1549# CONFIG_SGI_PARTITION is not set
1550# CONFIG_ULTRIX_PARTITION is not set
1551# CONFIG_SUN_PARTITION is not set
1552# CONFIG_KARMA_PARTITION is not set
1553# CONFIG_EFI_PARTITION is not set
1554# CONFIG_SYSV68_PARTITION is not set
1555CONFIG_NLS=m
1265CONFIG_NLS_DEFAULT="iso8859-1" 1556CONFIG_NLS_DEFAULT="iso8859-1"
1266CONFIG_NLS_CODEPAGE_437=y 1557CONFIG_NLS_CODEPAGE_437=m
1267# CONFIG_NLS_CODEPAGE_737 is not set 1558# CONFIG_NLS_CODEPAGE_737 is not set
1268# CONFIG_NLS_CODEPAGE_775 is not set 1559# CONFIG_NLS_CODEPAGE_775 is not set
1269# CONFIG_NLS_CODEPAGE_850 is not set 1560# CONFIG_NLS_CODEPAGE_850 is not set
@@ -1287,7 +1578,7 @@ CONFIG_NLS_CODEPAGE_437=y
1287# CONFIG_NLS_CODEPAGE_1250 is not set 1578# CONFIG_NLS_CODEPAGE_1250 is not set
1288# CONFIG_NLS_CODEPAGE_1251 is not set 1579# CONFIG_NLS_CODEPAGE_1251 is not set
1289# CONFIG_NLS_ASCII is not set 1580# CONFIG_NLS_ASCII is not set
1290CONFIG_NLS_ISO8859_1=y 1581CONFIG_NLS_ISO8859_1=m
1291# CONFIG_NLS_ISO8859_2 is not set 1582# CONFIG_NLS_ISO8859_2 is not set
1292# CONFIG_NLS_ISO8859_3 is not set 1583# CONFIG_NLS_ISO8859_3 is not set
1293# CONFIG_NLS_ISO8859_4 is not set 1584# CONFIG_NLS_ISO8859_4 is not set
@@ -1300,53 +1591,52 @@ CONFIG_NLS_ISO8859_1=y
1300# CONFIG_NLS_ISO8859_15 is not set 1591# CONFIG_NLS_ISO8859_15 is not set
1301# CONFIG_NLS_KOI8_R is not set 1592# CONFIG_NLS_KOI8_R is not set
1302# CONFIG_NLS_KOI8_U is not set 1593# CONFIG_NLS_KOI8_U is not set
1303# CONFIG_NLS_UTF8 is not set 1594CONFIG_NLS_UTF8=m
1304
1305#
1306# Distributed Lock Manager
1307#
1308# CONFIG_DLM is not set 1595# CONFIG_DLM is not set
1309 1596
1310# 1597#
1311# Profiling support
1312#
1313# CONFIG_PROFILING is not set
1314
1315#
1316# Kernel hacking 1598# Kernel hacking
1317# 1599#
1318# CONFIG_PRINTK_TIME is not set 1600# CONFIG_PRINTK_TIME is not set
1601CONFIG_ENABLE_WARN_DEPRECATED=y
1319CONFIG_ENABLE_MUST_CHECK=y 1602CONFIG_ENABLE_MUST_CHECK=y
1320CONFIG_MAGIC_SYSRQ=y 1603CONFIG_FRAME_WARN=0
1604# CONFIG_MAGIC_SYSRQ is not set
1321# CONFIG_UNUSED_SYMBOLS is not set 1605# CONFIG_UNUSED_SYMBOLS is not set
1322# CONFIG_DEBUG_FS is not set 1606# CONFIG_DEBUG_FS is not set
1323# CONFIG_HEADERS_CHECK is not set 1607# CONFIG_HEADERS_CHECK is not set
1324CONFIG_DEBUG_KERNEL=y 1608CONFIG_DEBUG_KERNEL=y
1325# CONFIG_DEBUG_SHIRQ is not set 1609# CONFIG_DEBUG_SHIRQ is not set
1326# CONFIG_DETECT_SOFTLOCKUP is not set 1610# CONFIG_DETECT_SOFTLOCKUP is not set
1327CONFIG_SCHED_DEBUG=y 1611# CONFIG_SCHED_DEBUG is not set
1328# CONFIG_SCHEDSTATS is not set 1612# CONFIG_SCHEDSTATS is not set
1329# CONFIG_TIMER_STATS is not set 1613# CONFIG_TIMER_STATS is not set
1330# CONFIG_DEBUG_SLAB is not set 1614# CONFIG_DEBUG_OBJECTS is not set
1331# CONFIG_DEBUG_RT_MUTEXES is not set 1615# CONFIG_DEBUG_RT_MUTEXES is not set
1332# CONFIG_RT_MUTEX_TESTER is not set 1616# CONFIG_RT_MUTEX_TESTER is not set
1333# CONFIG_DEBUG_SPINLOCK is not set 1617# CONFIG_DEBUG_SPINLOCK is not set
1334# CONFIG_DEBUG_MUTEXES is not set 1618# CONFIG_DEBUG_MUTEXES is not set
1335# CONFIG_DEBUG_LOCK_ALLOC is not set 1619# CONFIG_DEBUG_LOCK_ALLOC is not set
1336# CONFIG_PROVE_LOCKING is not set 1620# CONFIG_PROVE_LOCKING is not set
1621# CONFIG_LOCK_STAT is not set
1337# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1622# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1338# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1623# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1339# CONFIG_DEBUG_KOBJECT is not set 1624# CONFIG_DEBUG_KOBJECT is not set
1340# CONFIG_DEBUG_BUGVERBOSE is not set 1625# CONFIG_DEBUG_BUGVERBOSE is not set
1341CONFIG_DEBUG_INFO=y 1626# CONFIG_DEBUG_INFO is not set
1342# CONFIG_DEBUG_VM is not set 1627# CONFIG_DEBUG_VM is not set
1628# CONFIG_DEBUG_WRITECOUNT is not set
1343# CONFIG_DEBUG_LIST is not set 1629# CONFIG_DEBUG_LIST is not set
1630# CONFIG_DEBUG_SG is not set
1344CONFIG_FRAME_POINTER=y 1631CONFIG_FRAME_POINTER=y
1345CONFIG_FORCED_INLINING=y 1632# CONFIG_BOOT_PRINTK_DELAY is not set
1346# CONFIG_RCU_TORTURE_TEST is not set 1633# CONFIG_RCU_TORTURE_TEST is not set
1634# CONFIG_BACKTRACE_SELF_TEST is not set
1347# CONFIG_FAULT_INJECTION is not set 1635# CONFIG_FAULT_INJECTION is not set
1636# CONFIG_SAMPLES is not set
1348CONFIG_DEBUG_USER=y 1637CONFIG_DEBUG_USER=y
1349CONFIG_DEBUG_ERRORS=y 1638CONFIG_DEBUG_ERRORS=y
1639# CONFIG_DEBUG_STACK_USAGE is not set
1350CONFIG_DEBUG_LL=y 1640CONFIG_DEBUG_LL=y
1351# CONFIG_DEBUG_ICEDCC is not set 1641# CONFIG_DEBUG_ICEDCC is not set
1352 1642
@@ -1355,55 +1645,96 @@ CONFIG_DEBUG_LL=y
1355# 1645#
1356# CONFIG_KEYS is not set 1646# CONFIG_KEYS is not set
1357# CONFIG_SECURITY is not set 1647# CONFIG_SECURITY is not set
1648# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1358CONFIG_CRYPTO=y 1649CONFIG_CRYPTO=y
1359CONFIG_CRYPTO_ALGAPI=m 1650
1360CONFIG_CRYPTO_BLKCIPHER=m 1651#
1361CONFIG_CRYPTO_MANAGER=m 1652# Crypto core or helper
1653#
1654# CONFIG_CRYPTO_MANAGER is not set
1655# CONFIG_CRYPTO_GF128MUL is not set
1656# CONFIG_CRYPTO_NULL is not set
1657# CONFIG_CRYPTO_CRYPTD is not set
1658# CONFIG_CRYPTO_AUTHENC is not set
1659# CONFIG_CRYPTO_TEST is not set
1660
1661#
1662# Authenticated Encryption with Associated Data
1663#
1664# CONFIG_CRYPTO_CCM is not set
1665# CONFIG_CRYPTO_GCM is not set
1666# CONFIG_CRYPTO_SEQIV is not set
1667
1668#
1669# Block modes
1670#
1671# CONFIG_CRYPTO_CBC is not set
1672# CONFIG_CRYPTO_CTR is not set
1673# CONFIG_CRYPTO_CTS is not set
1674# CONFIG_CRYPTO_ECB is not set
1675# CONFIG_CRYPTO_LRW is not set
1676# CONFIG_CRYPTO_PCBC is not set
1677# CONFIG_CRYPTO_XTS is not set
1678
1679#
1680# Hash modes
1681#
1362# CONFIG_CRYPTO_HMAC is not set 1682# CONFIG_CRYPTO_HMAC is not set
1363# CONFIG_CRYPTO_XCBC is not set 1683# CONFIG_CRYPTO_XCBC is not set
1364# CONFIG_CRYPTO_NULL is not set 1684
1685#
1686# Digest
1687#
1688# CONFIG_CRYPTO_CRC32C is not set
1365# CONFIG_CRYPTO_MD4 is not set 1689# CONFIG_CRYPTO_MD4 is not set
1366# CONFIG_CRYPTO_MD5 is not set 1690# CONFIG_CRYPTO_MD5 is not set
1691# CONFIG_CRYPTO_MICHAEL_MIC is not set
1367# CONFIG_CRYPTO_SHA1 is not set 1692# CONFIG_CRYPTO_SHA1 is not set
1368# CONFIG_CRYPTO_SHA256 is not set 1693# CONFIG_CRYPTO_SHA256 is not set
1369# CONFIG_CRYPTO_SHA512 is not set 1694# CONFIG_CRYPTO_SHA512 is not set
1370# CONFIG_CRYPTO_WP512 is not set
1371# CONFIG_CRYPTO_TGR192 is not set 1695# CONFIG_CRYPTO_TGR192 is not set
1372# CONFIG_CRYPTO_GF128MUL is not set 1696# CONFIG_CRYPTO_WP512 is not set
1373CONFIG_CRYPTO_ECB=m 1697
1374CONFIG_CRYPTO_CBC=m 1698#
1375CONFIG_CRYPTO_PCBC=m 1699# Ciphers
1376# CONFIG_CRYPTO_LRW is not set 1700#
1377# CONFIG_CRYPTO_CRYPTD is not set 1701# CONFIG_CRYPTO_AES is not set
1378# CONFIG_CRYPTO_DES is not set 1702# CONFIG_CRYPTO_ANUBIS is not set
1379# CONFIG_CRYPTO_FCRYPT is not set 1703# CONFIG_CRYPTO_ARC4 is not set
1380# CONFIG_CRYPTO_BLOWFISH is not set 1704# CONFIG_CRYPTO_BLOWFISH is not set
1381# CONFIG_CRYPTO_TWOFISH is not set 1705# CONFIG_CRYPTO_CAMELLIA is not set
1382# CONFIG_CRYPTO_SERPENT is not set
1383CONFIG_CRYPTO_AES=m
1384# CONFIG_CRYPTO_CAST5 is not set 1706# CONFIG_CRYPTO_CAST5 is not set
1385# CONFIG_CRYPTO_CAST6 is not set 1707# CONFIG_CRYPTO_CAST6 is not set
1386# CONFIG_CRYPTO_TEA is not set 1708# CONFIG_CRYPTO_DES is not set
1387CONFIG_CRYPTO_ARC4=m 1709# CONFIG_CRYPTO_FCRYPT is not set
1388# CONFIG_CRYPTO_KHAZAD is not set 1710# CONFIG_CRYPTO_KHAZAD is not set
1389# CONFIG_CRYPTO_ANUBIS is not set 1711# CONFIG_CRYPTO_SALSA20 is not set
1712# CONFIG_CRYPTO_SEED is not set
1713# CONFIG_CRYPTO_SERPENT is not set
1714# CONFIG_CRYPTO_TEA is not set
1715# CONFIG_CRYPTO_TWOFISH is not set
1716
1717#
1718# Compression
1719#
1390# CONFIG_CRYPTO_DEFLATE is not set 1720# CONFIG_CRYPTO_DEFLATE is not set
1391# CONFIG_CRYPTO_MICHAEL_MIC is not set 1721# CONFIG_CRYPTO_LZO is not set
1392# CONFIG_CRYPTO_CRC32C is not set 1722# CONFIG_CRYPTO_HW is not set
1393# CONFIG_CRYPTO_CAMELLIA is not set
1394# CONFIG_CRYPTO_TEST is not set
1395CONFIG_CRYPTO_HW=y
1396 1723
1397# 1724#
1398# Library routines 1725# Library routines
1399# 1726#
1400CONFIG_BITREVERSE=y 1727CONFIG_BITREVERSE=y
1401# CONFIG_CRC_CCITT is not set 1728# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1729# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1730CONFIG_CRC_CCITT=m
1402# CONFIG_CRC16 is not set 1731# CONFIG_CRC16 is not set
1403# CONFIG_CRC_ITU_T is not set 1732# CONFIG_CRC_ITU_T is not set
1404CONFIG_CRC32=y 1733CONFIG_CRC32=y
1405# CONFIG_CRC7 is not set 1734# CONFIG_CRC7 is not set
1406# CONFIG_LIBCRC32C is not set 1735# CONFIG_LIBCRC32C is not set
1736CONFIG_ZLIB_INFLATE=y
1737CONFIG_ZLIB_DEFLATE=y
1407CONFIG_PLIST=y 1738CONFIG_PLIST=y
1408CONFIG_HAS_IOMEM=y 1739CONFIG_HAS_IOMEM=y
1409CONFIG_HAS_IOPORT=y 1740CONFIG_HAS_IOPORT=y
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index ad455ff5aebe..eb9092ca8008 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -4,6 +4,10 @@
4 4
5AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 5AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
6 6
7ifdef CONFIG_DYNAMIC_FTRACE
8CFLAGS_REMOVE_ftrace.o = -pg
9endif
10
7# Object file lists. 11# Object file lists.
8 12
9obj-y := compat.o entry-armv.o entry-common.o irq.o \ 13obj-y := compat.o entry-armv.o entry-common.o irq.o \
@@ -18,6 +22,7 @@ obj-$(CONFIG_ARTHUR) += arthur.o
18obj-$(CONFIG_ISA_DMA) += dma-isa.o 22obj-$(CONFIG_ISA_DMA) += dma-isa.o
19obj-$(CONFIG_PCI) += bios32.o isa.o 23obj-$(CONFIG_PCI) += bios32.o isa.o
20obj-$(CONFIG_SMP) += smp.o 24obj-$(CONFIG_SMP) += smp.o
25obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
21obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 26obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
22obj-$(CONFIG_KPROBES) += kprobes.o kprobes-decode.o 27obj-$(CONFIG_KPROBES) += kprobes.o kprobes-decode.o
23obj-$(CONFIG_ATAGS_PROC) += atags.o 28obj-$(CONFIG_ATAGS_PROC) += atags.o
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 688b7b1ee416..cc7b246e9652 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -18,6 +18,7 @@
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/uaccess.h> 20#include <asm/uaccess.h>
21#include <asm/ftrace.h>
21 22
22/* 23/*
23 * libgcc functions - functions that are used internally by the 24 * libgcc functions - functions that are used internally by the
@@ -181,3 +182,7 @@ EXPORT_SYMBOL(_find_next_bit_be);
181#endif 182#endif
182 183
183EXPORT_SYMBOL(copy_page); 184EXPORT_SYMBOL(copy_page);
185
186#ifdef CONFIG_FTRACE
187EXPORT_SYMBOL(mcount);
188#endif
diff --git a/arch/arm/kernel/atags.c b/arch/arm/kernel/atags.c
index 64c420805e6f..42a1a1415fa6 100644
--- a/arch/arm/kernel/atags.c
+++ b/arch/arm/kernel/atags.c
@@ -1,5 +1,4 @@
1#include <linux/slab.h> 1#include <linux/slab.h>
2#include <linux/kexec.h>
3#include <linux/proc_fs.h> 2#include <linux/proc_fs.h>
4#include <asm/setup.h> 3#include <asm/setup.h>
5#include <asm/types.h> 4#include <asm/types.h>
@@ -7,9 +6,8 @@
7 6
8struct buffer { 7struct buffer {
9 size_t size; 8 size_t size;
10 char *data; 9 char data[];
11}; 10};
12static struct buffer tags_buffer;
13 11
14static int 12static int
15read_buffer(char* page, char** start, off_t off, int count, 13read_buffer(char* page, char** start, off_t off, int count,
@@ -29,58 +27,57 @@ read_buffer(char* page, char** start, off_t off, int count,
29 return count; 27 return count;
30} 28}
31 29
32 30#define BOOT_PARAMS_SIZE 1536
33static int 31static char __initdata atags_copy[BOOT_PARAMS_SIZE];
34create_proc_entries(void)
35{
36 struct proc_dir_entry* tags_entry;
37
38 tags_entry = create_proc_read_entry("atags", 0400, NULL, read_buffer, &tags_buffer);
39 if (!tags_entry)
40 return -ENOMEM;
41
42 return 0;
43}
44
45
46static char __initdata atags_copy_buf[KEXEC_BOOT_PARAMS_SIZE];
47static char __initdata *atags_copy;
48 32
49void __init save_atags(const struct tag *tags) 33void __init save_atags(const struct tag *tags)
50{ 34{
51 atags_copy = atags_copy_buf; 35 memcpy(atags_copy, tags, sizeof(atags_copy));
52 memcpy(atags_copy, tags, KEXEC_BOOT_PARAMS_SIZE);
53} 36}
54 37
55
56static int __init init_atags_procfs(void) 38static int __init init_atags_procfs(void)
57{ 39{
58 struct tag *tag; 40 /*
59 int error; 41 * This cannot go into save_atags() because kmalloc and proc don't work
42 * yet when it is called.
43 */
44 struct proc_dir_entry *tags_entry;
45 struct tag *tag = (struct tag *)atags_copy;
46 struct buffer *b;
47 size_t size;
60 48
61 if (!atags_copy) { 49 if (tag->hdr.tag != ATAG_CORE) {
62 printk(KERN_WARNING "Exporting ATAGs: No saved tags found\n"); 50 printk(KERN_INFO "No ATAGs?");
63 return -EIO; 51 return -EINVAL;
64 } 52 }
65 53
66 for (tag = (struct tag *) atags_copy; tag->hdr.size; tag = tag_next(tag)) 54 for (; tag->hdr.size; tag = tag_next(tag))
67 ; 55 ;
68 56
69 tags_buffer.size = ((char *) tag - atags_copy) + sizeof(tag->hdr); 57 /* include the terminating ATAG_NONE */
70 tags_buffer.data = kmalloc(tags_buffer.size, GFP_KERNEL); 58 size = (char *)tag - atags_copy + sizeof(struct tag_header);
71 if (tags_buffer.data == NULL)
72 return -ENOMEM;
73 memcpy(tags_buffer.data, atags_copy, tags_buffer.size);
74
75 error = create_proc_entries();
76 if (error) {
77 printk(KERN_ERR "Exporting ATAGs: not enough memory\n");
78 kfree(tags_buffer.data);
79 tags_buffer.size = 0;
80 tags_buffer.data = NULL;
81 }
82 59
83 return error; 60 WARN_ON(tag->hdr.tag != ATAG_NONE);
84} 61
62 b = kmalloc(sizeof(*b) + size, GFP_KERNEL);
63 if (!b)
64 goto nomem;
85 65
66 b->size = size;
67 memcpy(b->data, atags_copy, size);
68
69 tags_entry = create_proc_read_entry("atags", 0400,
70 NULL, read_buffer, b);
71
72 if (!tags_entry)
73 goto nomem;
74
75 return 0;
76
77nomem:
78 kfree(b);
79 printk(KERN_ERR "Exporting ATAGs: not enough memory\n");
80
81 return -ENOMEM;
82}
86arch_initcall(init_atags_procfs); 83arch_initcall(init_atags_procfs);
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index a53c0aba5c14..8bfd299bfe77 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -680,7 +680,7 @@ static int __init ecard_probeirqhw(void)
680#define IO_EC_MEMC8_BASE 0 680#define IO_EC_MEMC8_BASE 0
681#endif 681#endif
682 682
683unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed) 683static unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
684{ 684{
685 unsigned long address = 0; 685 unsigned long address = 0;
686 int slot = ec->slot_no; 686 int slot = ec->slot_no;
@@ -1002,7 +1002,7 @@ ecard_probe(int slot, card_type_t type)
1002 } 1002 }
1003 1003
1004 rc = -ENODEV; 1004 rc = -ENODEV;
1005 if ((ec->podaddr = ecard_address(ec, type, ECARD_SYNC)) == 0) 1005 if ((ec->podaddr = __ecard_address(ec, type, ECARD_SYNC)) == 0)
1006 goto nodev; 1006 goto nodev;
1007 1007
1008 cid.r_zero = 1; 1008 cid.r_zero = 1;
@@ -1141,10 +1141,10 @@ static int ecard_drv_probe(struct device *dev)
1141 1141
1142 id = ecard_match_device(drv->id_table, ec); 1142 id = ecard_match_device(drv->id_table, ec);
1143 1143
1144 ecard_claim(ec); 1144 ec->claimed = 1;
1145 ret = drv->probe(ec, id); 1145 ret = drv->probe(ec, id);
1146 if (ret) 1146 if (ret)
1147 ecard_release(ec); 1147 ec->claimed = 0;
1148 return ret; 1148 return ret;
1149} 1149}
1150 1150
@@ -1154,7 +1154,7 @@ static int ecard_drv_remove(struct device *dev)
1154 struct ecard_driver *drv = ECARD_DRV(dev->driver); 1154 struct ecard_driver *drv = ECARD_DRV(dev->driver);
1155 1155
1156 drv->remove(ec); 1156 drv->remove(ec);
1157 ecard_release(ec); 1157 ec->claimed = 0;
1158 1158
1159 /* 1159 /*
1160 * Restore the default operations. We ensure that the 1160 * Restore the default operations. We ensure that the
@@ -1182,7 +1182,7 @@ static void ecard_drv_shutdown(struct device *dev)
1182 if (dev->driver) { 1182 if (dev->driver) {
1183 if (drv->shutdown) 1183 if (drv->shutdown)
1184 drv->shutdown(ec); 1184 drv->shutdown(ec);
1185 ecard_release(ec); 1185 ec->claimed = 0;
1186 } 1186 }
1187 1187
1188 /* 1188 /*
@@ -1239,7 +1239,6 @@ static int ecard_bus_init(void)
1239postcore_initcall(ecard_bus_init); 1239postcore_initcall(ecard_bus_init);
1240 1240
1241EXPORT_SYMBOL(ecard_readchunk); 1241EXPORT_SYMBOL(ecard_readchunk);
1242EXPORT_SYMBOL(__ecard_address);
1243EXPORT_SYMBOL(ecard_register_driver); 1242EXPORT_SYMBOL(ecard_register_driver);
1244EXPORT_SYMBOL(ecard_remove_driver); 1243EXPORT_SYMBOL(ecard_remove_driver);
1245EXPORT_SYMBOL(ecard_bus_type); 1244EXPORT_SYMBOL(ecard_bus_type);
diff --git a/arch/arm/kernel/ecard.h b/arch/arm/kernel/ecard.h
index d7c2dacf935d..4642d436be2a 100644
--- a/arch/arm/kernel/ecard.h
+++ b/arch/arm/kernel/ecard.h
@@ -54,3 +54,16 @@ struct ex_chunk_dir {
54#define c_len(x) ((x)->r_len[0]|((x)->r_len[1]<<8)|((x)->r_len[2]<<16)) 54#define c_len(x) ((x)->r_len[0]|((x)->r_len[1]<<8)|((x)->r_len[2]<<16))
55#define c_start(x) ((x)->r_start) 55#define c_start(x) ((x)->r_start)
56}; 56};
57
58typedef enum ecard_type { /* Cards address space */
59 ECARD_IOC,
60 ECARD_MEMC,
61 ECARD_EASI
62} card_type_t;
63
64typedef enum { /* Speed for ECARD_IOC space */
65 ECARD_SLOW = 0,
66 ECARD_MEDIUM = 1,
67 ECARD_FAST = 2,
68 ECARD_SYNC = 3
69} card_speed_t;
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 597ed00a08d8..84694e88b428 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <asm/unistd.h> 11#include <asm/unistd.h>
12#include <asm/ftrace.h>
12#include <asm/arch/entry-macro.S> 13#include <asm/arch/entry-macro.S>
13 14
14#include "entry-header.S" 15#include "entry-header.S"
@@ -99,6 +100,56 @@ ENTRY(ret_from_fork)
99#undef CALL 100#undef CALL
100#define CALL(x) .long x 101#define CALL(x) .long x
101 102
103#ifdef CONFIG_FTRACE
104#ifdef CONFIG_DYNAMIC_FTRACE
105ENTRY(mcount)
106 stmdb sp!, {r0-r3, lr}
107 mov r0, lr
108 sub r0, r0, #MCOUNT_INSN_SIZE
109
110 .globl mcount_call
111mcount_call:
112 bl ftrace_stub
113 ldmia sp!, {r0-r3, pc}
114
115ENTRY(ftrace_caller)
116 stmdb sp!, {r0-r3, lr}
117 ldr r1, [fp, #-4]
118 mov r0, lr
119 sub r0, r0, #MCOUNT_INSN_SIZE
120
121 .globl ftrace_call
122ftrace_call:
123 bl ftrace_stub
124 ldmia sp!, {r0-r3, pc}
125
126#else
127
128ENTRY(mcount)
129 stmdb sp!, {r0-r3, lr}
130 ldr r0, =ftrace_trace_function
131 ldr r2, [r0]
132 adr r0, ftrace_stub
133 cmp r0, r2
134 bne trace
135 ldmia sp!, {r0-r3, pc}
136
137trace:
138 ldr r1, [fp, #-4]
139 mov r0, lr
140 sub r0, r0, #MCOUNT_INSN_SIZE
141 mov lr, pc
142 mov pc, r2
143 ldmia sp!, {r0-r3, pc}
144
145#endif /* CONFIG_DYNAMIC_FTRACE */
146
147 .globl ftrace_stub
148ftrace_stub:
149 mov pc, lr
150
151#endif /* CONFIG_FTRACE */
152
102/*============================================================================= 153/*=============================================================================
103 * SWI handler 154 * SWI handler
104 *----------------------------------------------------------------------------- 155 *-----------------------------------------------------------------------------
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
new file mode 100644
index 000000000000..76d50e6091bc
--- /dev/null
+++ b/arch/arm/kernel/ftrace.c
@@ -0,0 +1,116 @@
1/*
2 * Dynamic function tracing support.
3 *
4 * Copyright (C) 2008 Abhishek Sagar <sagar.abhishek@gmail.com>
5 *
6 * For licencing details, see COPYING.
7 *
8 * Defines low-level handling of mcount calls when the kernel
9 * is compiled with the -pg flag. When using dynamic ftrace, the
10 * mcount call-sites get patched lazily with NOP till they are
11 * enabled. All code mutation routines here take effect atomically.
12 */
13
14#include <linux/ftrace.h>
15
16#include <asm/cacheflush.h>
17#include <asm/ftrace.h>
18
19#define PC_OFFSET 8
20#define BL_OPCODE 0xeb000000
21#define BL_OFFSET_MASK 0x00ffffff
22
23static unsigned long bl_insn;
24static const unsigned long NOP = 0xe1a00000; /* mov r0, r0 */
25
26unsigned char *ftrace_nop_replace(void)
27{
28 return (char *)&NOP;
29}
30
31/* construct a branch (BL) instruction to addr */
32unsigned char *ftrace_call_replace(unsigned long pc, unsigned long addr)
33{
34 long offset;
35
36 offset = (long)addr - (long)(pc + PC_OFFSET);
37 if (unlikely(offset < -33554432 || offset > 33554428)) {
38 /* Can't generate branches that far (from ARM ARM). Ftrace
39 * doesn't generate branches outside of kernel text.
40 */
41 WARN_ON_ONCE(1);
42 return NULL;
43 }
44 offset = (offset >> 2) & BL_OFFSET_MASK;
45 bl_insn = BL_OPCODE | offset;
46 return (unsigned char *)&bl_insn;
47}
48
49int ftrace_modify_code(unsigned long pc, unsigned char *old_code,
50 unsigned char *new_code)
51{
52 unsigned long err = 0, replaced = 0, old, new;
53
54 old = *(unsigned long *)old_code;
55 new = *(unsigned long *)new_code;
56
57 __asm__ __volatile__ (
58 "1: ldr %1, [%2] \n"
59 " cmp %1, %4 \n"
60 "2: streq %3, [%2] \n"
61 " cmpne %1, %3 \n"
62 " movne %0, #2 \n"
63 "3:\n"
64
65 ".section .fixup, \"ax\"\n"
66 "4: mov %0, #1 \n"
67 " b 3b \n"
68 ".previous\n"
69
70 ".section __ex_table, \"a\"\n"
71 " .long 1b, 4b \n"
72 " .long 2b, 4b \n"
73 ".previous\n"
74
75 : "=r"(err), "=r"(replaced)
76 : "r"(pc), "r"(new), "r"(old), "0"(err), "1"(replaced)
77 : "memory");
78
79 if (!err && (replaced == old))
80 flush_icache_range(pc, pc + MCOUNT_INSN_SIZE);
81
82 return err;
83}
84
85int ftrace_update_ftrace_func(ftrace_func_t func)
86{
87 int ret;
88 unsigned long pc, old;
89 unsigned char *new;
90
91 pc = (unsigned long)&ftrace_call;
92 memcpy(&old, &ftrace_call, MCOUNT_INSN_SIZE);
93 new = ftrace_call_replace(pc, (unsigned long)func);
94 ret = ftrace_modify_code(pc, (unsigned char *)&old, new);
95 return ret;
96}
97
98int ftrace_mcount_set(unsigned long *data)
99{
100 unsigned long pc, old;
101 unsigned long *addr = data;
102 unsigned char *new;
103
104 pc = (unsigned long)&mcount_call;
105 memcpy(&old, &mcount_call, MCOUNT_INSN_SIZE);
106 new = ftrace_call_replace(pc, *addr);
107 *addr = ftrace_modify_code(pc, (unsigned char *)&old, new);
108 return 0;
109}
110
111/* run from kstop_machine */
112int __init ftrace_dyn_arch_init(void *data)
113{
114 ftrace_mcount_set(data);
115 return 0;
116}
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 5593dd207216..5ee39e10c8d1 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -274,7 +274,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
274 * for kretprobe handlers which should normally be interested in r0 only 274 * for kretprobe handlers which should normally be interested in r0 only
275 * anyway. 275 * anyway.
276 */ 276 */
277static void __attribute__((naked)) __kprobes kretprobe_trampoline(void) 277void __naked __kprobes kretprobe_trampoline(void)
278{ 278{
279 __asm__ __volatile__ ( 279 __asm__ __volatile__ (
280 "stmdb sp!, {r0 - r11} \n\t" 280 "stmdb sp!, {r0 - r11} \n\t"
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 46bf2ede6128..199b3680118b 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -133,10 +133,8 @@ static void default_idle(void)
133 cpu_relax(); 133 cpu_relax();
134 else { 134 else {
135 local_irq_disable(); 135 local_irq_disable();
136 if (!need_resched()) { 136 if (!need_resched())
137 timer_dyn_reprogram();
138 arch_idle(); 137 arch_idle();
139 }
140 local_irq_enable(); 138 local_irq_enable();
141 } 139 }
142} 140}
diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index ae31deb2d065..90e0c35ae60d 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -36,6 +36,7 @@ EXPORT_SYMBOL(walk_stackframe);
36#ifdef CONFIG_STACKTRACE 36#ifdef CONFIG_STACKTRACE
37struct stack_trace_data { 37struct stack_trace_data {
38 struct stack_trace *trace; 38 struct stack_trace *trace;
39 unsigned int no_sched_functions;
39 unsigned int skip; 40 unsigned int skip;
40}; 41};
41 42
@@ -43,27 +44,52 @@ static int save_trace(struct stackframe *frame, void *d)
43{ 44{
44 struct stack_trace_data *data = d; 45 struct stack_trace_data *data = d;
45 struct stack_trace *trace = data->trace; 46 struct stack_trace *trace = data->trace;
47 unsigned long addr = frame->lr;
46 48
49 if (data->no_sched_functions && in_sched_functions(addr))
50 return 0;
47 if (data->skip) { 51 if (data->skip) {
48 data->skip--; 52 data->skip--;
49 return 0; 53 return 0;
50 } 54 }
51 55
52 trace->entries[trace->nr_entries++] = frame->lr; 56 trace->entries[trace->nr_entries++] = addr;
53 57
54 return trace->nr_entries >= trace->max_entries; 58 return trace->nr_entries >= trace->max_entries;
55} 59}
56 60
57void save_stack_trace(struct stack_trace *trace) 61void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
58{ 62{
59 struct stack_trace_data data; 63 struct stack_trace_data data;
60 unsigned long fp, base; 64 unsigned long fp, base;
61 65
62 data.trace = trace; 66 data.trace = trace;
63 data.skip = trace->skip; 67 data.skip = trace->skip;
64 base = (unsigned long)task_stack_page(current); 68 base = (unsigned long)task_stack_page(tsk);
65 asm("mov %0, fp" : "=r" (fp)); 69
70 if (tsk != current) {
71#ifdef CONFIG_SMP
72 /*
73 * What guarantees do we have here that 'tsk'
74 * is not running on another CPU?
75 */
76 BUG();
77#else
78 data.no_sched_functions = 1;
79 fp = thread_saved_fp(tsk);
80#endif
81 } else {
82 data.no_sched_functions = 0;
83 asm("mov %0, fp" : "=r" (fp));
84 }
66 85
67 walk_stackframe(fp, base, base + THREAD_SIZE, save_trace, &data); 86 walk_stackframe(fp, base, base + THREAD_SIZE, save_trace, &data);
87 if (trace->nr_entries < trace->max_entries)
88 trace->entries[trace->nr_entries++] = ULONG_MAX;
89}
90
91void save_stack_trace(struct stack_trace *trace)
92{
93 save_stack_trace_tsk(current, trace);
68} 94}
69#endif 95#endif
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index b5867eca1d0b..cc5145b28e7f 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -365,108 +365,6 @@ static struct sysdev_class timer_sysclass = {
365 .resume = timer_resume, 365 .resume = timer_resume,
366}; 366};
367 367
368#ifdef CONFIG_NO_IDLE_HZ
369static int timer_dyn_tick_enable(void)
370{
371 struct dyn_tick_timer *dyn_tick = system_timer->dyn_tick;
372 unsigned long flags;
373 int ret = -ENODEV;
374
375 if (dyn_tick) {
376 spin_lock_irqsave(&dyn_tick->lock, flags);
377 ret = 0;
378 if (!(dyn_tick->state & DYN_TICK_ENABLED)) {
379 ret = dyn_tick->enable();
380
381 if (ret == 0)
382 dyn_tick->state |= DYN_TICK_ENABLED;
383 }
384 spin_unlock_irqrestore(&dyn_tick->lock, flags);
385 }
386
387 return ret;
388}
389
390static int timer_dyn_tick_disable(void)
391{
392 struct dyn_tick_timer *dyn_tick = system_timer->dyn_tick;
393 unsigned long flags;
394 int ret = -ENODEV;
395
396 if (dyn_tick) {
397 spin_lock_irqsave(&dyn_tick->lock, flags);
398 ret = 0;
399 if (dyn_tick->state & DYN_TICK_ENABLED) {
400 ret = dyn_tick->disable();
401
402 if (ret == 0)
403 dyn_tick->state &= ~DYN_TICK_ENABLED;
404 }
405 spin_unlock_irqrestore(&dyn_tick->lock, flags);
406 }
407
408 return ret;
409}
410
411/*
412 * Reprogram the system timer for at least the calculated time interval.
413 * This function should be called from the idle thread with IRQs disabled,
414 * immediately before sleeping.
415 */
416void timer_dyn_reprogram(void)
417{
418 struct dyn_tick_timer *dyn_tick = system_timer->dyn_tick;
419 unsigned long next, seq, flags;
420
421 if (!dyn_tick)
422 return;
423
424 spin_lock_irqsave(&dyn_tick->lock, flags);
425 if (dyn_tick->state & DYN_TICK_ENABLED) {
426 next = next_timer_interrupt();
427 do {
428 seq = read_seqbegin(&xtime_lock);
429 dyn_tick->reprogram(next - jiffies);
430 } while (read_seqretry(&xtime_lock, seq));
431 }
432 spin_unlock_irqrestore(&dyn_tick->lock, flags);
433}
434
435static ssize_t timer_show_dyn_tick(struct sys_device *dev, char *buf)
436{
437 return sprintf(buf, "%i\n",
438 (system_timer->dyn_tick->state & DYN_TICK_ENABLED) >> 1);
439}
440
441static ssize_t timer_set_dyn_tick(struct sys_device *dev, const char *buf,
442 size_t count)
443{
444 unsigned int enable = simple_strtoul(buf, NULL, 2);
445
446 if (enable)
447 timer_dyn_tick_enable();
448 else
449 timer_dyn_tick_disable();
450
451 return count;
452}
453static SYSDEV_ATTR(dyn_tick, 0644, timer_show_dyn_tick, timer_set_dyn_tick);
454
455/*
456 * dyntick=enable|disable
457 */
458static char dyntick_str[4] __initdata = "";
459
460static int __init dyntick_setup(char *str)
461{
462 if (str)
463 strlcpy(dyntick_str, str, sizeof(dyntick_str));
464 return 1;
465}
466
467__setup("dyntick=", dyntick_setup);
468#endif
469
470static int __init timer_init_sysfs(void) 368static int __init timer_init_sysfs(void)
471{ 369{
472 int ret = sysdev_class_register(&timer_sysclass); 370 int ret = sysdev_class_register(&timer_sysclass);
@@ -475,19 +373,6 @@ static int __init timer_init_sysfs(void)
475 ret = sysdev_register(&system_timer->dev); 373 ret = sysdev_register(&system_timer->dev);
476 } 374 }
477 375
478#ifdef CONFIG_NO_IDLE_HZ
479 if (ret == 0 && system_timer->dyn_tick) {
480 ret = sysdev_create_file(&system_timer->dev, &attr_dyn_tick);
481
482 /*
483 * Turn on dynamic tick after calibrate delay
484 * for correct bogomips
485 */
486 if (ret == 0 && dyntick_str[0] == 'e')
487 ret = timer_dyn_tick_enable();
488 }
489#endif
490
491 return ret; 376 return ret;
492} 377}
493 378
@@ -500,10 +385,5 @@ void __init time_init(void)
500 system_timer->offset = dummy_gettimeoffset; 385 system_timer->offset = dummy_gettimeoffset;
501#endif 386#endif
502 system_timer->init(); 387 system_timer->init();
503
504#ifdef CONFIG_NO_IDLE_HZ
505 if (system_timer->dyn_tick)
506 spin_lock_init(&system_timer->dyn_tick->lock);
507#endif
508} 388}
509 389
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index cab355c0c1f7..139cce646055 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -13,14 +13,6 @@
13 */ 13 */
14 14
15/* 15/*
16 * This can be used to enable code to cacheline align the source pointer.
17 * Experiments on tested architectures (StrongARM and XScale) didn't show
18 * this a worthwhile thing to do. That might be different in the future.
19 */
20//#define CALGN(code...) code
21#define CALGN(code...)
22
23/*
24 * Theory of operation 16 * Theory of operation
25 * ------------------- 17 * -------------------
26 * 18 *
@@ -82,7 +74,7 @@
82 stmfd sp!, {r5 - r8} 74 stmfd sp!, {r5 - r8}
83 blt 5f 75 blt 5f
84 76
85 CALGN( ands ip, r1, #31 ) 77 CALGN( ands ip, r0, #31 )
86 CALGN( rsb r3, ip, #32 ) 78 CALGN( rsb r3, ip, #32 )
87 CALGN( sbcnes r4, r3, r2 ) @ C is always set here 79 CALGN( sbcnes r4, r3, r2 ) @ C is always set here
88 CALGN( bcs 2f ) 80 CALGN( bcs 2f )
@@ -168,7 +160,7 @@
168 subs r2, r2, #28 160 subs r2, r2, #28
169 blt 14f 161 blt 14f
170 162
171 CALGN( ands ip, r1, #31 ) 163 CALGN( ands ip, r0, #31 )
172 CALGN( rsb ip, ip, #32 ) 164 CALGN( rsb ip, ip, #32 )
173 CALGN( sbcnes r4, ip, r2 ) @ C is always set here 165 CALGN( sbcnes r4, ip, r2 ) @ C is always set here
174 CALGN( subcc r2, r2, ip ) 166 CALGN( subcc r2, r2, ip )
diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
index ef7fddc14ac9..2e301b7bd8f1 100644
--- a/arch/arm/lib/memmove.S
+++ b/arch/arm/lib/memmove.S
@@ -13,14 +13,6 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15 15
16/*
17 * This can be used to enable code to cacheline align the source pointer.
18 * Experiments on tested architectures (StrongARM and XScale) didn't show
19 * this a worthwhile thing to do. That might be different in the future.
20 */
21//#define CALGN(code...) code
22#define CALGN(code...)
23
24 .text 16 .text
25 17
26/* 18/*
@@ -55,11 +47,12 @@ ENTRY(memmove)
55 stmfd sp!, {r5 - r8} 47 stmfd sp!, {r5 - r8}
56 blt 5f 48 blt 5f
57 49
58 CALGN( ands ip, r1, #31 ) 50 CALGN( ands ip, r0, #31 )
59 CALGN( sbcnes r4, ip, r2 ) @ C is always set here 51 CALGN( sbcnes r4, ip, r2 ) @ C is always set here
60 CALGN( bcs 2f ) 52 CALGN( bcs 2f )
61 CALGN( adr r4, 6f ) 53 CALGN( adr r4, 6f )
62 CALGN( subs r2, r2, ip ) @ C is set here 54 CALGN( subs r2, r2, ip ) @ C is set here
55 CALGN( rsb ip, ip, #32 )
63 CALGN( add pc, r4, ip ) 56 CALGN( add pc, r4, ip )
64 57
65 PLD( pld [r1, #-4] ) 58 PLD( pld [r1, #-4] )
@@ -138,8 +131,7 @@ ENTRY(memmove)
138 subs r2, r2, #28 131 subs r2, r2, #28
139 blt 14f 132 blt 14f
140 133
141 CALGN( ands ip, r1, #31 ) 134 CALGN( ands ip, r0, #31 )
142 CALGN( rsb ip, ip, #32 )
143 CALGN( sbcnes r4, ip, r2 ) @ C is always set here 135 CALGN( sbcnes r4, ip, r2 ) @ C is always set here
144 CALGN( subcc r2, r2, ip ) 136 CALGN( subcc r2, r2, ip )
145 CALGN( bcc 15f ) 137 CALGN( bcc 15f )
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
index 95b110b07a89..b477d4ac88ef 100644
--- a/arch/arm/lib/memset.S
+++ b/arch/arm/lib/memset.S
@@ -39,6 +39,9 @@ ENTRY(memset)
39 mov r3, r1 39 mov r3, r1
40 cmp r2, #16 40 cmp r2, #16
41 blt 4f 41 blt 4f
42
43#if ! CALGN(1)+0
44
42/* 45/*
43 * We need an extra register for this loop - save the return address and 46 * We need an extra register for this loop - save the return address and
44 * use the LR 47 * use the LR
@@ -64,6 +67,49 @@ ENTRY(memset)
64 stmneia r0!, {r1, r3, ip, lr} 67 stmneia r0!, {r1, r3, ip, lr}
65 ldr lr, [sp], #4 68 ldr lr, [sp], #4
66 69
70#else
71
72/*
73 * This version aligns the destination pointer in order to write
74 * whole cache lines at once.
75 */
76
77 stmfd sp!, {r4-r7, lr}
78 mov r4, r1
79 mov r5, r1
80 mov r6, r1
81 mov r7, r1
82 mov ip, r1
83 mov lr, r1
84
85 cmp r2, #96
86 tstgt r0, #31
87 ble 3f
88
89 and ip, r0, #31
90 rsb ip, ip, #32
91 sub r2, r2, ip
92 movs ip, ip, lsl #(32 - 4)
93 stmcsia r0!, {r4, r5, r6, r7}
94 stmmiia r0!, {r4, r5}
95 tst ip, #(1 << 30)
96 mov ip, r1
97 strne r1, [r0], #4
98
993: subs r2, r2, #64
100 stmgeia r0!, {r1, r3-r7, ip, lr}
101 stmgeia r0!, {r1, r3-r7, ip, lr}
102 bgt 3b
103 ldmeqfd sp!, {r4-r7, pc}
104
105 tst r2, #32
106 stmneia r0!, {r1, r3-r7, ip, lr}
107 tst r2, #16
108 stmneia r0!, {r4-r7}
109 ldmfd sp!, {r4-r7, lr}
110
111#endif
112
674: tst r2, #8 1134: tst r2, #8
68 stmneia r0!, {r1, r3} 114 stmneia r0!, {r1, r3}
69 tst r2, #4 115 tst r2, #4
diff --git a/arch/arm/lib/memzero.S b/arch/arm/lib/memzero.S
index abf2508e8221..b8f79d80ee9b 100644
--- a/arch/arm/lib/memzero.S
+++ b/arch/arm/lib/memzero.S
@@ -39,6 +39,9 @@ ENTRY(__memzero)
39 */ 39 */
40 cmp r1, #16 @ 1 we can skip this chunk if we 40 cmp r1, #16 @ 1 we can skip this chunk if we
41 blt 4f @ 1 have < 16 bytes 41 blt 4f @ 1 have < 16 bytes
42
43#if ! CALGN(1)+0
44
42/* 45/*
43 * We need an extra register for this loop - save the return address and 46 * We need an extra register for this loop - save the return address and
44 * use the LR 47 * use the LR
@@ -64,6 +67,47 @@ ENTRY(__memzero)
64 stmneia r0!, {r2, r3, ip, lr} @ 4 67 stmneia r0!, {r2, r3, ip, lr} @ 4
65 ldr lr, [sp], #4 @ 1 68 ldr lr, [sp], #4 @ 1
66 69
70#else
71
72/*
73 * This version aligns the destination pointer in order to write
74 * whole cache lines at once.
75 */
76
77 stmfd sp!, {r4-r7, lr}
78 mov r4, r2
79 mov r5, r2
80 mov r6, r2
81 mov r7, r2
82 mov ip, r2
83 mov lr, r2
84
85 cmp r1, #96
86 andgts ip, r0, #31
87 ble 3f
88
89 rsb ip, ip, #32
90 sub r1, r1, ip
91 movs ip, ip, lsl #(32 - 4)
92 stmcsia r0!, {r4, r5, r6, r7}
93 stmmiia r0!, {r4, r5}
94 movs ip, ip, lsl #2
95 strcs r2, [r0], #4
96
973: subs r1, r1, #64
98 stmgeia r0!, {r2-r7, ip, lr}
99 stmgeia r0!, {r2-r7, ip, lr}
100 bgt 3b
101 ldmeqfd sp!, {r4-r7, pc}
102
103 tst r1, #32
104 stmneia r0!, {r2-r7, ip, lr}
105 tst r1, #16
106 stmneia r0!, {r4-r7}
107 ldmfd sp!, {r4-r7, lr}
108
109#endif
110
674: tst r1, #8 @ 1 8 bytes or more? 1114: tst r1, #8 @ 1 8 bytes or more?
68 stmneia r0!, {r2, r3} @ 2 112 stmneia r0!, {r2, r3} @ 2
69 tst r1, #4 @ 1 4 bytes or more? 113 tst r1, #4 @ 1 4 bytes or more?
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 0fc07b6db749..5bad6b9b00d7 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -30,6 +30,11 @@ config ARCH_AT91SAM9RL
30 select GENERIC_TIME 30 select GENERIC_TIME
31 select GENERIC_CLOCKEVENTS 31 select GENERIC_CLOCKEVENTS
32 32
33config ARCH_AT91SAM9G20
34 bool "AT91SAM9G20"
35 select GENERIC_TIME
36 select GENERIC_CLOCKEVENTS
37
33config ARCH_AT91CAP9 38config ARCH_AT91CAP9
34 bool "AT91CAP9" 39 bool "AT91CAP9"
35 select GENERIC_TIME 40 select GENERIC_TIME
@@ -126,6 +131,12 @@ config MACH_ECBAT91
126 Select this if you are using emQbit's ECB_AT91 board. 131 Select this if you are using emQbit's ECB_AT91 board.
127 <http://wiki.emqbit.com/free-ecb-at91> 132 <http://wiki.emqbit.com/free-ecb-at91>
128 133
134config MACH_YL9200
135 bool "ucDragon YL-9200"
136 depends on ARCH_AT91RM9200
137 help
138 Select this if you are using the ucDragon YL-9200 board.
139
129endif 140endif
130 141
131# ---------------------------------------------------------- 142# ----------------------------------------------------------
@@ -164,6 +175,20 @@ config MACH_SAM9_L9260
164 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260. 175 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260.
165 <http://www.olimex.com/dev/sam9-L9260.html> 176 <http://www.olimex.com/dev/sam9-L9260.html>
166 177
178config MACH_USB_A9260
179 bool "CALAO USB-A9260"
180 depends on ARCH_AT91SAM9260
181 help
182 Select this if you are using a Calao Systems USB-A9260.
183 <http://www.calao-systems.com>
184
185config MACH_QIL_A9260
186 bool "CALAO QIL-A9260 board"
187 depends on ARCH_AT91SAM9260
188 help
189 Select this if you are using a Calao Systems QIL-A9260 Board.
190 <http://www.calao-systems.com>
191
167endif 192endif
168 193
169# ---------------------------------------------------------- 194# ----------------------------------------------------------
@@ -194,6 +219,13 @@ config MACH_AT91SAM9263EK
194 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit. 219 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
195 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057> 220 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
196 221
222config MACH_USB_A9263
223 bool "CALAO USB-A9263"
224 depends on ARCH_AT91SAM9263
225 help
226 Select this if you are using a Calao Systems USB-A9263.
227 <http://www.calao-systems.com>
228
197endif 229endif
198 230
199# ---------------------------------------------------------- 231# ----------------------------------------------------------
@@ -212,6 +244,20 @@ endif
212 244
213# ---------------------------------------------------------- 245# ----------------------------------------------------------
214 246
247if ARCH_AT91SAM9G20
248
249comment "AT91SAM9G20 Board Type"
250
251config MACH_AT91SAM9G20EK
252 bool "Atmel AT91SAM9G20-EK Evaluation Kit"
253 depends on ARCH_AT91SAM9G20
254 help
255 Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit.
256
257endif
258
259# ----------------------------------------------------------
260
215if ARCH_AT91CAP9 261if ARCH_AT91CAP9
216 262
217comment "AT91CAP9 Board Type" 263comment "AT91CAP9 Board Type"
@@ -247,13 +293,13 @@ comment "AT91 Board Options"
247 293
248config MTD_AT91_DATAFLASH_CARD 294config MTD_AT91_DATAFLASH_CARD
249 bool "Enable DataFlash Card support" 295 bool "Enable DataFlash Card support"
250 depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK || MACH_SAM9_L9260 || MACH_ECBAT91) 296 depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_ECBAT91 || MACH_SAM9_L9260 || MACH_AT91CAP9ADK)
251 help 297 help
252 Enable support for the DataFlash card. 298 Enable support for the DataFlash card.
253 299
254config MTD_NAND_AT91_BUSWIDTH_16 300config MTD_NAND_AT91_BUSWIDTH_16
255 bool "Enable 16-bit data bus interface to NAND flash" 301 bool "Enable 16-bit data bus interface to NAND flash"
256 depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK) 302 depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_AT91CAP9ADK)
257 help 303 help
258 On AT91SAM926x boards both types of NAND flash can be present 304 On AT91SAM926x boards both types of NAND flash can be present
259 (8 and 16 bit data bus width). 305 (8 and 16 bit data bus width).
@@ -302,15 +348,15 @@ config AT91_EARLY_USART2
302 348
303config AT91_EARLY_USART3 349config AT91_EARLY_USART3
304 bool "USART3" 350 bool "USART3"
305 depends on (ARCH_AT91RM9200 || ARCH_AT91SAM9RL || ARCH_AT91SAM9260) 351 depends on (ARCH_AT91RM9200 || ARCH_AT91SAM9RL || ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
306 352
307config AT91_EARLY_USART4 353config AT91_EARLY_USART4
308 bool "USART4" 354 bool "USART4"
309 depends on ARCH_AT91SAM9260 355 depends on ARCH_AT91SAM9260 || ARCH_AT91SAM9G20
310 356
311config AT91_EARLY_USART5 357config AT91_EARLY_USART5
312 bool "USART5" 358 bool "USART5"
313 depends on ARCH_AT91SAM9260 359 depends on ARCH_AT91SAM9260 || ARCH_AT91SAM9G20
314 360
315endchoice 361endchoice
316 362
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 8d9bc0153b18..7d641f97516b 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_d
15obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o 15obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o
16obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o 16obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o
17obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o 17obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o
18obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o
18obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o 19obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o
19obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o 20obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
20 21
@@ -30,21 +31,28 @@ obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
30obj-$(CONFIG_MACH_KAFA) += board-kafa.o 31obj-$(CONFIG_MACH_KAFA) += board-kafa.o
31obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o 32obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o
32obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o 33obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o
34obj-$(CONFIG_MACH_YL9200) += board-yl-9200.o
33 35
34# AT91SAM9260 board-specific support 36# AT91SAM9260 board-specific support
35obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 37obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
36obj-$(CONFIG_MACH_CAM60) += board-cam60.o 38obj-$(CONFIG_MACH_CAM60) += board-cam60.o
37obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 39obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
40obj-$(CONFIG_MACH_USB_A9260) += board-usb-a9260.o
41obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
38 42
39# AT91SAM9261 board-specific support 43# AT91SAM9261 board-specific support
40obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o 44obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o
41 45
42# AT91SAM9263 board-specific support 46# AT91SAM9263 board-specific support
43obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o 47obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
48obj-$(CONFIG_MACH_USB_A9263) += board-usb-a9263.o
44 49
45# AT91SAM9RL board-specific support 50# AT91SAM9RL board-specific support
46obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o 51obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
47 52
53# AT91SAM9G20 board-specific support
54obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
55
48# AT91CAP9 board-specific support 56# AT91CAP9 board-specific support
49obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o 57obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
50 58
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index be526746e01e..747b9dedab88 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -84,6 +84,105 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
84 84
85 85
86/* -------------------------------------------------------------------- 86/* --------------------------------------------------------------------
87 * USB HS Device (Gadget)
88 * -------------------------------------------------------------------- */
89
90#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
91
92static struct resource usba_udc_resources[] = {
93 [0] = {
94 .start = AT91CAP9_UDPHS_FIFO,
95 .end = AT91CAP9_UDPHS_FIFO + SZ_512K - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 .start = AT91CAP9_BASE_UDPHS,
100 .end = AT91CAP9_BASE_UDPHS + SZ_1K - 1,
101 .flags = IORESOURCE_MEM,
102 },
103 [2] = {
104 .start = AT91CAP9_ID_UDPHS,
105 .end = AT91CAP9_ID_UDPHS,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
111 [idx] = { \
112 .name = nam, \
113 .index = idx, \
114 .fifo_size = maxpkt, \
115 .nr_banks = maxbk, \
116 .can_dma = dma, \
117 .can_isoc = isoc, \
118 }
119
120static struct usba_ep_data usba_udc_ep[] = {
121 EP("ep0", 0, 64, 1, 0, 0),
122 EP("ep1", 1, 1024, 3, 1, 1),
123 EP("ep2", 2, 1024, 3, 1, 1),
124 EP("ep3", 3, 1024, 2, 1, 1),
125 EP("ep4", 4, 1024, 2, 1, 1),
126 EP("ep5", 5, 1024, 2, 1, 0),
127 EP("ep6", 6, 1024, 2, 1, 0),
128 EP("ep7", 7, 1024, 2, 0, 0),
129};
130
131#undef EP
132
133/*
134 * pdata doesn't have room for any endpoints, so we need to
135 * append room for the ones we need right after it.
136 */
137static struct {
138 struct usba_platform_data pdata;
139 struct usba_ep_data ep[8];
140} usba_udc_data;
141
142static struct platform_device at91_usba_udc_device = {
143 .name = "atmel_usba_udc",
144 .id = -1,
145 .dev = {
146 .platform_data = &usba_udc_data.pdata,
147 },
148 .resource = usba_udc_resources,
149 .num_resources = ARRAY_SIZE(usba_udc_resources),
150};
151
152void __init at91_add_device_usba(struct usba_platform_data *data)
153{
154 at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS |
155 AT91_MATRIX_UDPHS_BYPASS_LOCK);
156
157 /*
158 * Invalid pins are 0 on AT91, but the usba driver is shared
159 * with AVR32, which use negative values instead. Once/if
160 * gpio_is_valid() is ported to AT91, revisit this code.
161 */
162 usba_udc_data.pdata.vbus_pin = -EINVAL;
163 usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
164 memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));;
165
166 if (data && data->vbus_pin > 0) {
167 at91_set_gpio_input(data->vbus_pin, 0);
168 at91_set_deglitch(data->vbus_pin, 1);
169 usba_udc_data.pdata.vbus_pin = data->vbus_pin;
170 }
171
172 /* Pullup pin is handled internally by USB device peripheral */
173
174 /* Clocks */
175 at91_clock_associate("utmi_clk", &at91_usba_udc_device.dev, "hclk");
176 at91_clock_associate("udphs_clk", &at91_usba_udc_device.dev, "pclk");
177
178 platform_device_register(&at91_usba_udc_device);
179}
180#else
181void __init at91_add_device_usba(struct usba_platform_data *data) {}
182#endif
183
184
185/* --------------------------------------------------------------------
87 * Ethernet 186 * Ethernet
88 * -------------------------------------------------------------------- */ 187 * -------------------------------------------------------------------- */
89 188
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index ee26550cdc21..380f12a12200 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -47,6 +47,20 @@ static struct map_desc at91sam9260_sram_desc[] __initdata = {
47 } 47 }
48}; 48};
49 49
50static struct map_desc at91sam9g20_sram_desc[] __initdata = {
51 {
52 .virtual = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE,
53 .pfn = __phys_to_pfn(AT91SAM9G20_SRAM0_BASE),
54 .length = AT91SAM9G20_SRAM0_SIZE,
55 .type = MT_DEVICE,
56 }, {
57 .virtual = AT91_IO_VIRT_BASE - AT91SAM9G20_SRAM0_SIZE - AT91SAM9G20_SRAM1_SIZE,
58 .pfn = __phys_to_pfn(AT91SAM9G20_SRAM1_BASE),
59 .length = AT91SAM9G20_SRAM1_SIZE,
60 .type = MT_DEVICE,
61 }
62};
63
50static struct map_desc at91sam9xe_sram_desc[] __initdata = { 64static struct map_desc at91sam9xe_sram_desc[] __initdata = {
51 { 65 {
52 .pfn = __phys_to_pfn(AT91SAM9XE_SRAM_BASE), 66 .pfn = __phys_to_pfn(AT91SAM9XE_SRAM_BASE),
@@ -307,6 +321,8 @@ void __init at91sam9260_initialize(unsigned long main_clock)
307 321
308 if (cpu_is_at91sam9xe()) 322 if (cpu_is_at91sam9xe())
309 at91sam9xe_initialize(); 323 at91sam9xe_initialize();
324 else if (cpu_is_at91sam9g20())
325 iotable_init(at91sam9g20_sram_desc, ARRAY_SIZE(at91sam9g20_sram_desc));
310 else 326 else
311 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc)); 327 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc));
312 328
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 393a32aefce5..86cba4ac29b1 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -18,6 +18,7 @@
18 18
19#include <asm/arch/board.h> 19#include <asm/arch/board.h>
20#include <asm/arch/gpio.h> 20#include <asm/arch/gpio.h>
21#include <asm/arch/cpu.h>
21#include <asm/arch/at91sam9260.h> 22#include <asm/arch/at91sam9260.h>
22#include <asm/arch/at91sam9260_matrix.h> 23#include <asm/arch/at91sam9260_matrix.h>
23#include <asm/arch/at91sam9_smc.h> 24#include <asm/arch/at91sam9_smc.h>
@@ -320,20 +321,41 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
320 csa = at91_sys_read(AT91_MATRIX_EBICSA); 321 csa = at91_sys_read(AT91_MATRIX_EBICSA);
321 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 322 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
322 323
323 /* set the bus interface characteristics */ 324 if (cpu_is_at91sam9260()) {
324 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 325 /* Timing for sam9260 */
325 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 326 /* set the bus interface characteristics */
327 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
328 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
326 329
327 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) 330 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
328 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3)); 331 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
329 332
330 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5)); 333 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
331 334
332 if (data->bus_width_16) 335 if (data->bus_width_16)
333 mode = AT91_SMC_DBW_16; 336 mode = AT91_SMC_DBW_16;
334 else 337 else
335 mode = AT91_SMC_DBW_8; 338 mode = AT91_SMC_DBW_8;
336 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2)); 339 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
340 }
341
342 if (cpu_is_at91sam9g20()) {
343 /* Timing for sam9g20 */
344 /* set the bus interface characteristics */
345 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0)
346 | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
347
348 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(4)
349 | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(4));
350
351 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7));
352
353 if (data->bus_width_16)
354 mode = AT91_SMC_DBW_16;
355 else
356 mode = AT91_SMC_DBW_8;
357 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(3));
358 }
337 359
338 /* enable pin */ 360 /* enable pin */
339 if (data->enable_pin) 361 if (data->enable_pin)
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 0babb645b83c..ec1891375dfb 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -232,19 +232,19 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
232 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 232 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
233 233
234 /* set the bus interface characteristics */ 234 /* set the bus interface characteristics */
235 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 235 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
236 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 236 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
237 237
238 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) 238 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
239 | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5)); 239 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
240 240
241 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7)); 241 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
242 242
243 if (data->bus_width_16) 243 if (data->bus_width_16)
244 mode = AT91_SMC_DBW_16; 244 mode = AT91_SMC_DBW_16;
245 else 245 else
246 mode = AT91_SMC_DBW_8; 246 mode = AT91_SMC_DBW_8;
247 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1)); 247 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
248 248
249 /* enable pin */ 249 /* enable pin */
250 if (data->enable_pin) 250 if (data->enable_pin)
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 719667e25c98..8a81f76f0200 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -391,8 +391,8 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
391 at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); 391 at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
392 392
393 /* set the bus interface characteristics */ 393 /* set the bus interface characteristics */
394 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 394 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
395 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 395 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
396 396
397 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) 397 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
398 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3)); 398 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 450db304936f..ae28101e7542 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -26,6 +26,101 @@
26 26
27 27
28/* -------------------------------------------------------------------- 28/* --------------------------------------------------------------------
29 * USB HS Device (Gadget)
30 * -------------------------------------------------------------------- */
31
32#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
33
34static struct resource usba_udc_resources[] = {
35 [0] = {
36 .start = AT91SAM9RL_UDPHS_FIFO,
37 .end = AT91SAM9RL_UDPHS_FIFO + SZ_512K - 1,
38 .flags = IORESOURCE_MEM,
39 },
40 [1] = {
41 .start = AT91SAM9RL_BASE_UDPHS,
42 .end = AT91SAM9RL_BASE_UDPHS + SZ_1K - 1,
43 .flags = IORESOURCE_MEM,
44 },
45 [2] = {
46 .start = AT91SAM9RL_ID_UDPHS,
47 .end = AT91SAM9RL_ID_UDPHS,
48 .flags = IORESOURCE_IRQ,
49 },
50};
51
52#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
53 [idx] = { \
54 .name = nam, \
55 .index = idx, \
56 .fifo_size = maxpkt, \
57 .nr_banks = maxbk, \
58 .can_dma = dma, \
59 .can_isoc = isoc, \
60 }
61
62static struct usba_ep_data usba_udc_ep[] __initdata = {
63 EP("ep0", 0, 64, 1, 0, 0),
64 EP("ep1", 1, 1024, 2, 1, 1),
65 EP("ep2", 2, 1024, 2, 1, 1),
66 EP("ep3", 3, 1024, 3, 1, 0),
67 EP("ep4", 4, 1024, 3, 1, 0),
68 EP("ep5", 5, 1024, 3, 1, 1),
69 EP("ep6", 6, 1024, 3, 1, 1),
70};
71
72#undef EP
73
74/*
75 * pdata doesn't have room for any endpoints, so we need to
76 * append room for the ones we need right after it.
77 */
78static struct {
79 struct usba_platform_data pdata;
80 struct usba_ep_data ep[7];
81} usba_udc_data;
82
83static struct platform_device at91_usba_udc_device = {
84 .name = "atmel_usba_udc",
85 .id = -1,
86 .dev = {
87 .platform_data = &usba_udc_data.pdata,
88 },
89 .resource = usba_udc_resources,
90 .num_resources = ARRAY_SIZE(usba_udc_resources),
91};
92
93void __init at91_add_device_usba(struct usba_platform_data *data)
94{
95 /*
96 * Invalid pins are 0 on AT91, but the usba driver is shared
97 * with AVR32, which use negative values instead. Once/if
98 * gpio_is_valid() is ported to AT91, revisit this code.
99 */
100 usba_udc_data.pdata.vbus_pin = -EINVAL;
101 usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
102 memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));;
103
104 if (data && data->vbus_pin > 0) {
105 at91_set_gpio_input(data->vbus_pin, 0);
106 at91_set_deglitch(data->vbus_pin, 1);
107 usba_udc_data.pdata.vbus_pin = data->vbus_pin;
108 }
109
110 /* Pullup pin is handled internally by USB device peripheral */
111
112 /* Clocks */
113 at91_clock_associate("utmi_clk", &at91_usba_udc_device.dev, "hclk");
114 at91_clock_associate("udphs_clk", &at91_usba_udc_device.dev, "pclk");
115
116 platform_device_register(&at91_usba_udc_device);
117}
118#else
119void __init at91_add_device_usba(struct usba_platform_data *data) {}
120#endif
121
122
123/* --------------------------------------------------------------------
29 * MMC / SD 124 * MMC / SD
30 * -------------------------------------------------------------------- */ 125 * -------------------------------------------------------------------- */
31 126
@@ -138,15 +233,15 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
138 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); 233 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
139 234
140 /* set the bus interface characteristics */ 235 /* set the bus interface characteristics */
141 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 236 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0)
142 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 237 | AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
143 238
144 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) 239 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
145 | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5)); 240 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
146 241
147 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7)); 242 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
148 243
149 at91_sys_write(AT91_SMC_MODE(3), AT91_SMC_DBW_8 | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1)); 244 at91_sys_write(AT91_SMC_MODE(3), AT91_SMC_DBW_8 | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
150 245
151 /* enable pin */ 246 /* enable pin */
152 if (data->enable_pin) 247 if (data->enable_pin)
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index e5512d1ff217..8a2a958639db 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -78,6 +78,12 @@ static struct at91_usbh_data __initdata cap9adk_usbh_data = {
78 .ports = 2, 78 .ports = 2,
79}; 79};
80 80
81/*
82 * USB HS Device port
83 */
84static struct usba_platform_data __initdata cap9adk_usba_udc_data = {
85 .vbus_pin = AT91_PIN_PB31,
86};
81 87
82/* 88/*
83 * ADS7846 Touchscreen 89 * ADS7846 Touchscreen
@@ -326,6 +332,9 @@ static void __init cap9adk_board_init(void)
326 /* USB Host */ 332 /* USB Host */
327 set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH); 333 set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH);
328 at91_add_device_usbh(&cap9adk_usbh_data); 334 at91_add_device_usbh(&cap9adk_usbh_data);
335 /* USB HS */
336 set_irq_type(AT91CAP9_ID_UDPHS, IRQT_HIGH);
337 at91_add_device_usba(&cap9adk_usba_udc_data);
329 /* SPI */ 338 /* SPI */
330 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices)); 339 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices));
331 /* Touchscreen */ 340 /* Touchscreen */
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 0f0878294a67..9854fc3dd1f2 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -40,24 +40,21 @@
40#include "generic.h" 40#include "generic.h"
41 41
42 42
43/*
44 * Serial port configuration.
45 * 0 .. 3 = USART0 .. USART3
46 * 4 = DBGU
47 */
48static struct at91_uart_config __initdata carmeva_uart_config = {
49 .console_tty = 0, /* ttyS0 */
50 .nr_tty = 2,
51 .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
52};
53
54static void __init carmeva_map_io(void) 43static void __init carmeva_map_io(void)
55{ 44{
56 /* Initialize processor: 20.000 MHz crystal */ 45 /* Initialize processor: 20.000 MHz crystal */
57 at91rm9200_initialize(20000000, AT91RM9200_BGA); 46 at91rm9200_initialize(20000000, AT91RM9200_BGA);
58 47
59 /* Setup the serial ports and console */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
60 at91_init_serial(&carmeva_uart_config); 49 at91_register_uart(0, 0, 0);
50
51 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
52 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
53 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
54 | ATMEL_UART_RI);
55
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
61} 58}
62 59
63static void __init carmeva_init_irq(void) 60static void __init carmeva_init_irq(void)
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 419fd19b620b..bb1a5474ddab 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -45,10 +45,10 @@ static void __init csb637_map_io(void)
45 /* Initialize processor: 3.6864 MHz crystal */ 45 /* Initialize processor: 3.6864 MHz crystal */
46 at91rm9200_initialize(3686400, AT91RM9200_BGA); 46 at91rm9200_initialize(3686400, AT91RM9200_BGA);
47 47
48 /* DBGU on ttyS0 */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
49 at91_register_uart(0, 0, 0); 49 at91_register_uart(0, 0, 0);
50 50
51 /* make console=ttyS0 the default */ 51 /* make console=ttyS0 (ie, DBGU) the default */
52 at91_set_serial_console(0); 52 at91_set_serial_console(0);
53} 53}
54 54
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index c1a813c7169b..dab958d25926 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -45,17 +45,6 @@
45#include "generic.h" 45#include "generic.h"
46 46
47 47
48/*
49 * Serial port configuration.
50 * 0 .. 3 = USART0 .. USART3
51 * 4 = DBGU
52 */
53static struct at91_uart_config __initdata dk_uart_config = {
54 .console_tty = 0, /* ttyS0 */
55 .nr_tty = 2,
56 .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
57};
58
59static void __init dk_map_io(void) 48static void __init dk_map_io(void)
60{ 49{
61 /* Initialize processor: 18.432 MHz crystal */ 50 /* Initialize processor: 18.432 MHz crystal */
@@ -64,8 +53,16 @@ static void __init dk_map_io(void)
64 /* Setup the LEDs */ 53 /* Setup the LEDs */
65 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); 54 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
66 55
67 /* Setup the serial ports and console */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
68 at91_init_serial(&dk_uart_config); 57 at91_register_uart(0, 0, 0);
58
59 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
61 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
62 | ATMEL_UART_RI);
63
64 /* set serial console to ttyS0 (ie, DBGU) */
65 at91_set_serial_console(0);
69} 66}
70 67
71static void __init dk_init_irq(void) 68static void __init dk_init_irq(void)
@@ -163,7 +160,7 @@ static struct at91_nand_data __initdata dk_nand_data = {
163#define DK_FLASH_SIZE 0x200000 160#define DK_FLASH_SIZE 0x200000
164 161
165static struct physmap_flash_data dk_flash_data = { 162static struct physmap_flash_data dk_flash_data = {
166 .width = 2, 163 .width = 2,
167}; 164};
168 165
169static struct resource dk_flash_resource = { 166static struct resource dk_flash_resource = {
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index af1a1d8ecc30..3fe054e0056b 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -40,24 +40,24 @@
40#include "generic.h" 40#include "generic.h"
41 41
42 42
43/*
44 * Serial port configuration.
45 * 0 .. 3 = USART0 .. USART3
46 * 4 = DBGU
47 */
48static struct at91_uart_config __initdata eb9200_uart_config = {
49 .console_tty = 0, /* ttyS0 */
50 .nr_tty = 2,
51 .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
52};
53
54static void __init eb9200_map_io(void) 43static void __init eb9200_map_io(void)
55{ 44{
56 /* Initialize processor: 18.432 MHz crystal */ 45 /* Initialize processor: 18.432 MHz crystal */
57 at91rm9200_initialize(18432000, AT91RM9200_BGA); 46 at91rm9200_initialize(18432000, AT91RM9200_BGA);
58 47
59 /* Setup the serial ports and console */ 48 /* DBGU on ttyS0. (Rx & Tx only) */
60 at91_init_serial(&eb9200_uart_config); 49 at91_register_uart(0, 0, 0);
50
51 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
52 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
53 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
54 | ATMEL_UART_RI);
55
56 /* USART2 on ttyS2. (Rx, Tx) - IRDA */
57 at91_register_uart(AT91RM9200_ID_US2, 2, 0);
58
59 /* set serial console to ttyS0 (ie, DBGU) */
60 at91_set_serial_console(0);
61} 61}
62 62
63static void __init eb9200_init_irq(void) 63static void __init eb9200_init_irq(void)
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 0574e50a30dd..74aa4325eab3 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -45,17 +45,6 @@
45#include "generic.h" 45#include "generic.h"
46 46
47 47
48/*
49 * Serial port configuration.
50 * 0 .. 3 = USART0 .. USART3
51 * 4 = DBGU
52 */
53static struct at91_uart_config __initdata ek_uart_config = {
54 .console_tty = 0, /* ttyS0 */
55 .nr_tty = 2,
56 .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
57};
58
59static void __init ek_map_io(void) 48static void __init ek_map_io(void)
60{ 49{
61 /* Initialize processor: 18.432 MHz crystal */ 50 /* Initialize processor: 18.432 MHz crystal */
@@ -64,8 +53,16 @@ static void __init ek_map_io(void)
64 /* Setup the LEDs */ 53 /* Setup the LEDs */
65 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2); 54 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
66 55
67 /* Setup the serial ports and console */ 56 /* DBGU on ttyS0. (Rx & Tx only) */
68 at91_init_serial(&ek_uart_config); 57 at91_register_uart(0, 0, 0);
58
59 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
61 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
62 | ATMEL_UART_RI);
63
64 /* set serial console to ttyS0 (ie, DBGU) */
65 at91_set_serial_console(0);
69} 66}
70 67
71static void __init ek_init_irq(void) 68static void __init ek_init_irq(void)
@@ -122,7 +119,7 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
122#define EK_FLASH_SIZE 0x200000 119#define EK_FLASH_SIZE 0x200000
123 120
124static struct physmap_flash_data ek_flash_data = { 121static struct physmap_flash_data ek_flash_data = {
125 .width = 2, 122 .width = 2,
126}; 123};
127 124
128static struct resource ek_flash_resource = { 125static struct resource ek_flash_resource = {
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 4b39b9cda75b..cb065febd95e 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -37,19 +37,10 @@
37#include <asm/arch/board.h> 37#include <asm/arch/board.h>
38#include <asm/arch/gpio.h> 38#include <asm/arch/gpio.h>
39 39
40#include "generic.h" 40#include <asm/arch/at91rm9200_mc.h>
41 41
42#include "generic.h"
42 43
43/*
44 * Serial port configuration.
45 * 0 .. 3 = USART0 .. USART3
46 * 4 = DBGU
47 */
48static struct at91_uart_config __initdata kb9202_uart_config = {
49 .console_tty = 0, /* ttyS0 */
50 .nr_tty = 3,
51 .tty_map = { 4, 0, 1, -1, -1 } /* ttyS0, ..., ttyS4 */
52};
53 44
54static void __init kb9202_map_io(void) 45static void __init kb9202_map_io(void)
55{ 46{
@@ -59,8 +50,20 @@ static void __init kb9202_map_io(void)
59 /* Set up the LEDs */ 50 /* Set up the LEDs */
60 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18); 51 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
61 52
62 /* Setup the serial ports and console */ 53 /* DBGU on ttyS0. (Rx & Tx only) */
63 at91_init_serial(&kb9202_uart_config); 54 at91_register_uart(0, 0, 0);
55
56 /* USART0 on ttyS1 (Rx & Tx only) */
57 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
58
59 /* USART1 on ttyS2 (Rx & Tx only) - IRDA (optional) */
60 at91_register_uart(AT91RM9200_ID_US1, 2, 0);
61
62 /* USART3 on ttyS3 (Rx, Tx, CTS, RTS) - RS485 (optional) */
63 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
64
65 /* set serial console to ttyS0 (ie, DBGU) */
66 at91_set_serial_console(0);
64} 67}
65 68
66static void __init kb9202_init_irq(void) 69static void __init kb9202_init_irq(void)
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
new file mode 100644
index 000000000000..99b4ec3818d6
--- /dev/null
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -0,0 +1,255 @@
1/*
2 * linux/arch/arm/mach-at91/board-qil-a9260.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2007 Calao-systems
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/types.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/gpio_keys.h>
30#include <linux/input.h>
31#include <linux/clk.h>
32
33#include <asm/hardware.h>
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <asm/arch/board.h>
43#include <asm/arch/gpio.h>
44#include <asm/arch/at91_shdwc.h>
45
46#include "generic.h"
47
48
49static void __init ek_map_io(void)
50{
51 /* Initialize processor: 12.000 MHz crystal */
52 at91sam9260_initialize(12000000);
53
54 /* DGBU on ttyS0. (Rx & Tx only) */
55 at91_register_uart(0, 0, 0);
56
57 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
58 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
59 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
60 | ATMEL_UART_RI);
61
62 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
63 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
64
65 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
66 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
67
68 /* set serial console to ttyS1 (ie, USART0) */
69 at91_set_serial_console(1);
70
71}
72
73static void __init ek_init_irq(void)
74{
75 at91sam9260_init_interrupts(NULL);
76}
77
78
79/*
80 * USB Host port
81 */
82static struct at91_usbh_data __initdata ek_usbh_data = {
83 .ports = 2,
84};
85
86/*
87 * USB Device port
88 */
89static struct at91_udc_data __initdata ek_udc_data = {
90 .vbus_pin = AT91_PIN_PC5,
91 .pullup_pin = 0, /* pull-up driven by UDC */
92};
93
94/*
95 * SPI devices.
96 */
97static struct spi_board_info ek_spi_devices[] = {
98#if defined(CONFIG_RTC_DRV_M41T94)
99 { /* M41T94 RTC */
100 .modalias = "m41t94",
101 .chip_select = 0,
102 .max_speed_hz = 1 * 1000 * 1000,
103 .bus_num = 0,
104 }
105#endif
106};
107
108/*
109 * MACB Ethernet device
110 */
111static struct at91_eth_data __initdata ek_macb_data = {
112 .phy_irq_pin = AT91_PIN_PA31,
113 .is_rmii = 1,
114};
115
116/*
117 * NAND flash
118 */
119static struct mtd_partition __initdata ek_nand_partition[] = {
120 {
121 .name = "Uboot & Kernel",
122 .offset = 0x00000000,
123 .size = 16 * 1024 * 1024,
124 },
125 {
126 .name = "Root FS",
127 .offset = 0x01000000,
128 .size = 120 * 1024 * 1024,
129 },
130 {
131 .name = "FS",
132 .offset = 0x08800000,
133 .size = 120 * 1024 * 1024,
134 },
135};
136
137static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
138{
139 *num_partitions = ARRAY_SIZE(ek_nand_partition);
140 return ek_nand_partition;
141}
142
143static struct at91_nand_data __initdata ek_nand_data = {
144 .ale = 21,
145 .cle = 22,
146// .det_pin = ... not connected
147 .rdy_pin = AT91_PIN_PC13,
148 .enable_pin = AT91_PIN_PC14,
149 .partition_info = nand_partitions,
150#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
151 .bus_width_16 = 1,
152#else
153 .bus_width_16 = 0,
154#endif
155};
156
157/*
158 * MCI (SD/MMC)
159 */
160static struct at91_mmc_data __initdata ek_mmc_data = {
161 .slot_b = 0,
162 .wire4 = 1,
163// .det_pin = ... not connected
164// .wp_pin = ... not connected
165// .vcc_pin = ... not connected
166};
167
168/*
169 * GPIO Buttons
170 */
171#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
172static struct gpio_keys_button ek_buttons[] = {
173 { /* USER PUSH BUTTON */
174 .code = KEY_ENTER,
175 .gpio = AT91_PIN_PB10,
176 .active_low = 1,
177 .desc = "user_pb",
178 .wakeup = 1,
179 }
180};
181
182static struct gpio_keys_platform_data ek_button_data = {
183 .buttons = ek_buttons,
184 .nbuttons = ARRAY_SIZE(ek_buttons),
185};
186
187static struct platform_device ek_button_device = {
188 .name = "gpio-keys",
189 .id = -1,
190 .num_resources = 0,
191 .dev = {
192 .platform_data = &ek_button_data,
193 }
194};
195
196static void __init ek_add_device_buttons(void)
197{
198 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
199 at91_set_deglitch(AT91_PIN_PB10, 1);
200
201 platform_device_register(&ek_button_device);
202}
203#else
204static void __init ek_add_device_buttons(void) {}
205#endif
206
207/*
208 * LEDs
209 */
210static struct gpio_led ek_leds[] = {
211 { /* user_led (green) */
212 .name = "user_led",
213 .gpio = AT91_PIN_PB21,
214 .active_low = 0,
215 .default_trigger = "heartbeat",
216 }
217};
218
219static void __init ek_board_init(void)
220{
221 /* Serial */
222 at91_add_device_serial();
223 /* USB Host */
224 at91_add_device_usbh(&ek_usbh_data);
225 /* USB Device */
226 at91_add_device_udc(&ek_udc_data);
227 /* SPI */
228 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
229 /* NAND */
230 at91_add_device_nand(&ek_nand_data);
231 /* I2C */
232 at91_add_device_i2c(NULL, 0);
233 /* Ethernet */
234 at91_add_device_eth(&ek_macb_data);
235 /* MMC */
236 at91_add_device_mmc(0, &ek_mmc_data);
237 /* Push Buttons */
238 ek_add_device_buttons();
239 /* LEDs */
240 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
241 /* shutdown controller, wakeup button (5 msec low) */
242 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
243 | AT91_SHDW_RTTWKEN);
244}
245
246MACHINE_START(QIL_A9260, "CALAO QIL_A9260")
247 /* Maintainer: calao-systems */
248 .phys_io = AT91_BASE_SYS,
249 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
250 .boot_params = AT91_SDRAM_BASE + 0x100,
251 .timer = &at91sam926x_timer,
252 .map_io = ek_map_io,
253 .init_irq = ek_init_irq,
254 .init_machine = ek_board_init,
255MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
new file mode 100644
index 000000000000..45617c201240
--- /dev/null
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -0,0 +1,218 @@
1/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2008 Atmel
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/types.h>
21#include <linux/init.h>
22#include <linux/mm.h>
23#include <linux/module.h>
24#include <linux/platform_device.h>
25#include <linux/spi/spi.h>
26#include <linux/spi/at73c213.h>
27#include <linux/clk.h>
28
29#include <asm/hardware.h>
30#include <asm/setup.h>
31#include <asm/mach-types.h>
32#include <asm/irq.h>
33
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
37
38#include <asm/arch/board.h>
39#include <asm/arch/gpio.h>
40
41#include "generic.h"
42
43
44static void __init ek_map_io(void)
45{
46 /* Initialize processor: 18.432 MHz crystal */
47 at91sam9260_initialize(18432000);
48
49 /* DGBU on ttyS0. (Rx & Tx only) */
50 at91_register_uart(0, 0, 0);
51
52 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
53 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
54 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
55 | ATMEL_UART_RI);
56
57 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
58 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
59
60 /* set serial console to ttyS0 (ie, DBGU) */
61 at91_set_serial_console(0);
62}
63
64static void __init ek_init_irq(void)
65{
66 at91sam9260_init_interrupts(NULL);
67}
68
69
70/*
71 * USB Host port
72 */
73static struct at91_usbh_data __initdata ek_usbh_data = {
74 .ports = 2,
75};
76
77/*
78 * USB Device port
79 */
80static struct at91_udc_data __initdata ek_udc_data = {
81 .vbus_pin = AT91_PIN_PC5,
82 .pullup_pin = 0, /* pull-up driven by UDC */
83};
84
85
86/*
87 * SPI devices.
88 */
89static struct spi_board_info ek_spi_devices[] = {
90#if !defined(CONFIG_MMC_AT91)
91 { /* DataFlash chip */
92 .modalias = "mtd_dataflash",
93 .chip_select = 1,
94 .max_speed_hz = 15 * 1000 * 1000,
95 .bus_num = 0,
96 },
97#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
98 { /* DataFlash card */
99 .modalias = "mtd_dataflash",
100 .chip_select = 0,
101 .max_speed_hz = 15 * 1000 * 1000,
102 .bus_num = 0,
103 },
104#endif
105#endif
106};
107
108
109/*
110 * MACB Ethernet device
111 */
112static struct at91_eth_data __initdata ek_macb_data = {
113 .phy_irq_pin = AT91_PIN_PA7,
114 .is_rmii = 1,
115};
116
117
118/*
119 * NAND flash
120 */
121static struct mtd_partition __initdata ek_nand_partition[] = {
122 {
123 .name = "Bootstrap",
124 .offset = 0,
125 .size = 4 * 1024 * 1024,
126 },
127 {
128 .name = "Partition 1",
129 .offset = 4 * 1024 * 1024,
130 .size = 60 * 1024 * 1024,
131 },
132 {
133 .name = "Partition 2",
134 .offset = 64 * 1024 * 1024,
135 .size = MTDPART_SIZ_FULL,
136 },
137};
138
139static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
140{
141 *num_partitions = ARRAY_SIZE(ek_nand_partition);
142 return ek_nand_partition;
143}
144
145/* det_pin is not connected */
146static struct at91_nand_data __initdata ek_nand_data = {
147 .ale = 21,
148 .cle = 22,
149 .rdy_pin = AT91_PIN_PC13,
150 .enable_pin = AT91_PIN_PC14,
151 .partition_info = nand_partitions,
152#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
153 .bus_width_16 = 1,
154#else
155 .bus_width_16 = 0,
156#endif
157};
158
159
160/*
161 * MCI (SD/MMC)
162 * det_pin, wp_pin and vcc_pin are not connected
163 */
164static struct at91_mmc_data __initdata ek_mmc_data = {
165 .slot_b = 1,
166 .wire4 = 1,
167};
168
169
170/*
171 * LEDs
172 */
173static struct gpio_led ek_leds[] = {
174 { /* "bottom" led, green, userled1 to be defined */
175 .name = "ds5",
176 .gpio = AT91_PIN_PA6,
177 .active_low = 1,
178 .default_trigger = "none",
179 },
180 { /* "power" led, yellow */
181 .name = "ds1",
182 .gpio = AT91_PIN_PA9,
183 .default_trigger = "heartbeat",
184 }
185};
186
187static void __init ek_board_init(void)
188{
189 /* Serial */
190 at91_add_device_serial();
191 /* USB Host */
192 at91_add_device_usbh(&ek_usbh_data);
193 /* USB Device */
194 at91_add_device_udc(&ek_udc_data);
195 /* SPI */
196 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
197 /* NAND */
198 at91_add_device_nand(&ek_nand_data);
199 /* Ethernet */
200 at91_add_device_eth(&ek_macb_data);
201 /* MMC */
202 at91_add_device_mmc(0, &ek_mmc_data);
203 /* I2C */
204 at91_add_device_i2c(NULL, 0);
205 /* LEDs */
206 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
207}
208
209MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK")
210 /* Maintainer: Atmel */
211 .phys_io = AT91_BASE_SYS,
212 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
213 .boot_params = AT91_SDRAM_BASE + 0x100,
214 .timer = &at91sam926x_timer,
215 .map_io = ek_map_io,
216 .init_irq = ek_init_irq,
217 .init_machine = ek_board_init,
218MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index ffc0597aee8d..b6a70fc735c3 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -56,6 +56,14 @@ static void __init ek_init_irq(void)
56 56
57 57
58/* 58/*
59 * USB HS Device port
60 */
61static struct usba_platform_data __initdata ek_usba_udc_data = {
62 .vbus_pin = AT91_PIN_PA8,
63};
64
65
66/*
59 * MCI (SD/MMC) 67 * MCI (SD/MMC)
60 */ 68 */
61static struct at91_mmc_data __initdata ek_mmc_data = { 69static struct at91_mmc_data __initdata ek_mmc_data = {
@@ -175,6 +183,8 @@ static void __init ek_board_init(void)
175{ 183{
176 /* Serial */ 184 /* Serial */
177 at91_add_device_serial(); 185 at91_add_device_serial();
186 /* USB HS */
187 at91_add_device_usba(&ek_usba_udc_data);
178 /* I2C */ 188 /* I2C */
179 at91_add_device_i2c(NULL, 0); 189 at91_add_device_i2c(NULL, 0);
180 /* NAND */ 190 /* NAND */
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
new file mode 100644
index 000000000000..837aedf8ffeb
--- /dev/null
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -0,0 +1,215 @@
1/*
2 * linux/arch/arm/mach-at91/board-usb-a9260.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2007 Calao-systems
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/types.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/gpio_keys.h>
30#include <linux/input.h>
31#include <linux/clk.h>
32
33#include <asm/hardware.h>
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <asm/arch/board.h>
43#include <asm/arch/gpio.h>
44#include <asm/arch/at91_shdwc.h>
45
46#include "generic.h"
47
48
49static void __init ek_map_io(void)
50{
51 /* Initialize processor: 12.000 MHz crystal */
52 at91sam9260_initialize(12000000);
53
54 /* DGBU on ttyS0. (Rx & Tx only) */
55 at91_register_uart(0, 0, 0);
56
57 /* set serial console to ttyS0 (ie, DBGU) */
58 at91_set_serial_console(0);
59}
60
61static void __init ek_init_irq(void)
62{
63 at91sam9260_init_interrupts(NULL);
64}
65
66
67/*
68 * USB Host port
69 */
70static struct at91_usbh_data __initdata ek_usbh_data = {
71 .ports = 2,
72};
73
74/*
75 * USB Device port
76 */
77static struct at91_udc_data __initdata ek_udc_data = {
78 .vbus_pin = AT91_PIN_PC5,
79 .pullup_pin = 0, /* pull-up driven by UDC */
80};
81
82/*
83 * MACB Ethernet device
84 */
85static struct at91_eth_data __initdata ek_macb_data = {
86 .phy_irq_pin = AT91_PIN_PA31,
87 .is_rmii = 1,
88};
89
90/*
91 * NAND flash
92 */
93static struct mtd_partition __initdata ek_nand_partition[] = {
94 {
95 .name = "Uboot & Kernel",
96 .offset = 0x00000000,
97 .size = 16 * 1024 * 1024,
98 },
99 {
100 .name = "Root FS",
101 .offset = 0x01000000,
102 .size = 120 * 1024 * 1024,
103 },
104 {
105 .name = "FS",
106 .offset = 0x08800000,
107 .size = 120 * 1024 * 1024,
108 }
109};
110
111static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
112{
113 *num_partitions = ARRAY_SIZE(ek_nand_partition);
114 return ek_nand_partition;
115}
116
117static struct at91_nand_data __initdata ek_nand_data = {
118 .ale = 21,
119 .cle = 22,
120// .det_pin = ... not connected
121 .rdy_pin = AT91_PIN_PC13,
122 .enable_pin = AT91_PIN_PC14,
123 .partition_info = nand_partitions,
124#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
125 .bus_width_16 = 1,
126#else
127 .bus_width_16 = 0,
128#endif
129};
130
131/*
132 * GPIO Buttons
133 */
134
135#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
136static struct gpio_keys_button ek_buttons[] = {
137 { /* USER PUSH BUTTON */
138 .code = KEY_ENTER,
139 .gpio = AT91_PIN_PB10,
140 .active_low = 1,
141 .desc = "user_pb",
142 .wakeup = 1,
143 }
144};
145
146static struct gpio_keys_platform_data ek_button_data = {
147 .buttons = ek_buttons,
148 .nbuttons = ARRAY_SIZE(ek_buttons),
149};
150
151static struct platform_device ek_button_device = {
152 .name = "gpio-keys",
153 .id = -1,
154 .num_resources = 0,
155 .dev = {
156 .platform_data = &ek_button_data,
157 }
158};
159
160static void __init ek_add_device_buttons(void)
161{
162 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
163 at91_set_deglitch(AT91_PIN_PB10, 1);
164
165 platform_device_register(&ek_button_device);
166}
167#else
168static void __init ek_add_device_buttons(void) {}
169#endif
170
171/*
172 * LEDs
173 */
174static struct gpio_led ek_leds[] = {
175 { /* user_led (green) */
176 .name = "user_led",
177 .gpio = AT91_PIN_PB21,
178 .active_low = 0,
179 .default_trigger = "heartbeat",
180 }
181};
182
183static void __init ek_board_init(void)
184{
185 /* Serial */
186 at91_add_device_serial();
187 /* USB Host */
188 at91_add_device_usbh(&ek_usbh_data);
189 /* USB Device */
190 at91_add_device_udc(&ek_udc_data);
191 /* NAND */
192 at91_add_device_nand(&ek_nand_data);
193 /* I2C */
194 at91_add_device_i2c(NULL, 0);
195 /* Ethernet */
196 at91_add_device_eth(&ek_macb_data);
197 /* Push Buttons */
198 ek_add_device_buttons();
199 /* LEDs */
200 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
201 /* shutdown controller, wakeup button (5 msec low) */
202 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
203 | AT91_SHDW_RTTWKEN);
204}
205
206MACHINE_START(USB_A9260, "CALAO USB_A9260")
207 /* Maintainer: calao-systems */
208 .phys_io = AT91_BASE_SYS,
209 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
210 .boot_params = AT91_SDRAM_BASE + 0x100,
211 .timer = &at91sam926x_timer,
212 .map_io = ek_map_io,
213 .init_irq = ek_init_irq,
214 .init_machine = ek_board_init,
215MACHINE_END
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
new file mode 100644
index 000000000000..95800d32bd49
--- /dev/null
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -0,0 +1,230 @@
1/*
2 * linux/arch/arm/mach-at91/board-usb-a9263.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation.
6 * Copyright (C) 2007 Calao-systems
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/types.h>
24#include <linux/init.h>
25#include <linux/mm.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/gpio_keys.h>
30#include <linux/input.h>
31
32#include <asm/hardware.h>
33#include <asm/setup.h>
34#include <asm/mach-types.h>
35#include <asm/irq.h>
36
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39#include <asm/mach/irq.h>
40
41#include <asm/arch/board.h>
42#include <asm/arch/gpio.h>
43#include <asm/arch/at91_shdwc.h>
44
45#include "generic.h"
46
47
48static void __init ek_map_io(void)
49{
50 /* Initialize processor: 12.00 MHz crystal */
51 at91sam9263_initialize(12000000);
52
53 /* DGBU on ttyS0. (Rx & Tx only) */
54 at91_register_uart(0, 0, 0);
55
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
58}
59
60static void __init ek_init_irq(void)
61{
62 at91sam9263_init_interrupts(NULL);
63}
64
65
66/*
67 * USB Host port
68 */
69static struct at91_usbh_data __initdata ek_usbh_data = {
70 .ports = 2,
71};
72
73/*
74 * USB Device port
75 */
76static struct at91_udc_data __initdata ek_udc_data = {
77 .vbus_pin = AT91_PIN_PB11,
78 .pullup_pin = 0, /* pull-up driven by UDC */
79};
80
81/*
82 * SPI devices.
83 */
84static struct spi_board_info ek_spi_devices[] = {
85#if !defined(CONFIG_MMC_AT91)
86 { /* DataFlash chip */
87 .modalias = "mtd_dataflash",
88 .chip_select = 0,
89 .max_speed_hz = 15 * 1000 * 1000,
90 .bus_num = 0,
91 }
92#endif
93};
94
95/*
96 * MACB Ethernet device
97 */
98static struct at91_eth_data __initdata ek_macb_data = {
99 .phy_irq_pin = AT91_PIN_PE31,
100 .is_rmii = 1,
101};
102
103/*
104 * NAND flash
105 */
106static struct mtd_partition __initdata ek_nand_partition[] = {
107 {
108 .name = "Linux Kernel",
109 .offset = 0x00000000,
110 .size = 16 * 1024 * 1024,
111 },
112 {
113 .name = "Root FS",
114 .offset = 0x01000000,
115 .size = 120 * 1024 * 1024,
116 },
117 {
118 .name = "FS",
119 .offset = 0x08800000,
120 .size = 120 * 1024 * 1024,
121 }
122};
123
124static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
125{
126 *num_partitions = ARRAY_SIZE(ek_nand_partition);
127 return ek_nand_partition;
128}
129
130static struct at91_nand_data __initdata ek_nand_data = {
131 .ale = 21,
132 .cle = 22,
133// .det_pin = ... not connected
134 .rdy_pin = AT91_PIN_PA22,
135 .enable_pin = AT91_PIN_PD15,
136 .partition_info = nand_partitions,
137#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
138 .bus_width_16 = 1,
139#else
140 .bus_width_16 = 0,
141#endif
142};
143
144/*
145 * GPIO Buttons
146 */
147#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
148static struct gpio_keys_button ek_buttons[] = {
149 { /* USER PUSH BUTTON */
150 .code = KEY_ENTER,
151 .gpio = AT91_PIN_PB10,
152 .active_low = 1,
153 .desc = "user_pb",
154 .wakeup = 1,
155 }
156};
157
158static struct gpio_keys_platform_data ek_button_data = {
159 .buttons = ek_buttons,
160 .nbuttons = ARRAY_SIZE(ek_buttons),
161};
162
163static struct platform_device ek_button_device = {
164 .name = "gpio-keys",
165 .id = -1,
166 .num_resources = 0,
167 .dev = {
168 .platform_data = &ek_button_data,
169 }
170};
171
172static void __init ek_add_device_buttons(void)
173{
174 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
175 at91_set_deglitch(AT91_PIN_PB10, 1);
176
177 platform_device_register(&ek_button_device);
178}
179#else
180static void __init ek_add_device_buttons(void) {}
181#endif
182
183/*
184 * LEDs
185 */
186static struct gpio_led ek_leds[] = {
187 { /* user_led (green) */
188 .name = "user_led",
189 .gpio = AT91_PIN_PB21,
190 .active_low = 1,
191 .default_trigger = "heartbeat",
192 }
193};
194
195
196static void __init ek_board_init(void)
197{
198 /* Serial */
199 at91_add_device_serial();
200 /* USB Host */
201 at91_add_device_usbh(&ek_usbh_data);
202 /* USB Device */
203 at91_add_device_udc(&ek_udc_data);
204 /* SPI */
205 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
206 /* Ethernet */
207 at91_add_device_eth(&ek_macb_data);
208 /* NAND */
209 at91_add_device_nand(&ek_nand_data);
210 /* I2C */
211 at91_add_device_i2c(NULL, 0);
212 /* Push Buttons */
213 ek_add_device_buttons();
214 /* LEDs */
215 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
216 /* shutdown controller, wakeup button (5 msec low) */
217 at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
218 | AT91_SHDW_RTTWKEN);
219}
220
221MACHINE_START(USB_A9263, "CALAO USB_A9263")
222 /* Maintainer: calao-systems */
223 .phys_io = AT91_BASE_SYS,
224 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
225 .boot_params = AT91_SDRAM_BASE + 0x100,
226 .timer = &at91sam926x_timer,
227 .map_io = ek_map_io,
228 .init_irq = ek_init_irq,
229 .init_machine = ek_board_init,
230MACHINE_END
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index b5717108991d..7079050ab88d 100755
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * linux/arch/arm/mach-at91/board-yl-9200.c 2 * linux/arch/arm/mach-at91/board-yl-9200.c
3 * 3 *
4 * Adapted from: 4 * Adapted from various board files in arch/arm/mach-at91
5 *various board files in 5 *
6 * /arch/arm/mach-at91 6 * Modifications for YL-9200 platform:
7 * modifications to convert to YL-9200 platform 7 * Copyright (C) 2007 S. Birtles
8 * Copyright (C) 2007 S.Birtles
9 * 8 *
10 * 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
11 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -26,13 +25,14 @@
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/mm.h> 26#include <linux/mm.h>
28#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/dma-mapping.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/spi/spi.h> 30#include <linux/spi/spi.h>
31/*#include <linux/can_bus/candata.h>*/
32#include <linux/spi/ads7846.h> 31#include <linux/spi/ads7846.h>
33#include <linux/mtd/physmap.h> 32#include <linux/mtd/physmap.h>
33#include <linux/gpio_keys.h>
34#include <linux/input.h>
34 35
35/*#include <sound/gpio_sounder.h>*/
36#include <asm/hardware.h> 36#include <asm/hardware.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
@@ -45,179 +45,108 @@
45#include <asm/arch/board.h> 45#include <asm/arch/board.h>
46#include <asm/arch/gpio.h> 46#include <asm/arch/gpio.h>
47#include <asm/arch/at91rm9200_mc.h> 47#include <asm/arch/at91rm9200_mc.h>
48#include <linux/gpio_keys.h>
49#include <linux/input.h>
50 48
51#include "generic.h" 49#include "generic.h"
52#include <asm/arch/at91_pio.h>
53 50
54#define YL_9200_FLASH_BASE AT91_CHIPSELECT_0
55#define YL_9200_FLASH_SIZE 0x800000
56 51
57/* 52static void __init yl9200_map_io(void)
58 * Serial port configuration. 53{
59 * 0 .. 3 = USART0 .. USART3 54 /* Initialize processor: 18.432 MHz crystal */
60 * 4 = DBGU 55 at91rm9200_initialize(18432000, AT91RM9200_PQFP);
61 *atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
62 *atmel_usart.1: ttyS1 at MMIO 0xfffc0000 (irq = 6) is a ATMEL_SERIAL
63 *atmel_usart.2: ttyS2 at MMIO 0xfffc4000 (irq = 7) is a ATMEL_SERIAL
64 *atmel_usart.3: ttyS3 at MMIO 0xfffc8000 (irq = 8) is a ATMEL_SERIAL
65 *atmel_usart.4: ttyS4 at MMIO 0xfffcc000 (irq = 9) is a ATMEL_SERIAL
66 * on the YL-9200 we are sitting at the following
67 *ttyS0 at MMIO 0xfefff200 (irq = 1) is a AT91_SERIAL
68 *ttyS1 at MMIO 0xfefc4000 (irq = 7) is a AT91_SERIAL
69 */
70 56
71/* extern void __init yl_9200_add_device_sounder(struct gpio_sounder *sounders, int nr);*/ 57 /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
58 at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
72 59
73static struct at91_uart_config __initdata yl_9200_uart_config = { 60 /* DBGU on ttyS0. (Rx & Tx only) */
74 .console_tty = 0, /* ttyS0 */ 61 at91_register_uart(0, 0, 0);
75 .nr_tty = 3,
76 .tty_map = { 4, 1, 0, -1, -1 } /* ttyS0, ..., ttyS4 */
77};
78 62
79static void __init yl_9200_map_io(void) 63 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
80{ 64 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
81 /* Initialize processor: 18.432 MHz crystal */ 65 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
82 /*Also initialises register clocks & gpio*/ 66 | ATMEL_UART_RI);
83 at91rm9200_initialize(18432000, AT91RM9200_PQFP); /*we have a 3 bank system*/
84 67
85 /* Setup the serial ports and console */ 68 /* USART0 on ttyS2. (Rx & Tx only to JP3) */
86 at91_init_serial(&yl_9200_uart_config); 69 at91_register_uart(AT91RM9200_ID_US0, 2, 0);
87 70
88 /* Setup the LEDs D2=PB17,D3=PB16 */ 71 /* USART3 on ttyS3. (Rx, Tx, RTS - RS485 interface) */
89 at91_init_leds(AT91_PIN_PB16,AT91_PIN_PB17); /*cpu-led,timer-led*/ 72 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_RTS);
73
74 /* set serial console to ttyS0 (ie, DBGU) */
75 at91_set_serial_console(0);
90} 76}
91 77
92static void __init yl_9200_init_irq(void) 78static void __init yl9200_init_irq(void)
93{ 79{
94 at91rm9200_init_interrupts(NULL); 80 at91rm9200_init_interrupts(NULL);
95} 81}
96 82
97static struct at91_eth_data __initdata yl_9200_eth_data = {
98 .phy_irq_pin = AT91_PIN_PB28,
99 .is_rmii = 1,
100};
101 83
102static struct at91_usbh_data __initdata yl_9200_usbh_data = { 84/*
103 .ports = 1, /* this should be 1 not 2 for the Yl9200*/ 85 * LEDs
86 */
87static struct gpio_led yl9200_leds[] = {
88 { /* D2 */
89 .name = "led2",
90 .gpio = AT91_PIN_PB17,
91 .active_low = 1,
92 .default_trigger = "timer",
93 },
94 { /* D3 */
95 .name = "led3",
96 .gpio = AT91_PIN_PB16,
97 .active_low = 1,
98 .default_trigger = "heartbeat",
99 },
100 { /* D4 */
101 .name = "led4",
102 .gpio = AT91_PIN_PB15,
103 .active_low = 1,
104 },
105 { /* D5 */
106 .name = "led5",
107 .gpio = AT91_PIN_PB8,
108 .active_low = 1,
109 }
104}; 110};
105 111
106static struct at91_udc_data __initdata yl_9200_udc_data = {
107/*on sheet 7 Schemitic rev 1.0*/
108 .pullup_pin = AT91_PIN_PC4,
109 .vbus_pin= AT91_PIN_PC5,
110 .pullup_active_low = 1, /*ACTIVE LOW!! due to PNP transistor on page 7*/
111
112};
113/* 112/*
114static struct at91_cf_data __initdata yl_9200_cf_data = { 113 * Ethernet
115TODO S.BIRTLES 114 */
116 .det_pin = AT91_PIN_xxx, 115static struct at91_eth_data __initdata yl9200_eth_data = {
117 .rst_pin = AT91_PIN_xxx, 116 .phy_irq_pin = AT91_PIN_PB28,
118 .irq_pin = ... not connected 117 .is_rmii = 1,
119 .vcc_pin = ... always powered
120
121}; 118};
122*/
123static struct at91_mmc_data __initdata yl_9200_mmc_data = {
124 .det_pin = AT91_PIN_PB9, /*THIS LOOKS CORRECT SHEET7*/
125/* .wp_pin = ... not connected SHEET7*/
126 .slot_b = 0,
127 .wire4 = 1,
128 119
120/*
121 * USB Host
122 */
123static struct at91_usbh_data __initdata yl9200_usbh_data = {
124 .ports = 1, /* PQFP version of AT91RM9200 */
129}; 125};
130 126
131/* -------------------------------------------------------------------- 127/*
132 * Touch screen 128 * USB Device
133 * -------------------------------------------------------------------- */ 129 */
134#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 130static struct at91_udc_data __initdata yl9200_udc_data = {
135static int ads7843_pendown_state(void) 131 .pullup_pin = AT91_PIN_PC4,
136{ 132 .vbus_pin = AT91_PIN_PC5,
137 return !at91_get_gpio_value(AT91_PIN_PB11); /* Touchscreen PENIRQ */ 133 .pullup_active_low = 1, /* Active Low due to PNP transistor (pg 7) */
138}
139
140static void __init at91_init_device_ts(void)
141{
142/*IMPORTANT NOTE THE SPI INTERFACE IS ALREADY CONFIGURED BY XXX_DEVICES.C
143THAT IS TO SAY THAT MISO,MOSI,SPCK AND CS are already configured
144we only need to enable the other datapins which are:
145PB10/RK1 BUSY
146*/
147/* Touchscreen BUSY signal , pin,use pullup ( TODO not currently used in the ADS7843/6.c driver)*/
148at91_set_gpio_input(AT91_PIN_PB10, 1);
149}
150
151#else
152static void __init at91_init_device_ts(void) {}
153#endif
154
155static struct ads7846_platform_data ads_info = {
156 .model = 7843,
157 .x_min = 150,
158 .x_max = 3830,
159 .y_min = 190,
160 .y_max = 3830,
161 .vref_delay_usecs = 100,
162/* for a 8" touch screen*/
163 //.x_plate_ohms = 603, //= 450, S.Birtles TODO
164 //.y_plate_ohms = 332, //= 250, S.Birtles TODO
165/*for a 10.4" touch screen*/
166 //.x_plate_ohms =611,
167 //.y_plate_ohms =325,
168
169 .x_plate_ohms = 576,
170 .y_plate_ohms = 366,
171 //
172 .pressure_max = 15000, /*generally nonsense on the 7843*/
173 /*number of times to send query to chip in a given run 0 equals one time (do not set to 0!! ,there is a bug in ADS 7846 code)*/
174 .debounce_max = 1,
175 .debounce_rep = 0,
176 .debounce_tol = (~0),
177 .get_pendown_state = ads7843_pendown_state,
178};
179 134
180/*static struct canbus_platform_data can_info = {
181 .model = 2510,
182}; 135};
183*/
184
185static struct spi_board_info yl_9200_spi_devices[] = {
186/*this sticks it at:
187 /sys/devices/platform/atmel_spi.0/spi0.0
188 /sys/bus/platform/devices/
189Documentation/spi IIRC*/
190 136
191#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 137/*
192 /*(this IS correct 04-NOV-2007)*/ 138 * MMC
193 { 139 */
194 .modalias = "ads7846", /* because the driver is called ads7846*/ 140static struct at91_mmc_data __initdata yl9200_mmc_data = {
195 .chip_select = 0, /*THIS MUST BE AN INDEX INTO AN ARRAY OF pins */ 141 .det_pin = AT91_PIN_PB9,
196/*this is ONLY TO BE USED if chipselect above is not used, it passes a pin directly for the chip select*/ 142 // .wp_pin = ... not connected
197 /*.controller_data =AT91_PIN_PA3 ,*/ 143 .wire4 = 1,
198 .max_speed_hz = 5000*26, /*(4700 * 26)-125000 * 26, (max sample rate @ 3V) * (cmd + data + overhead) */
199 .bus_num = 0,
200 .platform_data = &ads_info,
201 .irq = AT91_PIN_PB11,
202 },
203#endif
204/*we need to put our CAN driver data here!!*/
205/*THIS IS ALL DUMMY DATA*/
206/* {
207 .modalias = "mcp2510", //DUMMY for MCP2510 chip
208 .chip_select = 1,*/ /*THIS MUST BE AN INDEX INTO AN ARRAY OF pins */
209 /*this is ONLY TO BE USED if chipselect above is not used, it passes a pin directly for the chip select */
210 /* .controller_data =AT91_PIN_PA4 ,
211 .max_speed_hz = 25000 * 26,
212 .bus_num = 0,
213 .platform_data = &can_info,
214 .irq = AT91_PIN_PC0,
215 },
216 */
217 //max SPI chip needs to go here
218}; 144};
219 145
220static struct mtd_partition __initdata yl_9200_nand_partition[] = { 146/*
147 * NAND Flash
148 */
149static struct mtd_partition __initdata yl9200_nand_partition[] = {
221 { 150 {
222 .name = "AT91 NAND partition 1, boot", 151 .name = "AT91 NAND partition 1, boot",
223 .offset = 0, 152 .offset = 0,
@@ -242,442 +171,434 @@ static struct mtd_partition __initdata yl_9200_nand_partition[] = {
242 .name = "AT91 NAND partition 5, ext-fs", 171 .name = "AT91 NAND partition 5, ext-fs",
243 .offset = 32 * SZ_1M, 172 .offset = 32 * SZ_1M,
244 .size = 32 * SZ_1M 173 .size = 32 * SZ_1M
245 }, 174 }
246}; 175};
247 176
248static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) 177static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
249{ 178{
250 *num_partitions = ARRAY_SIZE(yl_9200_nand_partition); 179 *num_partitions = ARRAY_SIZE(yl9200_nand_partition);
251 return yl_9200_nand_partition; 180 return yl9200_nand_partition;
252} 181}
253 182
254static struct at91_nand_data __initdata yl_9200_nand_data = { 183static struct at91_nand_data __initdata yl9200_nand_data = {
255 .ale= 6, 184 .ale = 6,
256 .cle= 7, 185 .cle = 7,
257 /*.det_pin = AT91_PIN_PCxx,*/ /*we don't have a det pin because NandFlash is fixed to board*/ 186 // .det_pin = ... not connected
258 .rdy_pin = AT91_PIN_PC14, /*R/!B Sheet10*/ 187 .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */
259 .enable_pin = AT91_PIN_PC15, /*!CE Sheet10 */ 188 .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */
260 .partition_info = nand_partitions, 189 .partition_info = nand_partitions,
261}; 190};
262 191
263
264
265/* 192/*
266TODO S.Birtles 193 * NOR Flash
267potentially a problem with the size above 194 */
268physmap platform flash device: 00800000 at 10000000 195#define YL9200_FLASH_BASE AT91_CHIPSELECT_0
269physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank 196#define YL9200_FLASH_SIZE 0x1000000
270NOR chip too large to fit in mapping. Attempting to cope...
271 Intel/Sharp Extended Query Table at 0x0031
272Using buffer write method
273cfi_cmdset_0001: Erase suspend on write enabled
274Reducing visibility of 16384KiB chip to 8192KiB
275*/
276 197
277static struct mtd_partition yl_9200_flash_partitions[] = { 198static struct mtd_partition yl9200_flash_partitions[] = {
199 {
200 .name = "Bootloader",
201 .size = 0x00040000,
202 .offset = 0,
203 .mask_flags = MTD_WRITEABLE, /* force read-only */
204 },
278 { 205 {
279 .name = "Bootloader", 206 .name = "Kernel",
280 .size = 0x00040000, 207 .size = 0x001C0000,
281 .offset = 0, 208 .offset = 0x00040000,
282 .mask_flags = MTD_WRITEABLE /* force read-only */ 209 },
283 },{ 210 {
284 .name = "Kernel", 211 .name = "Filesystem",
285 .size = 0x001C0000, 212 .size = MTDPART_SIZ_FULL,
286 .offset = 0x00040000, 213 .offset = 0x00200000
287 },{
288 .name = "Filesystem",
289 .size = MTDPART_SIZ_FULL,
290 .offset = 0x00200000
291 } 214 }
292
293}; 215};
294 216
295static struct physmap_flash_data yl_9200_flash_data = { 217static struct physmap_flash_data yl9200_flash_data = {
296 .width = 2, 218 .width = 2,
297 .parts = yl_9200_flash_partitions, 219 .parts = yl9200_flash_partitions,
298 .nr_parts = ARRAY_SIZE(yl_9200_flash_partitions), 220 .nr_parts = ARRAY_SIZE(yl9200_flash_partitions),
299}; 221};
300 222
301static struct resource yl_9200_flash_resources[] = { 223static struct resource yl9200_flash_resources[] = {
302{ 224 {
303 .start = YL_9200_FLASH_BASE, 225 .start = YL9200_FLASH_BASE,
304 .end = YL_9200_FLASH_BASE + YL_9200_FLASH_SIZE - 1, 226 .end = YL9200_FLASH_BASE + YL9200_FLASH_SIZE - 1,
305 .flags = IORESOURCE_MEM, 227 .flags = IORESOURCE_MEM,
306 } 228 }
307}; 229};
308 230
309static struct platform_device yl_9200_flash = { 231static struct platform_device yl9200_flash = {
310 .name = "physmap-flash", 232 .name = "physmap-flash",
311 .id = 0, 233 .id = 0,
312 .dev = { 234 .dev = {
313 .platform_data = &yl_9200_flash_data, 235 .platform_data = &yl9200_flash_data,
314 }, 236 },
315 .resource = yl_9200_flash_resources, 237 .resource = yl9200_flash_resources,
316 .num_resources = ARRAY_SIZE(yl_9200_flash_resources), 238 .num_resources = ARRAY_SIZE(yl9200_flash_resources),
317}; 239};
318 240
319 241/*
320static struct gpio_led yl_9200_leds[] = { 242 * I2C (TWI)
321/*D2 &D3 are passed directly in via at91_init_leds*/ 243 */
322 { 244static struct i2c_board_info __initdata yl9200_i2c_devices[] = {
323 .name = "led4", /*D4*/ 245 { /* EEPROM */
324 .gpio = AT91_PIN_PB15, 246 I2C_BOARD_INFO("24c128", 0x50),
325 .active_low = 1,
326 .default_trigger = "heartbeat",
327 /*.default_trigger = "timer",*/
328 },
329 {
330 .name = "led5", /*D5*/
331 .gpio = AT91_PIN_PB8,
332 .active_low = 1,
333 .default_trigger = "heartbeat",
334 }
335};
336
337//static struct gpio_sounder yl_9200_sounder[] = {*/
338/*This is a simple speaker attached to a gpo line*/
339
340// {
341// .name = "Speaker", /*LS1*/
342// .gpio = AT91_PIN_PA22,
343// .active_low = 0,
344// .default_trigger = "heartbeat",
345 /*.default_trigger = "timer",*/
346// },
347//};
348
349
350
351static struct i2c_board_info __initdata yl_9200_i2c_devices[] = {
352 {
353 /*TODO*/
354 I2C_BOARD_INFO("CS4334", 0x00),
355 } 247 }
356}; 248};
357 249
358 250/*
359 /*
360 * GPIO Buttons 251 * GPIO Buttons
361 */ 252*/
362#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 253#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
363static struct gpio_keys_button yl_9200_buttons[] = { 254static struct gpio_keys_button yl9200_buttons[] = {
364 { 255 {
365 .gpio = AT91_PIN_PA24, 256 .gpio = AT91_PIN_PA24,
366 .code = BTN_2, 257 .code = BTN_2,
367 .desc = "SW2", 258 .desc = "SW2",
368 .active_low = 1, 259 .active_low = 1,
369 .wakeup = 1, 260 .wakeup = 1,
370 }, 261 },
371 { 262 {
372 .gpio = AT91_PIN_PB1, 263 .gpio = AT91_PIN_PB1,
373 .code = BTN_3, 264 .code = BTN_3,
374 .desc = "SW3", 265 .desc = "SW3",
375 .active_low = 1, 266 .active_low = 1,
376 .wakeup = 1, 267 .wakeup = 1,
377 }, 268 },
378 { 269 {
379 .gpio = AT91_PIN_PB2, 270 .gpio = AT91_PIN_PB2,
380 .code = BTN_4, 271 .code = BTN_4,
381 .desc = "SW4", 272 .desc = "SW4",
382 .active_low = 1, 273 .active_low = 1,
383 .wakeup = 1, 274 .wakeup = 1,
384 }, 275 },
385 { 276 {
386 .gpio = AT91_PIN_PB6, 277 .gpio = AT91_PIN_PB6,
387 .code = BTN_5, 278 .code = BTN_5,
388 .desc = "SW5", 279 .desc = "SW5",
389 .active_low = 1, 280 .active_low = 1,
390 .wakeup = 1, 281 .wakeup = 1,
391 }, 282 }
392
393}; 283};
394 284
395static struct gpio_keys_platform_data yl_9200_button_data = { 285static struct gpio_keys_platform_data yl9200_button_data = {
396 .buttons = yl_9200_buttons, 286 .buttons = yl9200_buttons,
397 .nbuttons = ARRAY_SIZE(yl_9200_buttons), 287 .nbuttons = ARRAY_SIZE(yl9200_buttons),
398}; 288};
399 289
400static struct platform_device yl_9200_button_device = { 290static struct platform_device yl9200_button_device = {
401 .name = "gpio-keys", 291 .name = "gpio-keys",
402 .id = -1, 292 .id = -1,
403 .num_resources = 0, 293 .num_resources = 0,
404 .dev = { 294 .dev = {
405 .platform_data = &yl_9200_button_data, 295 .platform_data = &yl9200_button_data,
406 } 296 }
407}; 297};
408 298
409static void __init yl_9200_add_device_buttons(void) 299static void __init yl9200_add_device_buttons(void)
410{ 300{
411 //SW2 301 at91_set_gpio_input(AT91_PIN_PA24, 1); /* SW2 */
412 at91_set_gpio_input(AT91_PIN_PA24, 0);
413 at91_set_deglitch(AT91_PIN_PA24, 1); 302 at91_set_deglitch(AT91_PIN_PA24, 1);
414 303 at91_set_gpio_input(AT91_PIN_PB1, 1); /* SW3 */
415 //SW3
416 at91_set_gpio_input(AT91_PIN_PB1, 0);
417 at91_set_deglitch(AT91_PIN_PB1, 1); 304 at91_set_deglitch(AT91_PIN_PB1, 1);
418 //SW4 305 at91_set_gpio_input(AT91_PIN_PB2, 1); /* SW4 */
419 at91_set_gpio_input(AT91_PIN_PB2, 0);
420 at91_set_deglitch(AT91_PIN_PB2, 1); 306 at91_set_deglitch(AT91_PIN_PB2, 1);
421 307 at91_set_gpio_input(AT91_PIN_PB6, 1); /* SW5 */
422 //SW5
423 at91_set_gpio_input(AT91_PIN_PB6, 0);
424 at91_set_deglitch(AT91_PIN_PB6, 1); 308 at91_set_deglitch(AT91_PIN_PB6, 1);
425 309
310 /* Enable buttons (Sheet 5) */
311 at91_set_gpio_output(AT91_PIN_PB7, 1);
312
313 platform_device_register(&yl9200_button_device);
314}
315#else
316static void __init yl9200_add_device_buttons(void) {}
317#endif
318
319/*
320 * Touchscreen
321 */
322#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
323static int ads7843_pendown_state(void)
324{
325 return !at91_get_gpio_value(AT91_PIN_PB11); /* Touchscreen PENIRQ */
326}
327
328static struct ads7846_platform_data ads_info = {
329 .model = 7843,
330 .x_min = 150,
331 .x_max = 3830,
332 .y_min = 190,
333 .y_max = 3830,
334 .vref_delay_usecs = 100,
335
336 /* For a 8" touch-screen */
337 // .x_plate_ohms = 603,
338 // .y_plate_ohms = 332,
339
340 /* For a 10.4" touch-screen */
341 // .x_plate_ohms = 611,
342 // .y_plate_ohms = 325,
343
344 .x_plate_ohms = 576,
345 .y_plate_ohms = 366,
346
347 .pressure_max = 15000, /* generally nonsense on the 7843 */
348 .debounce_max = 1,
349 .debounce_rep = 0,
350 .debounce_tol = (~0),
351 .get_pendown_state = ads7843_pendown_state,
352};
426 353
427 at91_set_gpio_output(AT91_PIN_PB7, 1); /* #TURN BUTTONS ON, SHEET 5 of schematics */ 354static void __init yl9200_add_device_ts(void)
428 platform_device_register(&yl_9200_button_device); 355{
356 at91_set_gpio_input(AT91_PIN_PB11, 1); /* Touchscreen interrupt pin */
357 at91_set_gpio_input(AT91_PIN_PB10, 1); /* Touchscreen BUSY signal - not used! */
429} 358}
430#else 359#else
431static void __init yl_9200_add_device_buttons(void) {} 360static void __init yl9200_add_device_ts(void) {}
361#endif
362
363/*
364 * SPI devices
365 */
366static struct spi_board_info yl9200_spi_devices[] = {
367#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
368 { /* Touchscreen */
369 .modalias = "ads7846",
370 .chip_select = 0,
371 .max_speed_hz = 5000 * 26,
372 .platform_data = &ads_info,
373 .irq = AT91_PIN_PB11,
374 },
432#endif 375#endif
376 { /* CAN */
377 .modalias = "mcp2510",
378 .chip_select = 1,
379 .max_speed_hz = 25000 * 26,
380 .irq = AT91_PIN_PC0,
381 }
382};
433 383
384/*
385 * LCD / VGA
386 *
387 * EPSON S1D13806 FB (discontinued chip)
388 * EPSON S1D13506 FB
389 */
434#if defined(CONFIG_FB_S1D135XX) || defined(CONFIG_FB_S1D13XXX_MODULE) 390#if defined(CONFIG_FB_S1D135XX) || defined(CONFIG_FB_S1D13XXX_MODULE)
435#include <video/s1d13xxxfb.h> 391#include <video/s1d13xxxfb.h>
436 392
437/* EPSON S1D13806 FB (discontinued chip)*/
438/* EPSON S1D13506 FB */
439
440#define AT91_FB_REG_BASE 0x80000000L 393#define AT91_FB_REG_BASE 0x80000000L
441#define AT91_FB_REG_SIZE 0x200 394#define AT91_FB_REG_SIZE 0x200
442#define AT91_FB_VMEM_BASE 0x80200000L 395#define AT91_FB_VMEM_BASE 0x80200000L
443#define AT91_FB_VMEM_SIZE 0x200000L 396#define AT91_FB_VMEM_SIZE 0x200000L
444 397
445/*#define S1D_DISPLAY_WIDTH 640*/ 398static void __init yl9200_init_video(void)
446/*#define S1D_DISPLAY_HEIGHT 480*/
447
448
449static void __init yl_9200_init_video(void)
450{ 399{
451 at91_sys_write(AT91_PIOC + PIO_ASR,AT91_PIN_PC6); 400 /* NWAIT Signal */
452 at91_sys_write(AT91_PIOC + PIO_BSR,0); 401 at91_set_A_periph(AT91_PIN_PC6, 0);
453 at91_sys_write(AT91_PIOC + PIO_ASR,AT91_PIN_PC6);
454
455 at91_sys_write( AT91_SMC_CSR(2),
456 AT91_SMC_NWS_(0x4) |
457 AT91_SMC_WSEN |
458 AT91_SMC_TDF_(0x100) |
459 AT91_SMC_DBW
460 );
461
462
463 402
403 /* Initialization of the Static Memory Controller for Chip Select 2 */
404 at91_sys_write(AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
405 | AT91_SMC_WSEN | AT91_SMC_NWS_(0x4) /* wait states */
406 | AT91_SMC_TDF_(0x100) /* float time */
407 );
464} 408}
465 409
466 410static struct s1d13xxxfb_regval yl9200_s1dfb_initregs[] =
467static struct s1d13xxxfb_regval yl_9200_s1dfb_initregs[] =
468{ 411{
469 {S1DREG_MISC, 0x00}, /* Miscellaneous Register*/ 412 {S1DREG_MISC, 0x00}, /* Miscellaneous Register*/
470 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/ 413 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
471 {S1DREG_GPIO_CNF0, 0x00}, /* General IO Pins Configuration Register*/ 414 {S1DREG_GPIO_CNF0, 0x00}, /* General IO Pins Configuration Register*/
472 {S1DREG_GPIO_CTL0, 0x00}, /* General IO Pins Control Register*/ 415 {S1DREG_GPIO_CTL0, 0x00}, /* General IO Pins Control Register*/
473 {S1DREG_CLK_CNF, 0x11}, /* Memory Clock Configuration Register*/ 416 {S1DREG_CLK_CNF, 0x11}, /* Memory Clock Configuration Register*/
474 {S1DREG_LCD_CLK_CNF, 0x10}, /* LCD Pixel Clock Configuration Register*/ 417 {S1DREG_LCD_CLK_CNF, 0x10}, /* LCD Pixel Clock Configuration Register*/
475 {S1DREG_CRT_CLK_CNF, 0x12}, /* CRT/TV Pixel Clock Configuration Register*/ 418 {S1DREG_CRT_CLK_CNF, 0x12}, /* CRT/TV Pixel Clock Configuration Register*/
476 {S1DREG_MPLUG_CLK_CNF, 0x01}, /* MediaPlug Clock Configuration Register*/ 419 {S1DREG_MPLUG_CLK_CNF, 0x01}, /* MediaPlug Clock Configuration Register*/
477 {S1DREG_CPU2MEM_WST_SEL, 0x02}, /* CPU To Memory Wait State Select Register*/ 420 {S1DREG_CPU2MEM_WST_SEL, 0x02}, /* CPU To Memory Wait State Select Register*/
478 {S1DREG_MEM_CNF, 0x00}, /* Memory Configuration Register*/ 421 {S1DREG_MEM_CNF, 0x00}, /* Memory Configuration Register*/
479 {S1DREG_SDRAM_REF_RATE, 0x04}, /* DRAM Refresh Rate Register, MCLK source*/ 422 {S1DREG_SDRAM_REF_RATE, 0x04}, /* DRAM Refresh Rate Register, MCLK source*/
480 {S1DREG_SDRAM_TC0, 0x12}, /* DRAM Timings Control Register 0*/ 423 {S1DREG_SDRAM_TC0, 0x12}, /* DRAM Timings Control Register 0*/
481 {S1DREG_SDRAM_TC1, 0x02}, /* DRAM Timings Control Register 1*/ 424 {S1DREG_SDRAM_TC1, 0x02}, /* DRAM Timings Control Register 1*/
482 {S1DREG_PANEL_TYPE, 0x25}, /* Panel Type Register*/ 425 {S1DREG_PANEL_TYPE, 0x25}, /* Panel Type Register*/
483 {S1DREG_MOD_RATE, 0x00}, /* MOD Rate Register*/ 426 {S1DREG_MOD_RATE, 0x00}, /* MOD Rate Register*/
484 {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* LCD Horizontal Display Width Register*/ 427 {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* LCD Horizontal Display Width Register*/
485 {S1DREG_LCD_NDISP_HPER, 0x13}, /* LCD Horizontal Non-Display Period Register*/ 428 {S1DREG_LCD_NDISP_HPER, 0x13}, /* LCD Horizontal Non-Display Period Register*/
486 {S1DREG_TFT_FPLINE_START, 0x01}, /* TFT FPLINE Start Position Register*/ 429 {S1DREG_TFT_FPLINE_START, 0x01}, /* TFT FPLINE Start Position Register*/
487 {S1DREG_TFT_FPLINE_PWIDTH, 0x0c}, /* TFT FPLINE Pulse Width Register*/ 430 {S1DREG_TFT_FPLINE_PWIDTH, 0x0c}, /* TFT FPLINE Pulse Width Register*/
488 {S1DREG_LCD_DISP_VHEIGHT0, 0xDF}, /* LCD Vertical Display Height Register 0*/ 431 {S1DREG_LCD_DISP_VHEIGHT0, 0xDF}, /* LCD Vertical Display Height Register 0*/
489 {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* LCD Vertical Display Height Register 1*/ 432 {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* LCD Vertical Display Height Register 1*/
490 {S1DREG_LCD_NDISP_VPER, 0x2c}, /* LCD Vertical Non-Display Period Register*/ 433 {S1DREG_LCD_NDISP_VPER, 0x2c}, /* LCD Vertical Non-Display Period Register*/
491 {S1DREG_TFT_FPFRAME_START, 0x0a}, /* TFT FPFRAME Start Position Register*/ 434 {S1DREG_TFT_FPFRAME_START, 0x0a}, /* TFT FPFRAME Start Position Register*/
492 {S1DREG_TFT_FPFRAME_PWIDTH, 0x02}, /* TFT FPFRAME Pulse Width Register*/ 435 {S1DREG_TFT_FPFRAME_PWIDTH, 0x02}, /* TFT FPFRAME Pulse Width Register*/
493 {S1DREG_LCD_DISP_MODE, 0x05}, /* LCD Display Mode Register*/ 436 {S1DREG_LCD_DISP_MODE, 0x05}, /* LCD Display Mode Register*/
494 {S1DREG_LCD_MISC, 0x01}, /* LCD Miscellaneous Register*/ 437 {S1DREG_LCD_MISC, 0x01}, /* LCD Miscellaneous Register*/
495 {S1DREG_LCD_DISP_START0, 0x00}, /* LCD Display Start Address Register 0*/ 438 {S1DREG_LCD_DISP_START0, 0x00}, /* LCD Display Start Address Register 0*/
496 {S1DREG_LCD_DISP_START1, 0x00}, /* LCD Display Start Address Register 1*/ 439 {S1DREG_LCD_DISP_START1, 0x00}, /* LCD Display Start Address Register 1*/
497 {S1DREG_LCD_DISP_START2, 0x00}, /* LCD Display Start Address Register 2*/ 440 {S1DREG_LCD_DISP_START2, 0x00}, /* LCD Display Start Address Register 2*/
498 {S1DREG_LCD_MEM_OFF0, 0x80}, /* LCD Memory Address Offset Register 0*/ 441 {S1DREG_LCD_MEM_OFF0, 0x80}, /* LCD Memory Address Offset Register 0*/
499 {S1DREG_LCD_MEM_OFF1, 0x02}, /* LCD Memory Address Offset Register 1*/ 442 {S1DREG_LCD_MEM_OFF1, 0x02}, /* LCD Memory Address Offset Register 1*/
500 {S1DREG_LCD_PIX_PAN, 0x03}, /* LCD Pixel Panning Register*/ 443 {S1DREG_LCD_PIX_PAN, 0x03}, /* LCD Pixel Panning Register*/
501 {S1DREG_LCD_DISP_FIFO_HTC, 0x00}, /* LCD Display FIFO High Threshold Control Register*/ 444 {S1DREG_LCD_DISP_FIFO_HTC, 0x00}, /* LCD Display FIFO High Threshold Control Register*/
502 {S1DREG_LCD_DISP_FIFO_LTC, 0x00}, /* LCD Display FIFO Low Threshold Control Register*/ 445 {S1DREG_LCD_DISP_FIFO_LTC, 0x00}, /* LCD Display FIFO Low Threshold Control Register*/
503 {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* CRT/TV Horizontal Display Width Register*/ 446 {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* CRT/TV Horizontal Display Width Register*/
504 {S1DREG_CRT_NDISP_HPER, 0x13}, /* CRT/TV Horizontal Non-Display Period Register*/ 447 {S1DREG_CRT_NDISP_HPER, 0x13}, /* CRT/TV Horizontal Non-Display Period Register*/
505 {S1DREG_CRT_HRTC_START, 0x01}, /* CRT/TV HRTC Start Position Register*/ 448 {S1DREG_CRT_HRTC_START, 0x01}, /* CRT/TV HRTC Start Position Register*/
506 {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* CRT/TV HRTC Pulse Width Register*/ 449 {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* CRT/TV HRTC Pulse Width Register*/
507 {S1DREG_CRT_DISP_VHEIGHT0, 0xDF}, /* CRT/TV Vertical Display Height Register 0*/ 450 {S1DREG_CRT_DISP_VHEIGHT0, 0xDF}, /* CRT/TV Vertical Display Height Register 0*/
508 {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* CRT/TV Vertical Display Height Register 1*/ 451 {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* CRT/TV Vertical Display Height Register 1*/
509 {S1DREG_CRT_NDISP_VPER, 0x2B}, /* CRT/TV Vertical Non-Display Period Register*/ 452 {S1DREG_CRT_NDISP_VPER, 0x2B}, /* CRT/TV Vertical Non-Display Period Register*/
510 {S1DREG_CRT_VRTC_START, 0x09}, /* CRT/TV VRTC Start Position Register*/ 453 {S1DREG_CRT_VRTC_START, 0x09}, /* CRT/TV VRTC Start Position Register*/
511 {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* CRT/TV VRTC Pulse Width Register*/ 454 {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* CRT/TV VRTC Pulse Width Register*/
512 {S1DREG_TV_OUT_CTL, 0x18}, /* TV Output Control Register */ 455 {S1DREG_TV_OUT_CTL, 0x18}, /* TV Output Control Register */
513 {S1DREG_CRT_DISP_MODE, 0x05}, /* CRT/TV Display Mode Register, 16BPP*/ 456 {S1DREG_CRT_DISP_MODE, 0x05}, /* CRT/TV Display Mode Register, 16BPP*/
514 {S1DREG_CRT_DISP_START0, 0x00}, /* CRT/TV Display Start Address Register 0*/ 457 {S1DREG_CRT_DISP_START0, 0x00}, /* CRT/TV Display Start Address Register 0*/
515 {S1DREG_CRT_DISP_START1, 0x00}, /* CRT/TV Display Start Address Register 1*/ 458 {S1DREG_CRT_DISP_START1, 0x00}, /* CRT/TV Display Start Address Register 1*/
516 {S1DREG_CRT_DISP_START2, 0x00}, /* CRT/TV Display Start Address Register 2*/ 459 {S1DREG_CRT_DISP_START2, 0x00}, /* CRT/TV Display Start Address Register 2*/
517 {S1DREG_CRT_MEM_OFF0, 0x80}, /* CRT/TV Memory Address Offset Register 0*/ 460 {S1DREG_CRT_MEM_OFF0, 0x80}, /* CRT/TV Memory Address Offset Register 0*/
518 {S1DREG_CRT_MEM_OFF1, 0x02}, /* CRT/TV Memory Address Offset Register 1*/ 461 {S1DREG_CRT_MEM_OFF1, 0x02}, /* CRT/TV Memory Address Offset Register 1*/
519 {S1DREG_CRT_PIX_PAN, 0x00}, /* CRT/TV Pixel Panning Register*/ 462 {S1DREG_CRT_PIX_PAN, 0x00}, /* CRT/TV Pixel Panning Register*/
520 {S1DREG_CRT_DISP_FIFO_HTC, 0x00}, /* CRT/TV Display FIFO High Threshold Control Register*/ 463 {S1DREG_CRT_DISP_FIFO_HTC, 0x00}, /* CRT/TV Display FIFO High Threshold Control Register*/
521 {S1DREG_CRT_DISP_FIFO_LTC, 0x00}, /* CRT/TV Display FIFO Low Threshold Control Register*/ 464 {S1DREG_CRT_DISP_FIFO_LTC, 0x00}, /* CRT/TV Display FIFO Low Threshold Control Register*/
522 {S1DREG_LCD_CUR_CTL, 0x00}, /* LCD Ink/Cursor Control Register*/ 465 {S1DREG_LCD_CUR_CTL, 0x00}, /* LCD Ink/Cursor Control Register*/
523 {S1DREG_LCD_CUR_START, 0x01}, /* LCD Ink/Cursor Start Address Register*/ 466 {S1DREG_LCD_CUR_START, 0x01}, /* LCD Ink/Cursor Start Address Register*/
524 {S1DREG_LCD_CUR_XPOS0, 0x00}, /* LCD Cursor X Position Register 0*/ 467 {S1DREG_LCD_CUR_XPOS0, 0x00}, /* LCD Cursor X Position Register 0*/
525 {S1DREG_LCD_CUR_XPOS1, 0x00}, /* LCD Cursor X Position Register 1*/ 468 {S1DREG_LCD_CUR_XPOS1, 0x00}, /* LCD Cursor X Position Register 1*/
526 {S1DREG_LCD_CUR_YPOS0, 0x00}, /* LCD Cursor Y Position Register 0*/ 469 {S1DREG_LCD_CUR_YPOS0, 0x00}, /* LCD Cursor Y Position Register 0*/
527 {S1DREG_LCD_CUR_YPOS1, 0x00}, /* LCD Cursor Y Position Register 1*/ 470 {S1DREG_LCD_CUR_YPOS1, 0x00}, /* LCD Cursor Y Position Register 1*/
528 {S1DREG_LCD_CUR_BCTL0, 0x00}, /* LCD Ink/Cursor Blue Color 0 Register*/ 471 {S1DREG_LCD_CUR_BCTL0, 0x00}, /* LCD Ink/Cursor Blue Color 0 Register*/
529 {S1DREG_LCD_CUR_GCTL0, 0x00}, /* LCD Ink/Cursor Green Color 0 Register*/ 472 {S1DREG_LCD_CUR_GCTL0, 0x00}, /* LCD Ink/Cursor Green Color 0 Register*/
530 {S1DREG_LCD_CUR_RCTL0, 0x00}, /* LCD Ink/Cursor Red Color 0 Register*/ 473 {S1DREG_LCD_CUR_RCTL0, 0x00}, /* LCD Ink/Cursor Red Color 0 Register*/
531 {S1DREG_LCD_CUR_BCTL1, 0x1F}, /* LCD Ink/Cursor Blue Color 1 Register*/ 474 {S1DREG_LCD_CUR_BCTL1, 0x1F}, /* LCD Ink/Cursor Blue Color 1 Register*/
532 {S1DREG_LCD_CUR_GCTL1, 0x3F}, /* LCD Ink/Cursor Green Color 1 Register*/ 475 {S1DREG_LCD_CUR_GCTL1, 0x3F}, /* LCD Ink/Cursor Green Color 1 Register*/
533 {S1DREG_LCD_CUR_RCTL1, 0x1F}, /* LCD Ink/Cursor Red Color 1 Register*/ 476 {S1DREG_LCD_CUR_RCTL1, 0x1F}, /* LCD Ink/Cursor Red Color 1 Register*/
534 {S1DREG_LCD_CUR_FIFO_HTC, 0x00}, /* LCD Ink/Cursor FIFO Threshold Register*/ 477 {S1DREG_LCD_CUR_FIFO_HTC, 0x00}, /* LCD Ink/Cursor FIFO Threshold Register*/
535 {S1DREG_CRT_CUR_CTL, 0x00}, /* CRT/TV Ink/Cursor Control Register*/ 478 {S1DREG_CRT_CUR_CTL, 0x00}, /* CRT/TV Ink/Cursor Control Register*/
536 {S1DREG_CRT_CUR_START, 0x01}, /* CRT/TV Ink/Cursor Start Address Register*/ 479 {S1DREG_CRT_CUR_START, 0x01}, /* CRT/TV Ink/Cursor Start Address Register*/
537 {S1DREG_CRT_CUR_XPOS0, 0x00}, /* CRT/TV Cursor X Position Register 0*/ 480 {S1DREG_CRT_CUR_XPOS0, 0x00}, /* CRT/TV Cursor X Position Register 0*/
538 {S1DREG_CRT_CUR_XPOS1, 0x00}, /* CRT/TV Cursor X Position Register 1*/ 481 {S1DREG_CRT_CUR_XPOS1, 0x00}, /* CRT/TV Cursor X Position Register 1*/
539 {S1DREG_CRT_CUR_YPOS0, 0x00}, /* CRT/TV Cursor Y Position Register 0*/ 482 {S1DREG_CRT_CUR_YPOS0, 0x00}, /* CRT/TV Cursor Y Position Register 0*/
540 {S1DREG_CRT_CUR_YPOS1, 0x00}, /* CRT/TV Cursor Y Position Register 1*/ 483 {S1DREG_CRT_CUR_YPOS1, 0x00}, /* CRT/TV Cursor Y Position Register 1*/
541 {S1DREG_CRT_CUR_BCTL0, 0x00}, /* CRT/TV Ink/Cursor Blue Color 0 Register*/ 484 {S1DREG_CRT_CUR_BCTL0, 0x00}, /* CRT/TV Ink/Cursor Blue Color 0 Register*/
542 {S1DREG_CRT_CUR_GCTL0, 0x00}, /* CRT/TV Ink/Cursor Green Color 0 Register*/ 485 {S1DREG_CRT_CUR_GCTL0, 0x00}, /* CRT/TV Ink/Cursor Green Color 0 Register*/
543 {S1DREG_CRT_CUR_RCTL0, 0x00}, /* CRT/TV Ink/Cursor Red Color 0 Register*/ 486 {S1DREG_CRT_CUR_RCTL0, 0x00}, /* CRT/TV Ink/Cursor Red Color 0 Register*/
544 {S1DREG_CRT_CUR_BCTL1, 0x1F}, /* CRT/TV Ink/Cursor Blue Color 1 Register*/ 487 {S1DREG_CRT_CUR_BCTL1, 0x1F}, /* CRT/TV Ink/Cursor Blue Color 1 Register*/
545 {S1DREG_CRT_CUR_GCTL1, 0x3F}, /* CRT/TV Ink/Cursor Green Color 1 Register*/ 488 {S1DREG_CRT_CUR_GCTL1, 0x3F}, /* CRT/TV Ink/Cursor Green Color 1 Register*/
546 {S1DREG_CRT_CUR_RCTL1, 0x1F}, /* CRT/TV Ink/Cursor Red Color 1 Register*/ 489 {S1DREG_CRT_CUR_RCTL1, 0x1F}, /* CRT/TV Ink/Cursor Red Color 1 Register*/
547 {S1DREG_CRT_CUR_FIFO_HTC, 0x00}, /* CRT/TV Ink/Cursor FIFO Threshold Register*/ 490 {S1DREG_CRT_CUR_FIFO_HTC, 0x00}, /* CRT/TV Ink/Cursor FIFO Threshold Register*/
548 {S1DREG_BBLT_CTL0, 0x00}, /* BitBlt Control Register 0*/ 491 {S1DREG_BBLT_CTL0, 0x00}, /* BitBlt Control Register 0*/
549 {S1DREG_BBLT_CTL1, 0x01}, /* BitBlt Control Register 1*/ 492 {S1DREG_BBLT_CTL1, 0x01}, /* BitBlt Control Register 1*/
550 {S1DREG_BBLT_CC_EXP, 0x00}, /* BitBlt ROP Code/Color Expansion Register*/ 493 {S1DREG_BBLT_CC_EXP, 0x00}, /* BitBlt ROP Code/Color Expansion Register*/
551 {S1DREG_BBLT_OP, 0x00}, /* BitBlt Operation Register*/ 494 {S1DREG_BBLT_OP, 0x00}, /* BitBlt Operation Register*/
552 {S1DREG_BBLT_SRC_START0, 0x00}, /* BitBlt Source Start Address Register 0*/ 495 {S1DREG_BBLT_SRC_START0, 0x00}, /* BitBlt Source Start Address Register 0*/
553 {S1DREG_BBLT_SRC_START1, 0x00}, /* BitBlt Source Start Address Register 1*/ 496 {S1DREG_BBLT_SRC_START1, 0x00}, /* BitBlt Source Start Address Register 1*/
554 {S1DREG_BBLT_SRC_START2, 0x00}, /* BitBlt Source Start Address Register 2*/ 497 {S1DREG_BBLT_SRC_START2, 0x00}, /* BitBlt Source Start Address Register 2*/
555 {S1DREG_BBLT_DST_START0, 0x00}, /* BitBlt Destination Start Address Register 0*/ 498 {S1DREG_BBLT_DST_START0, 0x00}, /* BitBlt Destination Start Address Register 0*/
556 {S1DREG_BBLT_DST_START1, 0x00}, /* BitBlt Destination Start Address Register 1*/ 499 {S1DREG_BBLT_DST_START1, 0x00}, /* BitBlt Destination Start Address Register 1*/
557 {S1DREG_BBLT_DST_START2, 0x00}, /* BitBlt Destination Start Address Register 2*/ 500 {S1DREG_BBLT_DST_START2, 0x00}, /* BitBlt Destination Start Address Register 2*/
558 {S1DREG_BBLT_MEM_OFF0, 0x00}, /* BitBlt Memory Address Offset Register 0*/ 501 {S1DREG_BBLT_MEM_OFF0, 0x00}, /* BitBlt Memory Address Offset Register 0*/
559 {S1DREG_BBLT_MEM_OFF1, 0x00}, /* BitBlt Memory Address Offset Register 1*/ 502 {S1DREG_BBLT_MEM_OFF1, 0x00}, /* BitBlt Memory Address Offset Register 1*/
560 {S1DREG_BBLT_WIDTH0, 0x00}, /* BitBlt Width Register 0*/ 503 {S1DREG_BBLT_WIDTH0, 0x00}, /* BitBlt Width Register 0*/
561 {S1DREG_BBLT_WIDTH1, 0x00}, /* BitBlt Width Register 1*/ 504 {S1DREG_BBLT_WIDTH1, 0x00}, /* BitBlt Width Register 1*/
562 {S1DREG_BBLT_HEIGHT0, 0x00}, /* BitBlt Height Register 0*/ 505 {S1DREG_BBLT_HEIGHT0, 0x00}, /* BitBlt Height Register 0*/
563 {S1DREG_BBLT_HEIGHT1, 0x00}, /* BitBlt Height Register 1*/ 506 {S1DREG_BBLT_HEIGHT1, 0x00}, /* BitBlt Height Register 1*/
564 {S1DREG_BBLT_BGC0, 0x00}, /* BitBlt Background Color Register 0*/ 507 {S1DREG_BBLT_BGC0, 0x00}, /* BitBlt Background Color Register 0*/
565 {S1DREG_BBLT_BGC1, 0x00}, /* BitBlt Background Color Register 1*/ 508 {S1DREG_BBLT_BGC1, 0x00}, /* BitBlt Background Color Register 1*/
566 {S1DREG_BBLT_FGC0, 0x00}, /* BitBlt Foreground Color Register 0*/ 509 {S1DREG_BBLT_FGC0, 0x00}, /* BitBlt Foreground Color Register 0*/
567 {S1DREG_BBLT_FGC1, 0x00}, /* BitBlt Foreground Color Register 1*/ 510 {S1DREG_BBLT_FGC1, 0x00}, /* BitBlt Foreground Color Register 1*/
568 {S1DREG_LKUP_MODE, 0x00}, /* Look-Up Table Mode Register*/ 511 {S1DREG_LKUP_MODE, 0x00}, /* Look-Up Table Mode Register*/
569 {S1DREG_LKUP_ADDR, 0x00}, /* Look-Up Table Address Register*/ 512 {S1DREG_LKUP_ADDR, 0x00}, /* Look-Up Table Address Register*/
570 {S1DREG_PS_CNF, 0x00}, /* Power Save Configuration Register*/ 513 {S1DREG_PS_CNF, 0x00}, /* Power Save Configuration Register*/
571 {S1DREG_PS_STATUS, 0x00}, /* Power Save Status Register*/ 514 {S1DREG_PS_STATUS, 0x00}, /* Power Save Status Register*/
572 {S1DREG_CPU2MEM_WDOGT, 0x00}, /* CPU-to-Memory Access Watchdog Timer Register*/ 515 {S1DREG_CPU2MEM_WDOGT, 0x00}, /* CPU-to-Memory Access Watchdog Timer Register*/
573 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/ 516 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
574}; 517};
575 518
576static u64 s1dfb_dmamask = 0xffffffffUL; 519static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
577 520
578static struct s1d13xxxfb_pdata yl_9200_s1dfb_pdata = { 521static struct s1d13xxxfb_pdata yl9200_s1dfb_pdata = {
579 .initregs = yl_9200_s1dfb_initregs, 522 .initregs = yl9200_s1dfb_initregs,
580 .initregssize = ARRAY_SIZE(yl_9200_s1dfb_initregs), 523 .initregssize = ARRAY_SIZE(yl9200_s1dfb_initregs),
581 .platform_init_video = yl_9200_init_video, 524 .platform_init_video = yl9200_init_video,
582}; 525};
583 526
584static struct resource yl_9200_s1dfb_resource[] = { 527static struct resource yl9200_s1dfb_resource[] = {
585 [0] = { /* video mem */ 528 [0] = { /* video mem */
586 .name = "s1d13xxxfb memory", 529 .name = "s1d13xxxfb memory",
587 /* .name = "s1d13806 memory",*/ 530 .start = AT91_FB_VMEM_BASE,
588 .start = AT91_FB_VMEM_BASE, 531 .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
589 .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1, 532 .flags = IORESOURCE_MEM,
590 .flags = IORESOURCE_MEM,
591 }, 533 },
592 [1] = { /* video registers */ 534 [1] = { /* video registers */
593 .name = "s1d13xxxfb registers", 535 .name = "s1d13xxxfb registers",
594 /* .name = "s1d13806 registers",*/ 536 .start = AT91_FB_REG_BASE,
595 .start = AT91_FB_REG_BASE, 537 .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
596 .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1, 538 .flags = IORESOURCE_MEM,
597 .flags = IORESOURCE_MEM,
598 }, 539 },
599}; 540};
600 541
601static struct platform_device yl_9200_s1dfb_device = { 542static struct platform_device yl9200_s1dfb_device = {
602 /*TODO S.Birtles , really we need the chip revision in here as well*/ 543 .name = "s1d13806fb",
603 .name = "s1d13806fb", 544 .id = -1,
604 /* .name = "s1d13506fb",*/ 545 .dev = {
605 .id = -1,
606 .dev = {
607 /*TODO theres a waring here!!*/
608 /*WARNING: vmlinux.o(.data+0x2dbc): Section mismatch: reference to .init.text: (between 'yl_9200_s1dfb_pdata' and 's1dfb_dmamask')*/
609 .dma_mask = &s1dfb_dmamask, 546 .dma_mask = &s1dfb_dmamask,
610 .coherent_dma_mask = 0xffffffff, 547 .coherent_dma_mask = DMA_BIT_MASK(32),
611 .platform_data = &yl_9200_s1dfb_pdata, 548 .platform_data = &yl9200_s1dfb_pdata,
612 }, 549 },
613 .resource = yl_9200_s1dfb_resource, 550 .resource = yl9200_s1dfb_resource,
614 .num_resources = ARRAY_SIZE(yl_9200_s1dfb_resource), 551 .num_resources = ARRAY_SIZE(yl9200_s1dfb_resource),
615}; 552};
616 553
617void __init yl_9200_add_device_video(void) 554void __init yl9200_add_device_video(void)
618{ 555{
619 platform_device_register(&yl_9200_s1dfb_device); 556 platform_device_register(&yl9200_s1dfb_device);
620} 557}
621#else 558#else
622 void __init yl_9200_add_device_video(void) {} 559void __init yl9200_add_device_video(void) {}
623#endif 560#endif
624 561
625/*this is not called first , yl_9200_map_io is called first*/ 562
626static void __init yl_9200_board_init(void) 563static void __init yl9200_board_init(void)
627{ 564{
628 /* Serial */ 565 /* Serial */
629 at91_add_device_serial(); 566 at91_add_device_serial();
630 /* Ethernet */ 567 /* Ethernet */
631 at91_add_device_eth(&yl_9200_eth_data); 568 at91_add_device_eth(&yl9200_eth_data);
632 /* USB Host */ 569 /* USB Host */
633 at91_add_device_usbh(&yl_9200_usbh_data); 570 at91_add_device_usbh(&yl9200_usbh_data);
634 /* USB Device */ 571 /* USB Device */
635 at91_add_device_udc(&yl_9200_udc_data); 572 at91_add_device_udc(&yl9200_udc_data);
636 /* pullup_pin it is actually active low, but this is not needed, driver sets it up */
637 /*at91_set_multi_drive(yl_9200_udc_data.pullup_pin, 0);*/
638
639 /* Compact Flash */
640 /*at91_add_device_cf(&yl_9200_cf_data);*/
641
642 /* I2C */ 573 /* I2C */
643 at91_add_device_i2c(yl_9200_i2c_devices, ARRAY_SIZE(yl_9200_i2c_devices)); 574 at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices));
644 /* SPI */ 575 /* MMC */
645 /*TODO YL9200 we have 2 spi interfaces touch screen & CAN*/ 576 at91_add_device_mmc(0, &yl9200_mmc_data);
646 /* AT91_PIN_PA5, AT91_PIN_PA6 , are used on the max 485 NOT SPI*/
647
648 /*touch screen and CAN*/
649 at91_add_device_spi(yl_9200_spi_devices, ARRAY_SIZE(yl_9200_spi_devices));
650
651 /*Basically the TS uses PB11 & PB10 , PB11 is configured by the SPI system BP10 IS NOT USED!!*/
652 /* we need this incase the board is running without a touch screen*/
653 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
654 at91_init_device_ts(); /*init the touch screen device*/
655 #endif
656 /* DataFlash card */
657 at91_add_device_mmc(0, &yl_9200_mmc_data);
658 /* NAND */ 577 /* NAND */
659 at91_add_device_nand(&yl_9200_nand_data); 578 at91_add_device_nand(&yl9200_nand_data);
660 /* NOR Flash */ 579 /* NOR Flash */
661 platform_device_register(&yl_9200_flash); 580 platform_device_register(&yl9200_flash);
662 /* LEDs. Note!! this does not include the led's we passed for the processor status */ 581#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
663 at91_gpio_leds(yl_9200_leds, ARRAY_SIZE(yl_9200_leds)); 582 /* SPI */
664 /* VGA */ 583 at91_add_device_spi(yl9200_spi_devices, ARRAY_SIZE(yl9200_spi_devices));
665 /*this is self registered by including the s1d13xxx chip in the kernel build*/ 584 /* Touchscreen */
666 yl_9200_add_device_video(); 585 yl9200_add_device_ts();
586#endif
587 /* LEDs. */
588 at91_gpio_leds(yl9200_leds, ARRAY_SIZE(yl9200_leds));
667 /* Push Buttons */ 589 /* Push Buttons */
668 yl_9200_add_device_buttons(); 590 yl9200_add_device_buttons();
669 /*TODO fixup the Sounder */ 591 /* VGA */
670// yl_9200_add_device_sounder(yl_9200_sounder,ARRAY_SIZE(yl_9200_sounder)); 592 yl9200_add_device_video();
671
672} 593}
673 594
674MACHINE_START(YL9200, "uCdragon YL-9200") 595MACHINE_START(YL9200, "uCdragon YL-9200")
675 /* Maintainer: S.Birtles*/ 596 /* Maintainer: S.Birtles */
676 .phys_io = AT91_BASE_SYS, 597 .phys_io = AT91_BASE_SYS,
677 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, 598 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
678 .boot_params = AT91_SDRAM_BASE + 0x100, 599 .boot_params = AT91_SDRAM_BASE + 0x100,
679 .timer = &at91rm9200_timer, 600 .timer = &at91rm9200_timer,
680 .map_io = yl_9200_map_io, 601 .map_io = yl9200_map_io,
681 .init_irq = yl_9200_init_irq, 602 .init_irq = yl9200_init_irq,
682 .init_machine = yl_9200_board_init, 603 .init_machine = yl9200_board_init,
683MACHINE_END 604MACHINE_END
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index a33dfe450726..464bdbbf74df 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -112,12 +112,34 @@ static void pmc_sys_mode(struct clk *clk, int is_on)
112 at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask); 112 at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask);
113} 113}
114 114
115static void pmc_uckr_mode(struct clk *clk, int is_on)
116{
117 unsigned int uckr = at91_sys_read(AT91_CKGR_UCKR);
118
119 if (is_on) {
120 is_on = AT91_PMC_LOCKU;
121 at91_sys_write(AT91_CKGR_UCKR, uckr | clk->pmc_mask);
122 } else
123 at91_sys_write(AT91_CKGR_UCKR, uckr & ~(clk->pmc_mask));
124
125 do {
126 cpu_relax();
127 } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKU) != is_on);
128}
129
115/* USB function clocks (PLLB must be 48 MHz) */ 130/* USB function clocks (PLLB must be 48 MHz) */
116static struct clk udpck = { 131static struct clk udpck = {
117 .name = "udpck", 132 .name = "udpck",
118 .parent = &pllb, 133 .parent = &pllb,
119 .mode = pmc_sys_mode, 134 .mode = pmc_sys_mode,
120}; 135};
136static struct clk utmi_clk = {
137 .name = "utmi_clk",
138 .parent = &main_clk,
139 .pmc_mask = AT91_PMC_UPLLEN, /* in CKGR_UCKR */
140 .mode = pmc_uckr_mode,
141 .type = CLK_TYPE_PLL,
142};
121static struct clk uhpck = { 143static struct clk uhpck = {
122 .name = "uhpck", 144 .name = "uhpck",
123 .parent = &pllb, 145 .parent = &pllb,
@@ -361,7 +383,7 @@ static void __init init_programmable_clock(struct clk *clk)
361 383
362static int at91_clk_show(struct seq_file *s, void *unused) 384static int at91_clk_show(struct seq_file *s, void *unused)
363{ 385{
364 u32 scsr, pcsr, sr; 386 u32 scsr, pcsr, uckr = 0, sr;
365 struct clk *clk; 387 struct clk *clk;
366 388
367 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR)); 389 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR));
@@ -369,7 +391,10 @@ static int at91_clk_show(struct seq_file *s, void *unused)
369 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR)); 391 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR));
370 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR)); 392 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR));
371 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR)); 393 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR));
372 seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR)); 394 if (!cpu_is_at91sam9rl())
395 seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR));
396 if (cpu_is_at91cap9() || cpu_is_at91sam9rl())
397 seq_printf(s, "UCKR = %8x\n", uckr = at91_sys_read(AT91_CKGR_UCKR));
373 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR)); 398 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR));
374 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR)); 399 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR));
375 400
@@ -382,6 +407,8 @@ static int at91_clk_show(struct seq_file *s, void *unused)
382 state = (scsr & clk->pmc_mask) ? "on" : "off"; 407 state = (scsr & clk->pmc_mask) ? "on" : "off";
383 else if (clk->mode == pmc_periph_mode) 408 else if (clk->mode == pmc_periph_mode)
384 state = (pcsr & clk->pmc_mask) ? "on" : "off"; 409 state = (pcsr & clk->pmc_mask) ? "on" : "off";
410 else if (clk->mode == pmc_uckr_mode)
411 state = (uckr & clk->pmc_mask) ? "on" : "off";
385 else if (clk->pmc_mask) 412 else if (clk->pmc_mask)
386 state = (sr & clk->pmc_mask) ? "on" : "off"; 413 state = (sr & clk->pmc_mask) ? "on" : "off";
387 else if (clk == &clk32k || clk == &main_clk) 414 else if (clk == &clk32k || clk == &main_clk)
@@ -488,14 +515,19 @@ static unsigned __init at91_pll_calc(unsigned main_freq, unsigned out_freq)
488 /* 515 /*
489 * PLL input between 1MHz and 32MHz per spec, but lower 516 * PLL input between 1MHz and 32MHz per spec, but lower
490 * frequences seem necessary in some cases so allow 100K. 517 * frequences seem necessary in some cases so allow 100K.
518 * Warning: some newer products need 2MHz min.
491 */ 519 */
492 input = main_freq / i; 520 input = main_freq / i;
521 if (cpu_is_at91sam9g20() && input < 2000000)
522 continue;
493 if (input < 100000) 523 if (input < 100000)
494 continue; 524 continue;
495 if (input > 32000000) 525 if (input > 32000000)
496 continue; 526 continue;
497 527
498 mul1 = out_freq / input; 528 mul1 = out_freq / input;
529 if (cpu_is_at91sam9g20() && mul > 63)
530 continue;
499 if (mul1 > 2048) 531 if (mul1 > 2048)
500 continue; 532 continue;
501 if (mul1 < 2) 533 if (mul1 < 2)
@@ -555,7 +587,8 @@ int __init at91_clock_init(unsigned long main_clock)
555 587
556 /* report if PLLA is more than mildly overclocked */ 588 /* report if PLLA is more than mildly overclocked */
557 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR)); 589 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR));
558 if (plla.rate_hz > 209000000) 590 if ((!cpu_is_at91sam9g20() && plla.rate_hz > 209000000)
591 || (cpu_is_at91sam9g20() && plla.rate_hz > 800000000))
559 pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000); 592 pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000);
560 593
561 /* 594 /*
@@ -570,7 +603,7 @@ int __init at91_clock_init(unsigned long main_clock)
570 uhpck.pmc_mask = AT91RM9200_PMC_UHP; 603 uhpck.pmc_mask = AT91RM9200_PMC_UHP;
571 udpck.pmc_mask = AT91RM9200_PMC_UDP; 604 udpck.pmc_mask = AT91RM9200_PMC_UDP;
572 at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); 605 at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP);
573 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { 606 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) {
574 uhpck.pmc_mask = AT91SAM926x_PMC_UHP; 607 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
575 udpck.pmc_mask = AT91SAM926x_PMC_UDP; 608 udpck.pmc_mask = AT91SAM926x_PMC_UDP;
576 } else if (cpu_is_at91cap9()) { 609 } else if (cpu_is_at91cap9()) {
@@ -582,6 +615,17 @@ int __init at91_clock_init(unsigned long main_clock)
582 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); 615 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init);
583 616
584 /* 617 /*
618 * USB HS clock init
619 */
620 if (cpu_is_at91cap9() || cpu_is_at91sam9rl()) {
621 /*
622 * multiplier is hard-wired to 40
623 * (obtain the USB High Speed 480 MHz when input is 12 MHz)
624 */
625 utmi_clk.rate_hz = 40 * utmi_clk.parent->rate_hz;
626 }
627
628 /*
585 * MCK and CPU derive from one of those primary clocks. 629 * MCK and CPU derive from one of those primary clocks.
586 * For now, assume this parentage won't change. 630 * For now, assume this parentage won't change.
587 */ 631 */
@@ -591,13 +635,21 @@ int __init at91_clock_init(unsigned long main_clock)
591 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */ 635 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */
592 if (cpu_is_at91rm9200()) 636 if (cpu_is_at91rm9200())
593 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ 637 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
594 else 638 else if (cpu_is_at91sam9g20()) {
595 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */ 639 mck.rate_hz = (mckr & AT91_PMC_MDIV) ?
640 freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */
641 if (mckr & AT91_PMC_PDIV)
642 freq /= 2; /* processor clock division */
643 } else
644 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
596 645
597 /* Register the PMC's standard clocks */ 646 /* Register the PMC's standard clocks */
598 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) 647 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
599 list_add_tail(&standard_pmc_clocks[i]->node, &clocks); 648 list_add_tail(&standard_pmc_clocks[i]->node, &clocks);
600 649
650 if (cpu_is_at91cap9() || cpu_is_at91sam9rl())
651 list_add_tail(&utmi_clk.node, &clocks);
652
601 /* MCK and CPU clock are "always on" */ 653 /* MCK and CPU clock are "always on" */
602 clk_enable(&mck); 654 clk_enable(&mck);
603 655
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index aa863c157708..8ab4feb1ec5b 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -202,7 +202,7 @@ static int at91_pm_verify_clocks(void)
202 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 202 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
203 return 0; 203 return 0;
204 } 204 }
205 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { 205 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) {
206 if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) { 206 if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) {
207 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 207 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
208 return 0; 208 return 0;
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 9d7515c36bff..f62c35500bb7 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -74,6 +74,7 @@ struct clk *clk_get(struct device *dev, const char *id)
74 74
75 return ERR_PTR(-ENOENT); 75 return ERR_PTR(-ENOENT);
76} 76}
77EXPORT_SYMBOL(clk_get);
77 78
78int clk_enable(struct clk *clk) 79int clk_enable(struct clk *clk)
79{ 80{
@@ -86,6 +87,7 @@ int clk_enable(struct clk *clk)
86 87
87 return 0; 88 return 0;
88} 89}
90EXPORT_SYMBOL(clk_enable);
89 91
90void clk_disable(struct clk *clk) 92void clk_disable(struct clk *clk)
91{ 93{
@@ -96,15 +98,18 @@ void clk_disable(struct clk *clk)
96 __raw_writel(value & ~clk->enable_mask, clk->enable_reg); 98 __raw_writel(value & ~clk->enable_mask, clk->enable_reg);
97 } 99 }
98} 100}
101EXPORT_SYMBOL(clk_disable);
99 102
100unsigned long clk_get_rate(struct clk *clk) 103unsigned long clk_get_rate(struct clk *clk)
101{ 104{
102 return clk->rate; 105 return clk->rate;
103} 106}
107EXPORT_SYMBOL(clk_get_rate);
104 108
105void clk_put(struct clk *clk) 109void clk_put(struct clk *clk)
106{ 110{
107} 111}
112EXPORT_SYMBOL(clk_put);
108 113
109 114
110 115
diff --git a/arch/arm/mach-footbridge/Makefile b/arch/arm/mach-footbridge/Makefile
index 0694ad6b6476..32f8609e4f85 100644
--- a/arch/arm/mach-footbridge/Makefile
+++ b/arch/arm/mach-footbridge/Makefile
@@ -14,12 +14,10 @@ pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o
14pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o 14pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o
15pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o 15pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
16 16
17leds-$(CONFIG_ARCH_CO285) += ebsa285-leds.o
18leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o 17leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
19leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o 18leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o
20 19
21obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o 20obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o
22obj-$(CONFIG_ARCH_CO285) += co285.o dc21285-timer.o
23obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o 21obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
24obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o 22obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o
25obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o 23obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
diff --git a/arch/arm/mach-footbridge/co285.c b/arch/arm/mach-footbridge/co285.c
deleted file mode 100644
index 4545576ad8d9..000000000000
--- a/arch/arm/mach-footbridge/co285.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * linux/arch/arm/mach-footbridge/co285.c
3 *
4 * CO285 machine fixup
5 */
6#include <linux/init.h>
7
8#include <asm/hardware/dec21285.h>
9#include <asm/mach-types.h>
10
11#include <asm/mach/arch.h>
12
13#include "common.h"
14
15static void __init
16fixup_coebsa285(struct machine_desc *desc, struct tag *tags,
17 char **cmdline, struct meminfo *mi)
18{
19 extern unsigned long boot_memory_end;
20 extern char boot_command_line[];
21
22 mi->nr_banks = 1;
23 mi->bank[0].start = PHYS_OFFSET;
24 mi->bank[0].size = boot_memory_end;
25 mi->bank[0].node = 0;
26
27 *cmdline = boot_command_line;
28}
29
30MACHINE_START(CO285, "co-EBSA285")
31 /* Maintainer: Mark van Doesburg */
32 .phys_io = DC21285_ARMCSR_BASE,
33 .io_pg_offst = ((0x7cf00000) >> 18) & 0xfffc,
34 .fixup = fixup_coebsa285,
35 .map_io = footbridge_map_io,
36 .init_irq = footbridge_init_irq,
37 .timer = &footbridge_timer,
38MACHINE_END
39
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index ef29fc34ce65..b08ab507c052 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -177,25 +177,6 @@ static struct map_desc ebsa285_host_io_desc[] __initdata = {
177#endif 177#endif
178}; 178};
179 179
180/*
181 * The CO-ebsa285 mapping.
182 */
183static struct map_desc co285_io_desc[] __initdata = {
184#ifdef CONFIG_ARCH_CO285
185 {
186 .virtual = PCIO_BASE,
187 .pfn = __phys_to_pfn(DC21285_PCI_IO),
188 .length = PCIO_SIZE,
189 .type = MT_DEVICE,
190 }, {
191 .virtual = PCIMEM_BASE,
192 .pfn = __phys_to_pfn(DC21285_PCI_MEM),
193 .length = PCIMEM_SIZE,
194 .type = MT_DEVICE,
195 },
196#endif
197};
198
199void __init footbridge_map_io(void) 180void __init footbridge_map_io(void)
200{ 181{
201 /* 182 /*
@@ -208,8 +189,6 @@ void __init footbridge_map_io(void)
208 * Now, work out what we've got to map in addition on this 189 * Now, work out what we've got to map in addition on this
209 * platform. 190 * platform.
210 */ 191 */
211 if (machine_is_co285())
212 iotable_init(co285_io_desc, ARRAY_SIZE(co285_io_desc));
213 if (footbridge_cfn_mode()) 192 if (footbridge_cfn_mode())
214 iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc)); 193 iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc));
215} 194}
diff --git a/arch/arm/mach-footbridge/ebsa285-leds.c b/arch/arm/mach-footbridge/ebsa285-leds.c
index a64e22226515..09c1fbc51876 100644
--- a/arch/arm/mach-footbridge/ebsa285-leds.c
+++ b/arch/arm/mach-footbridge/ebsa285-leds.c
@@ -128,7 +128,7 @@ static void ebsa285_leds_event(led_event_t evt)
128 128
129static int __init leds_init(void) 129static int __init leds_init(void)
130{ 130{
131 if (machine_is_ebsa285() || machine_is_co285()) 131 if (machine_is_ebsa285())
132 leds_event = ebsa285_leds_event; 132 leds_event = ebsa285_leds_event;
133 133
134 leds_event(led_start); 134 leds_event(led_start);
diff --git a/arch/arm/mach-footbridge/time.c b/arch/arm/mach-footbridge/time.c
index 5d02e95dede3..d5cfcda385d6 100644
--- a/arch/arm/mach-footbridge/time.c
+++ b/arch/arm/mach-footbridge/time.c
@@ -115,8 +115,7 @@ static int set_isa_cmos_time(void)
115 115
116void __init isa_rtc_init(void) 116void __init isa_rtc_init(void)
117{ 117{
118 if (machine_is_co285() || 118 if (machine_is_personal_server())
119 machine_is_personal_server())
120 /* 119 /*
121 * Add-in 21285s shouldn't access the RTC 120 * Add-in 21285s shouldn't access the RTC
122 */ 121 */
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 88d5e61a2e13..b047c7e795a9 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y += irq.o time.o dma.o generic.o 7obj-y += irq.o time.o dma.o generic.o clock.o
8 8
9obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o 9obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
10 10
diff --git a/arch/arm/mach-imx/clock.c b/arch/arm/mach-imx/clock.c
new file mode 100644
index 000000000000..6a90fe5578df
--- /dev/null
+++ b/arch/arm/mach-imx/clock.c
@@ -0,0 +1,205 @@
1/*
2 * Copyright (C) 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/kernel.h>
20#include <linux/device.h>
21#include <linux/list.h>
22#include <linux/math64.h>
23#include <linux/err.h>
24
25#include <asm/io.h>
26#include <asm/arch/imx-regs.h>
27
28/*
29 * Very simple approach: We can't disable clocks, so we do
30 * not need refcounting
31 */
32
33struct clk {
34 struct list_head node;
35 const char *name;
36 unsigned long (*get_rate)(void);
37};
38
39/*
40 * get the system pll clock in Hz
41 *
42 * mfi + mfn / (mfd +1)
43 * f = 2 * f_ref * --------------------
44 * pd + 1
45 */
46static unsigned long imx_decode_pll(unsigned int pll, u32 f_ref)
47{
48 unsigned long long ll;
49 unsigned long quot;
50
51 u32 mfi = (pll >> 10) & 0xf;
52 u32 mfn = pll & 0x3ff;
53 u32 mfd = (pll >> 16) & 0x3ff;
54 u32 pd = (pll >> 26) & 0xf;
55
56 mfi = mfi <= 5 ? 5 : mfi;
57
58 ll = 2 * (unsigned long long)f_ref *
59 ((mfi << 16) + (mfn << 16) / (mfd + 1));
60 quot = (pd + 1) * (1 << 16);
61 ll += quot / 2;
62 do_div(ll, quot);
63 return (unsigned long)ll;
64}
65
66static unsigned long imx_get_system_clk(void)
67{
68 u32 f_ref = (CSCR & CSCR_SYSTEM_SEL) ? 16000000 : (CLK32 * 512);
69
70 return imx_decode_pll(SPCTL0, f_ref);
71}
72
73static unsigned long imx_get_mcu_clk(void)
74{
75 return imx_decode_pll(MPCTL0, CLK32 * 512);
76}
77
78/*
79 * get peripheral clock 1 ( UART[12], Timer[12], PWM )
80 */
81static unsigned long imx_get_perclk1(void)
82{
83 return imx_get_system_clk() / (((PCDR) & 0xf)+1);
84}
85
86/*
87 * get peripheral clock 2 ( LCD, SD, SPI[12] )
88 */
89static unsigned long imx_get_perclk2(void)
90{
91 return imx_get_system_clk() / (((PCDR>>4) & 0xf)+1);
92}
93
94/*
95 * get peripheral clock 3 ( SSI )
96 */
97static unsigned long imx_get_perclk3(void)
98{
99 return imx_get_system_clk() / (((PCDR>>16) & 0x7f)+1);
100}
101
102/*
103 * get hclk ( SDRAM, CSI, Memory Stick, I2C, DMA )
104 */
105static unsigned long imx_get_hclk(void)
106{
107 return imx_get_system_clk() / (((CSCR>>10) & 0xf)+1);
108}
109
110static struct clk clk_system_clk = {
111 .name = "system_clk",
112 .get_rate = imx_get_system_clk,
113};
114
115static struct clk clk_hclk = {
116 .name = "hclk",
117 .get_rate = imx_get_hclk,
118};
119
120static struct clk clk_mcu_clk = {
121 .name = "mcu_clk",
122 .get_rate = imx_get_mcu_clk,
123};
124
125static struct clk clk_perclk1 = {
126 .name = "perclk1",
127 .get_rate = imx_get_perclk1,
128};
129
130static struct clk clk_uart_clk = {
131 .name = "uart_clk",
132 .get_rate = imx_get_perclk1,
133};
134
135static struct clk clk_perclk2 = {
136 .name = "perclk2",
137 .get_rate = imx_get_perclk2,
138};
139
140static struct clk clk_perclk3 = {
141 .name = "perclk3",
142 .get_rate = imx_get_perclk3,
143};
144
145static struct clk *clks[] = {
146 &clk_perclk1,
147 &clk_perclk2,
148 &clk_perclk3,
149 &clk_system_clk,
150 &clk_hclk,
151 &clk_mcu_clk,
152 &clk_uart_clk,
153};
154
155static LIST_HEAD(clocks);
156static DEFINE_MUTEX(clocks_mutex);
157
158struct clk *clk_get(struct device *dev, const char *id)
159{
160 struct clk *p, *clk = ERR_PTR(-ENOENT);
161
162 mutex_lock(&clocks_mutex);
163 list_for_each_entry(p, &clocks, node) {
164 if (!strcmp(p->name, id)) {
165 clk = p;
166 goto found;
167 }
168 }
169
170found:
171 mutex_unlock(&clocks_mutex);
172
173 return clk;
174}
175
176void clk_put(struct clk *clk)
177{
178}
179
180int clk_enable(struct clk *clk)
181{
182 return 0;
183}
184
185void clk_disable(struct clk *clk)
186{
187}
188
189unsigned long clk_get_rate(struct clk *clk)
190{
191 return clk->get_rate();
192}
193
194int imx_clocks_init(void)
195{
196 int i;
197
198 mutex_lock(&clocks_mutex);
199 for (i = 0; i < ARRAY_SIZE(clks); i++)
200 list_add(&clks[i]->node, &clocks);
201 mutex_unlock(&clocks_mutex);
202
203 return 0;
204}
205
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c
index e548ba74a4d2..be0809b33e08 100644
--- a/arch/arm/mach-imx/cpufreq.c
+++ b/arch/arm/mach-imx/cpufreq.c
@@ -32,6 +32,8 @@
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/cpufreq.h> 34#include <linux/cpufreq.h>
35#include <linux/clk.h>
36#include <linux/err.h>
35#include <asm/system.h> 37#include <asm/system.h>
36 38
37#include <asm/hardware.h> 39#include <asm/hardware.h>
@@ -52,6 +54,8 @@
52static u32 mpctl0_at_boot; 54static u32 mpctl0_at_boot;
53static u32 bclk_div_at_boot; 55static u32 bclk_div_at_boot;
54 56
57static struct clk *system_clk, *mcu_clk;
58
55static void imx_set_async_mode(void) 59static void imx_set_async_mode(void)
56{ 60{
57 adjust_cr(CR_920T_CLOCK_MODE, CR_920T_ASYNC_MODE); 61 adjust_cr(CR_920T_CLOCK_MODE, CR_920T_ASYNC_MODE);
@@ -160,10 +164,10 @@ static unsigned int imx_get_speed(unsigned int cpu)
160 cr = get_cr(); 164 cr = get_cr();
161 165
162 if((cr & CR_920T_CLOCK_MODE) == CR_920T_FASTBUS_MODE) { 166 if((cr & CR_920T_CLOCK_MODE) == CR_920T_FASTBUS_MODE) {
163 freq = imx_get_system_clk(); 167 freq = clk_get_rate(system_clk);
164 freq = (freq + bclk_div/2) / bclk_div; 168 freq = (freq + bclk_div/2) / bclk_div;
165 } else { 169 } else {
166 freq = imx_get_mcu_clk(); 170 freq = clk_get_rate(mcu_clk);
167 if (cscr & CSCR_MPU_PRESC) 171 if (cscr & CSCR_MPU_PRESC)
168 freq /= 2; 172 freq /= 2;
169 } 173 }
@@ -201,7 +205,7 @@ static int imx_set_target(struct cpufreq_policy *policy,
201 pr_debug(KERN_DEBUG "imx: requested frequency %ld Hz, mpctl0 at boot 0x%08x\n", 205 pr_debug(KERN_DEBUG "imx: requested frequency %ld Hz, mpctl0 at boot 0x%08x\n",
202 freq, mpctl0_at_boot); 206 freq, mpctl0_at_boot);
203 207
204 sysclk = imx_get_system_clk(); 208 sysclk = clk_get_rate(system_clk);
205 209
206 if (freq > sysclk / bclk_div_at_boot + 1000000) { 210 if (freq > sysclk / bclk_div_at_boot + 1000000) {
207 freq = imx_compute_mpctl(&mpctl0, mpctl0_at_boot, CLK32 * 512, freq, relation); 211 freq = imx_compute_mpctl(&mpctl0, mpctl0_at_boot, CLK32 * 512, freq, relation);
@@ -290,6 +294,16 @@ static int __init imx_cpufreq_init(void)
290 bclk_div_at_boot = __mfld2val(CSCR_BCLK_DIV, CSCR) + 1; 294 bclk_div_at_boot = __mfld2val(CSCR_BCLK_DIV, CSCR) + 1;
291 mpctl0_at_boot = 0; 295 mpctl0_at_boot = 0;
292 296
297 system_clk = clk_get(NULL, "system_clk");
298 if (IS_ERR(system_clk))
299 return PTR_ERR(system_clk);
300
301 mcu_clk = clk_get(NULL, "mcu_clk");
302 if (IS_ERR(mcu_clk)) {
303 clk_put(system_clk);
304 return PTR_ERR(mcu_clk);
305 }
306
293 if((CSCR & CSCR_MPEN) && 307 if((CSCR & CSCR_MPEN) &&
294 ((get_cr() & CR_920T_CLOCK_MODE) != CR_920T_FASTBUS_MODE)) 308 ((get_cr() & CR_920T_CLOCK_MODE) != CR_920T_FASTBUS_MODE))
295 mpctl0_at_boot = MPCTL0; 309 mpctl0_at_boot = MPCTL0;
diff --git a/arch/arm/mach-imx/dma.c b/arch/arm/mach-imx/dma.c
index a59ff2987cb7..ee1c6f06ff64 100644
--- a/arch/arm/mach-imx/dma.c
+++ b/arch/arm/mach-imx/dma.c
@@ -410,7 +410,6 @@ void imx_dma_free(imx_dmach_t dma_ch)
410 410
411/** 411/**
412 * imx_dma_request_by_prio - find and request some of free channels best suiting requested priority 412 * imx_dma_request_by_prio - find and request some of free channels best suiting requested priority
413 * @dma_ch: i.MX DMA channel number
414 * @name: the driver/caller own non-%NULL identification 413 * @name: the driver/caller own non-%NULL identification
415 * @prio: one of the hardware distinguished priority level: 414 * @prio: one of the hardware distinguished priority level:
416 * %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW 415 * %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW
@@ -420,11 +419,9 @@ void imx_dma_free(imx_dmach_t dma_ch)
420 * in the higher and then even lower priority groups. 419 * in the higher and then even lower priority groups.
421 * 420 *
422 * Return value: If there is no free channel to allocate, -%ENODEV is returned. 421 * Return value: If there is no free channel to allocate, -%ENODEV is returned.
423 * Zero value indicates successful channel allocation. 422 * On successful allocation channel is returned.
424 */ 423 */
425int 424imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio)
426imx_dma_request_by_prio(imx_dmach_t * pdma_ch, const char *name,
427 imx_dma_prio prio)
428{ 425{
429 int i; 426 int i;
430 int best; 427 int best;
@@ -444,15 +441,13 @@ imx_dma_request_by_prio(imx_dmach_t * pdma_ch, const char *name,
444 441
445 for (i = best; i < IMX_DMA_CHANNELS; i++) { 442 for (i = best; i < IMX_DMA_CHANNELS; i++) {
446 if (!imx_dma_request(i, name)) { 443 if (!imx_dma_request(i, name)) {
447 *pdma_ch = i; 444 return i;
448 return 0;
449 } 445 }
450 } 446 }
451 447
452 for (i = best - 1; i >= 0; i--) { 448 for (i = best - 1; i >= 0; i--) {
453 if (!imx_dma_request(i, name)) { 449 if (!imx_dma_request(i, name)) {
454 *pdma_ch = i; 450 return i;
455 return 0;
456 } 451 }
457 } 452 }
458 453
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c
index 4cfc9d3af28a..98ddd8a6d05f 100644
--- a/arch/arm/mach-imx/generic.c
+++ b/arch/arm/mach-imx/generic.c
@@ -214,82 +214,6 @@ int imx_irq_to_gpio(unsigned irq)
214 214
215EXPORT_SYMBOL(imx_irq_to_gpio); 215EXPORT_SYMBOL(imx_irq_to_gpio);
216 216
217/*
218 * get the system pll clock in Hz
219 *
220 * mfi + mfn / (mfd +1)
221 * f = 2 * f_ref * --------------------
222 * pd + 1
223 */
224static unsigned int imx_decode_pll(unsigned int pll, u32 f_ref)
225{
226 unsigned long long ll;
227 unsigned long quot;
228
229 u32 mfi = (pll >> 10) & 0xf;
230 u32 mfn = pll & 0x3ff;
231 u32 mfd = (pll >> 16) & 0x3ff;
232 u32 pd = (pll >> 26) & 0xf;
233
234 mfi = mfi <= 5 ? 5 : mfi;
235
236 ll = 2 * (unsigned long long)f_ref * ( (mfi<<16) + (mfn<<16) / (mfd+1) );
237 quot = (pd+1) * (1<<16);
238 ll += quot / 2;
239 do_div(ll, quot);
240 return (unsigned int) ll;
241}
242
243unsigned int imx_get_system_clk(void)
244{
245 u32 f_ref = (CSCR & CSCR_SYSTEM_SEL) ? 16000000 : (CLK32 * 512);
246
247 return imx_decode_pll(SPCTL0, f_ref);
248}
249EXPORT_SYMBOL(imx_get_system_clk);
250
251unsigned int imx_get_mcu_clk(void)
252{
253 return imx_decode_pll(MPCTL0, CLK32 * 512);
254}
255EXPORT_SYMBOL(imx_get_mcu_clk);
256
257/*
258 * get peripheral clock 1 ( UART[12], Timer[12], PWM )
259 */
260unsigned int imx_get_perclk1(void)
261{
262 return imx_get_system_clk() / (((PCDR) & 0xf)+1);
263}
264EXPORT_SYMBOL(imx_get_perclk1);
265
266/*
267 * get peripheral clock 2 ( LCD, SD, SPI[12] )
268 */
269unsigned int imx_get_perclk2(void)
270{
271 return imx_get_system_clk() / (((PCDR>>4) & 0xf)+1);
272}
273EXPORT_SYMBOL(imx_get_perclk2);
274
275/*
276 * get peripheral clock 3 ( SSI )
277 */
278unsigned int imx_get_perclk3(void)
279{
280 return imx_get_system_clk() / (((PCDR>>16) & 0x7f)+1);
281}
282EXPORT_SYMBOL(imx_get_perclk3);
283
284/*
285 * get hclk ( SDRAM, CSI, Memory Stick, I2C, DMA )
286 */
287unsigned int imx_get_hclk(void)
288{
289 return imx_get_system_clk() / (((CSCR>>10) & 0xf)+1);
290}
291EXPORT_SYMBOL(imx_get_hclk);
292
293static struct resource imx_mmc_resources[] = { 217static struct resource imx_mmc_resources[] = {
294 [0] = { 218 [0] = {
295 .start = 0x00214000, 219 .start = 0x00214000,
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index a9778c1587ab..9635d5812bcd 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -69,6 +69,11 @@ static struct resource imx_uart1_resources[] = {
69 .end = (UART1_MINT_TX), 69 .end = (UART1_MINT_TX),
70 .flags = IORESOURCE_IRQ, 70 .flags = IORESOURCE_IRQ,
71 }, 71 },
72 [3] = {
73 .start = UART1_MINT_RTS,
74 .end = UART1_MINT_RTS,
75 .flags = IORESOURCE_IRQ,
76 },
72}; 77};
73 78
74static struct platform_device imx_uart1_device = { 79static struct platform_device imx_uart1_device = {
@@ -97,6 +102,11 @@ static struct resource imx_uart2_resources[] = {
97 .end = (UART2_MINT_TX), 102 .end = (UART2_MINT_TX),
98 .flags = IORESOURCE_IRQ, 103 .flags = IORESOURCE_IRQ,
99 }, 104 },
105 [3] = {
106 .start = UART2_MINT_RTS,
107 .end = UART2_MINT_RTS,
108 .flags = IORESOURCE_IRQ,
109 },
100}; 110};
101 111
102static struct platform_device imx_uart2_device = { 112static struct platform_device imx_uart2_device = {
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index d86d124aea22..5a41e96e8586 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -17,6 +17,7 @@
17#include <linux/time.h> 17#include <linux/time.h>
18#include <linux/clocksource.h> 18#include <linux/clocksource.h>
19#include <linux/clockchips.h> 19#include <linux/clockchips.h>
20#include <linux/clk.h>
20 21
21#include <asm/hardware.h> 22#include <asm/hardware.h>
22#include <asm/io.h> 23#include <asm/io.h>
@@ -86,10 +87,10 @@ static struct clocksource clocksource_imx = {
86 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 87 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
87}; 88};
88 89
89static int __init imx_clocksource_init(void) 90static int __init imx_clocksource_init(unsigned long rate)
90{ 91{
91 clocksource_imx.mult = 92 clocksource_imx.mult =
92 clocksource_hz2mult(imx_get_perclk1(), clocksource_imx.shift); 93 clocksource_hz2mult(rate, clocksource_imx.shift);
93 clocksource_register(&clocksource_imx); 94 clocksource_register(&clocksource_imx);
94 95
95 return 0; 96 return 0;
@@ -174,9 +175,9 @@ static struct clock_event_device clockevent_imx = {
174 .rating = 200, 175 .rating = 200,
175}; 176};
176 177
177static int __init imx_clockevent_init(void) 178static int __init imx_clockevent_init(unsigned long rate)
178{ 179{
179 clockevent_imx.mult = div_sc(imx_get_perclk1(), NSEC_PER_SEC, 180 clockevent_imx.mult = div_sc(rate, NSEC_PER_SEC,
180 clockevent_imx.shift); 181 clockevent_imx.shift);
181 clockevent_imx.max_delta_ns = 182 clockevent_imx.max_delta_ns =
182 clockevent_delta2ns(0xfffffffe, &clockevent_imx); 183 clockevent_delta2ns(0xfffffffe, &clockevent_imx);
@@ -190,13 +191,23 @@ static int __init imx_clockevent_init(void)
190 return 0; 191 return 0;
191} 192}
192 193
194extern int imx_clocks_init(void);
193 195
194static void __init imx_timer_init(void) 196static void __init imx_timer_init(void)
195{ 197{
198 struct clk *clk;
199 unsigned long rate;
200
201 imx_clocks_init();
202
203 clk = clk_get(NULL, "perclk1");
204 clk_enable(clk);
205 rate = clk_get_rate(clk);
206
196 imx_timer_hardware_init(); 207 imx_timer_hardware_init();
197 imx_clocksource_init(); 208 imx_clocksource_init(rate);
198 209
199 imx_clockevent_init(); 210 imx_clockevent_init(rate);
200 211
201 /* 212 /*
202 * Make irqs happen for the system timer 213 * Make irqs happen for the system timer
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile
index 158daaf9e3b0..6a5ef8d30b10 100644
--- a/arch/arm/mach-integrator/Makefile
+++ b/arch/arm/mach-integrator/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := clock.o core.o lm.o time.o 7obj-y := clock.o core.o lm.o
8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o 8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o
9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o 9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
10 10
diff --git a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c
deleted file mode 100644
index 8508a0db3eaf..000000000000
--- a/arch/arm/mach-integrator/time.c
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * linux/arch/arm/mach-integrator/time.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd.
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#include <linux/module.h>
11#include <linux/kernel.h>
12#include <linux/time.h>
13#include <linux/mc146818rtc.h>
14#include <linux/interrupt.h>
15#include <linux/init.h>
16#include <linux/device.h>
17#include <linux/amba/bus.h>
18
19#include <asm/hardware.h>
20#include <asm/io.h>
21#include <asm/uaccess.h>
22#include <asm/rtc.h>
23
24#include <asm/mach/time.h>
25
26#define RTC_DR (0)
27#define RTC_MR (4)
28#define RTC_STAT (8)
29#define RTC_EOI (8)
30#define RTC_LR (12)
31#define RTC_CR (16)
32#define RTC_CR_MIE (1 << 0)
33
34extern int (*set_rtc)(void);
35static void __iomem *rtc_base;
36
37static int integrator_set_rtc(void)
38{
39 __raw_writel(xtime.tv_sec, rtc_base + RTC_LR);
40 return 1;
41}
42
43static int integrator_rtc_read_alarm(struct rtc_wkalrm *alrm)
44{
45 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time);
46 return 0;
47}
48
49static inline int integrator_rtc_set_alarm(struct rtc_wkalrm *alrm)
50{
51 unsigned long time;
52 int ret;
53
54 /*
55 * At the moment, we can only deal with non-wildcarded alarm times.
56 */
57 ret = rtc_valid_tm(&alrm->time);
58 if (ret == 0)
59 ret = rtc_tm_to_time(&alrm->time, &time);
60 if (ret == 0)
61 writel(time, rtc_base + RTC_MR);
62 return ret;
63}
64
65static int integrator_rtc_read_time(struct rtc_time *tm)
66{
67 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm);
68 return 0;
69}
70
71/*
72 * Set the RTC time. Unfortunately, we can't accurately set
73 * the point at which the counter updates.
74 *
75 * Also, since RTC_LR is transferred to RTC_CR on next rising
76 * edge of the 1Hz clock, we must write the time one second
77 * in advance.
78 */
79static inline int integrator_rtc_set_time(struct rtc_time *tm)
80{
81 unsigned long time;
82 int ret;
83
84 ret = rtc_tm_to_time(tm, &time);
85 if (ret == 0)
86 writel(time + 1, rtc_base + RTC_LR);
87
88 return ret;
89}
90
91static struct rtc_ops rtc_ops = {
92 .owner = THIS_MODULE,
93 .read_time = integrator_rtc_read_time,
94 .set_time = integrator_rtc_set_time,
95 .read_alarm = integrator_rtc_read_alarm,
96 .set_alarm = integrator_rtc_set_alarm,
97};
98
99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id)
100{
101 writel(0, rtc_base + RTC_EOI);
102 return IRQ_HANDLED;
103}
104
105static int rtc_probe(struct amba_device *dev, void *id)
106{
107 int ret;
108
109 if (rtc_base)
110 return -EBUSY;
111
112 ret = amba_request_regions(dev, NULL);
113 if (ret)
114 goto out;
115
116 rtc_base = ioremap(dev->res.start, SZ_4K);
117 if (!rtc_base) {
118 ret = -ENOMEM;
119 goto res_out;
120 }
121
122 __raw_writel(0, rtc_base + RTC_CR);
123 __raw_writel(0, rtc_base + RTC_EOI);
124
125 xtime.tv_sec = __raw_readl(rtc_base + RTC_DR);
126
127 /* note that 'dev' is merely used for irq disambiguation;
128 * it is not actually referenced in the irq handler
129 */
130 ret = request_irq(dev->irq[0], arm_rtc_interrupt, IRQF_DISABLED,
131 "rtc-pl030", dev);
132 if (ret)
133 goto map_out;
134
135 ret = register_rtc(&rtc_ops);
136 if (ret)
137 goto irq_out;
138
139 set_rtc = integrator_set_rtc;
140 return 0;
141
142 irq_out:
143 free_irq(dev->irq[0], dev);
144 map_out:
145 iounmap(rtc_base);
146 rtc_base = NULL;
147 res_out:
148 amba_release_regions(dev);
149 out:
150 return ret;
151}
152
153static int rtc_remove(struct amba_device *dev)
154{
155 set_rtc = NULL;
156
157 writel(0, rtc_base + RTC_CR);
158
159 free_irq(dev->irq[0], dev);
160 unregister_rtc(&rtc_ops);
161
162 iounmap(rtc_base);
163 rtc_base = NULL;
164 amba_release_regions(dev);
165
166 return 0;
167}
168
169static struct timespec rtc_delta;
170
171static int rtc_suspend(struct amba_device *dev, pm_message_t state)
172{
173 struct timespec rtc;
174
175 rtc.tv_sec = readl(rtc_base + RTC_DR);
176 rtc.tv_nsec = 0;
177 save_time_delta(&rtc_delta, &rtc);
178
179 return 0;
180}
181
182static int rtc_resume(struct amba_device *dev)
183{
184 struct timespec rtc;
185
186 rtc.tv_sec = readl(rtc_base + RTC_DR);
187 rtc.tv_nsec = 0;
188 restore_time_delta(&rtc_delta, &rtc);
189
190 return 0;
191}
192
193static struct amba_id rtc_ids[] = {
194 {
195 .id = 0x00041030,
196 .mask = 0x000fffff,
197 },
198 { 0, 0 },
199};
200
201static struct amba_driver rtc_driver = {
202 .drv = {
203 .name = "rtc-pl030",
204 },
205 .probe = rtc_probe,
206 .remove = rtc_remove,
207 .suspend = rtc_suspend,
208 .resume = rtc_resume,
209 .id_table = rtc_ids,
210};
211
212static int __init integrator_rtc_init(void)
213{
214 return amba_driver_register(&rtc_driver);
215}
216
217static void __exit integrator_rtc_exit(void)
218{
219 amba_driver_unregister(&rtc_driver);
220}
221
222module_init(integrator_rtc_init);
223module_exit(integrator_rtc_exit);
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index e774447c0592..db8b5fe06c0d 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -125,6 +125,15 @@ config ARCH_IXDP4XX
125 depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435 125 depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435
126 default y 126 default y
127 127
128config MACH_FSG
129 bool
130 prompt "Freecom FSG-3"
131 select PCI
132 help
133 Say 'Y' here if you want your kernel to support Freecom's
134 FSG-3 device. For more information on this platform,
135 see http://www.nslu2-linux.org/wiki/FSG3/HomePage
136
128# 137#
129# Certain registers and IRQs are only enabled if supporting IXP465 CPUs 138# Certain registers and IRQs are only enabled if supporting IXP465 CPUs
130# 139#
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
index c1956882c48b..2e6bbf927a74 100644
--- a/arch/arm/mach-ixp4xx/Makefile
+++ b/arch/arm/mach-ixp4xx/Makefile
@@ -15,6 +15,7 @@ obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o
15obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o 15obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o
16obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o 16obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o
17obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o 17obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
18obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
18 19
19obj-y += common.o 20obj-y += common.o
20 21
@@ -28,6 +29,7 @@ obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o
28obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o 29obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o
29obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o 30obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
30obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o 31obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
32obj-$(CONFIG_MACH_FSG) += fsg-setup.o
31 33
32obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o 34obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
33obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o 35obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index f6d66dce6852..3781b3db9f49 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -326,11 +326,11 @@ static struct resource ixp4xx_udc_resources[] = {
326}; 326};
327 327
328/* 328/*
329 * USB device controller. The IXP4xx uses the same controller as PXA2XX, 329 * USB device controller. The IXP4xx uses the same controller as PXA25X,
330 * so we just use the same device. 330 * so we just use the same device.
331 */ 331 */
332static struct platform_device ixp4xx_udc_device = { 332static struct platform_device ixp4xx_udc_device = {
333 .name = "pxa2xx-udc", 333 .name = "pxa25x-udc",
334 .id = -1, 334 .id = -1,
335 .num_resources = 2, 335 .num_resources = 2,
336 .resource = ixp4xx_udc_resources, 336 .resource = ixp4xx_udc_resources,
diff --git a/arch/arm/mach-ixp4xx/fsg-pci.c b/arch/arm/mach-ixp4xx/fsg-pci.c
new file mode 100644
index 000000000000..f19f3f6feda1
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/fsg-pci.c
@@ -0,0 +1,71 @@
1/*
2 * arch/arch/mach-ixp4xx/fsg-pci.c
3 *
4 * FSG board-level PCI initialization
5 *
6 * Author: Rod Whitby <rod@whitby.id.au>
7 * Maintainer: http://www.nslu2-linux.org/
8 *
9 * based on ixdp425-pci.c:
10 * Copyright (C) 2002 Intel Corporation.
11 * Copyright (C) 2003-2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 *
17 */
18
19#include <linux/pci.h>
20#include <linux/init.h>
21#include <linux/irq.h>
22
23#include <asm/mach/pci.h>
24#include <asm/mach-types.h>
25
26void __init fsg_pci_preinit(void)
27{
28 set_irq_type(IRQ_FSG_PCI_INTA, IRQT_LOW);
29 set_irq_type(IRQ_FSG_PCI_INTB, IRQT_LOW);
30 set_irq_type(IRQ_FSG_PCI_INTC, IRQT_LOW);
31
32 ixp4xx_pci_preinit();
33}
34
35static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
36{
37 static int pci_irq_table[FSG_PCI_IRQ_LINES] = {
38 IRQ_FSG_PCI_INTC,
39 IRQ_FSG_PCI_INTB,
40 IRQ_FSG_PCI_INTA,
41 };
42
43 int irq = -1;
44 slot = slot - 11;
45
46 if (slot >= 1 && slot <= FSG_PCI_MAX_DEV &&
47 pin >= 1 && pin <= FSG_PCI_IRQ_LINES)
48 irq = pci_irq_table[(slot - 1)];
49 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
50 __func__, slot, pin, irq);
51
52 return irq;
53}
54
55struct hw_pci fsg_pci __initdata = {
56 .nr_controllers = 1,
57 .preinit = fsg_pci_preinit,
58 .swizzle = pci_std_swizzle,
59 .setup = ixp4xx_setup,
60 .scan = ixp4xx_scan_bus,
61 .map_irq = fsg_map_irq,
62};
63
64int __init fsg_pci_init(void)
65{
66 if (machine_is_fsg())
67 pci_common_init(&fsg_pci);
68 return 0;
69}
70
71subsys_initcall(fsg_pci_init);
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
new file mode 100644
index 000000000000..0db3a909ae61
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -0,0 +1,276 @@
1/*
2 * arch/arm/mach-ixp4xx/fsg-setup.c
3 *
4 * FSG board-setup
5 *
6 * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
7 *
8 * based on ixdp425-setup.c:
9 * Copyright (C) 2003-2004 MontaVista Software, Inc.
10 * based on nslu2-power.c
11 * Copyright (C) 2005 Tower Technologies
12 *
13 * Author: Rod Whitby <rod@whitby.id.au>
14 * Maintainers: http://www.nslu2-linux.org/
15 *
16 */
17
18#include <linux/if_ether.h>
19#include <linux/irq.h>
20#include <linux/serial.h>
21#include <linux/serial_8250.h>
22#include <linux/leds.h>
23#include <linux/reboot.h>
24#include <linux/i2c.h>
25#include <linux/i2c-gpio.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/flash.h>
30#include <asm/io.h>
31#include <asm/gpio.h>
32
33static struct flash_platform_data fsg_flash_data = {
34 .map_name = "cfi_probe",
35 .width = 2,
36};
37
38static struct resource fsg_flash_resource = {
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device fsg_flash = {
43 .name = "IXP4XX-Flash",
44 .id = 0,
45 .dev = {
46 .platform_data = &fsg_flash_data,
47 },
48 .num_resources = 1,
49 .resource = &fsg_flash_resource,
50};
51
52static struct i2c_gpio_platform_data fsg_i2c_gpio_data = {
53 .sda_pin = FSG_SDA_PIN,
54 .scl_pin = FSG_SCL_PIN,
55};
56
57static struct platform_device fsg_i2c_gpio = {
58 .name = "i2c-gpio",
59 .id = 0,
60 .dev = {
61 .platform_data = &fsg_i2c_gpio_data,
62 },
63};
64
65static struct i2c_board_info __initdata fsg_i2c_board_info [] = {
66 {
67 I2C_BOARD_INFO("rtc-isl1208", 0x6f),
68 },
69};
70
71static struct resource fsg_uart_resources[] = {
72 {
73 .start = IXP4XX_UART1_BASE_PHYS,
74 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
75 .flags = IORESOURCE_MEM,
76 },
77 {
78 .start = IXP4XX_UART2_BASE_PHYS,
79 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
80 .flags = IORESOURCE_MEM,
81 }
82};
83
84static struct plat_serial8250_port fsg_uart_data[] = {
85 {
86 .mapbase = IXP4XX_UART1_BASE_PHYS,
87 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
88 .irq = IRQ_IXP4XX_UART1,
89 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
90 .iotype = UPIO_MEM,
91 .regshift = 2,
92 .uartclk = IXP4XX_UART_XTAL,
93 },
94 {
95 .mapbase = IXP4XX_UART2_BASE_PHYS,
96 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
97 .irq = IRQ_IXP4XX_UART2,
98 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
99 .iotype = UPIO_MEM,
100 .regshift = 2,
101 .uartclk = IXP4XX_UART_XTAL,
102 },
103 { }
104};
105
106static struct platform_device fsg_uart = {
107 .name = "serial8250",
108 .id = PLAT8250_DEV_PLATFORM,
109 .dev = {
110 .platform_data = fsg_uart_data,
111 },
112 .num_resources = ARRAY_SIZE(fsg_uart_resources),
113 .resource = fsg_uart_resources,
114};
115
116static struct platform_device fsg_leds = {
117 .name = "fsg-led",
118 .id = -1,
119};
120
121/* Built-in 10/100 Ethernet MAC interfaces */
122static struct eth_plat_info fsg_plat_eth[] = {
123 {
124 .phy = 5,
125 .rxq = 3,
126 .txreadyq = 20,
127 }, {
128 .phy = 4,
129 .rxq = 4,
130 .txreadyq = 21,
131 }
132};
133
134static struct platform_device fsg_eth[] = {
135 {
136 .name = "ixp4xx_eth",
137 .id = IXP4XX_ETH_NPEB,
138 .dev = {
139 .platform_data = fsg_plat_eth,
140 },
141 }, {
142 .name = "ixp4xx_eth",
143 .id = IXP4XX_ETH_NPEC,
144 .dev = {
145 .platform_data = fsg_plat_eth + 1,
146 },
147 }
148};
149
150static struct platform_device *fsg_devices[] __initdata = {
151 &fsg_i2c_gpio,
152 &fsg_flash,
153 &fsg_leds,
154 &fsg_eth[0],
155 &fsg_eth[1],
156};
157
158static irqreturn_t fsg_power_handler(int irq, void *dev_id)
159{
160 /* Signal init to do the ctrlaltdel action, this will bypass init if
161 * it hasn't started and do a kernel_restart.
162 */
163 ctrl_alt_del();
164
165 return IRQ_HANDLED;
166}
167
168static irqreturn_t fsg_reset_handler(int irq, void *dev_id)
169{
170 /* This is the paper-clip reset which does an emergency reboot. */
171 printk(KERN_INFO "Restarting system.\n");
172 machine_restart(NULL);
173
174 /* This should never be reached. */
175 return IRQ_HANDLED;
176}
177
178static void __init fsg_init(void)
179{
180 DECLARE_MAC_BUF(mac_buf);
181 uint8_t __iomem *f;
182 int i;
183
184 ixp4xx_sys_init();
185
186 fsg_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
187 fsg_flash_resource.end =
188 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
189
190 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
191 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
192
193 /* Configure CS2 for operation, 8bit and writable */
194 *IXP4XX_EXP_CS2 = 0xbfff0002;
195
196 i2c_register_board_info(0, fsg_i2c_board_info,
197 ARRAY_SIZE(fsg_i2c_board_info));
198
199 /* This is only useful on a modified machine, but it is valuable
200 * to have it first in order to see debug messages, and so that
201 * it does *not* get removed if platform_add_devices fails!
202 */
203 (void)platform_device_register(&fsg_uart);
204
205 platform_add_devices(fsg_devices, ARRAY_SIZE(fsg_devices));
206
207 if (request_irq(gpio_to_irq(FSG_RB_GPIO), &fsg_reset_handler,
208 IRQF_DISABLED | IRQF_TRIGGER_LOW,
209 "FSG reset button", NULL) < 0) {
210
211 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
212 gpio_to_irq(FSG_RB_GPIO));
213 }
214
215 if (request_irq(gpio_to_irq(FSG_SB_GPIO), &fsg_power_handler,
216 IRQF_DISABLED | IRQF_TRIGGER_LOW,
217 "FSG power button", NULL) < 0) {
218
219 printk(KERN_DEBUG "Power Button IRQ %d not available\n",
220 gpio_to_irq(FSG_SB_GPIO));
221 }
222
223 /*
224 * Map in a portion of the flash and read the MAC addresses.
225 * Since it is stored in BE in the flash itself, we need to
226 * byteswap it if we're in LE mode.
227 */
228 f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x400000);
229 if (f) {
230#ifdef __ARMEB__
231 for (i = 0; i < 6; i++) {
232 fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i);
233 fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i);
234 }
235#else
236
237 /*
238 Endian-swapped reads from unaligned addresses are
239 required to extract the two MACs from the big-endian
240 Redboot config area in flash.
241 */
242
243 fsg_plat_eth[0].hwaddr[0] = readb(f + 0x3C0421);
244 fsg_plat_eth[0].hwaddr[1] = readb(f + 0x3C0420);
245 fsg_plat_eth[0].hwaddr[2] = readb(f + 0x3C0427);
246 fsg_plat_eth[0].hwaddr[3] = readb(f + 0x3C0426);
247 fsg_plat_eth[0].hwaddr[4] = readb(f + 0x3C0425);
248 fsg_plat_eth[0].hwaddr[5] = readb(f + 0x3C0424);
249
250 fsg_plat_eth[1].hwaddr[0] = readb(f + 0x3C0439);
251 fsg_plat_eth[1].hwaddr[1] = readb(f + 0x3C043F);
252 fsg_plat_eth[1].hwaddr[2] = readb(f + 0x3C043E);
253 fsg_plat_eth[1].hwaddr[3] = readb(f + 0x3C043D);
254 fsg_plat_eth[1].hwaddr[4] = readb(f + 0x3C043C);
255 fsg_plat_eth[1].hwaddr[5] = readb(f + 0x3C0443);
256#endif
257 iounmap(f);
258 }
259 printk(KERN_INFO "FSG: Using MAC address %s for port 0\n",
260 print_mac(mac_buf, fsg_plat_eth[0].hwaddr));
261 printk(KERN_INFO "FSG: Using MAC address %s for port 1\n",
262 print_mac(mac_buf, fsg_plat_eth[1].hwaddr));
263
264}
265
266MACHINE_START(FSG, "Freecom FSG-3")
267 /* Maintainer: www.nslu2-linux.org */
268 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
269 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
270 .map_io = ixp4xx_map_io,
271 .init_irq = ixp4xx_init_irq,
272 .timer = &ixp4xx_timer,
273 .boot_params = 0x0100,
274 .init_machine = fsg_init,
275MACHINE_END
276
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
new file mode 100644
index 000000000000..3600cd9f0519
--- /dev/null
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -0,0 +1,25 @@
1if ARCH_KIRKWOOD
2
3menu "Marvell Kirkwood Implementations"
4
5config MACH_DB88F6281_BP
6 bool "Marvell DB-88F6281-BP Development Board"
7 help
8 Say 'Y' here if you want your kernel to support the
9 Marvell DB-88F6281-BP Development Board.
10
11config MACH_RD88F6192_NAS
12 bool "Marvell RD-88F6192-NAS Reference Board"
13 help
14 Say 'Y' here if you want your kernel to support the
15 Marvell RD-88F6192-NAS Reference Board.
16
17config MACH_RD88F6281
18 bool "Marvell RD-88F6281 Reference Board"
19 help
20 Say 'Y' here if you want your kernel to support the
21 Marvell RD-88F6281 Reference Board.
22
23endmenu
24
25endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
new file mode 100644
index 000000000000..e14bf40bfb07
--- /dev/null
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -0,0 +1,5 @@
1obj-y += common.o addr-map.o irq.o pcie.o
2
3obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o
4obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o
5obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6281-setup.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
new file mode 100644
index 000000000000..67039c3e0c48
--- /dev/null
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c
new file mode 100644
index 000000000000..a39f0f3c4730
--- /dev/null
+++ b/arch/arm/mach-kirkwood/addr-map.c
@@ -0,0 +1,139 @@
1/*
2 * arch/arm/mach-kirkwood/addr-map.c
3 *
4 * Address map functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <linux/io.h>
15#include <asm/hardware.h>
16#include "common.h"
17
18/*
19 * Generic Address Decode Windows bit settings
20 */
21#define TARGET_DDR 0
22#define TARGET_DEV_BUS 1
23#define TARGET_PCIE 4
24#define ATTR_DEV_SPI_ROM 0x1e
25#define ATTR_DEV_BOOT 0x1d
26#define ATTR_DEV_NAND 0x2f
27#define ATTR_DEV_CS3 0x37
28#define ATTR_DEV_CS2 0x3b
29#define ATTR_DEV_CS1 0x3d
30#define ATTR_DEV_CS0 0x3e
31#define ATTR_PCIE_IO 0xe0
32#define ATTR_PCIE_MEM 0xe8
33
34/*
35 * Helpers to get DDR bank info
36 */
37#define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3))
38#define DDR_SIZE_CS_OFF(n) (0x0004 + ((n) << 3))
39
40/*
41 * CPU Address Decode Windows registers
42 */
43#define WIN_OFF(n) (BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4))
44#define WIN_CTRL_OFF 0x0000
45#define WIN_BASE_OFF 0x0004
46#define WIN_REMAP_LO_OFF 0x0008
47#define WIN_REMAP_HI_OFF 0x000c
48
49
50struct mbus_dram_target_info kirkwood_mbus_dram_info;
51
52static int __init cpu_win_can_remap(int win)
53{
54 if (win < 4)
55 return 1;
56
57 return 0;
58}
59
60static void __init setup_cpu_win(int win, u32 base, u32 size,
61 u8 target, u8 attr, int remap)
62{
63 void __iomem *addr = (void __iomem *)WIN_OFF(win);
64 u32 ctrl;
65
66 base &= 0xffff0000;
67 ctrl = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1;
68
69 writel(base, addr + WIN_BASE_OFF);
70 writel(ctrl, addr + WIN_CTRL_OFF);
71 if (cpu_win_can_remap(win)) {
72 if (remap < 0)
73 remap = base;
74
75 writel(remap & 0xffff0000, addr + WIN_REMAP_LO_OFF);
76 writel(0, addr + WIN_REMAP_HI_OFF);
77 }
78}
79
80void __init kirkwood_setup_cpu_mbus(void)
81{
82 void __iomem *addr;
83 int i;
84 int cs;
85
86 /*
87 * First, disable and clear windows.
88 */
89 for (i = 0; i < 8; i++) {
90 addr = (void __iomem *)WIN_OFF(i);
91
92 writel(0, addr + WIN_BASE_OFF);
93 writel(0, addr + WIN_CTRL_OFF);
94 if (cpu_win_can_remap(i)) {
95 writel(0, addr + WIN_REMAP_LO_OFF);
96 writel(0, addr + WIN_REMAP_HI_OFF);
97 }
98 }
99
100 /*
101 * Setup windows for PCIe IO+MEM space.
102 */
103 setup_cpu_win(0, KIRKWOOD_PCIE_IO_PHYS_BASE, KIRKWOOD_PCIE_IO_SIZE,
104 TARGET_PCIE, ATTR_PCIE_IO, KIRKWOOD_PCIE_IO_BUS_BASE);
105 setup_cpu_win(1, KIRKWOOD_PCIE_MEM_PHYS_BASE, KIRKWOOD_PCIE_MEM_SIZE,
106 TARGET_PCIE, ATTR_PCIE_MEM, -1);
107
108 /*
109 * Setup window for NAND controller.
110 */
111 setup_cpu_win(2, KIRKWOOD_NAND_MEM_PHYS_BASE, KIRKWOOD_NAND_MEM_SIZE,
112 TARGET_DEV_BUS, ATTR_DEV_NAND, -1);
113
114 /*
115 * Setup MBUS dram target info.
116 */
117 kirkwood_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
118
119 addr = (void __iomem *)DDR_WINDOW_CPU_BASE;
120
121 for (i = 0, cs = 0; i < 4; i++) {
122 u32 base = readl(addr + DDR_BASE_CS_OFF(i));
123 u32 size = readl(addr + DDR_SIZE_CS_OFF(i));
124
125 /*
126 * Chip select enabled?
127 */
128 if (size & 1) {
129 struct mbus_dram_window *w;
130
131 w = &kirkwood_mbus_dram_info.cs[cs++];
132 w->cs_index = i;
133 w->mbus_attr = 0xf & ~(1 << i);
134 w->base = base & 0xffff0000;
135 w->size = (size | 0x0000ffff) + 1;
136 }
137 }
138 kirkwood_mbus_dram_info.num_cs = cs;
139}
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
new file mode 100644
index 000000000000..5938a3b33cdc
--- /dev/null
+++ b/arch/arm/mach-kirkwood/common.c
@@ -0,0 +1,331 @@
1/*
2 * arch/arm/mach-kirkwood/common.c
3 *
4 * Core functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/serial_8250.h>
15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/ata_platform.h>
18#include <asm/page.h>
19#include <asm/timex.h>
20#include <asm/mach/map.h>
21#include <asm/mach/time.h>
22#include <asm/arch/kirkwood.h>
23#include <asm/plat-orion/cache-feroceon-l2.h>
24#include <asm/plat-orion/ehci-orion.h>
25#include <asm/plat-orion/orion_nand.h>
26#include <asm/plat-orion/time.h>
27#include "common.h"
28
29/*****************************************************************************
30 * I/O Address Mapping
31 ****************************************************************************/
32static struct map_desc kirkwood_io_desc[] __initdata = {
33 {
34 .virtual = KIRKWOOD_PCIE_IO_VIRT_BASE,
35 .pfn = __phys_to_pfn(KIRKWOOD_PCIE_IO_PHYS_BASE),
36 .length = KIRKWOOD_PCIE_IO_SIZE,
37 .type = MT_DEVICE,
38 }, {
39 .virtual = KIRKWOOD_REGS_VIRT_BASE,
40 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
41 .length = KIRKWOOD_REGS_SIZE,
42 .type = MT_DEVICE,
43 },
44};
45
46void __init kirkwood_map_io(void)
47{
48 iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc));
49}
50
51
52/*****************************************************************************
53 * EHCI
54 ****************************************************************************/
55static struct orion_ehci_data kirkwood_ehci_data = {
56 .dram = &kirkwood_mbus_dram_info,
57};
58
59static u64 ehci_dmamask = 0xffffffffUL;
60
61
62/*****************************************************************************
63 * EHCI0
64 ****************************************************************************/
65static struct resource kirkwood_ehci_resources[] = {
66 {
67 .start = USB_PHYS_BASE,
68 .end = USB_PHYS_BASE + 0x0fff,
69 .flags = IORESOURCE_MEM,
70 }, {
71 .start = IRQ_KIRKWOOD_USB,
72 .end = IRQ_KIRKWOOD_USB,
73 .flags = IORESOURCE_IRQ,
74 },
75};
76
77static struct platform_device kirkwood_ehci = {
78 .name = "orion-ehci",
79 .id = 0,
80 .dev = {
81 .dma_mask = &ehci_dmamask,
82 .coherent_dma_mask = 0xffffffff,
83 .platform_data = &kirkwood_ehci_data,
84 },
85 .resource = kirkwood_ehci_resources,
86 .num_resources = ARRAY_SIZE(kirkwood_ehci_resources),
87};
88
89void __init kirkwood_ehci_init(void)
90{
91 platform_device_register(&kirkwood_ehci);
92}
93
94
95/*****************************************************************************
96 * GE00
97 ****************************************************************************/
98struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = {
99 .t_clk = KIRKWOOD_TCLK,
100 .dram = &kirkwood_mbus_dram_info,
101};
102
103static struct resource kirkwood_ge00_shared_resources[] = {
104 {
105 .name = "ge00 base",
106 .start = GE00_PHYS_BASE + 0x2000,
107 .end = GE00_PHYS_BASE + 0x3fff,
108 .flags = IORESOURCE_MEM,
109 },
110};
111
112static struct platform_device kirkwood_ge00_shared = {
113 .name = MV643XX_ETH_SHARED_NAME,
114 .id = 0,
115 .dev = {
116 .platform_data = &kirkwood_ge00_shared_data,
117 },
118 .num_resources = 1,
119 .resource = kirkwood_ge00_shared_resources,
120};
121
122static struct resource kirkwood_ge00_resources[] = {
123 {
124 .name = "ge00 irq",
125 .start = IRQ_KIRKWOOD_GE00_SUM,
126 .end = IRQ_KIRKWOOD_GE00_SUM,
127 .flags = IORESOURCE_IRQ,
128 },
129};
130
131static struct platform_device kirkwood_ge00 = {
132 .name = MV643XX_ETH_NAME,
133 .id = 0,
134 .num_resources = 1,
135 .resource = kirkwood_ge00_resources,
136};
137
138void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
139{
140 eth_data->shared = &kirkwood_ge00_shared;
141 kirkwood_ge00.dev.platform_data = eth_data;
142
143 platform_device_register(&kirkwood_ge00_shared);
144 platform_device_register(&kirkwood_ge00);
145}
146
147
148/*****************************************************************************
149 * SoC RTC
150 ****************************************************************************/
151static struct resource kirkwood_rtc_resource = {
152 .start = RTC_PHYS_BASE,
153 .end = RTC_PHYS_BASE + SZ_16 - 1,
154 .flags = IORESOURCE_MEM,
155};
156
157void __init kirkwood_rtc_init(void)
158{
159 platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1);
160}
161
162
163/*****************************************************************************
164 * SATA
165 ****************************************************************************/
166static struct resource kirkwood_sata_resources[] = {
167 {
168 .name = "sata base",
169 .start = SATA_PHYS_BASE,
170 .end = SATA_PHYS_BASE + 0x5000 - 1,
171 .flags = IORESOURCE_MEM,
172 }, {
173 .name = "sata irq",
174 .start = IRQ_KIRKWOOD_SATA,
175 .end = IRQ_KIRKWOOD_SATA,
176 .flags = IORESOURCE_IRQ,
177 },
178};
179
180static struct platform_device kirkwood_sata = {
181 .name = "sata_mv",
182 .id = 0,
183 .dev = {
184 .coherent_dma_mask = 0xffffffff,
185 },
186 .num_resources = ARRAY_SIZE(kirkwood_sata_resources),
187 .resource = kirkwood_sata_resources,
188};
189
190void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
191{
192 sata_data->dram = &kirkwood_mbus_dram_info;
193 kirkwood_sata.dev.platform_data = sata_data;
194 platform_device_register(&kirkwood_sata);
195}
196
197
198/*****************************************************************************
199 * UART0
200 ****************************************************************************/
201static struct plat_serial8250_port kirkwood_uart0_data[] = {
202 {
203 .mapbase = UART0_PHYS_BASE,
204 .membase = (char *)UART0_VIRT_BASE,
205 .irq = IRQ_KIRKWOOD_UART_0,
206 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
207 .iotype = UPIO_MEM,
208 .regshift = 2,
209 .uartclk = KIRKWOOD_TCLK,
210 }, {
211 },
212};
213
214static struct resource kirkwood_uart0_resources[] = {
215 {
216 .start = UART0_PHYS_BASE,
217 .end = UART0_PHYS_BASE + 0xff,
218 .flags = IORESOURCE_MEM,
219 }, {
220 .start = IRQ_KIRKWOOD_UART_0,
221 .end = IRQ_KIRKWOOD_UART_0,
222 .flags = IORESOURCE_IRQ,
223 },
224};
225
226static struct platform_device kirkwood_uart0 = {
227 .name = "serial8250",
228 .id = 0,
229 .dev = {
230 .platform_data = kirkwood_uart0_data,
231 },
232 .resource = kirkwood_uart0_resources,
233 .num_resources = ARRAY_SIZE(kirkwood_uart0_resources),
234};
235
236void __init kirkwood_uart0_init(void)
237{
238 platform_device_register(&kirkwood_uart0);
239}
240
241
242/*****************************************************************************
243 * UART1
244 ****************************************************************************/
245static struct plat_serial8250_port kirkwood_uart1_data[] = {
246 {
247 .mapbase = UART1_PHYS_BASE,
248 .membase = (char *)UART1_VIRT_BASE,
249 .irq = IRQ_KIRKWOOD_UART_1,
250 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
251 .iotype = UPIO_MEM,
252 .regshift = 2,
253 .uartclk = KIRKWOOD_TCLK,
254 }, {
255 },
256};
257
258static struct resource kirkwood_uart1_resources[] = {
259 {
260 .start = UART1_PHYS_BASE,
261 .end = UART1_PHYS_BASE + 0xff,
262 .flags = IORESOURCE_MEM,
263 }, {
264 .start = IRQ_KIRKWOOD_UART_1,
265 .end = IRQ_KIRKWOOD_UART_1,
266 .flags = IORESOURCE_IRQ,
267 },
268};
269
270static struct platform_device kirkwood_uart1 = {
271 .name = "serial8250",
272 .id = 1,
273 .dev = {
274 .platform_data = kirkwood_uart1_data,
275 },
276 .resource = kirkwood_uart1_resources,
277 .num_resources = ARRAY_SIZE(kirkwood_uart1_resources),
278};
279
280void __init kirkwood_uart1_init(void)
281{
282 platform_device_register(&kirkwood_uart1);
283}
284
285
286/*****************************************************************************
287 * Time handling
288 ****************************************************************************/
289static void kirkwood_timer_init(void)
290{
291 orion_time_init(IRQ_KIRKWOOD_BRIDGE, KIRKWOOD_TCLK);
292}
293
294struct sys_timer kirkwood_timer = {
295 .init = kirkwood_timer_init,
296};
297
298
299/*****************************************************************************
300 * General
301 ****************************************************************************/
302static char * __init kirkwood_id(void)
303{
304 switch (readl(DEVICE_ID) & 0x3) {
305 case 0:
306 return "88F6180";
307 case 1:
308 return "88F6192";
309 case 2:
310 return "88F6281";
311 }
312
313 return "unknown 88F6000 variant";
314}
315
316static int __init is_l2_writethrough(void)
317{
318 return !!(readl(L2_CONFIG_REG) & L2_WRITETHROUGH);
319}
320
321void __init kirkwood_init(void)
322{
323 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
324 kirkwood_id(), KIRKWOOD_TCLK);
325
326 kirkwood_setup_cpu_mbus();
327
328#ifdef CONFIG_CACHE_FEROCEON_L2
329 feroceon_l2_init(is_l2_writethrough());
330#endif
331}
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
new file mode 100644
index 000000000000..5dee2f6b40a5
--- /dev/null
+++ b/arch/arm/mach-kirkwood/common.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-kirkwood/common.h
3 *
4 * Core functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ARCH_KIRKWOOD_COMMON_H
12#define __ARCH_KIRKWOOD_COMMON_H
13
14struct mv643xx_eth_platform_data;
15struct mv_sata_platform_data;
16
17/*
18 * Basic Kirkwood init functions used early by machine-setup.
19 */
20void kirkwood_map_io(void);
21void kirkwood_init(void);
22void kirkwood_init_irq(void);
23
24extern struct mbus_dram_target_info kirkwood_mbus_dram_info;
25void kirkwood_setup_cpu_mbus(void);
26void kirkwood_setup_pcie_io_win(int window, u32 base, u32 size,
27 int maj, int min);
28void kirkwood_setup_pcie_mem_win(int window, u32 base, u32 size,
29 int maj, int min);
30
31void kirkwood_ehci_init(void);
32void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data);
33void kirkwood_pcie_init(void);
34void kirkwood_rtc_init(void);
35void kirkwood_sata_init(struct mv_sata_platform_data *sata_data);
36void kirkwood_uart0_init(void);
37void kirkwood_uart1_init(void);
38
39extern struct sys_timer kirkwood_timer;
40
41
42#endif
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
new file mode 100644
index 000000000000..d5c482c628e3
--- /dev/null
+++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
@@ -0,0 +1,68 @@
1/*
2 * arch/arm/mach-kirkwood/db88f6281-bp-setup.c
3 *
4 * Marvell DB-88F6281-BP Development Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h>
18#include <linux/timer.h>
19#include <linux/ata_platform.h>
20#include <linux/mv643xx_eth.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h>
24#include <asm/arch/kirkwood.h>
25#include "common.h"
26
27static struct mv643xx_eth_platform_data db88f6281_ge00_data = {
28 .phy_addr = 8,
29};
30
31static struct mv_sata_platform_data db88f6281_sata_data = {
32 .n_ports = 2,
33};
34
35static void __init db88f6281_init(void)
36{
37 /*
38 * Basic setup. Needs to be called early.
39 */
40 kirkwood_init();
41
42 kirkwood_ehci_init();
43 kirkwood_ge00_init(&db88f6281_ge00_data);
44 kirkwood_rtc_init();
45 kirkwood_sata_init(&db88f6281_sata_data);
46 kirkwood_uart0_init();
47 kirkwood_uart1_init();
48}
49
50static int __init db88f6281_pci_init(void)
51{
52 if (machine_is_db88f6281_bp())
53 kirkwood_pcie_init();
54
55 return 0;
56}
57subsys_initcall(db88f6281_pci_init);
58
59MACHINE_START(DB88F6281_BP, "Marvell DB-88F6281-BP Development Board")
60 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
61 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
62 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
63 .boot_params = 0x00000100,
64 .init_machine = db88f6281_init,
65 .map_io = kirkwood_map_io,
66 .init_irq = kirkwood_init_irq,
67 .timer = &kirkwood_timer,
68MACHINE_END
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
new file mode 100644
index 000000000000..302bb2cf6669
--- /dev/null
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-kirkwood/irq.c
3 *
4 * Kirkwood IRQ handling.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/io.h>
15#include <asm/plat-orion/irq.h>
16#include "common.h"
17
18void __init kirkwood_init_irq(void)
19{
20 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF));
21 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
22}
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
new file mode 100644
index 000000000000..8282d0ff84bf
--- /dev/null
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -0,0 +1,180 @@
1/*
2 * arch/arm/mach-kirkwood/pcie.c
3 *
4 * PCIe functions for Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/pci.h>
13#include <linux/mbus.h>
14#include <asm/mach/pci.h>
15#include <asm/plat-orion/pcie.h>
16#include "common.h"
17
18
19#define PCIE_BASE ((void __iomem *)PCIE_VIRT_BASE)
20
21static int pcie_valid_config(int bus, int dev)
22{
23 /*
24 * Don't go out when trying to access --
25 * 1. nonexisting device on local bus
26 * 2. where there's no device connected (no link)
27 */
28 if (bus == 0 && dev == 0)
29 return 1;
30
31 if (!orion_pcie_link_up(PCIE_BASE))
32 return 0;
33
34 if (bus == 0 && dev != 1)
35 return 0;
36
37 return 1;
38}
39
40
41/*
42 * PCIe config cycles are done by programming the PCIE_CONF_ADDR register
43 * and then reading the PCIE_CONF_DATA register. Need to make sure these
44 * transactions are atomic.
45 */
46static DEFINE_SPINLOCK(kirkwood_pcie_lock);
47
48static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
49 int size, u32 *val)
50{
51 unsigned long flags;
52 int ret;
53
54 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) {
55 *val = 0xffffffff;
56 return PCIBIOS_DEVICE_NOT_FOUND;
57 }
58
59 spin_lock_irqsave(&kirkwood_pcie_lock, flags);
60 ret = orion_pcie_rd_conf(PCIE_BASE, bus, devfn, where, size, val);
61 spin_unlock_irqrestore(&kirkwood_pcie_lock, flags);
62
63 return ret;
64}
65
66static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
67 int where, int size, u32 val)
68{
69 unsigned long flags;
70 int ret;
71
72 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0)
73 return PCIBIOS_DEVICE_NOT_FOUND;
74
75 spin_lock_irqsave(&kirkwood_pcie_lock, flags);
76 ret = orion_pcie_wr_conf(PCIE_BASE, bus, devfn, where, size, val);
77 spin_unlock_irqrestore(&kirkwood_pcie_lock, flags);
78
79 return ret;
80}
81
82static struct pci_ops pcie_ops = {
83 .read = pcie_rd_conf,
84 .write = pcie_wr_conf,
85};
86
87
88static int kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
89{
90 struct resource *res;
91
92 /*
93 * Generic PCIe unit setup.
94 */
95 orion_pcie_setup(PCIE_BASE, &kirkwood_mbus_dram_info);
96
97 /*
98 * Request resources.
99 */
100 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
101 if (!res)
102 panic("pcie_setup unable to alloc resources");
103
104 /*
105 * IORESOURCE_IO
106 */
107 res[0].name = "PCIe I/O Space";
108 res[0].flags = IORESOURCE_IO;
109 res[0].start = KIRKWOOD_PCIE_IO_PHYS_BASE;
110 res[0].end = res[0].start + KIRKWOOD_PCIE_IO_SIZE - 1;
111 if (request_resource(&ioport_resource, &res[0]))
112 panic("Request PCIe IO resource failed\n");
113 sys->resource[0] = &res[0];
114
115 /*
116 * IORESOURCE_MEM
117 */
118 res[1].name = "PCIe Memory Space";
119 res[1].flags = IORESOURCE_MEM;
120 res[1].start = KIRKWOOD_PCIE_MEM_PHYS_BASE;
121 res[1].end = res[1].start + KIRKWOOD_PCIE_MEM_SIZE - 1;
122 if (request_resource(&iomem_resource, &res[1]))
123 panic("Request PCIe Memory resource failed\n");
124 sys->resource[1] = &res[1];
125
126 sys->resource[2] = NULL;
127 sys->io_offset = 0;
128
129 return 1;
130}
131
132static void __devinit rc_pci_fixup(struct pci_dev *dev)
133{
134 /*
135 * Prevent enumeration of root complex.
136 */
137 if (dev->bus->parent == NULL && dev->devfn == 0) {
138 int i;
139
140 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
141 dev->resource[i].start = 0;
142 dev->resource[i].end = 0;
143 dev->resource[i].flags = 0;
144 }
145 }
146}
147DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);
148
149static struct pci_bus __init *
150kirkwood_pcie_scan_bus(int nr, struct pci_sys_data *sys)
151{
152 struct pci_bus *bus;
153
154 if (nr == 0) {
155 bus = pci_scan_bus(sys->busnr, &pcie_ops, sys);
156 } else {
157 bus = NULL;
158 BUG();
159 }
160
161 return bus;
162}
163
164static int __init kirkwood_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
165{
166 return IRQ_KIRKWOOD_PCIE;
167}
168
169static struct hw_pci kirkwood_pci __initdata = {
170 .nr_controllers = 1,
171 .swizzle = pci_std_swizzle,
172 .setup = kirkwood_pcie_setup,
173 .scan = kirkwood_pcie_scan_bus,
174 .map_irq = kirkwood_pcie_map_irq,
175};
176
177void __init kirkwood_pcie_init(void)
178{
179 pci_common_init(&kirkwood_pci);
180}
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
new file mode 100644
index 000000000000..6cf642c504d3
--- /dev/null
+++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
3 *
4 * Marvell RD-88F6192-NAS Reference Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h>
18#include <linux/timer.h>
19#include <linux/ata_platform.h>
20#include <linux/mv643xx_eth.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h>
24#include <asm/arch/kirkwood.h>
25#include "common.h"
26
27#define RD88F6192_GPIO_USB_VBUS 10
28
29static struct mv643xx_eth_platform_data rd88f6192_ge00_data = {
30 .phy_addr = 8,
31};
32
33static struct mv_sata_platform_data rd88f6192_sata_data = {
34 .n_ports = 2,
35};
36
37static void __init rd88f6192_init(void)
38{
39 /*
40 * Basic setup. Needs to be called early.
41 */
42 kirkwood_init();
43
44 kirkwood_ehci_init();
45 kirkwood_ge00_init(&rd88f6192_ge00_data);
46 kirkwood_rtc_init();
47 kirkwood_sata_init(&rd88f6192_sata_data);
48 kirkwood_uart0_init();
49}
50
51static int __init rd88f6192_pci_init(void)
52{
53 if (machine_is_rd88f6192_nas())
54 kirkwood_pcie_init();
55
56 return 0;
57}
58subsys_initcall(rd88f6192_pci_init);
59
60MACHINE_START(RD88F6192_NAS, "Marvell RD-88F6192-NAS Development Board")
61 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
62 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
63 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
64 .boot_params = 0x00000100,
65 .init_machine = rd88f6192_init,
66 .map_io = kirkwood_map_io,
67 .init_irq = kirkwood_init_irq,
68 .timer = &kirkwood_timer,
69MACHINE_END
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
new file mode 100644
index 000000000000..e1f8de2c74a2
--- /dev/null
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -0,0 +1,113 @@
1/*
2 * arch/arm/mach-kirkwood/rd88f6281-setup.c
3 *
4 * Marvell RD-88F6281 Reference Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h>
18#include <linux/timer.h>
19#include <linux/ata_platform.h>
20#include <linux/mv643xx_eth.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h>
24#include <asm/arch/kirkwood.h>
25#include <asm/plat-orion/orion_nand.h>
26#include "common.h"
27
28static struct mtd_partition rd88f6281_nand_parts[] = {
29 {
30 .name = "u-boot",
31 .offset = 0,
32 .size = SZ_1M
33 }, {
34 .name = "uImage",
35 .offset = MTDPART_OFS_NXTBLK,
36 .size = SZ_2M
37 }, {
38 .name = "root",
39 .offset = MTDPART_OFS_NXTBLK,
40 .size = MTDPART_SIZ_FULL
41 },
42};
43
44static struct resource rd88f6281_nand_resource = {
45 .flags = IORESOURCE_MEM,
46 .start = KIRKWOOD_NAND_MEM_PHYS_BASE,
47 .end = KIRKWOOD_NAND_MEM_PHYS_BASE +
48 KIRKWOOD_NAND_MEM_SIZE - 1,
49};
50
51static struct orion_nand_data rd88f6281_nand_data = {
52 .parts = rd88f6281_nand_parts,
53 .nr_parts = ARRAY_SIZE(rd88f6281_nand_parts),
54 .cle = 0,
55 .ale = 1,
56 .width = 8,
57 .chip_delay = 25,
58};
59
60static struct platform_device rd88f6281_nand_flash = {
61 .name = "orion_nand",
62 .id = -1,
63 .dev = {
64 .platform_data = &rd88f6281_nand_data,
65 },
66 .resource = &rd88f6281_nand_resource,
67 .num_resources = 1,
68};
69
70static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
71 .phy_addr = -1,
72};
73
74static struct mv_sata_platform_data rd88f6281_sata_data = {
75 .n_ports = 2,
76};
77
78static void __init rd88f6281_init(void)
79{
80 /*
81 * Basic setup. Needs to be called early.
82 */
83 kirkwood_init();
84
85 kirkwood_ehci_init();
86 kirkwood_ge00_init(&rd88f6281_ge00_data);
87 kirkwood_rtc_init();
88 kirkwood_sata_init(&rd88f6281_sata_data);
89 kirkwood_uart0_init();
90 kirkwood_uart1_init();
91
92 platform_device_register(&rd88f6281_nand_flash);
93}
94
95static int __init rd88f6281_pci_init(void)
96{
97 if (machine_is_rd88f6281())
98 kirkwood_pcie_init();
99
100 return 0;
101}
102subsys_initcall(rd88f6281_pci_init);
103
104MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
105 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
106 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
107 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
108 .boot_params = 0x00000100,
109 .init_machine = rd88f6281_init,
110 .map_io = kirkwood_map_io,
111 .init_irq = kirkwood_init_irq,
112 .timer = &kirkwood_timer,
113MACHINE_END
diff --git a/arch/arm/mach-loki/Kconfig b/arch/arm/mach-loki/Kconfig
new file mode 100644
index 000000000000..0045bdd761ca
--- /dev/null
+++ b/arch/arm/mach-loki/Kconfig
@@ -0,0 +1,13 @@
1if ARCH_LOKI
2
3menu "Marvell Loki (88RC8480) Implementations"
4
5config MACH_LB88RC8480
6 bool "Marvell LB88RC8480 Development Board"
7 help
8 Say 'Y' here if you want your kernel to support the
9 Marvell LB88RC8480 Development Board.
10
11endmenu
12
13endif
diff --git a/arch/arm/mach-loki/Makefile b/arch/arm/mach-loki/Makefile
new file mode 100644
index 000000000000..d43233ee590f
--- /dev/null
+++ b/arch/arm/mach-loki/Makefile
@@ -0,0 +1,3 @@
1obj-y += common.o addr-map.o irq.o
2
3obj-$(CONFIG_MACH_LB88RC8480) += lb88rc8480-setup.o
diff --git a/arch/arm/mach-loki/Makefile.boot b/arch/arm/mach-loki/Makefile.boot
new file mode 100644
index 000000000000..67039c3e0c48
--- /dev/null
+++ b/arch/arm/mach-loki/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-loki/addr-map.c b/arch/arm/mach-loki/addr-map.c
new file mode 100644
index 000000000000..ba25e56ade58
--- /dev/null
+++ b/arch/arm/mach-loki/addr-map.c
@@ -0,0 +1,121 @@
1/*
2 * arch/arm/mach-loki/addr-map.c
3 *
4 * Address map functions for Marvell Loki (88RC8480) SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <asm/hardware.h>
15#include <asm/io.h>
16#include "common.h"
17
18/*
19 * Generic Address Decode Windows bit settings
20 */
21#define TARGET_DDR 0
22#define TARGET_DEV_BUS 1
23#define TARGET_PCIE0 3
24#define TARGET_PCIE1 4
25#define ATTR_DEV_BOOT 0x0f
26#define ATTR_DEV_CS2 0x1b
27#define ATTR_DEV_CS1 0x1d
28#define ATTR_DEV_CS0 0x1e
29#define ATTR_PCIE_IO 0x51
30#define ATTR_PCIE_MEM 0x59
31
32/*
33 * Helpers to get DDR bank info
34 */
35#define DDR_SIZE_CS(n) DDR_REG(0x1500 + ((n) << 3))
36#define DDR_BASE_CS(n) DDR_REG(0x1504 + ((n) << 3))
37
38/*
39 * CPU Address Decode Windows registers
40 */
41#define CPU_WIN_CTRL(n) BRIDGE_REG(0x000 | ((n) << 4))
42#define CPU_WIN_BASE(n) BRIDGE_REG(0x004 | ((n) << 4))
43#define CPU_WIN_REMAP_LO(n) BRIDGE_REG(0x008 | ((n) << 4))
44#define CPU_WIN_REMAP_HI(n) BRIDGE_REG(0x00c | ((n) << 4))
45
46
47struct mbus_dram_target_info loki_mbus_dram_info;
48
49static void __init setup_cpu_win(int win, u32 base, u32 size,
50 u8 target, u8 attr, int remap)
51{
52 u32 ctrl;
53
54 base &= 0xffff0000;
55 ctrl = ((size - 1) & 0xffff0000) | (attr << 8) | (1 << 5) | target;
56
57 writel(base, CPU_WIN_BASE(win));
58 writel(ctrl, CPU_WIN_CTRL(win));
59 if (win < 2) {
60 if (remap < 0)
61 remap = base;
62
63 writel(remap & 0xffff0000, CPU_WIN_REMAP_LO(win));
64 writel(0, CPU_WIN_REMAP_HI(win));
65 }
66}
67
68void __init loki_setup_cpu_mbus(void)
69{
70 int i;
71 int cs;
72
73 /*
74 * First, disable and clear windows.
75 */
76 for (i = 0; i < 8; i++) {
77 writel(0, CPU_WIN_BASE(i));
78 writel(0, CPU_WIN_CTRL(i));
79 if (i < 2) {
80 writel(0, CPU_WIN_REMAP_LO(i));
81 writel(0, CPU_WIN_REMAP_HI(i));
82 }
83 }
84
85 /*
86 * Setup windows for PCIe IO+MEM space.
87 */
88 setup_cpu_win(2, LOKI_PCIE0_MEM_PHYS_BASE, LOKI_PCIE0_MEM_SIZE,
89 TARGET_PCIE0, ATTR_PCIE_MEM, -1);
90 setup_cpu_win(3, LOKI_PCIE1_MEM_PHYS_BASE, LOKI_PCIE1_MEM_SIZE,
91 TARGET_PCIE1, ATTR_PCIE_MEM, -1);
92
93 /*
94 * Setup MBUS dram target info.
95 */
96 loki_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
97
98 for (i = 0, cs = 0; i < 4; i++) {
99 u32 base = readl(DDR_BASE_CS(i));
100 u32 size = readl(DDR_SIZE_CS(i));
101
102 /*
103 * Chip select enabled?
104 */
105 if (size & 1) {
106 struct mbus_dram_window *w;
107
108 w = &loki_mbus_dram_info.cs[cs++];
109 w->cs_index = i;
110 w->mbus_attr = 0xf & ~(1 << i);
111 w->base = base & 0xffff0000;
112 w->size = (size | 0x0000ffff) + 1;
113 }
114 }
115 loki_mbus_dram_info.num_cs = cs;
116}
117
118void __init loki_setup_dev_boot_win(u32 base, u32 size)
119{
120 setup_cpu_win(4, base, size, TARGET_DEV_BUS, ATTR_DEV_BOOT, -1);
121}
diff --git a/arch/arm/mach-loki/common.c b/arch/arm/mach-loki/common.c
new file mode 100644
index 000000000000..410f50399dd3
--- /dev/null
+++ b/arch/arm/mach-loki/common.c
@@ -0,0 +1,305 @@
1/*
2 * arch/arm/mach-loki/common.c
3 *
4 * Core functions for Marvell Loki (88RC8480) SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/serial_8250.h>
15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <asm/page.h>
18#include <asm/timex.h>
19#include <asm/mach/map.h>
20#include <asm/mach/time.h>
21#include <asm/arch/loki.h>
22#include <asm/plat-orion/orion_nand.h>
23#include <asm/plat-orion/time.h>
24#include "common.h"
25
26/*****************************************************************************
27 * I/O Address Mapping
28 ****************************************************************************/
29static struct map_desc loki_io_desc[] __initdata = {
30 {
31 .virtual = LOKI_REGS_VIRT_BASE,
32 .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
33 .length = LOKI_REGS_SIZE,
34 .type = MT_DEVICE,
35 },
36};
37
38void __init loki_map_io(void)
39{
40 iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
41}
42
43
44/*****************************************************************************
45 * GE0
46 ****************************************************************************/
47struct mv643xx_eth_shared_platform_data loki_ge0_shared_data = {
48 .t_clk = LOKI_TCLK,
49 .dram = &loki_mbus_dram_info,
50};
51
52static struct resource loki_ge0_shared_resources[] = {
53 {
54 .name = "ge0 base",
55 .start = GE0_PHYS_BASE + 0x2000,
56 .end = GE0_PHYS_BASE + 0x3fff,
57 .flags = IORESOURCE_MEM,
58 },
59};
60
61static struct platform_device loki_ge0_shared = {
62 .name = MV643XX_ETH_SHARED_NAME,
63 .id = 0,
64 .dev = {
65 .platform_data = &loki_ge0_shared_data,
66 },
67 .num_resources = 1,
68 .resource = loki_ge0_shared_resources,
69};
70
71static struct resource loki_ge0_resources[] = {
72 {
73 .name = "ge0 irq",
74 .start = IRQ_LOKI_GBE_A_INT,
75 .end = IRQ_LOKI_GBE_A_INT,
76 .flags = IORESOURCE_IRQ,
77 },
78};
79
80static struct platform_device loki_ge0 = {
81 .name = MV643XX_ETH_NAME,
82 .id = 0,
83 .num_resources = 1,
84 .resource = loki_ge0_resources,
85};
86
87void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
88{
89 eth_data->shared = &loki_ge0_shared;
90 loki_ge0.dev.platform_data = eth_data;
91
92 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
93 platform_device_register(&loki_ge0_shared);
94 platform_device_register(&loki_ge0);
95}
96
97
98/*****************************************************************************
99 * GE1
100 ****************************************************************************/
101struct mv643xx_eth_shared_platform_data loki_ge1_shared_data = {
102 .t_clk = LOKI_TCLK,
103 .dram = &loki_mbus_dram_info,
104};
105
106static struct resource loki_ge1_shared_resources[] = {
107 {
108 .name = "ge1 base",
109 .start = GE1_PHYS_BASE + 0x2000,
110 .end = GE1_PHYS_BASE + 0x3fff,
111 .flags = IORESOURCE_MEM,
112 },
113};
114
115static struct platform_device loki_ge1_shared = {
116 .name = MV643XX_ETH_SHARED_NAME,
117 .id = 1,
118 .dev = {
119 .platform_data = &loki_ge1_shared_data,
120 },
121 .num_resources = 1,
122 .resource = loki_ge1_shared_resources,
123};
124
125static struct resource loki_ge1_resources[] = {
126 {
127 .name = "ge1 irq",
128 .start = IRQ_LOKI_GBE_B_INT,
129 .end = IRQ_LOKI_GBE_B_INT,
130 .flags = IORESOURCE_IRQ,
131 },
132};
133
134static struct platform_device loki_ge1 = {
135 .name = MV643XX_ETH_NAME,
136 .id = 1,
137 .num_resources = 1,
138 .resource = loki_ge1_resources,
139};
140
141void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
142{
143 eth_data->shared = &loki_ge1_shared;
144 loki_ge1.dev.platform_data = eth_data;
145
146 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
147 platform_device_register(&loki_ge1_shared);
148 platform_device_register(&loki_ge1);
149}
150
151
152/*****************************************************************************
153 * SAS/SATA
154 ****************************************************************************/
155static struct resource loki_sas_resources[] = {
156 {
157 .name = "mvsas0 mem",
158 .start = SAS0_PHYS_BASE,
159 .end = SAS0_PHYS_BASE + 0x01ff,
160 .flags = IORESOURCE_MEM,
161 }, {
162 .name = "mvsas0 irq",
163 .start = IRQ_LOKI_SAS_A,
164 .end = IRQ_LOKI_SAS_A,
165 .flags = IORESOURCE_IRQ,
166 }, {
167 .name = "mvsas1 mem",
168 .start = SAS1_PHYS_BASE,
169 .end = SAS1_PHYS_BASE + 0x01ff,
170 .flags = IORESOURCE_MEM,
171 }, {
172 .name = "mvsas1 irq",
173 .start = IRQ_LOKI_SAS_B,
174 .end = IRQ_LOKI_SAS_B,
175 .flags = IORESOURCE_IRQ,
176 },
177};
178
179static struct platform_device loki_sas = {
180 .name = "mvsas",
181 .id = 0,
182 .dev = {
183 .coherent_dma_mask = 0xffffffff,
184 },
185 .num_resources = ARRAY_SIZE(loki_sas_resources),
186 .resource = loki_sas_resources,
187};
188
189void __init loki_sas_init(void)
190{
191 writel(0x8300f707, DDR_REG(0x1424));
192 platform_device_register(&loki_sas);
193}
194
195
196/*****************************************************************************
197 * UART0
198 ****************************************************************************/
199static struct plat_serial8250_port loki_uart0_data[] = {
200 {
201 .mapbase = UART0_PHYS_BASE,
202 .membase = (char *)UART0_VIRT_BASE,
203 .irq = IRQ_LOKI_UART0,
204 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
205 .iotype = UPIO_MEM,
206 .regshift = 2,
207 .uartclk = LOKI_TCLK,
208 }, {
209 },
210};
211
212static struct resource loki_uart0_resources[] = {
213 {
214 .start = UART0_PHYS_BASE,
215 .end = UART0_PHYS_BASE + 0xff,
216 .flags = IORESOURCE_MEM,
217 }, {
218 .start = IRQ_LOKI_UART0,
219 .end = IRQ_LOKI_UART0,
220 .flags = IORESOURCE_IRQ,
221 },
222};
223
224static struct platform_device loki_uart0 = {
225 .name = "serial8250",
226 .id = 0,
227 .dev = {
228 .platform_data = loki_uart0_data,
229 },
230 .resource = loki_uart0_resources,
231 .num_resources = ARRAY_SIZE(loki_uart0_resources),
232};
233
234void __init loki_uart0_init(void)
235{
236 platform_device_register(&loki_uart0);
237}
238
239
240/*****************************************************************************
241 * UART1
242 ****************************************************************************/
243static struct plat_serial8250_port loki_uart1_data[] = {
244 {
245 .mapbase = UART1_PHYS_BASE,
246 .membase = (char *)UART1_VIRT_BASE,
247 .irq = IRQ_LOKI_UART1,
248 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
249 .iotype = UPIO_MEM,
250 .regshift = 2,
251 .uartclk = LOKI_TCLK,
252 }, {
253 },
254};
255
256static struct resource loki_uart1_resources[] = {
257 {
258 .start = UART1_PHYS_BASE,
259 .end = UART1_PHYS_BASE + 0xff,
260 .flags = IORESOURCE_MEM,
261 }, {
262 .start = IRQ_LOKI_UART1,
263 .end = IRQ_LOKI_UART1,
264 .flags = IORESOURCE_IRQ,
265 },
266};
267
268static struct platform_device loki_uart1 = {
269 .name = "serial8250",
270 .id = 1,
271 .dev = {
272 .platform_data = loki_uart1_data,
273 },
274 .resource = loki_uart1_resources,
275 .num_resources = ARRAY_SIZE(loki_uart1_resources),
276};
277
278void __init loki_uart1_init(void)
279{
280 platform_device_register(&loki_uart1);
281}
282
283
284/*****************************************************************************
285 * Time handling
286 ****************************************************************************/
287static void loki_timer_init(void)
288{
289 orion_time_init(IRQ_LOKI_BRIDGE, LOKI_TCLK);
290}
291
292struct sys_timer loki_timer = {
293 .init = loki_timer_init,
294};
295
296
297/*****************************************************************************
298 * General
299 ****************************************************************************/
300void __init loki_init(void)
301{
302 printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
303
304 loki_setup_cpu_mbus();
305}
diff --git a/arch/arm/mach-loki/common.h b/arch/arm/mach-loki/common.h
new file mode 100644
index 000000000000..26054fd0f05e
--- /dev/null
+++ b/arch/arm/mach-loki/common.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/mach-loki/common.h
3 *
4 * Core functions for Marvell Loki (88RC8480) SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ARCH_LOKI_COMMON_H
12#define __ARCH_LOKI_COMMON_H
13
14struct mv643xx_eth_platform_data;
15
16/*
17 * Basic Loki init functions used early by machine-setup.
18 */
19void loki_map_io(void);
20void loki_init(void);
21void loki_init_irq(void);
22
23extern struct mbus_dram_target_info loki_mbus_dram_info;
24void loki_setup_cpu_mbus(void);
25void loki_setup_dev_boot_win(u32 base, u32 size);
26
27void loki_ge0_init(struct mv643xx_eth_platform_data *eth_data);
28void loki_ge1_init(struct mv643xx_eth_platform_data *eth_data);
29void loki_sas_init(void);
30void loki_uart0_init(void);
31void loki_uart1_init(void);
32
33extern struct sys_timer loki_timer;
34
35
36#endif
diff --git a/arch/arm/mach-loki/irq.c b/arch/arm/mach-loki/irq.c
new file mode 100644
index 000000000000..d839af91fe03
--- /dev/null
+++ b/arch/arm/mach-loki/irq.c
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-loki/irq.c
3 *
4 * Marvell Loki (88RC8480) IRQ handling.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <asm/io.h>
15#include <asm/plat-orion/irq.h>
16#include "common.h"
17
18void __init loki_init_irq(void)
19{
20 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_OFF));
21}
diff --git a/arch/arm/mach-loki/lb88rc8480-setup.c b/arch/arm/mach-loki/lb88rc8480-setup.c
new file mode 100644
index 000000000000..d1b9e6e6253a
--- /dev/null
+++ b/arch/arm/mach-loki/lb88rc8480-setup.c
@@ -0,0 +1,100 @@
1/*
2 * arch/arm/mach-loki/lb88rc8480-setup.c
3 *
4 * Marvell LB88RC8480 Development Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/irq.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mtd/nand.h>
17#include <linux/timer.h>
18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h>
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <asm/arch/loki.h>
23#include "common.h"
24
25#define LB88RC8480_FLASH_BOOT_CS_BASE 0xf8000000
26#define LB88RC8480_FLASH_BOOT_CS_SIZE SZ_128M
27
28#define LB88RC8480_NOR_BOOT_BASE 0xff000000
29#define LB88RC8480_NOR_BOOT_SIZE SZ_16M
30
31static struct mtd_partition lb88rc8480_boot_flash_parts[] = {
32 {
33 .name = "kernel",
34 .offset = 0,
35 .size = SZ_2M,
36 }, {
37 .name = "root-fs",
38 .offset = SZ_2M,
39 .size = (SZ_8M + SZ_4M + SZ_1M),
40 }, {
41 .name = "u-boot",
42 .offset = (SZ_8M + SZ_4M + SZ_2M + SZ_1M),
43 .size = SZ_1M,
44 },
45};
46
47static struct physmap_flash_data lb88rc8480_boot_flash_data = {
48 .parts = lb88rc8480_boot_flash_parts,
49 .nr_parts = ARRAY_SIZE(lb88rc8480_boot_flash_parts),
50 .width = 1, /* 8 bit bus width */
51};
52
53static struct resource lb88rc8480_boot_flash_resource = {
54 .flags = IORESOURCE_MEM,
55 .start = LB88RC8480_NOR_BOOT_BASE,
56 .end = LB88RC8480_NOR_BOOT_BASE + LB88RC8480_NOR_BOOT_SIZE - 1,
57};
58
59static struct platform_device lb88rc8480_boot_flash = {
60 .name = "physmap-flash",
61 .id = 0,
62 .dev = {
63 .platform_data = &lb88rc8480_boot_flash_data,
64 },
65 .num_resources = 1,
66 .resource = &lb88rc8480_boot_flash_resource,
67};
68
69static struct mv643xx_eth_platform_data lb88rc8480_ge0_data = {
70 .phy_addr = 1,
71 .mac_addr = { 0x00, 0x50, 0x43, 0x11, 0x22, 0x33 },
72};
73
74static void __init lb88rc8480_init(void)
75{
76 /*
77 * Basic setup. Needs to be called early.
78 */
79 loki_init();
80
81 loki_ge0_init(&lb88rc8480_ge0_data);
82 loki_sas_init();
83 loki_uart0_init();
84 loki_uart1_init();
85
86 loki_setup_dev_boot_win(LB88RC8480_FLASH_BOOT_CS_BASE,
87 LB88RC8480_FLASH_BOOT_CS_SIZE);
88 platform_device_register(&lb88rc8480_boot_flash);
89}
90
91MACHINE_START(LB88RC8480, "Marvell LB88RC8480 Development Board")
92 /* Maintainer: Ke Wei <kewei@marvell.com> */
93 .phys_io = LOKI_REGS_PHYS_BASE,
94 .io_pg_offst = ((LOKI_REGS_VIRT_BASE) >> 18) & 0xfffc,
95 .boot_params = 0x00000100,
96 .init_machine = lb88rc8480_init,
97 .map_io = loki_map_io,
98 .init_irq = loki_init_irq,
99 .timer = &loki_timer,
100MACHINE_END
diff --git a/arch/arm/mach-mv78xx0/Kconfig b/arch/arm/mach-mv78xx0/Kconfig
new file mode 100644
index 000000000000..d83cb86837db
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/Kconfig
@@ -0,0 +1,13 @@
1if ARCH_MV78XX0
2
3menu "Marvell MV78xx0 Implementations"
4
5config MACH_DB78X00_BP
6 bool "Marvell DB-78x00-BP Development Board"
7 help
8 Say 'Y' here if you want your kernel to support the
9 Marvell DB-78x00-BP Development Board.
10
11endmenu
12
13endif
diff --git a/arch/arm/mach-mv78xx0/Makefile b/arch/arm/mach-mv78xx0/Makefile
new file mode 100644
index 000000000000..ec16c05c3b1b
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/Makefile
@@ -0,0 +1,2 @@
1obj-y += common.o addr-map.o irq.o pcie.o
2obj-$(CONFIG_MACH_DB78X00_BP) += db78x00-bp-setup.o
diff --git a/arch/arm/mach-mv78xx0/Makefile.boot b/arch/arm/mach-mv78xx0/Makefile.boot
new file mode 100644
index 000000000000..67039c3e0c48
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
new file mode 100644
index 000000000000..4004b672a2eb
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/addr-map.c
@@ -0,0 +1,156 @@
1/*
2 * arch/arm/mach-mv78xx0/addr-map.c
3 *
4 * Address map functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <asm/io.h>
15#include "common.h"
16
17/*
18 * Generic Address Decode Windows bit settings
19 */
20#define TARGET_DDR 0
21#define TARGET_DEV_BUS 1
22#define TARGET_PCIE0 4
23#define TARGET_PCIE1 8
24#define TARGET_PCIE(i) ((i) ? TARGET_PCIE1 : TARGET_PCIE0)
25#define ATTR_DEV_SPI_ROM 0x1f
26#define ATTR_DEV_BOOT 0x2f
27#define ATTR_DEV_CS3 0x37
28#define ATTR_DEV_CS2 0x3b
29#define ATTR_DEV_CS1 0x3d
30#define ATTR_DEV_CS0 0x3e
31#define ATTR_PCIE_IO(l) (0xf0 & ~(0x10 << (l)))
32#define ATTR_PCIE_MEM(l) (0xf8 & ~(0x10 << (l)))
33
34/*
35 * Helpers to get DDR bank info
36 */
37#define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3))
38#define DDR_SIZE_CS_OFF(n) (0x0004 + ((n) << 3))
39
40/*
41 * CPU Address Decode Windows registers
42 */
43#define WIN0_OFF(n) (BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4))
44#define WIN8_OFF(n) (BRIDGE_VIRT_BASE + 0x0900 + (((n) - 8) << 4))
45#define WIN_CTRL_OFF 0x0000
46#define WIN_BASE_OFF 0x0004
47#define WIN_REMAP_LO_OFF 0x0008
48#define WIN_REMAP_HI_OFF 0x000c
49
50
51struct mbus_dram_target_info mv78xx0_mbus_dram_info;
52
53static void __init __iomem *win_cfg_base(int win)
54{
55 /*
56 * Find the control register base address for this window.
57 *
58 * BRIDGE_VIRT_BASE points to the right (CPU0's or CPU1's)
59 * MBUS bridge depending on which CPU core we're running on,
60 * so we don't need to take that into account here.
61 */
62
63 return (void __iomem *)((win < 8) ? WIN0_OFF(win) : WIN8_OFF(win));
64}
65
66static int __init cpu_win_can_remap(int win)
67{
68 if (win < 8)
69 return 1;
70
71 return 0;
72}
73
74static void __init setup_cpu_win(int win, u32 base, u32 size,
75 u8 target, u8 attr, int remap)
76{
77 void __iomem *addr = win_cfg_base(win);
78 u32 ctrl;
79
80 base &= 0xffff0000;
81 ctrl = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1;
82
83 writel(base, addr + WIN_BASE_OFF);
84 writel(ctrl, addr + WIN_CTRL_OFF);
85 if (cpu_win_can_remap(win)) {
86 if (remap < 0)
87 remap = base;
88
89 writel(remap & 0xffff0000, addr + WIN_REMAP_LO_OFF);
90 writel(0, addr + WIN_REMAP_HI_OFF);
91 }
92}
93
94void __init mv78xx0_setup_cpu_mbus(void)
95{
96 void __iomem *addr;
97 int i;
98 int cs;
99
100 /*
101 * First, disable and clear windows.
102 */
103 for (i = 0; i < 14; i++) {
104 addr = win_cfg_base(i);
105
106 writel(0, addr + WIN_BASE_OFF);
107 writel(0, addr + WIN_CTRL_OFF);
108 if (cpu_win_can_remap(i)) {
109 writel(0, addr + WIN_REMAP_LO_OFF);
110 writel(0, addr + WIN_REMAP_HI_OFF);
111 }
112 }
113
114 /*
115 * Setup MBUS dram target info.
116 */
117 mv78xx0_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
118
119 if (mv78xx0_core_index() == 0)
120 addr = (void __iomem *)DDR_WINDOW_CPU0_BASE;
121 else
122 addr = (void __iomem *)DDR_WINDOW_CPU1_BASE;
123
124 for (i = 0, cs = 0; i < 4; i++) {
125 u32 base = readl(addr + DDR_BASE_CS_OFF(i));
126 u32 size = readl(addr + DDR_SIZE_CS_OFF(i));
127
128 /*
129 * Chip select enabled?
130 */
131 if (size & 1) {
132 struct mbus_dram_window *w;
133
134 w = &mv78xx0_mbus_dram_info.cs[cs++];
135 w->cs_index = i;
136 w->mbus_attr = 0xf & ~(1 << i);
137 w->base = base & 0xffff0000;
138 w->size = (size | 0x0000ffff) + 1;
139 }
140 }
141 mv78xx0_mbus_dram_info.num_cs = cs;
142}
143
144void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
145 int maj, int min)
146{
147 setup_cpu_win(window, base, size, TARGET_PCIE(maj),
148 ATTR_PCIE_IO(min), -1);
149}
150
151void __init mv78xx0_setup_pcie_mem_win(int window, u32 base, u32 size,
152 int maj, int min)
153{
154 setup_cpu_win(window, base, size, TARGET_PCIE(maj),
155 ATTR_PCIE_MEM(min), -1);
156}
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
new file mode 100644
index 000000000000..d27b83b7bf62
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -0,0 +1,754 @@
1/*
2 * arch/arm/mach-mv78xx0/common.c
3 *
4 * Core functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/serial_8250.h>
15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/ata_platform.h>
18#include <asm/mach/map.h>
19#include <asm/mach/time.h>
20#include <asm/arch/mv78xx0.h>
21#include <asm/plat-orion/cache-feroceon-l2.h>
22#include <asm/plat-orion/ehci-orion.h>
23#include <asm/plat-orion/orion_nand.h>
24#include <asm/plat-orion/time.h>
25#include "common.h"
26
27
28/*****************************************************************************
29 * Common bits
30 ****************************************************************************/
31int mv78xx0_core_index(void)
32{
33 u32 extra;
34
35 /*
36 * Read Extra Features register.
37 */
38 __asm__("mrc p15, 1, %0, c15, c1, 0" : "=r" (extra));
39
40 return !!(extra & 0x00004000);
41}
42
43static int get_hclk(void)
44{
45 int hclk;
46
47 /*
48 * HCLK tick rate is configured by DEV_D[7:5] pins.
49 */
50 switch ((readl(SAMPLE_AT_RESET_LOW) >> 5) & 7) {
51 case 0:
52 hclk = 166666667;
53 break;
54 case 1:
55 hclk = 200000000;
56 break;
57 case 2:
58 hclk = 266666667;
59 break;
60 case 3:
61 hclk = 333333333;
62 break;
63 case 4:
64 hclk = 400000000;
65 break;
66 default:
67 panic("unknown HCLK PLL setting: %.8x\n",
68 readl(SAMPLE_AT_RESET_LOW));
69 }
70
71 return hclk;
72}
73
74static void get_pclk_l2clk(int hclk, int core_index, int *pclk, int *l2clk)
75{
76 u32 cfg;
77
78 /*
79 * Core #0 PCLK/L2CLK is configured by bits [13:8], core #1
80 * PCLK/L2CLK by bits [19:14].
81 */
82 if (core_index == 0) {
83 cfg = (readl(SAMPLE_AT_RESET_LOW) >> 8) & 0x3f;
84 } else {
85 cfg = (readl(SAMPLE_AT_RESET_LOW) >> 14) & 0x3f;
86 }
87
88 /*
89 * Bits [11:8] ([17:14] for core #1) configure the PCLK:HCLK
90 * ratio (1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6).
91 */
92 *pclk = ((u64)hclk * (2 + (cfg & 0xf))) >> 1;
93
94 /*
95 * Bits [13:12] ([19:18] for core #1) configure the PCLK:L2CLK
96 * ratio (1, 2, 3).
97 */
98 *l2clk = *pclk / (((cfg >> 4) & 3) + 1);
99}
100
101static int get_tclk(void)
102{
103 int tclk;
104
105 /*
106 * TCLK tick rate is configured by DEV_A[2:0] strap pins.
107 */
108 switch ((readl(SAMPLE_AT_RESET_HIGH) >> 6) & 7) {
109 case 1:
110 tclk = 166666667;
111 break;
112 case 3:
113 tclk = 200000000;
114 break;
115 default:
116 panic("unknown TCLK PLL setting: %.8x\n",
117 readl(SAMPLE_AT_RESET_HIGH));
118 }
119
120 return tclk;
121}
122
123
124/*****************************************************************************
125 * I/O Address Mapping
126 ****************************************************************************/
127static struct map_desc mv78xx0_io_desc[] __initdata = {
128 {
129 .virtual = MV78XX0_CORE_REGS_VIRT_BASE,
130 .pfn = 0,
131 .length = MV78XX0_CORE_REGS_SIZE,
132 .type = MT_DEVICE,
133 }, {
134 .virtual = MV78XX0_PCIE_IO_VIRT_BASE(0),
135 .pfn = __phys_to_pfn(MV78XX0_PCIE_IO_PHYS_BASE(0)),
136 .length = MV78XX0_PCIE_IO_SIZE * 8,
137 .type = MT_DEVICE,
138 }, {
139 .virtual = MV78XX0_REGS_VIRT_BASE,
140 .pfn = __phys_to_pfn(MV78XX0_REGS_PHYS_BASE),
141 .length = MV78XX0_REGS_SIZE,
142 .type = MT_DEVICE,
143 },
144};
145
146void __init mv78xx0_map_io(void)
147{
148 unsigned long phys;
149
150 /*
151 * Map the right set of per-core registers depending on
152 * which core we are running on.
153 */
154 if (mv78xx0_core_index() == 0) {
155 phys = MV78XX0_CORE0_REGS_PHYS_BASE;
156 } else {
157 phys = MV78XX0_CORE1_REGS_PHYS_BASE;
158 }
159 mv78xx0_io_desc[0].pfn = __phys_to_pfn(phys);
160
161 iotable_init(mv78xx0_io_desc, ARRAY_SIZE(mv78xx0_io_desc));
162}
163
164
165/*****************************************************************************
166 * EHCI
167 ****************************************************************************/
168static struct orion_ehci_data mv78xx0_ehci_data = {
169 .dram = &mv78xx0_mbus_dram_info,
170};
171
172static u64 ehci_dmamask = 0xffffffffUL;
173
174
175/*****************************************************************************
176 * EHCI0
177 ****************************************************************************/
178static struct resource mv78xx0_ehci0_resources[] = {
179 {
180 .start = USB0_PHYS_BASE,
181 .end = USB0_PHYS_BASE + 0x0fff,
182 .flags = IORESOURCE_MEM,
183 }, {
184 .start = IRQ_MV78XX0_USB_0,
185 .end = IRQ_MV78XX0_USB_0,
186 .flags = IORESOURCE_IRQ,
187 },
188};
189
190static struct platform_device mv78xx0_ehci0 = {
191 .name = "orion-ehci",
192 .id = 0,
193 .dev = {
194 .dma_mask = &ehci_dmamask,
195 .coherent_dma_mask = 0xffffffff,
196 .platform_data = &mv78xx0_ehci_data,
197 },
198 .resource = mv78xx0_ehci0_resources,
199 .num_resources = ARRAY_SIZE(mv78xx0_ehci0_resources),
200};
201
202void __init mv78xx0_ehci0_init(void)
203{
204 platform_device_register(&mv78xx0_ehci0);
205}
206
207
208/*****************************************************************************
209 * EHCI1
210 ****************************************************************************/
211static struct resource mv78xx0_ehci1_resources[] = {
212 {
213 .start = USB1_PHYS_BASE,
214 .end = USB1_PHYS_BASE + 0x0fff,
215 .flags = IORESOURCE_MEM,
216 }, {
217 .start = IRQ_MV78XX0_USB_1,
218 .end = IRQ_MV78XX0_USB_1,
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223static struct platform_device mv78xx0_ehci1 = {
224 .name = "orion-ehci",
225 .id = 1,
226 .dev = {
227 .dma_mask = &ehci_dmamask,
228 .coherent_dma_mask = 0xffffffff,
229 .platform_data = &mv78xx0_ehci_data,
230 },
231 .resource = mv78xx0_ehci1_resources,
232 .num_resources = ARRAY_SIZE(mv78xx0_ehci1_resources),
233};
234
235void __init mv78xx0_ehci1_init(void)
236{
237 platform_device_register(&mv78xx0_ehci1);
238}
239
240
241/*****************************************************************************
242 * EHCI2
243 ****************************************************************************/
244static struct resource mv78xx0_ehci2_resources[] = {
245 {
246 .start = USB2_PHYS_BASE,
247 .end = USB2_PHYS_BASE + 0x0fff,
248 .flags = IORESOURCE_MEM,
249 }, {
250 .start = IRQ_MV78XX0_USB_2,
251 .end = IRQ_MV78XX0_USB_2,
252 .flags = IORESOURCE_IRQ,
253 },
254};
255
256static struct platform_device mv78xx0_ehci2 = {
257 .name = "orion-ehci",
258 .id = 2,
259 .dev = {
260 .dma_mask = &ehci_dmamask,
261 .coherent_dma_mask = 0xffffffff,
262 .platform_data = &mv78xx0_ehci_data,
263 },
264 .resource = mv78xx0_ehci2_resources,
265 .num_resources = ARRAY_SIZE(mv78xx0_ehci2_resources),
266};
267
268void __init mv78xx0_ehci2_init(void)
269{
270 platform_device_register(&mv78xx0_ehci2);
271}
272
273
274/*****************************************************************************
275 * GE00
276 ****************************************************************************/
277struct mv643xx_eth_shared_platform_data mv78xx0_ge00_shared_data = {
278 .t_clk = 0,
279 .dram = &mv78xx0_mbus_dram_info,
280};
281
282static struct resource mv78xx0_ge00_shared_resources[] = {
283 {
284 .name = "ge00 base",
285 .start = GE00_PHYS_BASE + 0x2000,
286 .end = GE00_PHYS_BASE + 0x3fff,
287 .flags = IORESOURCE_MEM,
288 },
289};
290
291static struct platform_device mv78xx0_ge00_shared = {
292 .name = MV643XX_ETH_SHARED_NAME,
293 .id = 0,
294 .dev = {
295 .platform_data = &mv78xx0_ge00_shared_data,
296 },
297 .num_resources = 1,
298 .resource = mv78xx0_ge00_shared_resources,
299};
300
301static struct resource mv78xx0_ge00_resources[] = {
302 {
303 .name = "ge00 irq",
304 .start = IRQ_MV78XX0_GE00_SUM,
305 .end = IRQ_MV78XX0_GE00_SUM,
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310static struct platform_device mv78xx0_ge00 = {
311 .name = MV643XX_ETH_NAME,
312 .id = 0,
313 .num_resources = 1,
314 .resource = mv78xx0_ge00_resources,
315};
316
317void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)
318{
319 eth_data->shared = &mv78xx0_ge00_shared;
320 mv78xx0_ge00.dev.platform_data = eth_data;
321
322 platform_device_register(&mv78xx0_ge00_shared);
323 platform_device_register(&mv78xx0_ge00);
324}
325
326
327/*****************************************************************************
328 * GE01
329 ****************************************************************************/
330struct mv643xx_eth_shared_platform_data mv78xx0_ge01_shared_data = {
331 .t_clk = 0,
332 .dram = &mv78xx0_mbus_dram_info,
333};
334
335static struct resource mv78xx0_ge01_shared_resources[] = {
336 {
337 .name = "ge01 base",
338 .start = GE01_PHYS_BASE + 0x2000,
339 .end = GE01_PHYS_BASE + 0x3fff,
340 .flags = IORESOURCE_MEM,
341 },
342};
343
344static struct platform_device mv78xx0_ge01_shared = {
345 .name = MV643XX_ETH_SHARED_NAME,
346 .id = 1,
347 .dev = {
348 .platform_data = &mv78xx0_ge01_shared_data,
349 },
350 .num_resources = 1,
351 .resource = mv78xx0_ge01_shared_resources,
352};
353
354static struct resource mv78xx0_ge01_resources[] = {
355 {
356 .name = "ge01 irq",
357 .start = IRQ_MV78XX0_GE01_SUM,
358 .end = IRQ_MV78XX0_GE01_SUM,
359 .flags = IORESOURCE_IRQ,
360 },
361};
362
363static struct platform_device mv78xx0_ge01 = {
364 .name = MV643XX_ETH_NAME,
365 .id = 1,
366 .num_resources = 1,
367 .resource = mv78xx0_ge01_resources,
368};
369
370void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
371{
372 eth_data->shared = &mv78xx0_ge01_shared;
373 eth_data->shared_smi = &mv78xx0_ge00_shared;
374 mv78xx0_ge01.dev.platform_data = eth_data;
375
376 platform_device_register(&mv78xx0_ge01_shared);
377 platform_device_register(&mv78xx0_ge01);
378}
379
380
381/*****************************************************************************
382 * GE10
383 ****************************************************************************/
384struct mv643xx_eth_shared_platform_data mv78xx0_ge10_shared_data = {
385 .t_clk = 0,
386 .dram = &mv78xx0_mbus_dram_info,
387};
388
389static struct resource mv78xx0_ge10_shared_resources[] = {
390 {
391 .name = "ge10 base",
392 .start = GE10_PHYS_BASE + 0x2000,
393 .end = GE10_PHYS_BASE + 0x3fff,
394 .flags = IORESOURCE_MEM,
395 },
396};
397
398static struct platform_device mv78xx0_ge10_shared = {
399 .name = MV643XX_ETH_SHARED_NAME,
400 .id = 2,
401 .dev = {
402 .platform_data = &mv78xx0_ge10_shared_data,
403 },
404 .num_resources = 1,
405 .resource = mv78xx0_ge10_shared_resources,
406};
407
408static struct resource mv78xx0_ge10_resources[] = {
409 {
410 .name = "ge10 irq",
411 .start = IRQ_MV78XX0_GE10_SUM,
412 .end = IRQ_MV78XX0_GE10_SUM,
413 .flags = IORESOURCE_IRQ,
414 },
415};
416
417static struct platform_device mv78xx0_ge10 = {
418 .name = MV643XX_ETH_NAME,
419 .id = 2,
420 .num_resources = 1,
421 .resource = mv78xx0_ge10_resources,
422};
423
424void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
425{
426 eth_data->shared = &mv78xx0_ge10_shared;
427 eth_data->shared_smi = &mv78xx0_ge00_shared;
428 mv78xx0_ge10.dev.platform_data = eth_data;
429
430 platform_device_register(&mv78xx0_ge10_shared);
431 platform_device_register(&mv78xx0_ge10);
432}
433
434
435/*****************************************************************************
436 * GE11
437 ****************************************************************************/
438struct mv643xx_eth_shared_platform_data mv78xx0_ge11_shared_data = {
439 .t_clk = 0,
440 .dram = &mv78xx0_mbus_dram_info,
441};
442
443static struct resource mv78xx0_ge11_shared_resources[] = {
444 {
445 .name = "ge11 base",
446 .start = GE11_PHYS_BASE + 0x2000,
447 .end = GE11_PHYS_BASE + 0x3fff,
448 .flags = IORESOURCE_MEM,
449 },
450};
451
452static struct platform_device mv78xx0_ge11_shared = {
453 .name = MV643XX_ETH_SHARED_NAME,
454 .id = 3,
455 .dev = {
456 .platform_data = &mv78xx0_ge11_shared_data,
457 },
458 .num_resources = 1,
459 .resource = mv78xx0_ge11_shared_resources,
460};
461
462static struct resource mv78xx0_ge11_resources[] = {
463 {
464 .name = "ge11 irq",
465 .start = IRQ_MV78XX0_GE11_SUM,
466 .end = IRQ_MV78XX0_GE11_SUM,
467 .flags = IORESOURCE_IRQ,
468 },
469};
470
471static struct platform_device mv78xx0_ge11 = {
472 .name = MV643XX_ETH_NAME,
473 .id = 3,
474 .num_resources = 1,
475 .resource = mv78xx0_ge11_resources,
476};
477
478void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
479{
480 eth_data->shared = &mv78xx0_ge11_shared;
481 eth_data->shared_smi = &mv78xx0_ge00_shared;
482 mv78xx0_ge11.dev.platform_data = eth_data;
483
484 platform_device_register(&mv78xx0_ge11_shared);
485 platform_device_register(&mv78xx0_ge11);
486}
487
488
489/*****************************************************************************
490 * SATA
491 ****************************************************************************/
492static struct resource mv78xx0_sata_resources[] = {
493 {
494 .name = "sata base",
495 .start = SATA_PHYS_BASE,
496 .end = SATA_PHYS_BASE + 0x5000 - 1,
497 .flags = IORESOURCE_MEM,
498 }, {
499 .name = "sata irq",
500 .start = IRQ_MV78XX0_SATA,
501 .end = IRQ_MV78XX0_SATA,
502 .flags = IORESOURCE_IRQ,
503 },
504};
505
506static struct platform_device mv78xx0_sata = {
507 .name = "sata_mv",
508 .id = 0,
509 .dev = {
510 .coherent_dma_mask = 0xffffffff,
511 },
512 .num_resources = ARRAY_SIZE(mv78xx0_sata_resources),
513 .resource = mv78xx0_sata_resources,
514};
515
516void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data)
517{
518 sata_data->dram = &mv78xx0_mbus_dram_info;
519 mv78xx0_sata.dev.platform_data = sata_data;
520 platform_device_register(&mv78xx0_sata);
521}
522
523
524/*****************************************************************************
525 * UART0
526 ****************************************************************************/
527static struct plat_serial8250_port mv78xx0_uart0_data[] = {
528 {
529 .mapbase = UART0_PHYS_BASE,
530 .membase = (char *)UART0_VIRT_BASE,
531 .irq = IRQ_MV78XX0_UART_0,
532 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
533 .iotype = UPIO_MEM,
534 .regshift = 2,
535 .uartclk = 0,
536 }, {
537 },
538};
539
540static struct resource mv78xx0_uart0_resources[] = {
541 {
542 .start = UART0_PHYS_BASE,
543 .end = UART0_PHYS_BASE + 0xff,
544 .flags = IORESOURCE_MEM,
545 }, {
546 .start = IRQ_MV78XX0_UART_0,
547 .end = IRQ_MV78XX0_UART_0,
548 .flags = IORESOURCE_IRQ,
549 },
550};
551
552static struct platform_device mv78xx0_uart0 = {
553 .name = "serial8250",
554 .id = 0,
555 .dev = {
556 .platform_data = mv78xx0_uart0_data,
557 },
558 .resource = mv78xx0_uart0_resources,
559 .num_resources = ARRAY_SIZE(mv78xx0_uart0_resources),
560};
561
562void __init mv78xx0_uart0_init(void)
563{
564 platform_device_register(&mv78xx0_uart0);
565}
566
567
568/*****************************************************************************
569 * UART1
570 ****************************************************************************/
571static struct plat_serial8250_port mv78xx0_uart1_data[] = {
572 {
573 .mapbase = UART1_PHYS_BASE,
574 .membase = (char *)UART1_VIRT_BASE,
575 .irq = IRQ_MV78XX0_UART_1,
576 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
577 .iotype = UPIO_MEM,
578 .regshift = 2,
579 .uartclk = 0,
580 }, {
581 },
582};
583
584static struct resource mv78xx0_uart1_resources[] = {
585 {
586 .start = UART1_PHYS_BASE,
587 .end = UART1_PHYS_BASE + 0xff,
588 .flags = IORESOURCE_MEM,
589 }, {
590 .start = IRQ_MV78XX0_UART_1,
591 .end = IRQ_MV78XX0_UART_1,
592 .flags = IORESOURCE_IRQ,
593 },
594};
595
596static struct platform_device mv78xx0_uart1 = {
597 .name = "serial8250",
598 .id = 1,
599 .dev = {
600 .platform_data = mv78xx0_uart1_data,
601 },
602 .resource = mv78xx0_uart1_resources,
603 .num_resources = ARRAY_SIZE(mv78xx0_uart1_resources),
604};
605
606void __init mv78xx0_uart1_init(void)
607{
608 platform_device_register(&mv78xx0_uart1);
609}
610
611
612/*****************************************************************************
613 * UART2
614 ****************************************************************************/
615static struct plat_serial8250_port mv78xx0_uart2_data[] = {
616 {
617 .mapbase = UART2_PHYS_BASE,
618 .membase = (char *)UART2_VIRT_BASE,
619 .irq = IRQ_MV78XX0_UART_2,
620 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
621 .iotype = UPIO_MEM,
622 .regshift = 2,
623 .uartclk = 0,
624 }, {
625 },
626};
627
628static struct resource mv78xx0_uart2_resources[] = {
629 {
630 .start = UART2_PHYS_BASE,
631 .end = UART2_PHYS_BASE + 0xff,
632 .flags = IORESOURCE_MEM,
633 }, {
634 .start = IRQ_MV78XX0_UART_2,
635 .end = IRQ_MV78XX0_UART_2,
636 .flags = IORESOURCE_IRQ,
637 },
638};
639
640static struct platform_device mv78xx0_uart2 = {
641 .name = "serial8250",
642 .id = 2,
643 .dev = {
644 .platform_data = mv78xx0_uart2_data,
645 },
646 .resource = mv78xx0_uart2_resources,
647 .num_resources = ARRAY_SIZE(mv78xx0_uart2_resources),
648};
649
650void __init mv78xx0_uart2_init(void)
651{
652 platform_device_register(&mv78xx0_uart2);
653}
654
655
656/*****************************************************************************
657 * UART3
658 ****************************************************************************/
659static struct plat_serial8250_port mv78xx0_uart3_data[] = {
660 {
661 .mapbase = UART3_PHYS_BASE,
662 .membase = (char *)UART3_VIRT_BASE,
663 .irq = IRQ_MV78XX0_UART_3,
664 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
665 .iotype = UPIO_MEM,
666 .regshift = 2,
667 .uartclk = 0,
668 }, {
669 },
670};
671
672static struct resource mv78xx0_uart3_resources[] = {
673 {
674 .start = UART3_PHYS_BASE,
675 .end = UART3_PHYS_BASE + 0xff,
676 .flags = IORESOURCE_MEM,
677 }, {
678 .start = IRQ_MV78XX0_UART_3,
679 .end = IRQ_MV78XX0_UART_3,
680 .flags = IORESOURCE_IRQ,
681 },
682};
683
684static struct platform_device mv78xx0_uart3 = {
685 .name = "serial8250",
686 .id = 3,
687 .dev = {
688 .platform_data = mv78xx0_uart3_data,
689 },
690 .resource = mv78xx0_uart3_resources,
691 .num_resources = ARRAY_SIZE(mv78xx0_uart3_resources),
692};
693
694void __init mv78xx0_uart3_init(void)
695{
696 platform_device_register(&mv78xx0_uart3);
697}
698
699
700/*****************************************************************************
701 * Time handling
702 ****************************************************************************/
703static void mv78xx0_timer_init(void)
704{
705 orion_time_init(IRQ_MV78XX0_TIMER_1, get_tclk());
706}
707
708struct sys_timer mv78xx0_timer = {
709 .init = mv78xx0_timer_init,
710};
711
712
713/*****************************************************************************
714 * General
715 ****************************************************************************/
716static int __init is_l2_writethrough(void)
717{
718 return !!(readl(CPU_CONTROL) & L2_WRITETHROUGH);
719}
720
721void __init mv78xx0_init(void)
722{
723 int core_index;
724 int hclk;
725 int pclk;
726 int l2clk;
727 int tclk;
728
729 core_index = mv78xx0_core_index();
730 hclk = get_hclk();
731 get_pclk_l2clk(hclk, core_index, &pclk, &l2clk);
732 tclk = get_tclk();
733
734 printk(KERN_INFO "MV78xx0 core #%d, ", core_index);
735 printk("PCLK = %dMHz, ", (pclk + 499999) / 1000000);
736 printk("L2 = %dMHz, ", (l2clk + 499999) / 1000000);
737 printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000);
738 printk("TCLK = %dMHz\n", (tclk + 499999) / 1000000);
739
740 mv78xx0_setup_cpu_mbus();
741
742#ifdef CONFIG_CACHE_FEROCEON_L2
743 feroceon_l2_init(is_l2_writethrough());
744#endif
745
746 mv78xx0_ge00_shared_data.t_clk = tclk;
747 mv78xx0_ge01_shared_data.t_clk = tclk;
748 mv78xx0_ge10_shared_data.t_clk = tclk;
749 mv78xx0_ge11_shared_data.t_clk = tclk;
750 mv78xx0_uart0_data[0].uartclk = tclk;
751 mv78xx0_uart1_data[0].uartclk = tclk;
752 mv78xx0_uart2_data[0].uartclk = tclk;
753 mv78xx0_uart3_data[0].uartclk = tclk;
754}
diff --git a/arch/arm/mach-mv78xx0/common.h b/arch/arm/mach-mv78xx0/common.h
new file mode 100644
index 000000000000..78af5de319dd
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/common.h
@@ -0,0 +1,49 @@
1/*
2 * arch/arm/mach-mv78xx0/common.h
3 *
4 * Core functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ARCH_MV78XX0_COMMON_H
12#define __ARCH_MV78XX0_COMMON_H
13
14struct mv643xx_eth_platform_data;
15struct mv_sata_platform_data;
16
17/*
18 * Basic MV78xx0 init functions used early by machine-setup.
19 */
20int mv78xx0_core_index(void);
21void mv78xx0_map_io(void);
22void mv78xx0_init(void);
23void mv78xx0_init_irq(void);
24
25extern struct mbus_dram_target_info mv78xx0_mbus_dram_info;
26void mv78xx0_setup_cpu_mbus(void);
27void mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size,
28 int maj, int min);
29void mv78xx0_setup_pcie_mem_win(int window, u32 base, u32 size,
30 int maj, int min);
31
32void mv78xx0_ehci0_init(void);
33void mv78xx0_ehci1_init(void);
34void mv78xx0_ehci2_init(void);
35void mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data);
36void mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data);
37void mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data);
38void mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data);
39void mv78xx0_pcie_init(int init_port0, int init_port1);
40void mv78xx0_sata_init(struct mv_sata_platform_data *sata_data);
41void mv78xx0_uart0_init(void);
42void mv78xx0_uart1_init(void);
43void mv78xx0_uart2_init(void);
44void mv78xx0_uart3_init(void);
45
46extern struct sys_timer mv78xx0_timer;
47
48
49#endif
diff --git a/arch/arm/mach-mv78xx0/db78x00-bp-setup.c b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
new file mode 100644
index 000000000000..0c93d19193df
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
@@ -0,0 +1,94 @@
1/*
2 * arch/arm/mach-mv78xx0/db78x00-bp-setup.c
3 *
4 * Marvell DB-78x00-BP Development Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/ata_platform.h>
15#include <linux/mv643xx_eth.h>
16#include <asm/arch/mv78xx0.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include "common.h"
20
21static struct mv643xx_eth_platform_data db78x00_ge00_data = {
22 .phy_addr = 8,
23};
24
25static struct mv643xx_eth_platform_data db78x00_ge01_data = {
26 .phy_addr = 9,
27};
28
29static struct mv643xx_eth_platform_data db78x00_ge10_data = {
30 .phy_addr = -1,
31};
32
33static struct mv643xx_eth_platform_data db78x00_ge11_data = {
34 .phy_addr = -1,
35};
36
37static struct mv_sata_platform_data db78x00_sata_data = {
38 .n_ports = 2,
39};
40
41static void __init db78x00_init(void)
42{
43 /*
44 * Basic MV78xx0 setup. Needs to be called early.
45 */
46 mv78xx0_init();
47
48 /*
49 * Partition on-chip peripherals between the two CPU cores.
50 */
51 if (mv78xx0_core_index() == 0) {
52 mv78xx0_ehci0_init();
53 mv78xx0_ehci1_init();
54 mv78xx0_ehci2_init();
55 mv78xx0_ge00_init(&db78x00_ge00_data);
56 mv78xx0_ge01_init(&db78x00_ge01_data);
57 mv78xx0_ge10_init(&db78x00_ge10_data);
58 mv78xx0_ge11_init(&db78x00_ge11_data);
59 mv78xx0_sata_init(&db78x00_sata_data);
60 mv78xx0_uart0_init();
61 mv78xx0_uart2_init();
62 } else {
63 mv78xx0_uart1_init();
64 mv78xx0_uart3_init();
65 }
66}
67
68static int __init db78x00_pci_init(void)
69{
70 if (machine_is_db78x00_bp()) {
71 /*
72 * Assign the x16 PCIe slot on the board to CPU core
73 * #0, and let CPU core #1 have the four x1 slots.
74 */
75 if (mv78xx0_core_index() == 0)
76 mv78xx0_pcie_init(0, 1);
77 else
78 mv78xx0_pcie_init(1, 0);
79 }
80
81 return 0;
82}
83subsys_initcall(db78x00_pci_init);
84
85MACHINE_START(DB78X00_BP, "Marvell DB-78x00-BP Development Board")
86 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
87 .phys_io = MV78XX0_REGS_PHYS_BASE,
88 .io_pg_offst = ((MV78XX0_REGS_VIRT_BASE) >> 18) & 0xfffc,
89 .boot_params = 0x00000100,
90 .init_machine = db78x00_init,
91 .map_io = mv78xx0_map_io,
92 .init_irq = mv78xx0_init_irq,
93 .timer = &mv78xx0_timer,
94MACHINE_END
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
new file mode 100644
index 000000000000..60f4ee4d4532
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-mv78xx0/irq.c
3 *
4 * MV78xx0 IRQ handling.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/pci.h>
14#include <asm/arch/mv78xx0.h>
15#include <asm/plat-orion/irq.h>
16#include "common.h"
17
18void __init mv78xx0_init_irq(void)
19{
20 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF));
21 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
22}
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
new file mode 100644
index 000000000000..b78e1443159f
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -0,0 +1,312 @@
1/*
2 * arch/arm/mach-mv78xx0/pcie.c
3 *
4 * PCIe functions for Marvell MV78xx0 SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/pci.h>
13#include <linux/mbus.h>
14#include <asm/mach/pci.h>
15#include <asm/plat-orion/pcie.h>
16#include "common.h"
17
18struct pcie_port {
19 u8 maj;
20 u8 min;
21 u8 root_bus_nr;
22 void __iomem *base;
23 spinlock_t conf_lock;
24 char io_space_name[16];
25 char mem_space_name[16];
26 struct resource res[2];
27};
28
29static struct pcie_port pcie_port[8];
30static int num_pcie_ports;
31static struct resource pcie_io_space;
32static struct resource pcie_mem_space;
33
34
35static void __init mv78xx0_pcie_preinit(void)
36{
37 int i;
38 u32 size_each;
39 u32 start;
40 int win;
41
42 pcie_io_space.name = "PCIe I/O Space";
43 pcie_io_space.start = MV78XX0_PCIE_IO_PHYS_BASE(0);
44 pcie_io_space.end =
45 MV78XX0_PCIE_IO_PHYS_BASE(0) + MV78XX0_PCIE_IO_SIZE * 8 - 1;
46 pcie_io_space.flags = IORESOURCE_IO;
47 if (request_resource(&iomem_resource, &pcie_io_space))
48 panic("can't allocate PCIe I/O space");
49
50 pcie_mem_space.name = "PCIe MEM Space";
51 pcie_mem_space.start = MV78XX0_PCIE_MEM_PHYS_BASE;
52 pcie_mem_space.end =
53 MV78XX0_PCIE_MEM_PHYS_BASE + MV78XX0_PCIE_MEM_SIZE - 1;
54 pcie_mem_space.flags = IORESOURCE_MEM;
55 if (request_resource(&iomem_resource, &pcie_mem_space))
56 panic("can't allocate PCIe MEM space");
57
58 for (i = 0; i < num_pcie_ports; i++) {
59 struct pcie_port *pp = pcie_port + i;
60
61 snprintf(pp->io_space_name, sizeof(pp->io_space_name),
62 "PCIe %d.%d I/O", pp->maj, pp->min);
63 pp->io_space_name[sizeof(pp->io_space_name) - 1] = 0;
64 pp->res[0].name = pp->io_space_name;
65 pp->res[0].start = MV78XX0_PCIE_IO_PHYS_BASE(i);
66 pp->res[0].end = pp->res[0].start + MV78XX0_PCIE_IO_SIZE - 1;
67 pp->res[0].flags = IORESOURCE_IO;
68
69 snprintf(pp->mem_space_name, sizeof(pp->mem_space_name),
70 "PCIe %d.%d MEM", pp->maj, pp->min);
71 pp->mem_space_name[sizeof(pp->mem_space_name) - 1] = 0;
72 pp->res[1].name = pp->mem_space_name;
73 pp->res[1].flags = IORESOURCE_MEM;
74 }
75
76 switch (num_pcie_ports) {
77 case 0:
78 size_each = 0;
79 break;
80
81 case 1:
82 size_each = 0x30000000;
83 break;
84
85 case 2 ... 3:
86 size_each = 0x10000000;
87 break;
88
89 case 4 ... 6:
90 size_each = 0x08000000;
91 break;
92
93 case 7:
94 size_each = 0x04000000;
95 break;
96
97 default:
98 panic("invalid number of PCIe ports");
99 }
100
101 start = MV78XX0_PCIE_MEM_PHYS_BASE;
102 for (i = 0; i < num_pcie_ports; i++) {
103 struct pcie_port *pp = pcie_port + i;
104
105 pp->res[1].start = start;
106 pp->res[1].end = start + size_each - 1;
107 start += size_each;
108 }
109
110 for (i = 0; i < num_pcie_ports; i++) {
111 struct pcie_port *pp = pcie_port + i;
112
113 if (request_resource(&pcie_io_space, &pp->res[0]))
114 panic("can't allocate PCIe I/O sub-space");
115
116 if (request_resource(&pcie_mem_space, &pp->res[1]))
117 panic("can't allocate PCIe MEM sub-space");
118 }
119
120 win = 0;
121 for (i = 0; i < num_pcie_ports; i++) {
122 struct pcie_port *pp = pcie_port + i;
123
124 mv78xx0_setup_pcie_io_win(win++, pp->res[0].start,
125 pp->res[0].end - pp->res[0].start + 1,
126 pp->maj, pp->min);
127
128 mv78xx0_setup_pcie_mem_win(win++, pp->res[1].start,
129 pp->res[1].end - pp->res[1].start + 1,
130 pp->maj, pp->min);
131 }
132}
133
134static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
135{
136 struct pcie_port *pp;
137
138 if (nr >= num_pcie_ports)
139 return 0;
140
141 pp = &pcie_port[nr];
142 pp->root_bus_nr = sys->busnr;
143
144 /*
145 * Generic PCIe unit setup.
146 */
147 orion_pcie_set_local_bus_nr(pp->base, sys->busnr);
148 orion_pcie_setup(pp->base, &mv78xx0_mbus_dram_info);
149
150 sys->resource[0] = &pp->res[0];
151 sys->resource[1] = &pp->res[1];
152 sys->resource[2] = NULL;
153
154 return 1;
155}
156
157static struct pcie_port *bus_to_port(int bus)
158{
159 int i;
160
161 for (i = num_pcie_ports - 1; i >= 0; i--) {
162 int rbus = pcie_port[i].root_bus_nr;
163 if (rbus != -1 && rbus <= bus)
164 break;
165 }
166
167 return i >= 0 ? pcie_port + i : NULL;
168}
169
170static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
171{
172 /*
173 * Don't go out when trying to access nonexisting devices
174 * on the local bus.
175 */
176 if (bus == pp->root_bus_nr && dev > 1)
177 return 0;
178
179 return 1;
180}
181
182static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
183 int size, u32 *val)
184{
185 struct pcie_port *pp = bus_to_port(bus->number);
186 unsigned long flags;
187 int ret;
188
189 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0) {
190 *val = 0xffffffff;
191 return PCIBIOS_DEVICE_NOT_FOUND;
192 }
193
194 spin_lock_irqsave(&pp->conf_lock, flags);
195 ret = orion_pcie_rd_conf(pp->base, bus, devfn, where, size, val);
196 spin_unlock_irqrestore(&pp->conf_lock, flags);
197
198 return ret;
199}
200
201static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
202 int where, int size, u32 val)
203{
204 struct pcie_port *pp = bus_to_port(bus->number);
205 unsigned long flags;
206 int ret;
207
208 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0)
209 return PCIBIOS_DEVICE_NOT_FOUND;
210
211 spin_lock_irqsave(&pp->conf_lock, flags);
212 ret = orion_pcie_wr_conf(pp->base, bus, devfn, where, size, val);
213 spin_unlock_irqrestore(&pp->conf_lock, flags);
214
215 return ret;
216}
217
218static struct pci_ops pcie_ops = {
219 .read = pcie_rd_conf,
220 .write = pcie_wr_conf,
221};
222
223static void __devinit rc_pci_fixup(struct pci_dev *dev)
224{
225 /*
226 * Prevent enumeration of root complex.
227 */
228 if (dev->bus->parent == NULL && dev->devfn == 0) {
229 int i;
230
231 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
232 dev->resource[i].start = 0;
233 dev->resource[i].end = 0;
234 dev->resource[i].flags = 0;
235 }
236 }
237}
238DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);
239
240static struct pci_bus __init *
241mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys)
242{
243 struct pci_bus *bus;
244
245 if (nr < num_pcie_ports) {
246 bus = pci_scan_bus(sys->busnr, &pcie_ops, sys);
247 } else {
248 bus = NULL;
249 BUG();
250 }
251
252 return bus;
253}
254
255static int __init mv78xx0_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
256{
257 struct pcie_port *pp = bus_to_port(dev->bus->number);
258
259 return IRQ_MV78XX0_PCIE_00 + (pp->maj << 2) + pp->min;
260}
261
262static struct hw_pci mv78xx0_pci __initdata = {
263 .nr_controllers = 8,
264 .preinit = mv78xx0_pcie_preinit,
265 .swizzle = pci_std_swizzle,
266 .setup = mv78xx0_pcie_setup,
267 .scan = mv78xx0_pcie_scan_bus,
268 .map_irq = mv78xx0_pcie_map_irq,
269};
270
271static void __init add_pcie_port(int maj, int min, unsigned long base)
272{
273 printk(KERN_INFO "MV78xx0 PCIe port %d.%d: ", maj, min);
274
275 if (orion_pcie_link_up((void __iomem *)base)) {
276 struct pcie_port *pp = &pcie_port[num_pcie_ports++];
277
278 printk("link up\n");
279
280 pp->maj = maj;
281 pp->min = min;
282 pp->root_bus_nr = -1;
283 pp->base = (void __iomem *)base;
284 spin_lock_init(&pp->conf_lock);
285 memset(pp->res, 0, sizeof(pp->res));
286 } else {
287 printk("link down, ignoring\n");
288 }
289}
290
291void __init mv78xx0_pcie_init(int init_port0, int init_port1)
292{
293 if (init_port0) {
294 add_pcie_port(0, 0, PCIE00_VIRT_BASE);
295 if (!orion_pcie_x4_mode((void __iomem *)PCIE00_VIRT_BASE)) {
296 add_pcie_port(0, 1, PCIE01_VIRT_BASE);
297 add_pcie_port(0, 2, PCIE02_VIRT_BASE);
298 add_pcie_port(0, 3, PCIE03_VIRT_BASE);
299 }
300 }
301
302 if (init_port1) {
303 add_pcie_port(1, 0, PCIE10_VIRT_BASE);
304 if (!orion_pcie_x4_mode((void __iomem *)PCIE10_VIRT_BASE)) {
305 add_pcie_port(1, 1, PCIE11_VIRT_BASE);
306 add_pcie_port(1, 2, PCIE12_VIRT_BASE);
307 add_pcie_port(1, 3, PCIE13_VIRT_BASE);
308 }
309 }
310
311 pci_common_init(&mv78xx0_pci);
312}
diff --git a/arch/arm/mach-mx2/Kconfig b/arch/arm/mach-mx2/Kconfig
new file mode 100644
index 000000000000..1eaa97cb716d
--- /dev/null
+++ b/arch/arm/mach-mx2/Kconfig
@@ -0,0 +1,39 @@
1comment "MX2 family CPU support"
2 depends on ARCH_MX2
3
4config MACH_MX27
5 bool "i.MX27 support"
6 depends on ARCH_MX2
7 help
8 This enables support for Freescale's MX2 based i.MX27 processor.
9
10comment "MX2 Platforms"
11 depends on ARCH_MX2
12
13config MACH_MX27ADS
14 bool "MX27ADS platform"
15 depends on MACH_MX27
16 help
17 Include support for MX27ADS platform. This includes specific
18 configurations for the board and its peripherals.
19
20config MACH_PCM038
21 bool "Phytec phyCORE-i.MX27 CPU module (pcm038)"
22 depends on MACH_MX27
23 help
24 Include support for phyCORE-i.MX27 (aka pcm038) platform. This
25 includes specific configurations for the module and its peripherals.
26
27choice
28 prompt "Baseboard"
29 depends on MACH_PCM038
30 default MACH_PCM970_BASEBOARD
31
32config MACH_PCM970_BASEBOARD
33 prompt "PHYTEC PCM970 development board"
34 bool
35 help
36 This adds board specific devices that can be found on Phytec's
37 PCM970 evaluation board.
38
39endchoice
diff --git a/arch/arm/mach-mx2/Makefile b/arch/arm/mach-mx2/Makefile
new file mode 100644
index 000000000000..382d86080e86
--- /dev/null
+++ b/arch/arm/mach-mx2/Makefile
@@ -0,0 +1,14 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := system.o generic.o devices.o serial.o
8
9obj-$(CONFIG_MACH_MX27) += cpu_imx27.o
10obj-$(CONFIG_MACH_MX27) += clock_imx27.o
11
12obj-$(CONFIG_MACH_MX27ADS) += mx27ads.o
13obj-$(CONFIG_MACH_PCM038) += pcm038.o
14obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o
diff --git a/arch/arm/mach-mx2/Makefile.boot b/arch/arm/mach-mx2/Makefile.boot
new file mode 100644
index 000000000000..696831dcd485
--- /dev/null
+++ b/arch/arm/mach-mx2/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0xA0008000
2params_phys-y := 0xA0000100
3initrd_phys-y := 0xA0800000
diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-mx2/clock_imx27.c
new file mode 100644
index 000000000000..0a29ef29c73a
--- /dev/null
+++ b/arch/arm/mach-mx2/clock_imx27.c
@@ -0,0 +1,1626 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/clk.h>
21#include <linux/io.h>
22#include <linux/module.h>
23#include <linux/spinlock.h>
24
25#include <asm/arch/clock.h>
26#include <asm/arch/common.h>
27#include <asm/div64.h>
28#include <asm/mach-types.h>
29
30#include "crm_regs.h"
31
32static struct clk ckil_clk;
33static struct clk mpll_clk;
34static struct clk mpll_main_clk[];
35static struct clk spll_clk;
36
37static int _clk_enable(struct clk *clk)
38{
39 unsigned long reg;
40
41 reg = __raw_readl(clk->enable_reg);
42 reg |= 1 << clk->enable_shift;
43 __raw_writel(reg, clk->enable_reg);
44
45 return 0;
46}
47
48static void _clk_disable(struct clk *clk)
49{
50 unsigned long reg;
51
52 reg = __raw_readl(clk->enable_reg);
53 reg &= ~(1 << clk->enable_shift);
54 __raw_writel(reg, clk->enable_reg);
55}
56
57static int _clk_spll_enable(struct clk *clk)
58{
59 unsigned long reg;
60
61 reg = __raw_readl(CCM_CSCR);
62 reg |= CCM_CSCR_SPEN;
63 __raw_writel(reg, CCM_CSCR);
64
65 while ((__raw_readl(CCM_SPCTL1) & CCM_SPCTL1_LF) == 0)
66 ;
67
68 return 0;
69}
70
71static void _clk_spll_disable(struct clk *clk)
72{
73 unsigned long reg;
74
75 reg = __raw_readl(CCM_CSCR);
76 reg &= ~CCM_CSCR_SPEN;
77 __raw_writel(reg, CCM_CSCR);
78}
79
80static void _clk_pccr01_enable(unsigned long mask0, unsigned long mask1)
81{
82 unsigned long reg;
83
84 reg = __raw_readl(CCM_PCCR0);
85 reg |= mask0;
86 __raw_writel(reg, CCM_PCCR0);
87
88 reg = __raw_readl(CCM_PCCR1);
89 reg |= mask1;
90 __raw_writel(reg, CCM_PCCR1);
91
92}
93
94static void _clk_pccr01_disable(unsigned long mask0, unsigned long mask1)
95{
96 unsigned long reg;
97
98 reg = __raw_readl(CCM_PCCR0);
99 reg &= ~mask0;
100 __raw_writel(reg, CCM_PCCR0);
101
102 reg = __raw_readl(CCM_PCCR1);
103 reg &= ~mask1;
104 __raw_writel(reg, CCM_PCCR1);
105}
106
107static void _clk_pccr10_enable(unsigned long mask1, unsigned long mask0)
108{
109 unsigned long reg;
110
111 reg = __raw_readl(CCM_PCCR1);
112 reg |= mask1;
113 __raw_writel(reg, CCM_PCCR1);
114
115 reg = __raw_readl(CCM_PCCR0);
116 reg |= mask0;
117 __raw_writel(reg, CCM_PCCR0);
118}
119
120static void _clk_pccr10_disable(unsigned long mask1, unsigned long mask0)
121{
122 unsigned long reg;
123
124 reg = __raw_readl(CCM_PCCR1);
125 reg &= ~mask1;
126 __raw_writel(reg, CCM_PCCR1);
127
128 reg = __raw_readl(CCM_PCCR0);
129 reg &= ~mask0;
130 __raw_writel(reg, CCM_PCCR0);
131}
132
133static int _clk_dma_enable(struct clk *clk)
134{
135 _clk_pccr01_enable(CCM_PCCR0_DMA_MASK, CCM_PCCR1_HCLK_DMA_MASK);
136
137 return 0;
138}
139
140static void _clk_dma_disable(struct clk *clk)
141{
142 _clk_pccr01_disable(CCM_PCCR0_DMA_MASK, CCM_PCCR1_HCLK_DMA_MASK);
143}
144
145static int _clk_rtic_enable(struct clk *clk)
146{
147 _clk_pccr01_enable(CCM_PCCR0_RTIC_MASK, CCM_PCCR1_HCLK_RTIC_MASK);
148
149 return 0;
150}
151
152static void _clk_rtic_disable(struct clk *clk)
153{
154 _clk_pccr01_disable(CCM_PCCR0_RTIC_MASK, CCM_PCCR1_HCLK_RTIC_MASK);
155}
156
157static int _clk_emma_enable(struct clk *clk)
158{
159 _clk_pccr01_enable(CCM_PCCR0_EMMA_MASK, CCM_PCCR1_HCLK_EMMA_MASK);
160
161 return 0;
162}
163
164static void _clk_emma_disable(struct clk *clk)
165{
166 _clk_pccr01_disable(CCM_PCCR0_EMMA_MASK, CCM_PCCR1_HCLK_EMMA_MASK);
167}
168
169static int _clk_slcdc_enable(struct clk *clk)
170{
171 _clk_pccr01_enable(CCM_PCCR0_SLCDC_MASK, CCM_PCCR1_HCLK_SLCDC_MASK);
172
173 return 0;
174}
175
176static void _clk_slcdc_disable(struct clk *clk)
177{
178 _clk_pccr01_disable(CCM_PCCR0_SLCDC_MASK, CCM_PCCR1_HCLK_SLCDC_MASK);
179}
180
181static int _clk_fec_enable(struct clk *clk)
182{
183 _clk_pccr01_enable(CCM_PCCR0_FEC_MASK, CCM_PCCR1_HCLK_FEC_MASK);
184
185 return 0;
186}
187
188static void _clk_fec_disable(struct clk *clk)
189{
190 _clk_pccr01_disable(CCM_PCCR0_FEC_MASK, CCM_PCCR1_HCLK_FEC_MASK);
191}
192
193static int _clk_vpu_enable(struct clk *clk)
194{
195 unsigned long reg;
196
197 reg = __raw_readl(CCM_PCCR1);
198 reg |= CCM_PCCR1_VPU_BAUD_MASK | CCM_PCCR1_HCLK_VPU_MASK;
199 __raw_writel(reg, CCM_PCCR1);
200
201 return 0;
202}
203
204static void _clk_vpu_disable(struct clk *clk)
205{
206 unsigned long reg;
207
208 reg = __raw_readl(CCM_PCCR1);
209 reg &= ~(CCM_PCCR1_VPU_BAUD_MASK | CCM_PCCR1_HCLK_VPU_MASK);
210 __raw_writel(reg, CCM_PCCR1);
211}
212
213static int _clk_sahara2_enable(struct clk *clk)
214{
215 _clk_pccr01_enable(CCM_PCCR0_SAHARA_MASK, CCM_PCCR1_HCLK_SAHARA_MASK);
216
217 return 0;
218}
219
220static void _clk_sahara2_disable(struct clk *clk)
221{
222 _clk_pccr01_disable(CCM_PCCR0_SAHARA_MASK, CCM_PCCR1_HCLK_SAHARA_MASK);
223}
224
225static int _clk_mstick1_enable(struct clk *clk)
226{
227 _clk_pccr10_enable(CCM_PCCR1_MSHC_BAUD_MASK, CCM_PCCR0_MSHC_MASK);
228
229 return 0;
230}
231
232static void _clk_mstick1_disable(struct clk *clk)
233{
234 _clk_pccr10_disable(CCM_PCCR1_MSHC_BAUD_MASK, CCM_PCCR0_MSHC_MASK);
235}
236
237#define CSCR() (__raw_readl(CCM_CSCR))
238#define PCDR0() (__raw_readl(CCM_PCDR0))
239#define PCDR1() (__raw_readl(CCM_PCDR1))
240
241static int _clk_cpu_set_parent(struct clk *clk, struct clk *parent)
242{
243 int cscr = CSCR();
244
245 if (clk->parent == parent)
246 return 0;
247
248 if (mx27_revision() >= CHIP_REV_2_0) {
249 if (parent == &mpll_main_clk[0]) {
250 cscr |= CCM_CSCR_ARM_SRC;
251 } else {
252 if (parent == &mpll_main_clk[1])
253 cscr &= ~CCM_CSCR_ARM_SRC;
254 else
255 return -EINVAL;
256 }
257 __raw_writel(cscr, CCM_CSCR);
258 } else
259 return -ENODEV;
260
261 clk->parent = parent;
262 return 0;
263}
264
265static unsigned long _clk_cpu_round_rate(struct clk *clk, unsigned long rate)
266{
267 int div;
268 unsigned long parent_rate;
269
270 parent_rate = clk_get_rate(clk->parent);
271
272 div = parent_rate / rate;
273 if (parent_rate % rate)
274 div++;
275
276 if (div > 4)
277 div = 4;
278
279 return parent_rate / div;
280}
281
282static int _clk_cpu_set_rate(struct clk *clk, unsigned long rate)
283{
284 unsigned int div;
285 uint32_t reg;
286 unsigned long parent_rate;
287
288 parent_rate = clk_get_rate(clk->parent);
289
290 div = parent_rate / rate;
291
292 if (div > 4 || div < 1 || ((parent_rate / div) != rate))
293 return -EINVAL;
294
295 div--;
296
297 reg = __raw_readl(CCM_CSCR);
298 if (mx27_revision() >= CHIP_REV_2_0) {
299 reg &= ~CCM_CSCR_ARM_MASK;
300 reg |= div << CCM_CSCR_ARM_OFFSET;
301 reg &= ~0x06;
302 __raw_writel(reg | 0x80000000, CCM_CSCR);
303 } else {
304 printk(KERN_ERR "Cant set CPU frequency!\n");
305 }
306
307 return 0;
308}
309
310static unsigned long _clk_perclkx_round_rate(struct clk *clk,
311 unsigned long rate)
312{
313 u32 div;
314 unsigned long parent_rate;
315
316 parent_rate = clk_get_rate(clk->parent);
317
318 div = parent_rate / rate;
319 if (parent_rate % rate)
320 div++;
321
322 if (div > 64)
323 div = 64;
324
325 return parent_rate / div;
326}
327
328static int _clk_perclkx_set_rate(struct clk *clk, unsigned long rate)
329{
330 u32 reg;
331 u32 div;
332 unsigned long parent_rate;
333
334 parent_rate = clk_get_rate(clk->parent);
335
336 if (clk->id < 0 || clk->id > 3)
337 return -EINVAL;
338
339 div = parent_rate / rate;
340 if (div > 64 || div < 1 || ((parent_rate / div) != rate))
341 return -EINVAL;
342 div--;
343
344 reg =
345 __raw_readl(CCM_PCDR1) & ~(CCM_PCDR1_PERDIV1_MASK <<
346 (clk->id << 3));
347 reg |= div << (clk->id << 3);
348 __raw_writel(reg, CCM_PCDR1);
349
350 return 0;
351}
352
353static unsigned long _clk_usb_recalc(struct clk *clk)
354{
355 unsigned long usb_pdf;
356 unsigned long parent_rate;
357
358 parent_rate = clk_get_rate(clk->parent);
359
360 usb_pdf = (CSCR() & CCM_CSCR_USB_MASK) >> CCM_CSCR_USB_OFFSET;
361
362 return parent_rate / (usb_pdf + 1U);
363}
364
365static unsigned long _clk_ssi1_recalc(struct clk *clk)
366{
367 unsigned long ssi1_pdf;
368 unsigned long parent_rate;
369
370 parent_rate = clk_get_rate(clk->parent);
371
372 ssi1_pdf = (PCDR0() & CCM_PCDR0_SSI1BAUDDIV_MASK) >>
373 CCM_PCDR0_SSI1BAUDDIV_OFFSET;
374
375 if (mx27_revision() >= CHIP_REV_2_0)
376 ssi1_pdf += 4;
377 else
378 ssi1_pdf = (ssi1_pdf < 2) ? 124UL : ssi1_pdf;
379
380 return 2UL * parent_rate / ssi1_pdf;
381}
382
383static unsigned long _clk_ssi2_recalc(struct clk *clk)
384{
385 unsigned long ssi2_pdf;
386 unsigned long parent_rate;
387
388 parent_rate = clk_get_rate(clk->parent);
389
390 ssi2_pdf = (PCDR0() & CCM_PCDR0_SSI2BAUDDIV_MASK) >>
391 CCM_PCDR0_SSI2BAUDDIV_OFFSET;
392
393 if (mx27_revision() >= CHIP_REV_2_0)
394 ssi2_pdf += 4;
395 else
396 ssi2_pdf = (ssi2_pdf < 2) ? 124UL : ssi2_pdf;
397
398 return 2UL * parent_rate / ssi2_pdf;
399}
400
401static unsigned long _clk_nfc_recalc(struct clk *clk)
402{
403 unsigned long nfc_pdf;
404 unsigned long parent_rate;
405
406 parent_rate = clk_get_rate(clk->parent);
407
408 if (mx27_revision() >= CHIP_REV_2_0) {
409 nfc_pdf =
410 (PCDR0() & CCM_PCDR0_NFCDIV2_MASK) >>
411 CCM_PCDR0_NFCDIV2_OFFSET;
412 } else {
413 nfc_pdf =
414 (PCDR0() & CCM_PCDR0_NFCDIV_MASK) >>
415 CCM_PCDR0_NFCDIV_OFFSET;
416 }
417
418 return parent_rate / (nfc_pdf + 1);
419}
420
421static unsigned long _clk_vpu_recalc(struct clk *clk)
422{
423 unsigned long vpu_pdf;
424 unsigned long parent_rate;
425
426 parent_rate = clk_get_rate(clk->parent);
427
428 if (mx27_revision() >= CHIP_REV_2_0) {
429 vpu_pdf =
430 (PCDR0() & CCM_PCDR0_VPUDIV2_MASK) >>
431 CCM_PCDR0_VPUDIV2_OFFSET;
432 vpu_pdf += 4;
433 } else {
434 vpu_pdf =
435 (PCDR0() & CCM_PCDR0_VPUDIV_MASK) >>
436 CCM_PCDR0_VPUDIV_OFFSET;
437 vpu_pdf = (vpu_pdf < 2) ? 124 : vpu_pdf;
438 }
439 return 2UL * parent_rate / vpu_pdf;
440}
441
442static unsigned long _clk_parent_round_rate(struct clk *clk, unsigned long rate)
443{
444 return clk->parent->round_rate(clk->parent, rate);
445}
446
447static int _clk_parent_set_rate(struct clk *clk, unsigned long rate)
448{
449 return clk->parent->set_rate(clk->parent, rate);
450}
451
452/* in Hz */
453static unsigned long external_high_reference = 26000000;
454
455static unsigned long get_high_reference_clock_rate(struct clk *clk)
456{
457 return external_high_reference;
458}
459
460/*
461 * the high frequency external clock reference
462 * Default case is 26MHz. Could be changed at runtime
463 * with a call to change_external_high_reference()
464 */
465static struct clk ckih_clk = {
466 .name = "ckih",
467 .get_rate = get_high_reference_clock_rate,
468};
469
470/* in Hz */
471static unsigned long external_low_reference = 32768;
472
473static unsigned long get_low_reference_clock_rate(struct clk *clk)
474{
475 return external_low_reference;
476}
477
478/*
479 * the low frequency external clock reference
480 * Default case is 32.768kHz Could be changed at runtime
481 * with a call to change_external_low_reference()
482 */
483static struct clk ckil_clk = {
484 .name = "ckil",
485 .get_rate = get_low_reference_clock_rate,
486};
487
488static unsigned long get_mpll_clk(struct clk *clk)
489{
490 uint32_t reg;
491 unsigned long ref_clk;
492 unsigned long mfi = 0, mfn = 0, mfd = 0, pdf = 0;
493 unsigned long long temp;
494
495 ref_clk = clk_get_rate(clk->parent);
496
497 reg = __raw_readl(CCM_MPCTL0);
498 pdf = (reg & CCM_MPCTL0_PD_MASK) >> CCM_MPCTL0_PD_OFFSET;
499 mfd = (reg & CCM_MPCTL0_MFD_MASK) >> CCM_MPCTL0_MFD_OFFSET;
500 mfi = (reg & CCM_MPCTL0_MFI_MASK) >> CCM_MPCTL0_MFI_OFFSET;
501 mfn = (reg & CCM_MPCTL0_MFN_MASK) >> CCM_MPCTL0_MFN_OFFSET;
502
503 mfi = (mfi <= 5) ? 5 : mfi;
504 temp = 2LL * ref_clk * mfn;
505 do_div(temp, mfd + 1);
506 temp = 2LL * ref_clk * mfi + temp;
507 do_div(temp, pdf + 1);
508
509 return (unsigned long)temp;
510}
511
512static struct clk mpll_clk = {
513 .name = "mpll",
514 .parent = &ckih_clk,
515 .get_rate = get_mpll_clk,
516};
517
518static unsigned long _clk_mpll_main_get_rate(struct clk *clk)
519{
520 unsigned long parent_rate;
521
522 parent_rate = clk_get_rate(clk->parent);
523
524 /* i.MX27 TO2:
525 * clk->id == 0: arm clock source path 1 which is from 2*MPLL/DIV_2
526 * clk->id == 1: arm clock source path 2 which is from 2*MPLL/DIV_3
527 */
528
529 if (mx27_revision() >= CHIP_REV_2_0 && clk->id == 1)
530 return 2UL * parent_rate / 3UL;
531
532 return parent_rate;
533}
534
535static struct clk mpll_main_clk[] = {
536 {
537 /* For i.MX27 TO2, it is the MPLL path 1 of ARM core
538 * It provide the clock source whose rate is same as MPLL
539 */
540 .name = "mpll_main",
541 .id = 0,
542 .parent = &mpll_clk,
543 .get_rate = _clk_mpll_main_get_rate
544 }, {
545 /* For i.MX27 TO2, it is the MPLL path 2 of ARM core
546 * It provide the clock source whose rate is same MPLL * 2/3
547 */
548 .name = "mpll_main",
549 .id = 1,
550 .parent = &mpll_clk,
551 .get_rate = _clk_mpll_main_get_rate
552 }
553};
554
555static unsigned long get_spll_clk(struct clk *clk)
556{
557 uint32_t reg;
558 unsigned long ref_clk;
559 unsigned long mfi = 0, mfn = 0, mfd = 0, pdf = 0;
560 unsigned long long temp;
561
562 ref_clk = clk_get_rate(clk->parent);
563
564 reg = __raw_readl(CCM_SPCTL0);
565 /*TODO: This is TO2 Bug */
566 if (mx27_revision() >= CHIP_REV_2_0)
567 __raw_writel(reg, CCM_SPCTL0);
568
569 pdf = (reg & CCM_SPCTL0_PD_MASK) >> CCM_SPCTL0_PD_OFFSET;
570 mfd = (reg & CCM_SPCTL0_MFD_MASK) >> CCM_SPCTL0_MFD_OFFSET;
571 mfi = (reg & CCM_SPCTL0_MFI_MASK) >> CCM_SPCTL0_MFI_OFFSET;
572 mfn = (reg & CCM_SPCTL0_MFN_MASK) >> CCM_SPCTL0_MFN_OFFSET;
573
574 mfi = (mfi <= 5) ? 5 : mfi;
575 temp = 2LL * ref_clk * mfn;
576 do_div(temp, mfd + 1);
577 temp = 2LL * ref_clk * mfi + temp;
578 do_div(temp, pdf + 1);
579
580 return (unsigned long)temp;
581}
582
583static struct clk spll_clk = {
584 .name = "spll",
585 .parent = &ckih_clk,
586 .get_rate = get_spll_clk,
587 .enable = _clk_spll_enable,
588 .disable = _clk_spll_disable,
589};
590
591static unsigned long get_cpu_clk(struct clk *clk)
592{
593 u32 div;
594 unsigned long rate;
595
596 if (mx27_revision() >= CHIP_REV_2_0)
597 div = (CSCR() & CCM_CSCR_ARM_MASK) >> CCM_CSCR_ARM_OFFSET;
598 else
599 div = (CSCR() & CCM_CSCR_PRESC_MASK) >> CCM_CSCR_PRESC_OFFSET;
600
601 rate = clk_get_rate(clk->parent);
602 return rate / (div + 1);
603}
604
605static struct clk cpu_clk = {
606 .name = "cpu_clk",
607 .parent = &mpll_main_clk[1],
608 .set_parent = _clk_cpu_set_parent,
609 .round_rate = _clk_cpu_round_rate,
610 .get_rate = get_cpu_clk,
611 .set_rate = _clk_cpu_set_rate,
612};
613
614static unsigned long get_ahb_clk(struct clk *clk)
615{
616 unsigned long rate;
617 unsigned long bclk_pdf;
618
619 if (mx27_revision() >= CHIP_REV_2_0)
620 bclk_pdf = (CSCR() & CCM_CSCR_AHB_MASK)
621 >> CCM_CSCR_AHB_OFFSET;
622 else
623 bclk_pdf = (CSCR() & CCM_CSCR_BCLK_MASK)
624 >> CCM_CSCR_BCLK_OFFSET;
625
626 rate = clk_get_rate(clk->parent);
627 return rate / (bclk_pdf + 1);
628}
629
630static struct clk ahb_clk = {
631 .name = "ahb_clk",
632 .parent = &mpll_main_clk[1],
633 .get_rate = get_ahb_clk,
634};
635
636static unsigned long get_ipg_clk(struct clk *clk)
637{
638 unsigned long rate;
639 unsigned long ipg_pdf;
640
641 if (mx27_revision() >= CHIP_REV_2_0)
642 return clk_get_rate(clk->parent);
643 else
644 ipg_pdf = (CSCR() & CCM_CSCR_IPDIV) >> CCM_CSCR_IPDIV_OFFSET;
645
646 rate = clk_get_rate(clk->parent);
647 return rate / (ipg_pdf + 1);
648}
649
650static struct clk ipg_clk = {
651 .name = "ipg_clk",
652 .parent = &ahb_clk,
653 .get_rate = get_ipg_clk,
654};
655
656static unsigned long _clk_perclkx_recalc(struct clk *clk)
657{
658 unsigned long perclk_pdf;
659 unsigned long parent_rate;
660
661 parent_rate = clk_get_rate(clk->parent);
662
663 if (clk->id < 0 || clk->id > 3)
664 return 0;
665
666 perclk_pdf = (PCDR1() >> (clk->id << 3)) & CCM_PCDR1_PERDIV1_MASK;
667
668 return parent_rate / (perclk_pdf + 1);
669}
670
671static struct clk per_clk[] = {
672 {
673 .name = "per_clk",
674 .id = 0,
675 .parent = &mpll_main_clk[1],
676 .get_rate = _clk_perclkx_recalc,
677 .enable = _clk_enable,
678 .enable_reg = CCM_PCCR1,
679 .enable_shift = CCM_PCCR1_PERCLK1_OFFSET,
680 .disable = _clk_disable,
681 }, {
682 .name = "per_clk",
683 .id = 1,
684 .parent = &mpll_main_clk[1],
685 .get_rate = _clk_perclkx_recalc,
686 .enable = _clk_enable,
687 .enable_reg = CCM_PCCR1,
688 .enable_shift = CCM_PCCR1_PERCLK2_OFFSET,
689 .disable = _clk_disable,
690 }, {
691 .name = "per_clk",
692 .id = 2,
693 .parent = &mpll_main_clk[1],
694 .round_rate = _clk_perclkx_round_rate,
695 .set_rate = _clk_perclkx_set_rate,
696 .get_rate = _clk_perclkx_recalc,
697 .enable = _clk_enable,
698 .enable_reg = CCM_PCCR1,
699 .enable_shift = CCM_PCCR1_PERCLK3_OFFSET,
700 .disable = _clk_disable,
701 }, {
702 .name = "per_clk",
703 .id = 3,
704 .parent = &mpll_main_clk[1],
705 .round_rate = _clk_perclkx_round_rate,
706 .set_rate = _clk_perclkx_set_rate,
707 .get_rate = _clk_perclkx_recalc,
708 .enable = _clk_enable,
709 .enable_reg = CCM_PCCR1,
710 .enable_shift = CCM_PCCR1_PERCLK4_OFFSET,
711 .disable = _clk_disable,
712 },
713};
714
715struct clk uart1_clk[] = {
716 {
717 .name = "uart_clk",
718 .id = 0,
719 .parent = &per_clk[0],
720 .secondary = &uart1_clk[1],
721 }, {
722 .name = "uart_ipg_clk",
723 .id = 0,
724 .parent = &ipg_clk,
725 .enable = _clk_enable,
726 .enable_reg = CCM_PCCR1,
727 .enable_shift = CCM_PCCR1_UART1_OFFSET,
728 .disable = _clk_disable,
729 },
730};
731
732struct clk uart2_clk[] = {
733 {
734 .name = "uart_clk",
735 .id = 1,
736 .parent = &per_clk[0],
737 .secondary = &uart2_clk[1],
738 }, {
739 .name = "uart_ipg_clk",
740 .id = 1,
741 .parent = &ipg_clk,
742 .enable = _clk_enable,
743 .enable_reg = CCM_PCCR1,
744 .enable_shift = CCM_PCCR1_UART2_OFFSET,
745 .disable = _clk_disable,
746 },
747};
748
749struct clk uart3_clk[] = {
750 {
751 .name = "uart_clk",
752 .id = 2,
753 .parent = &per_clk[0],
754 .secondary = &uart3_clk[1],
755 }, {
756 .name = "uart_ipg_clk",
757 .id = 2,
758 .parent = &ipg_clk,
759 .enable = _clk_enable,
760 .enable_reg = CCM_PCCR1,
761 .enable_shift = CCM_PCCR1_UART3_OFFSET,
762 .disable = _clk_disable,
763 },
764};
765
766struct clk uart4_clk[] = {
767 {
768 .name = "uart_clk",
769 .id = 3,
770 .parent = &per_clk[0],
771 .secondary = &uart4_clk[1],
772 }, {
773 .name = "uart_ipg_clk",
774 .id = 3,
775 .parent = &ipg_clk,
776 .enable = _clk_enable,
777 .enable_reg = CCM_PCCR1,
778 .enable_shift = CCM_PCCR1_UART4_OFFSET,
779 .disable = _clk_disable,
780 },
781};
782
783struct clk uart5_clk[] = {
784 {
785 .name = "uart_clk",
786 .id = 4,
787 .parent = &per_clk[0],
788 .secondary = &uart5_clk[1],
789 }, {
790 .name = "uart_ipg_clk",
791 .id = 4,
792 .parent = &ipg_clk,
793 .enable = _clk_enable,
794 .enable_reg = CCM_PCCR1,
795 .enable_shift = CCM_PCCR1_UART5_OFFSET,
796 .disable = _clk_disable,
797 },
798};
799
800struct clk uart6_clk[] = {
801 {
802 .name = "uart_clk",
803 .id = 5,
804 .parent = &per_clk[0],
805 .secondary = &uart6_clk[1],
806 }, {
807 .name = "uart_ipg_clk",
808 .id = 5,
809 .parent = &ipg_clk,
810 .enable = _clk_enable,
811 .enable_reg = CCM_PCCR1,
812 .enable_shift = CCM_PCCR1_UART6_OFFSET,
813 .disable = _clk_disable,
814 },
815};
816
817static struct clk gpt1_clk[] = {
818 {
819 .name = "gpt_clk",
820 .id = 0,
821 .parent = &per_clk[0],
822 .secondary = &gpt1_clk[1],
823 }, {
824 .name = "gpt_ipg_clk",
825 .id = 0,
826 .parent = &ipg_clk,
827 .enable = _clk_enable,
828 .enable_reg = CCM_PCCR0,
829 .enable_shift = CCM_PCCR0_GPT1_OFFSET,
830 .disable = _clk_disable,
831 },
832};
833
834static struct clk gpt2_clk[] = {
835 {
836 .name = "gpt_clk",
837 .id = 1,
838 .parent = &per_clk[0],
839 .secondary = &gpt2_clk[1],
840 }, {
841 .name = "gpt_ipg_clk",
842 .id = 1,
843 .parent = &ipg_clk,
844 .enable = _clk_enable,
845 .enable_reg = CCM_PCCR0,
846 .enable_shift = CCM_PCCR0_GPT2_OFFSET,
847 .disable = _clk_disable,
848 },
849};
850
851static struct clk gpt3_clk[] = {
852 {
853 .name = "gpt_clk",
854 .id = 2,
855 .parent = &per_clk[0],
856 .secondary = &gpt3_clk[1],
857 }, {
858 .name = "gpt_ipg_clk",
859 .id = 2,
860 .parent = &ipg_clk,
861 .enable = _clk_enable,
862 .enable_reg = CCM_PCCR0,
863 .enable_shift = CCM_PCCR0_GPT3_OFFSET,
864 .disable = _clk_disable,
865 },
866};
867
868static struct clk gpt4_clk[] = {
869 {
870 .name = "gpt_clk",
871 .id = 3,
872 .parent = &per_clk[0],
873 .secondary = &gpt4_clk[1],
874 }, {
875 .name = "gpt_ipg_clk",
876 .id = 3,
877 .parent = &ipg_clk,
878 .enable = _clk_enable,
879 .enable_reg = CCM_PCCR0,
880 .enable_shift = CCM_PCCR0_GPT4_OFFSET,
881 .disable = _clk_disable,
882 },
883};
884
885static struct clk gpt5_clk[] = {
886 {
887 .name = "gpt_clk",
888 .id = 4,
889 .parent = &per_clk[0],
890 .secondary = &gpt5_clk[1],
891 }, {
892 .name = "gpt_ipg_clk",
893 .id = 4,
894 .parent = &ipg_clk,
895 .enable = _clk_enable,
896 .enable_reg = CCM_PCCR0,
897 .enable_shift = CCM_PCCR0_GPT5_OFFSET,
898 .disable = _clk_disable,
899 },
900};
901
902static struct clk gpt6_clk[] = {
903 {
904 .name = "gpt_clk",
905 .id = 5,
906 .parent = &per_clk[0],
907 .secondary = &gpt6_clk[1],
908 }, {
909 .name = "gpt_ipg_clk",
910 .id = 5,
911 .parent = &ipg_clk,
912 .enable = _clk_enable,
913 .enable_reg = CCM_PCCR0,
914 .enable_shift = CCM_PCCR0_GPT6_OFFSET,
915 .disable = _clk_disable,
916 },
917};
918
919static struct clk pwm_clk[] = {
920 {
921 .name = "pwm_clk",
922 .parent = &per_clk[0],
923 .secondary = &pwm_clk[1],
924 }, {
925 .name = "pwm_clk",
926 .parent = &ipg_clk,
927 .enable = _clk_enable,
928 .enable_reg = CCM_PCCR0,
929 .enable_shift = CCM_PCCR0_PWM_OFFSET,
930 .disable = _clk_disable,
931 },
932};
933
934static struct clk sdhc1_clk[] = {
935 {
936 .name = "sdhc_clk",
937 .id = 0,
938 .parent = &per_clk[1],
939 .secondary = &sdhc1_clk[1],
940 }, {
941 .name = "sdhc_ipg_clk",
942 .id = 0,
943 .parent = &ipg_clk,
944 .enable = _clk_enable,
945 .enable_reg = CCM_PCCR0,
946 .enable_shift = CCM_PCCR0_SDHC1_OFFSET,
947 .disable = _clk_disable,
948 },
949};
950
951static struct clk sdhc2_clk[] = {
952 {
953 .name = "sdhc_clk",
954 .id = 1,
955 .parent = &per_clk[1],
956 .secondary = &sdhc2_clk[1],
957 }, {
958 .name = "sdhc_ipg_clk",
959 .id = 1,
960 .parent = &ipg_clk,
961 .enable = _clk_enable,
962 .enable_reg = CCM_PCCR0,
963 .enable_shift = CCM_PCCR0_SDHC2_OFFSET,
964 .disable = _clk_disable,
965 },
966};
967
968static struct clk sdhc3_clk[] = {
969 {
970 .name = "sdhc_clk",
971 .id = 2,
972 .parent = &per_clk[1],
973 .secondary = &sdhc3_clk[1],
974 }, {
975 .name = "sdhc_ipg_clk",
976 .id = 2,
977 .parent = &ipg_clk,
978 .enable = _clk_enable,
979 .enable_reg = CCM_PCCR0,
980 .enable_shift = CCM_PCCR0_SDHC3_OFFSET,
981 .disable = _clk_disable,
982 },
983};
984
985static struct clk cspi1_clk[] = {
986 {
987 .name = "cspi_clk",
988 .id = 0,
989 .parent = &per_clk[1],
990 .secondary = &cspi1_clk[1],
991 }, {
992 .name = "cspi_ipg_clk",
993 .id = 0,
994 .parent = &ipg_clk,
995 .enable = _clk_enable,
996 .enable_reg = CCM_PCCR0,
997 .enable_shift = CCM_PCCR0_CSPI1_OFFSET,
998 .disable = _clk_disable,
999 },
1000};
1001
1002static struct clk cspi2_clk[] = {
1003 {
1004 .name = "cspi_clk",
1005 .id = 1,
1006 .parent = &per_clk[1],
1007 .secondary = &cspi2_clk[1],
1008 }, {
1009 .name = "cspi_ipg_clk",
1010 .id = 1,
1011 .parent = &ipg_clk,
1012 .enable = _clk_enable,
1013 .enable_reg = CCM_PCCR0,
1014 .enable_shift = CCM_PCCR0_CSPI2_OFFSET,
1015 .disable = _clk_disable,
1016 },
1017};
1018
1019static struct clk cspi3_clk[] = {
1020 {
1021 .name = "cspi_clk",
1022 .id = 2,
1023 .parent = &per_clk[1],
1024 .secondary = &cspi3_clk[1],
1025 }, {
1026 .name = "cspi_ipg_clk",
1027 .id = 2,
1028 .parent = &ipg_clk,
1029 .enable = _clk_enable,
1030 .enable_reg = CCM_PCCR0,
1031 .enable_shift = CCM_PCCR0_CSPI3_OFFSET,
1032 .disable = _clk_disable,
1033 },
1034};
1035
1036static struct clk lcdc_clk[] = {
1037 {
1038 .name = "lcdc_clk",
1039 .parent = &per_clk[2],
1040 .secondary = &lcdc_clk[1],
1041 .round_rate = _clk_parent_round_rate,
1042 .set_rate = _clk_parent_set_rate,
1043 }, {
1044 .name = "lcdc_ipg_clk",
1045 .parent = &ipg_clk,
1046 .secondary = &lcdc_clk[2],
1047 .enable = _clk_enable,
1048 .enable_reg = CCM_PCCR0,
1049 .enable_shift = CCM_PCCR0_LCDC_OFFSET,
1050 .disable = _clk_disable,
1051 }, {
1052 .name = "lcdc_ahb_clk",
1053 .parent = &ahb_clk,
1054 .enable = _clk_enable,
1055 .enable_reg = CCM_PCCR1,
1056 .enable_shift = CCM_PCCR1_HCLK_LCDC_OFFSET,
1057 .disable = _clk_disable,
1058 },
1059};
1060
1061static struct clk csi_clk[] = {
1062 {
1063 .name = "csi_perclk",
1064 .parent = &per_clk[3],
1065 .secondary = &csi_clk[1],
1066 .round_rate = _clk_parent_round_rate,
1067 .set_rate = _clk_parent_set_rate,
1068 }, {
1069 .name = "csi_ahb_clk",
1070 .parent = &ahb_clk,
1071 .enable = _clk_enable,
1072 .enable_reg = CCM_PCCR1,
1073 .enable_shift = CCM_PCCR1_HCLK_CSI_OFFSET,
1074 .disable = _clk_disable,
1075 },
1076};
1077
1078static struct clk usb_clk[] = {
1079 {
1080 .name = "usb_clk",
1081 .parent = &spll_clk,
1082 .get_rate = _clk_usb_recalc,
1083 .enable = _clk_enable,
1084 .enable_reg = CCM_PCCR1,
1085 .enable_shift = CCM_PCCR1_USBOTG_OFFSET,
1086 .disable = _clk_disable,
1087 }, {
1088 .name = "usb_ahb_clk",
1089 .parent = &ahb_clk,
1090 .enable = _clk_enable,
1091 .enable_reg = CCM_PCCR1,
1092 .enable_shift = CCM_PCCR1_HCLK_USBOTG_OFFSET,
1093 .disable = _clk_disable,
1094 }
1095};
1096
1097static struct clk ssi1_clk[] = {
1098 {
1099 .name = "ssi_clk",
1100 .id = 0,
1101 .parent = &mpll_main_clk[1],
1102 .secondary = &ssi1_clk[1],
1103 .get_rate = _clk_ssi1_recalc,
1104 .enable = _clk_enable,
1105 .enable_reg = CCM_PCCR1,
1106 .enable_shift = CCM_PCCR1_SSI1_BAUD_OFFSET,
1107 .disable = _clk_disable,
1108 }, {
1109 .name = "ssi_ipg_clk",
1110 .id = 0,
1111 .parent = &ipg_clk,
1112 .enable = _clk_enable,
1113 .enable_reg = CCM_PCCR0,
1114 .enable_shift = CCM_PCCR0_SSI1_IPG_OFFSET,
1115 .disable = _clk_disable,
1116 },
1117};
1118
1119static struct clk ssi2_clk[] = {
1120 {
1121 .name = "ssi_clk",
1122 .id = 1,
1123 .parent = &mpll_main_clk[1],
1124 .secondary = &ssi2_clk[1],
1125 .get_rate = _clk_ssi2_recalc,
1126 .enable = _clk_enable,
1127 .enable_reg = CCM_PCCR1,
1128 .enable_shift = CCM_PCCR1_SSI2_BAUD_OFFSET,
1129 .disable = _clk_disable,
1130 }, {
1131 .name = "ssi_ipg_clk",
1132 .id = 1,
1133 .parent = &ipg_clk,
1134 .enable = _clk_enable,
1135 .enable_reg = CCM_PCCR0,
1136 .enable_shift = CCM_PCCR0_SSI2_IPG_OFFSET,
1137 .disable = _clk_disable,
1138 },
1139};
1140
1141static struct clk nfc_clk = {
1142 .name = "nfc_clk",
1143 .parent = &cpu_clk,
1144 .get_rate = _clk_nfc_recalc,
1145 .enable = _clk_enable,
1146 .enable_reg = CCM_PCCR1,
1147 .enable_shift = CCM_PCCR1_NFC_BAUD_OFFSET,
1148 .disable = _clk_disable,
1149};
1150
1151static struct clk vpu_clk = {
1152 .name = "vpu_clk",
1153 .parent = &mpll_main_clk[1],
1154 .get_rate = _clk_vpu_recalc,
1155 .enable = _clk_vpu_enable,
1156 .disable = _clk_vpu_disable,
1157};
1158
1159static struct clk dma_clk = {
1160 .name = "dma_clk",
1161 .parent = &ahb_clk,
1162 .enable = _clk_dma_enable,
1163 .disable = _clk_dma_disable,
1164};
1165
1166static struct clk rtic_clk = {
1167 .name = "rtic_clk",
1168 .parent = &ahb_clk,
1169 .enable = _clk_rtic_enable,
1170 .disable = _clk_rtic_disable,
1171};
1172
1173static struct clk brom_clk = {
1174 .name = "brom_clk",
1175 .parent = &ahb_clk,
1176 .enable = _clk_enable,
1177 .enable_reg = CCM_PCCR1,
1178 .enable_shift = CCM_PCCR1_HCLK_BROM_OFFSET,
1179 .disable = _clk_disable,
1180};
1181
1182static struct clk emma_clk = {
1183 .name = "emma_clk",
1184 .parent = &ahb_clk,
1185 .enable = _clk_emma_enable,
1186 .disable = _clk_emma_disable,
1187};
1188
1189static struct clk slcdc_clk = {
1190 .name = "slcdc_clk",
1191 .parent = &ahb_clk,
1192 .enable = _clk_slcdc_enable,
1193 .disable = _clk_slcdc_disable,
1194};
1195
1196static struct clk fec_clk = {
1197 .name = "fec_clk",
1198 .parent = &ahb_clk,
1199 .enable = _clk_fec_enable,
1200 .disable = _clk_fec_disable,
1201};
1202
1203static struct clk emi_clk = {
1204 .name = "emi_clk",
1205 .parent = &ahb_clk,
1206 .enable = _clk_enable,
1207 .enable_reg = CCM_PCCR1,
1208 .enable_shift = CCM_PCCR1_HCLK_EMI_OFFSET,
1209 .disable = _clk_disable,
1210};
1211
1212static struct clk sahara2_clk = {
1213 .name = "sahara_clk",
1214 .parent = &ahb_clk,
1215 .enable = _clk_sahara2_enable,
1216 .disable = _clk_sahara2_disable,
1217};
1218
1219static struct clk ata_clk = {
1220 .name = "ata_clk",
1221 .parent = &ahb_clk,
1222 .enable = _clk_enable,
1223 .enable_reg = CCM_PCCR1,
1224 .enable_shift = CCM_PCCR1_HCLK_ATA_OFFSET,
1225 .disable = _clk_disable,
1226};
1227
1228static struct clk mstick1_clk = {
1229 .name = "mstick1_clk",
1230 .parent = &ipg_clk,
1231 .enable = _clk_mstick1_enable,
1232 .disable = _clk_mstick1_disable,
1233};
1234
1235static struct clk wdog_clk = {
1236 .name = "wdog_clk",
1237 .parent = &ipg_clk,
1238 .enable = _clk_enable,
1239 .enable_reg = CCM_PCCR1,
1240 .enable_shift = CCM_PCCR1_WDT_OFFSET,
1241 .disable = _clk_disable,
1242};
1243
1244static struct clk gpio_clk = {
1245 .name = "gpio_clk",
1246 .parent = &ipg_clk,
1247 .enable = _clk_enable,
1248 .enable_reg = CCM_PCCR1,
1249 .enable_shift = CCM_PCCR0_GPIO_OFFSET,
1250 .disable = _clk_disable,
1251};
1252
1253static struct clk i2c_clk[] = {
1254 {
1255 .name = "i2c_clk",
1256 .id = 0,
1257 .parent = &ipg_clk,
1258 .enable = _clk_enable,
1259 .enable_reg = CCM_PCCR0,
1260 .enable_shift = CCM_PCCR0_I2C1_OFFSET,
1261 .disable = _clk_disable,
1262 }, {
1263 .name = "i2c_clk",
1264 .id = 1,
1265 .parent = &ipg_clk,
1266 .enable = _clk_enable,
1267 .enable_reg = CCM_PCCR0,
1268 .enable_shift = CCM_PCCR0_I2C2_OFFSET,
1269 .disable = _clk_disable,
1270 },
1271};
1272
1273static struct clk iim_clk = {
1274 .name = "iim_clk",
1275 .parent = &ipg_clk,
1276 .enable = _clk_enable,
1277 .enable_reg = CCM_PCCR0,
1278 .enable_shift = CCM_PCCR0_IIM_OFFSET,
1279 .disable = _clk_disable,
1280};
1281
1282static struct clk kpp_clk = {
1283 .name = "kpp_clk",
1284 .parent = &ipg_clk,
1285 .enable = _clk_enable,
1286 .enable_reg = CCM_PCCR0,
1287 .enable_shift = CCM_PCCR0_KPP_OFFSET,
1288 .disable = _clk_disable,
1289};
1290
1291static struct clk owire_clk = {
1292 .name = "owire_clk",
1293 .parent = &ipg_clk,
1294 .enable = _clk_enable,
1295 .enable_reg = CCM_PCCR0,
1296 .enable_shift = CCM_PCCR0_OWIRE_OFFSET,
1297 .disable = _clk_disable,
1298};
1299
1300static struct clk rtc_clk = {
1301 .name = "rtc_clk",
1302 .parent = &ipg_clk,
1303 .enable = _clk_enable,
1304 .enable_reg = CCM_PCCR0,
1305 .enable_shift = CCM_PCCR0_RTC_OFFSET,
1306 .disable = _clk_disable,
1307};
1308
1309static struct clk scc_clk = {
1310 .name = "scc_clk",
1311 .parent = &ipg_clk,
1312 .enable = _clk_enable,
1313 .enable_reg = CCM_PCCR0,
1314 .enable_shift = CCM_PCCR0_SCC_OFFSET,
1315 .disable = _clk_disable,
1316};
1317
1318static unsigned long _clk_clko_round_rate(struct clk *clk, unsigned long rate)
1319{
1320 u32 div;
1321 unsigned long parent_rate;
1322
1323 parent_rate = clk_get_rate(clk->parent);
1324 div = parent_rate / rate;
1325 if (parent_rate % rate)
1326 div++;
1327
1328 if (div > 8)
1329 div = 8;
1330
1331 return parent_rate / div;
1332}
1333
1334static int _clk_clko_set_rate(struct clk *clk, unsigned long rate)
1335{
1336 u32 reg;
1337 u32 div;
1338 unsigned long parent_rate;
1339
1340 parent_rate = clk_get_rate(clk->parent);
1341
1342 div = parent_rate / rate;
1343
1344 if (div > 8 || div < 1 || ((parent_rate / div) != rate))
1345 return -EINVAL;
1346 div--;
1347
1348 reg = __raw_readl(CCM_PCDR0) & ~CCM_PCDR0_CLKODIV_MASK;
1349 reg |= div << CCM_PCDR0_CLKODIV_OFFSET;
1350 __raw_writel(reg, CCM_PCDR0);
1351
1352 return 0;
1353}
1354
1355static unsigned long _clk_clko_recalc(struct clk *clk)
1356{
1357 u32 div;
1358 unsigned long parent_rate;
1359
1360 parent_rate = clk_get_rate(clk->parent);
1361
1362 div = __raw_readl(CCM_PCDR0) & CCM_PCDR0_CLKODIV_MASK >>
1363 CCM_PCDR0_CLKODIV_OFFSET;
1364 div++;
1365
1366 return parent_rate / div;
1367}
1368
1369static int _clk_clko_set_parent(struct clk *clk, struct clk *parent)
1370{
1371 u32 reg;
1372
1373 reg = __raw_readl(CCM_CCSR) & ~CCM_CCSR_CLKOSEL_MASK;
1374
1375 if (parent == &ckil_clk)
1376 reg |= 0 << CCM_CCSR_CLKOSEL_OFFSET;
1377 else if (parent == &ckih_clk)
1378 reg |= 2 << CCM_CCSR_CLKOSEL_OFFSET;
1379 else if (parent == mpll_clk.parent)
1380 reg |= 3 << CCM_CCSR_CLKOSEL_OFFSET;
1381 else if (parent == spll_clk.parent)
1382 reg |= 4 << CCM_CCSR_CLKOSEL_OFFSET;
1383 else if (parent == &mpll_clk)
1384 reg |= 5 << CCM_CCSR_CLKOSEL_OFFSET;
1385 else if (parent == &spll_clk)
1386 reg |= 6 << CCM_CCSR_CLKOSEL_OFFSET;
1387 else if (parent == &cpu_clk)
1388 reg |= 7 << CCM_CCSR_CLKOSEL_OFFSET;
1389 else if (parent == &ahb_clk)
1390 reg |= 8 << CCM_CCSR_CLKOSEL_OFFSET;
1391 else if (parent == &ipg_clk)
1392 reg |= 9 << CCM_CCSR_CLKOSEL_OFFSET;
1393 else if (parent == &per_clk[0])
1394 reg |= 0xA << CCM_CCSR_CLKOSEL_OFFSET;
1395 else if (parent == &per_clk[1])
1396 reg |= 0xB << CCM_CCSR_CLKOSEL_OFFSET;
1397 else if (parent == &per_clk[2])
1398 reg |= 0xC << CCM_CCSR_CLKOSEL_OFFSET;
1399 else if (parent == &per_clk[3])
1400 reg |= 0xD << CCM_CCSR_CLKOSEL_OFFSET;
1401 else if (parent == &ssi1_clk[0])
1402 reg |= 0xE << CCM_CCSR_CLKOSEL_OFFSET;
1403 else if (parent == &ssi2_clk[0])
1404 reg |= 0xF << CCM_CCSR_CLKOSEL_OFFSET;
1405 else if (parent == &nfc_clk)
1406 reg |= 0x10 << CCM_CCSR_CLKOSEL_OFFSET;
1407 else if (parent == &mstick1_clk)
1408 reg |= 0x11 << CCM_CCSR_CLKOSEL_OFFSET;
1409 else if (parent == &vpu_clk)
1410 reg |= 0x12 << CCM_CCSR_CLKOSEL_OFFSET;
1411 else if (parent == &usb_clk[0])
1412 reg |= 0x15 << CCM_CCSR_CLKOSEL_OFFSET;
1413 else
1414 return -EINVAL;
1415
1416 __raw_writel(reg, CCM_CCSR);
1417
1418 return 0;
1419}
1420
1421static int _clk_clko_enable(struct clk *clk)
1422{
1423 u32 reg;
1424
1425 reg = __raw_readl(CCM_PCDR0) | CCM_PCDR0_CLKO_EN;
1426 __raw_writel(reg, CCM_PCDR0);
1427
1428 return 0;
1429}
1430
1431static void _clk_clko_disable(struct clk *clk)
1432{
1433 u32 reg;
1434
1435 reg = __raw_readl(CCM_PCDR0) & ~CCM_PCDR0_CLKO_EN;
1436 __raw_writel(reg, CCM_PCDR0);
1437}
1438
1439static struct clk clko_clk = {
1440 .name = "clko_clk",
1441 .get_rate = _clk_clko_recalc,
1442 .set_rate = _clk_clko_set_rate,
1443 .round_rate = _clk_clko_round_rate,
1444 .set_parent = _clk_clko_set_parent,
1445 .enable = _clk_clko_enable,
1446 .disable = _clk_clko_disable,
1447};
1448
1449static struct clk *mxc_clks[] = {
1450 &ckih_clk,
1451 &ckil_clk,
1452 &mpll_clk,
1453 &mpll_main_clk[0],
1454 &mpll_main_clk[1],
1455 &spll_clk,
1456 &cpu_clk,
1457 &ahb_clk,
1458 &ipg_clk,
1459 &per_clk[0],
1460 &per_clk[1],
1461 &per_clk[2],
1462 &per_clk[3],
1463 &clko_clk,
1464 &uart1_clk[0],
1465 &uart1_clk[1],
1466 &uart2_clk[0],
1467 &uart2_clk[1],
1468 &uart3_clk[0],
1469 &uart3_clk[1],
1470 &uart4_clk[0],
1471 &uart4_clk[1],
1472 &uart5_clk[0],
1473 &uart5_clk[1],
1474 &uart6_clk[0],
1475 &uart6_clk[1],
1476 &gpt1_clk[0],
1477 &gpt1_clk[1],
1478 &gpt2_clk[0],
1479 &gpt2_clk[1],
1480 &gpt3_clk[0],
1481 &gpt3_clk[1],
1482 &gpt4_clk[0],
1483 &gpt4_clk[1],
1484 &gpt5_clk[0],
1485 &gpt5_clk[1],
1486 &gpt6_clk[0],
1487 &gpt6_clk[1],
1488 &pwm_clk[0],
1489 &pwm_clk[1],
1490 &sdhc1_clk[0],
1491 &sdhc1_clk[1],
1492 &sdhc2_clk[0],
1493 &sdhc2_clk[1],
1494 &sdhc3_clk[0],
1495 &sdhc3_clk[1],
1496 &cspi1_clk[0],
1497 &cspi1_clk[1],
1498 &cspi2_clk[0],
1499 &cspi2_clk[1],
1500 &cspi3_clk[0],
1501 &cspi3_clk[1],
1502 &lcdc_clk[0],
1503 &lcdc_clk[1],
1504 &lcdc_clk[2],
1505 &csi_clk[0],
1506 &csi_clk[1],
1507 &usb_clk[0],
1508 &usb_clk[1],
1509 &ssi1_clk[0],
1510 &ssi1_clk[1],
1511 &ssi2_clk[0],
1512 &ssi2_clk[1],
1513 &nfc_clk,
1514 &vpu_clk,
1515 &dma_clk,
1516 &rtic_clk,
1517 &brom_clk,
1518 &emma_clk,
1519 &slcdc_clk,
1520 &fec_clk,
1521 &emi_clk,
1522 &sahara2_clk,
1523 &ata_clk,
1524 &mstick1_clk,
1525 &wdog_clk,
1526 &gpio_clk,
1527 &i2c_clk[0],
1528 &i2c_clk[1],
1529 &iim_clk,
1530 &kpp_clk,
1531 &owire_clk,
1532 &rtc_clk,
1533 &scc_clk,
1534};
1535
1536void __init change_external_low_reference(unsigned long new_ref)
1537{
1538 external_low_reference = new_ref;
1539}
1540
1541unsigned long __init clk_early_get_timer_rate(void)
1542{
1543 return clk_get_rate(&per_clk[0]);
1544}
1545
1546static void __init probe_mxc_clocks(void)
1547{
1548 int i;
1549
1550 if (mx27_revision() >= CHIP_REV_2_0) {
1551 if (CSCR() & 0x8000)
1552 cpu_clk.parent = &mpll_main_clk[0];
1553
1554 if (!(CSCR() & 0x00800000))
1555 ssi2_clk[0].parent = &spll_clk;
1556
1557 if (!(CSCR() & 0x00400000))
1558 ssi1_clk[0].parent = &spll_clk;
1559
1560 if (!(CSCR() & 0x00200000))
1561 vpu_clk.parent = &spll_clk;
1562 } else {
1563 cpu_clk.parent = &mpll_clk;
1564 cpu_clk.set_parent = NULL;
1565 cpu_clk.round_rate = NULL;
1566 cpu_clk.set_rate = NULL;
1567 ahb_clk.parent = &mpll_clk;
1568
1569 for (i = 0; i < sizeof(per_clk) / sizeof(per_clk[0]); i++)
1570 per_clk[i].parent = &mpll_clk;
1571
1572 ssi1_clk[0].parent = &mpll_clk;
1573 ssi2_clk[0].parent = &mpll_clk;
1574
1575 vpu_clk.parent = &mpll_clk;
1576 }
1577}
1578
1579/*
1580 * must be called very early to get information about the
1581 * available clock rate when the timer framework starts
1582 */
1583int __init mxc_clocks_init(unsigned long fref)
1584{
1585 u32 cscr;
1586 struct clk **clkp;
1587
1588 external_high_reference = fref;
1589
1590 /* detect clock reference for both system PLL */
1591 cscr = CSCR();
1592 if (cscr & CCM_CSCR_MCU)
1593 mpll_clk.parent = &ckih_clk;
1594 else
1595 mpll_clk.parent = &ckil_clk;
1596
1597 if (cscr & CCM_CSCR_SP)
1598 spll_clk.parent = &ckih_clk;
1599 else
1600 spll_clk.parent = &ckil_clk;
1601
1602 probe_mxc_clocks();
1603
1604 per_clk[0].enable(&per_clk[0]);
1605 gpt1_clk[1].enable(&gpt1_clk[1]);
1606
1607 for (clkp = mxc_clks; clkp < mxc_clks + ARRAY_SIZE(mxc_clks); clkp++)
1608 clk_register(*clkp);
1609
1610 /* Turn off all possible clocks */
1611 __raw_writel(CCM_PCCR0_GPT1_MASK, CCM_PCCR0);
1612 __raw_writel(CCM_PCCR1_PERCLK1_MASK | CCM_PCCR1_HCLK_EMI_MASK,
1613 CCM_PCCR1);
1614 spll_clk.disable(&spll_clk);
1615
1616 /* This will propagate to all children and init all the clock rates */
1617
1618 clk_enable(&emi_clk);
1619 clk_enable(&gpio_clk);
1620 clk_enable(&iim_clk);
1621 clk_enable(&gpt1_clk[0]);
1622#ifdef CONFIG_DEBUG_LL_CONSOLE
1623 clk_enable(&uart1_clk[0]);
1624#endif
1625 return 0;
1626}
diff --git a/arch/arm/mach-mx2/cpu_imx27.c b/arch/arm/mach-mx2/cpu_imx27.c
new file mode 100644
index 000000000000..d6b5c2e3377f
--- /dev/null
+++ b/arch/arm/mach-mx2/cpu_imx27.c
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20/*
21 * i.MX27 specific CPU detection code
22 */
23
24#include <linux/io.h>
25#include <linux/module.h>
26
27#include <asm/hardware.h>
28
29#include "crm_regs.h"
30
31static int cpu_silicon_rev = -1;
32static int cpu_partnumber;
33
34static void query_silicon_parameter(void)
35{
36 u32 val;
37 /*
38 * now we have access to the IO registers. As we need
39 * the silicon revision very early we read it here to
40 * avoid any further hooks
41 */
42 val = __raw_readl(IO_ADDRESS(SYSCTRL_BASE_ADDR) + SYS_CHIP_ID);
43
44 cpu_silicon_rev = (int)(val >> 28);
45 cpu_partnumber = (int)((val >> 12) & 0xFFFF);
46}
47
48/*
49 * Returns:
50 * the silicon revision of the cpu
51 * -EINVAL - not a mx27
52 */
53int mx27_revision(void)
54{
55 if (cpu_silicon_rev == -1)
56 query_silicon_parameter();
57
58 if (cpu_partnumber != 0x8821)
59 return -EINVAL;
60
61 return cpu_silicon_rev;
62}
63EXPORT_SYMBOL(mx27_revision);
diff --git a/arch/arm/mach-mx2/crm_regs.h b/arch/arm/mach-mx2/crm_regs.h
new file mode 100644
index 000000000000..a40a9b950ce9
--- /dev/null
+++ b/arch/arm/mach-mx2/crm_regs.h
@@ -0,0 +1,273 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#ifndef __ARCH_ARM_MACH_MX2_CRM_REGS_H__
21#define __ARCH_ARM_MACH_MX2_CRM_REGS_H__
22
23#include <asm/arch/hardware.h>
24
25/* Register offsets */
26#define CCM_CSCR (IO_ADDRESS(CCM_BASE_ADDR) + 0x0)
27#define CCM_MPCTL0 (IO_ADDRESS(CCM_BASE_ADDR) + 0x4)
28#define CCM_MPCTL1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x8)
29#define CCM_SPCTL0 (IO_ADDRESS(CCM_BASE_ADDR) + 0xC)
30#define CCM_SPCTL1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x10)
31#define CCM_OSC26MCTL (IO_ADDRESS(CCM_BASE_ADDR) + 0x14)
32#define CCM_PCDR0 (IO_ADDRESS(CCM_BASE_ADDR) + 0x18)
33#define CCM_PCDR1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x1c)
34#define CCM_PCCR0 (IO_ADDRESS(CCM_BASE_ADDR) + 0x20)
35#define CCM_PCCR1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x24)
36#define CCM_CCSR (IO_ADDRESS(CCM_BASE_ADDR) + 0x28)
37#define CCM_PMCTL (IO_ADDRESS(CCM_BASE_ADDR) + 0x2c)
38#define CCM_PMCOUNT (IO_ADDRESS(CCM_BASE_ADDR) + 0x30)
39#define CCM_WKGDCTL (IO_ADDRESS(CCM_BASE_ADDR) + 0x34)
40
41#define CCM_CSCR_USB_OFFSET 28
42#define CCM_CSCR_USB_MASK (0x7 << 28)
43#define CCM_CSCR_SD_OFFSET 24
44#define CCM_CSCR_SD_MASK (0x3 << 24)
45#define CCM_CSCR_SSI2 (1 << 23)
46#define CCM_CSCR_SSI2_OFFSET 23
47#define CCM_CSCR_SSI1 (1 << 22)
48#define CCM_CSCR_SSI1_OFFSET 22
49#define CCM_CSCR_VPU (1 << 21)
50#define CCM_CSCR_VPU_OFFSET 21
51#define CCM_CSCR_MSHC (1 << 20)
52#define CCM_CSCR_SPLLRES (1 << 19)
53#define CCM_CSCR_MPLLRES (1 << 18)
54#define CCM_CSCR_SP (1 << 17)
55#define CCM_CSCR_MCU (1 << 16)
56/* CCM_CSCR_ARM_xxx just be avaliable on i.MX27 TO2*/
57#define CCM_CSCR_ARM_SRC (1 << 15)
58#define CCM_CSCR_ARM_OFFSET 12
59#define CCM_CSCR_ARM_MASK (0x3 << 12)
60/* CCM_CSCR_ARM_xxx just be avaliable on i.MX27 TO2*/
61#define CCM_CSCR_PRESC_OFFSET 13
62#define CCM_CSCR_PRESC_MASK (0x7 << 13)
63#define CCM_CSCR_BCLK_OFFSET 9
64#define CCM_CSCR_BCLK_MASK (0xf << 9)
65#define CCM_CSCR_IPDIV_OFFSET 8
66#define CCM_CSCR_IPDIV (1 << 8)
67/* CCM_CSCR_AHB_xxx just be avaliable on i.MX27 TO2*/
68#define CCM_CSCR_AHB_OFFSET 8
69#define CCM_CSCR_AHB_MASK (0x3 << 8)
70/* CCM_CSCR_AHB_xxx just be avaliable on i.MX27 TO2*/
71#define CCM_CSCR_OSC26MDIV (1 << 4)
72#define CCM_CSCR_OSC26M (1 << 3)
73#define CCM_CSCR_FPM (1 << 2)
74#define CCM_CSCR_SPEN (1 << 1)
75#define CCM_CSCR_MPEN 1
76
77#define CCM_MPCTL0_CPLM (1 << 31)
78#define CCM_MPCTL0_PD_OFFSET 26
79#define CCM_MPCTL0_PD_MASK (0xf << 26)
80#define CCM_MPCTL0_MFD_OFFSET 16
81#define CCM_MPCTL0_MFD_MASK (0x3ff << 16)
82#define CCM_MPCTL0_MFI_OFFSET 10
83#define CCM_MPCTL0_MFI_MASK (0xf << 10)
84#define CCM_MPCTL0_MFN_OFFSET 0
85#define CCM_MPCTL0_MFN_MASK 0x3ff
86
87#define CCM_MPCTL1_LF (1 << 15)
88#define CCM_MPCTL1_BRMO (1 << 6)
89
90#define CCM_SPCTL0_CPLM (1 << 31)
91#define CCM_SPCTL0_PD_OFFSET 26
92#define CCM_SPCTL0_PD_MASK (0xf << 26)
93#define CCM_SPCTL0_MFD_OFFSET 16
94#define CCM_SPCTL0_MFD_MASK (0x3ff << 16)
95#define CCM_SPCTL0_MFI_OFFSET 10
96#define CCM_SPCTL0_MFI_MASK (0xf << 10)
97#define CCM_SPCTL0_MFN_OFFSET 0
98#define CCM_SPCTL0_MFN_MASK 0x3ff
99
100#define CCM_SPCTL1_LF (1 << 15)
101#define CCM_SPCTL1_BRMO (1 << 6)
102
103#define CCM_OSC26MCTL_PEAK_OFFSET 16
104#define CCM_OSC26MCTL_PEAK_MASK (0x3 << 16)
105#define CCM_OSC26MCTL_AGC_OFFSET 8
106#define CCM_OSC26MCTL_AGC_MASK (0x3f << 8)
107#define CCM_OSC26MCTL_ANATEST_OFFSET 0
108#define CCM_OSC26MCTL_ANATEST_MASK 0x3f
109
110#define CCM_PCDR0_SSI2BAUDDIV_OFFSET 26
111#define CCM_PCDR0_SSI2BAUDDIV_MASK (0x3f << 26)
112#define CCM_PCDR0_CLKO_EN 25
113#define CCM_PCDR0_CLKODIV_OFFSET 22
114#define CCM_PCDR0_CLKODIV_MASK (0x7 << 22)
115#define CCM_PCDR0_SSI1BAUDDIV_OFFSET 16
116#define CCM_PCDR0_SSI1BAUDDIV_MASK (0x3f << 16)
117/*The difinition for i.MX27 TO2*/
118#define CCM_PCDR0_VPUDIV2_OFFSET 10
119#define CCM_PCDR0_VPUDIV2_MASK (0x3f << 10)
120#define CCM_PCDR0_NFCDIV2_OFFSET 6
121#define CCM_PCDR0_NFCDIV2_MASK (0xf << 6)
122#define CCM_PCDR0_MSHCDIV2_MASK 0x3f
123/*The difinition for i.MX27 TO2*/
124#define CCM_PCDR0_NFCDIV_OFFSET 12
125#define CCM_PCDR0_NFCDIV_MASK (0xf << 12)
126#define CCM_PCDR0_VPUDIV_OFFSET 8
127#define CCM_PCDR0_VPUDIV_MASK (0xf << 8)
128#define CCM_PCDR0_MSHCDIV_OFFSET 0
129#define CCM_PCDR0_MSHCDIV_MASK 0x1f
130
131#define CCM_PCDR1_PERDIV4_OFFSET 24
132#define CCM_PCDR1_PERDIV4_MASK (0x3f << 24)
133#define CCM_PCDR1_PERDIV3_OFFSET 16
134#define CCM_PCDR1_PERDIV3_MASK (0x3f << 16)
135#define CCM_PCDR1_PERDIV2_OFFSET 8
136#define CCM_PCDR1_PERDIV2_MASK (0x3f << 8)
137#define CCM_PCDR1_PERDIV1_OFFSET 0
138#define CCM_PCDR1_PERDIV1_MASK 0x3f
139
140#define CCM_PCCR0_CSPI1_OFFSET 31
141#define CCM_PCCR0_CSPI1_MASK (1 << 31)
142#define CCM_PCCR0_CSPI2_OFFSET 30
143#define CCM_PCCR0_CSPI2_MASK (1 << 30)
144#define CCM_PCCR0_CSPI3_OFFSET 29
145#define CCM_PCCR0_CSPI3_MASK (1 << 29)
146#define CCM_PCCR0_DMA_OFFSET 28
147#define CCM_PCCR0_DMA_MASK (1 << 28)
148#define CCM_PCCR0_EMMA_OFFSET 27
149#define CCM_PCCR0_EMMA_MASK (1 << 27)
150#define CCM_PCCR0_FEC_OFFSET 26
151#define CCM_PCCR0_FEC_MASK (1 << 26)
152#define CCM_PCCR0_GPIO_OFFSET 25
153#define CCM_PCCR0_GPIO_MASK (1 << 25)
154#define CCM_PCCR0_GPT1_OFFSET 24
155#define CCM_PCCR0_GPT1_MASK (1 << 24)
156#define CCM_PCCR0_GPT2_OFFSET 23
157#define CCM_PCCR0_GPT2_MASK (1 << 23)
158#define CCM_PCCR0_GPT3_OFFSET 22
159#define CCM_PCCR0_GPT3_MASK (1 << 22)
160#define CCM_PCCR0_GPT4_OFFSET 21
161#define CCM_PCCR0_GPT4_MASK (1 << 21)
162#define CCM_PCCR0_GPT5_OFFSET 20
163#define CCM_PCCR0_GPT5_MASK (1 << 20)
164#define CCM_PCCR0_GPT6_OFFSET 19
165#define CCM_PCCR0_GPT6_MASK (1 << 19)
166#define CCM_PCCR0_I2C1_OFFSET 18
167#define CCM_PCCR0_I2C1_MASK (1 << 18)
168#define CCM_PCCR0_I2C2_OFFSET 17
169#define CCM_PCCR0_I2C2_MASK (1 << 17)
170#define CCM_PCCR0_IIM_OFFSET 16
171#define CCM_PCCR0_IIM_MASK (1 << 16)
172#define CCM_PCCR0_KPP_OFFSET 15
173#define CCM_PCCR0_KPP_MASK (1 << 15)
174#define CCM_PCCR0_LCDC_OFFSET 14
175#define CCM_PCCR0_LCDC_MASK (1 << 14)
176#define CCM_PCCR0_MSHC_OFFSET 13
177#define CCM_PCCR0_MSHC_MASK (1 << 13)
178#define CCM_PCCR0_OWIRE_OFFSET 12
179#define CCM_PCCR0_OWIRE_MASK (1 << 12)
180#define CCM_PCCR0_PWM_OFFSET 11
181#define CCM_PCCR0_PWM_MASK (1 << 11)
182#define CCM_PCCR0_RTC_OFFSET 9
183#define CCM_PCCR0_RTC_MASK (1 << 9)
184#define CCM_PCCR0_RTIC_OFFSET 8
185#define CCM_PCCR0_RTIC_MASK (1 << 8)
186#define CCM_PCCR0_SAHARA_OFFSET 7
187#define CCM_PCCR0_SAHARA_MASK (1 << 7)
188#define CCM_PCCR0_SCC_OFFSET 6
189#define CCM_PCCR0_SCC_MASK (1 << 6)
190#define CCM_PCCR0_SDHC1_OFFSET 5
191#define CCM_PCCR0_SDHC1_MASK (1 << 5)
192#define CCM_PCCR0_SDHC2_OFFSET 4
193#define CCM_PCCR0_SDHC2_MASK (1 << 4)
194#define CCM_PCCR0_SDHC3_OFFSET 3
195#define CCM_PCCR0_SDHC3_MASK (1 << 3)
196#define CCM_PCCR0_SLCDC_OFFSET 2
197#define CCM_PCCR0_SLCDC_MASK (1 << 2)
198#define CCM_PCCR0_SSI1_IPG_OFFSET 1
199#define CCM_PCCR0_SSI1_IPG_MASK (1 << 1)
200#define CCM_PCCR0_SSI2_IPG_OFFSET 0
201#define CCM_PCCR0_SSI2_IPG_MASK (1 << 0)
202
203#define CCM_PCCR1_UART1_OFFSET 31
204#define CCM_PCCR1_UART1_MASK (1 << 31)
205#define CCM_PCCR1_UART2_OFFSET 30
206#define CCM_PCCR1_UART2_MASK (1 << 30)
207#define CCM_PCCR1_UART3_OFFSET 29
208#define CCM_PCCR1_UART3_MASK (1 << 29)
209#define CCM_PCCR1_UART4_OFFSET 28
210#define CCM_PCCR1_UART4_MASK (1 << 28)
211#define CCM_PCCR1_UART5_OFFSET 27
212#define CCM_PCCR1_UART5_MASK (1 << 27)
213#define CCM_PCCR1_UART6_OFFSET 26
214#define CCM_PCCR1_UART6_MASK (1 << 26)
215#define CCM_PCCR1_USBOTG_OFFSET 25
216#define CCM_PCCR1_USBOTG_MASK (1 << 25)
217#define CCM_PCCR1_WDT_OFFSET 24
218#define CCM_PCCR1_WDT_MASK (1 << 24)
219#define CCM_PCCR1_HCLK_ATA_OFFSET 23
220#define CCM_PCCR1_HCLK_ATA_MASK (1 << 23)
221#define CCM_PCCR1_HCLK_BROM_OFFSET 22
222#define CCM_PCCR1_HCLK_BROM_MASK (1 << 22)
223#define CCM_PCCR1_HCLK_CSI_OFFSET 21
224#define CCM_PCCR1_HCLK_CSI_MASK (1 << 21)
225#define CCM_PCCR1_HCLK_DMA_OFFSET 20
226#define CCM_PCCR1_HCLK_DMA_MASK (1 << 20)
227#define CCM_PCCR1_HCLK_EMI_OFFSET 19
228#define CCM_PCCR1_HCLK_EMI_MASK (1 << 19)
229#define CCM_PCCR1_HCLK_EMMA_OFFSET 18
230#define CCM_PCCR1_HCLK_EMMA_MASK (1 << 18)
231#define CCM_PCCR1_HCLK_FEC_OFFSET 17
232#define CCM_PCCR1_HCLK_FEC_MASK (1 << 17)
233#define CCM_PCCR1_HCLK_VPU_OFFSET 16
234#define CCM_PCCR1_HCLK_VPU_MASK (1 << 16)
235#define CCM_PCCR1_HCLK_LCDC_OFFSET 15
236#define CCM_PCCR1_HCLK_LCDC_MASK (1 << 15)
237#define CCM_PCCR1_HCLK_RTIC_OFFSET 14
238#define CCM_PCCR1_HCLK_RTIC_MASK (1 << 14)
239#define CCM_PCCR1_HCLK_SAHARA_OFFSET 13
240#define CCM_PCCR1_HCLK_SAHARA_MASK (1 << 13)
241#define CCM_PCCR1_HCLK_SLCDC_OFFSET 12
242#define CCM_PCCR1_HCLK_SLCDC_MASK (1 << 12)
243#define CCM_PCCR1_HCLK_USBOTG_OFFSET 11
244#define CCM_PCCR1_HCLK_USBOTG_MASK (1 << 11)
245#define CCM_PCCR1_PERCLK1_OFFSET 10
246#define CCM_PCCR1_PERCLK1_MASK (1 << 10)
247#define CCM_PCCR1_PERCLK2_OFFSET 9
248#define CCM_PCCR1_PERCLK2_MASK (1 << 9)
249#define CCM_PCCR1_PERCLK3_OFFSET 8
250#define CCM_PCCR1_PERCLK3_MASK (1 << 8)
251#define CCM_PCCR1_PERCLK4_OFFSET 7
252#define CCM_PCCR1_PERCLK4_MASK (1 << 7)
253#define CCM_PCCR1_VPU_BAUD_OFFSET 6
254#define CCM_PCCR1_VPU_BAUD_MASK (1 << 6)
255#define CCM_PCCR1_SSI1_BAUD_OFFSET 5
256#define CCM_PCCR1_SSI1_BAUD_MASK (1 << 5)
257#define CCM_PCCR1_SSI2_BAUD_OFFSET 4
258#define CCM_PCCR1_SSI2_BAUD_MASK (1 << 4)
259#define CCM_PCCR1_NFC_BAUD_OFFSET 3
260#define CCM_PCCR1_NFC_BAUD_MASK (1 << 3)
261#define CCM_PCCR1_MSHC_BAUD_OFFSET 2
262#define CCM_PCCR1_MSHC_BAUD_MASK (1 << 2)
263
264#define CCM_CCSR_32KSR (1 << 15)
265#define CCM_CCSR_CLKMODE1 (1 << 9)
266#define CCM_CCSR_CLKMODE0 (1 << 8)
267#define CCM_CCSR_CLKOSEL_OFFSET 0
268#define CCM_CCSR_CLKOSEL_MASK 0x1f
269
270#define SYS_FMCR 0x14 /* Functional Muxing Control Reg */
271#define SYS_CHIP_ID 0x00 /* The offset of CHIP ID register */
272
273#endif /* __ARCH_ARM_MACH_MX2_CRM_REGS_H__ */
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-mx2/devices.c
new file mode 100644
index 000000000000..a1f44c3c5315
--- /dev/null
+++ b/arch/arm/mach-mx2/devices.c
@@ -0,0 +1,231 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * <source@mvista.com>
4 *
5 * Based on the OMAP devices.c
6 *
7 * 2005 (c) MontaVista Software, Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is
9 * licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 *
12 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
13 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27 * MA 02110-1301, USA.
28 */
29#include <linux/module.h>
30#include <linux/kernel.h>
31#include <linux/init.h>
32#include <linux/platform_device.h>
33#include <linux/gpio.h>
34
35#include <asm/hardware.h>
36
37/*
38 * Resource definition for the MXC IrDA
39 */
40static struct resource mxc_irda_resources[] = {
41 [0] = {
42 .start = UART3_BASE_ADDR,
43 .end = UART3_BASE_ADDR + SZ_4K - 1,
44 .flags = IORESOURCE_MEM,
45 },
46 [1] = {
47 .start = MXC_INT_UART3,
48 .end = MXC_INT_UART3,
49 .flags = IORESOURCE_IRQ,
50 },
51};
52
53/* Platform Data for MXC IrDA */
54struct platform_device mxc_irda_device = {
55 .name = "mxc_irda",
56 .id = 0,
57 .num_resources = ARRAY_SIZE(mxc_irda_resources),
58 .resource = mxc_irda_resources,
59};
60
61/*
62 * General Purpose Timer
63 * - i.MX1: 2 timer (slighly different register handling)
64 * - i.MX21: 3 timer
65 * - i.MX27: 6 timer
66 */
67
68/* We use gpt0 as system timer, so do not add a device for this one */
69
70static struct resource timer1_resources[] = {
71 [0] = {
72 .start = GPT2_BASE_ADDR,
73 .end = GPT2_BASE_ADDR + 0x17,
74 .flags = IORESOURCE_MEM
75 },
76 [1] = {
77 .start = MXC_INT_GPT2,
78 .end = MXC_INT_GPT2,
79 .flags = IORESOURCE_IRQ,
80 }
81};
82
83struct platform_device mxc_gpt1 = {
84 .name = "imx_gpt",
85 .id = 1,
86 .num_resources = ARRAY_SIZE(timer1_resources),
87 .resource = timer1_resources
88};
89
90static struct resource timer2_resources[] = {
91 [0] = {
92 .start = GPT3_BASE_ADDR,
93 .end = GPT3_BASE_ADDR + 0x17,
94 .flags = IORESOURCE_MEM
95 },
96 [1] = {
97 .start = MXC_INT_GPT3,
98 .end = MXC_INT_GPT3,
99 .flags = IORESOURCE_IRQ,
100 }
101};
102
103struct platform_device mxc_gpt2 = {
104 .name = "imx_gpt",
105 .id = 2,
106 .num_resources = ARRAY_SIZE(timer2_resources),
107 .resource = timer2_resources
108};
109
110#ifdef CONFIG_MACH_MX27
111static struct resource timer3_resources[] = {
112 [0] = {
113 .start = GPT4_BASE_ADDR,
114 .end = GPT4_BASE_ADDR + 0x17,
115 .flags = IORESOURCE_MEM
116 },
117 [1] = {
118 .start = MXC_INT_GPT4,
119 .end = MXC_INT_GPT4,
120 .flags = IORESOURCE_IRQ,
121 }
122};
123
124struct platform_device mxc_gpt3 = {
125 .name = "imx_gpt",
126 .id = 3,
127 .num_resources = ARRAY_SIZE(timer3_resources),
128 .resource = timer3_resources
129};
130
131static struct resource timer4_resources[] = {
132 [0] = {
133 .start = GPT5_BASE_ADDR,
134 .end = GPT5_BASE_ADDR + 0x17,
135 .flags = IORESOURCE_MEM
136 },
137 [1] = {
138 .start = MXC_INT_GPT5,
139 .end = MXC_INT_GPT5,
140 .flags = IORESOURCE_IRQ,
141 }
142};
143
144struct platform_device mxc_gpt4 = {
145 .name = "imx_gpt",
146 .id = 4,
147 .num_resources = ARRAY_SIZE(timer4_resources),
148 .resource = timer4_resources
149};
150
151static struct resource timer5_resources[] = {
152 [0] = {
153 .start = GPT6_BASE_ADDR,
154 .end = GPT6_BASE_ADDR + 0x17,
155 .flags = IORESOURCE_MEM
156 },
157 [1] = {
158 .start = MXC_INT_GPT6,
159 .end = MXC_INT_GPT6,
160 .flags = IORESOURCE_IRQ,
161 }
162};
163
164struct platform_device mxc_gpt5 = {
165 .name = "imx_gpt",
166 .id = 5,
167 .num_resources = ARRAY_SIZE(timer5_resources),
168 .resource = timer5_resources
169};
170#endif
171
172/*
173 * Watchdog:
174 * - i.MX1
175 * - i.MX21
176 * - i.MX27
177 */
178static struct resource mxc_wdt_resources[] = {
179 {
180 .start = WDOG_BASE_ADDR,
181 .end = WDOG_BASE_ADDR + 0x30,
182 .flags = IORESOURCE_MEM,
183 },
184};
185
186struct platform_device mxc_wdt = {
187 .name = "mxc_wdt",
188 .id = 0,
189 .num_resources = ARRAY_SIZE(mxc_wdt_resources),
190 .resource = mxc_wdt_resources,
191};
192
193/* GPIO port description */
194static struct mxc_gpio_port imx_gpio_ports[] = {
195 [0] = {
196 .chip.label = "gpio-0",
197 .irq = MXC_INT_GPIO,
198 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 0),
199 .virtual_irq_start = MXC_MAX_INT_LINES,
200 },
201 [1] = {
202 .chip.label = "gpio-1",
203 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 1),
204 .virtual_irq_start = MXC_MAX_INT_LINES + 32,
205 },
206 [2] = {
207 .chip.label = "gpio-2",
208 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 2),
209 .virtual_irq_start = MXC_MAX_INT_LINES + 64,
210 },
211 [3] = {
212 .chip.label = "gpio-3",
213 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 3),
214 .virtual_irq_start = MXC_MAX_INT_LINES + 96,
215 },
216 [4] = {
217 .chip.label = "gpio-4",
218 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 4),
219 .virtual_irq_start = MXC_MAX_INT_LINES + 128,
220 },
221 [5] = {
222 .chip.label = "gpio-5",
223 .base = (void*)(AIPI_BASE_ADDR_VIRT + 0x15000 + 0x100 * 5),
224 .virtual_irq_start = MXC_MAX_INT_LINES + 160,
225 }
226};
227
228int __init mxc_register_gpios(void)
229{
230 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
231}
diff --git a/arch/arm/mach-mx2/generic.c b/arch/arm/mach-mx2/generic.c
new file mode 100644
index 000000000000..07875cf00de9
--- /dev/null
+++ b/arch/arm/mach-mx2/generic.c
@@ -0,0 +1,74 @@
1/*
2 * generic.c
3 *
4 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA.
19 */
20
21#include <linux/mm.h>
22#include <linux/init.h>
23#include <asm/hardware.h>
24#include <asm/pgtable.h>
25#include <asm/mach/map.h>
26
27/* MX27 memory map definition */
28static struct map_desc mxc_io_desc[] __initdata = {
29 /*
30 * this fixed mapping covers:
31 * - AIPI1
32 * - AIPI2
33 * - AITC
34 * - ROM Patch
35 * - and some reserved space
36 */
37 {
38 .virtual = AIPI_BASE_ADDR_VIRT,
39 .pfn = __phys_to_pfn(AIPI_BASE_ADDR),
40 .length = AIPI_SIZE,
41 .type = MT_DEVICE
42 },
43 /*
44 * this fixed mapping covers:
45 * - CSI
46 * - ATA
47 */
48 {
49 .virtual = SAHB1_BASE_ADDR_VIRT,
50 .pfn = __phys_to_pfn(SAHB1_BASE_ADDR),
51 .length = SAHB1_SIZE,
52 .type = MT_DEVICE
53 },
54 /*
55 * this fixed mapping covers:
56 * - EMI
57 */
58 {
59 .virtual = X_MEMC_BASE_ADDR_VIRT,
60 .pfn = __phys_to_pfn(X_MEMC_BASE_ADDR),
61 .length = X_MEMC_SIZE,
62 .type = MT_DEVICE
63 }
64};
65
66/*
67 * Initialize the memory map. It is called during the
68 * system startup to create static physical to virtual
69 * memory map for the IO modules.
70 */
71void __init mxc_map_io(void)
72{
73 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
74}
diff --git a/arch/arm/mach-mx2/mx27ads.c b/arch/arm/mach-mx2/mx27ads.c
new file mode 100644
index 000000000000..a9ff01fff137
--- /dev/null
+++ b/arch/arm/mach-mx2/mx27ads.c
@@ -0,0 +1,304 @@
1/*
2 * Copyright (C) 2000 Deep Blue Solutions Ltd
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
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/platform_device.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/map.h>
24#include <linux/mtd/partitions.h>
25#include <linux/mtd/physmap.h>
26#include <asm/arch/common.h>
27#include <asm/hardware.h>
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/time.h>
31#include <asm/mach/map.h>
32#include <asm/arch/gpio.h>
33#include <asm/arch/imx-uart.h>
34#include <asm/arch/iomux-mx1-mx2.h>
35#include <asm/arch/board-mx27ads.h>
36
37/* ADS's NOR flash */
38static struct physmap_flash_data mx27ads_flash_data = {
39 .width = 2,
40};
41
42static struct resource mx27ads_flash_resource = {
43 .start = 0xc0000000,
44 .end = 0xc0000000 + 0x02000000 - 1,
45 .flags = IORESOURCE_MEM,
46
47};
48
49static struct platform_device mx27ads_nor_mtd_device = {
50 .name = "physmap-flash",
51 .id = 0,
52 .dev = {
53 .platform_data = &mx27ads_flash_data,
54 },
55 .num_resources = 1,
56 .resource = &mx27ads_flash_resource,
57};
58
59static int mxc_uart0_pins[] = {
60 PE12_PF_UART1_TXD,
61 PE13_PF_UART1_RXD,
62 PE14_PF_UART1_CTS,
63 PE15_PF_UART1_RTS
64};
65
66static int uart_mxc_port0_init(struct platform_device *pdev)
67{
68 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
69 ARRAY_SIZE(mxc_uart0_pins),
70 MXC_GPIO_ALLOC_MODE_NORMAL, "UART0");
71}
72
73static int uart_mxc_port0_exit(struct platform_device *pdev)
74{
75 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
76 ARRAY_SIZE(mxc_uart0_pins),
77 MXC_GPIO_ALLOC_MODE_RELEASE, "UART0");
78}
79
80static int mxc_uart1_pins[] = {
81 PE3_PF_UART2_CTS,
82 PE4_PF_UART2_RTS,
83 PE6_PF_UART2_TXD,
84 PE7_PF_UART2_RXD
85};
86
87static int uart_mxc_port1_init(struct platform_device *pdev)
88{
89 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
90 ARRAY_SIZE(mxc_uart1_pins),
91 MXC_GPIO_ALLOC_MODE_NORMAL, "UART1");
92}
93
94static int uart_mxc_port1_exit(struct platform_device *pdev)
95{
96 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
97 ARRAY_SIZE(mxc_uart1_pins),
98 MXC_GPIO_ALLOC_MODE_RELEASE, "UART1");
99}
100
101static int mxc_uart2_pins[] = {
102 PE8_PF_UART3_TXD,
103 PE9_PF_UART3_RXD,
104 PE10_PF_UART3_CTS,
105 PE11_PF_UART3_RTS
106};
107
108static int uart_mxc_port2_init(struct platform_device *pdev)
109{
110 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
111 ARRAY_SIZE(mxc_uart2_pins),
112 MXC_GPIO_ALLOC_MODE_NORMAL, "UART2");
113}
114
115static int uart_mxc_port2_exit(struct platform_device *pdev)
116{
117 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
118 ARRAY_SIZE(mxc_uart2_pins),
119 MXC_GPIO_ALLOC_MODE_RELEASE, "UART2");
120}
121
122static int mxc_uart3_pins[] = {
123 PB26_AF_UART4_RTS,
124 PB28_AF_UART4_TXD,
125 PB29_AF_UART4_CTS,
126 PB31_AF_UART4_RXD
127};
128
129static int uart_mxc_port3_init(struct platform_device *pdev)
130{
131 return mxc_gpio_setup_multiple_pins(mxc_uart3_pins,
132 ARRAY_SIZE(mxc_uart3_pins),
133 MXC_GPIO_ALLOC_MODE_NORMAL, "UART3");
134}
135
136static int uart_mxc_port3_exit(struct platform_device *pdev)
137{
138 return mxc_gpio_setup_multiple_pins(mxc_uart3_pins,
139 ARRAY_SIZE(mxc_uart3_pins),
140 MXC_GPIO_ALLOC_MODE_RELEASE, "UART3");
141}
142
143static int mxc_uart4_pins[] = {
144 PB18_AF_UART5_TXD,
145 PB19_AF_UART5_RXD,
146 PB20_AF_UART5_CTS,
147 PB21_AF_UART5_RTS
148};
149
150static int uart_mxc_port4_init(struct platform_device *pdev)
151{
152 return mxc_gpio_setup_multiple_pins(mxc_uart4_pins,
153 ARRAY_SIZE(mxc_uart4_pins),
154 MXC_GPIO_ALLOC_MODE_NORMAL, "UART4");
155}
156
157static int uart_mxc_port4_exit(struct platform_device *pdev)
158{
159 return mxc_gpio_setup_multiple_pins(mxc_uart4_pins,
160 ARRAY_SIZE(mxc_uart4_pins),
161 MXC_GPIO_ALLOC_MODE_RELEASE, "UART4");
162}
163
164static int mxc_uart5_pins[] = {
165 PB10_AF_UART6_TXD,
166 PB12_AF_UART6_CTS,
167 PB11_AF_UART6_RXD,
168 PB13_AF_UART6_RTS
169};
170
171static int uart_mxc_port5_init(struct platform_device *pdev)
172{
173 return mxc_gpio_setup_multiple_pins(mxc_uart5_pins,
174 ARRAY_SIZE(mxc_uart5_pins),
175 MXC_GPIO_ALLOC_MODE_NORMAL, "UART5");
176}
177
178static int uart_mxc_port5_exit(struct platform_device *pdev)
179{
180 return mxc_gpio_setup_multiple_pins(mxc_uart5_pins,
181 ARRAY_SIZE(mxc_uart5_pins),
182 MXC_GPIO_ALLOC_MODE_RELEASE, "UART5");
183}
184
185static struct platform_device *platform_devices[] __initdata = {
186 &mx27ads_nor_mtd_device,
187};
188
189static int mxc_fec_pins[] = {
190 PD0_AIN_FEC_TXD0,
191 PD1_AIN_FEC_TXD1,
192 PD2_AIN_FEC_TXD2,
193 PD3_AIN_FEC_TXD3,
194 PD4_AOUT_FEC_RX_ER,
195 PD5_AOUT_FEC_RXD1,
196 PD6_AOUT_FEC_RXD2,
197 PD7_AOUT_FEC_RXD3,
198 PD8_AF_FEC_MDIO,
199 PD9_AIN_FEC_MDC,
200 PD10_AOUT_FEC_CRS,
201 PD11_AOUT_FEC_TX_CLK,
202 PD12_AOUT_FEC_RXD0,
203 PD13_AOUT_FEC_RX_DV,
204 PD14_AOUT_FEC_CLR,
205 PD15_AOUT_FEC_COL,
206 PD16_AIN_FEC_TX_ER,
207 PF23_AIN_FEC_TX_EN
208};
209
210static void gpio_fec_active(void)
211{
212 mxc_gpio_setup_multiple_pins(mxc_fec_pins,
213 ARRAY_SIZE(mxc_fec_pins),
214 MXC_GPIO_ALLOC_MODE_NORMAL, "FEC");
215}
216
217static void gpio_fec_inactive(void)
218{
219 mxc_gpio_setup_multiple_pins(mxc_fec_pins,
220 ARRAY_SIZE(mxc_fec_pins),
221 MXC_GPIO_ALLOC_MODE_RELEASE, "FEC");
222}
223
224static struct imxuart_platform_data uart_pdata[] = {
225 {
226 .init = uart_mxc_port0_init,
227 .exit = uart_mxc_port0_exit,
228 .flags = IMXUART_HAVE_RTSCTS,
229 }, {
230 .init = uart_mxc_port1_init,
231 .exit = uart_mxc_port1_exit,
232 .flags = IMXUART_HAVE_RTSCTS,
233 }, {
234 .init = uart_mxc_port2_init,
235 .exit = uart_mxc_port2_exit,
236 .flags = IMXUART_HAVE_RTSCTS,
237 }, {
238 .init = uart_mxc_port3_init,
239 .exit = uart_mxc_port3_exit,
240 .flags = IMXUART_HAVE_RTSCTS,
241 }, {
242 .init = uart_mxc_port4_init,
243 .exit = uart_mxc_port4_exit,
244 .flags = IMXUART_HAVE_RTSCTS,
245 }, {
246 .init = uart_mxc_port5_init,
247 .exit = uart_mxc_port5_exit,
248 .flags = IMXUART_HAVE_RTSCTS,
249 },
250};
251
252static void __init mx27ads_board_init(void)
253{
254 int i;
255
256 gpio_fec_active();
257
258 for (i = 0; i < 6; i++)
259 imx_init_uart(i, &uart_pdata[i]);
260
261 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
262}
263
264static void __init mx27ads_timer_init(void)
265{
266 unsigned long fref = 26000000;
267
268 if ((__raw_readw(PBC_VERSION_REG) & CKIH_27MHZ_BIT_SET) == 0)
269 fref = 27000000;
270
271 mxc_clocks_init(fref);
272 mxc_timer_init("gpt_clk.0");
273}
274
275struct sys_timer mx27ads_timer = {
276 .init = mx27ads_timer_init,
277};
278
279static struct map_desc mx27ads_io_desc[] __initdata = {
280 {
281 .virtual = PBC_BASE_ADDRESS,
282 .pfn = __phys_to_pfn(CS4_BASE_ADDR),
283 .length = SZ_1M,
284 .type = MT_DEVICE,
285 },
286};
287
288void __init mx27ads_map_io(void)
289{
290 mxc_map_io();
291 iotable_init(mx27ads_io_desc, ARRAY_SIZE(mx27ads_io_desc));
292}
293
294MACHINE_START(MX27ADS, "Freescale i.MX27ADS")
295 /* maintainer: Freescale Semiconductor, Inc. */
296 .phys_io = AIPI_BASE_ADDR,
297 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
298 .boot_params = PHYS_OFFSET + 0x100,
299 .map_io = mx27ads_map_io,
300 .init_irq = mxc_init_irq,
301 .init_machine = mx27ads_board_init,
302 .timer = &mx27ads_timer,
303MACHINE_END
304
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c
new file mode 100644
index 000000000000..a9a28f58e714
--- /dev/null
+++ b/arch/arm/mach-mx2/pcm038.c
@@ -0,0 +1,204 @@
1/*
2 * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
3 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/platform_device.h>
21#include <linux/mtd/physmap.h>
22#include <asm/mach/arch.h>
23#include <asm/mach-types.h>
24#include <asm/arch/common.h>
25#include <asm/hardware.h>
26#include <asm/arch/iomux-mx1-mx2.h>
27#include <asm/mach/time.h>
28#include <asm/arch/imx-uart.h>
29#include <asm/arch/board-pcm038.h>
30
31/*
32 * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
33 * 16 bit width
34 */
35static struct physmap_flash_data pcm038_flash_data = {
36 .width = 2,
37};
38
39static struct resource pcm038_flash_resource = {
40 .start = 0xc0000000,
41 .end = 0xc1ffffff,
42 .flags = IORESOURCE_MEM,
43};
44
45static struct platform_device pcm038_nor_mtd_device = {
46 .name = "physmap-flash",
47 .id = 0,
48 .dev = {
49 .platform_data = &pcm038_flash_data,
50 },
51 .num_resources = 1,
52 .resource = &pcm038_flash_resource,
53};
54
55static int mxc_uart0_pins[] = {
56 PE12_PF_UART1_TXD,
57 PE13_PF_UART1_RXD,
58 PE14_PF_UART1_CTS,
59 PE15_PF_UART1_RTS
60};
61
62static int uart_mxc_port0_init(struct platform_device *pdev)
63{
64 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
65 ARRAY_SIZE(mxc_uart0_pins),
66 MXC_GPIO_ALLOC_MODE_NORMAL, "UART0");
67}
68
69static int uart_mxc_port0_exit(struct platform_device *pdev)
70{
71 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
72 ARRAY_SIZE(mxc_uart0_pins),
73 MXC_GPIO_ALLOC_MODE_RELEASE, "UART0");
74}
75
76static int mxc_uart1_pins[] = {
77 PE3_PF_UART2_CTS,
78 PE4_PF_UART2_RTS,
79 PE6_PF_UART2_TXD,
80 PE7_PF_UART2_RXD
81};
82
83static int uart_mxc_port1_init(struct platform_device *pdev)
84{
85 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
86 ARRAY_SIZE(mxc_uart1_pins),
87 MXC_GPIO_ALLOC_MODE_NORMAL, "UART1");
88}
89
90static int uart_mxc_port1_exit(struct platform_device *pdev)
91{
92 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
93 ARRAY_SIZE(mxc_uart1_pins),
94 MXC_GPIO_ALLOC_MODE_RELEASE, "UART1");
95}
96
97static int mxc_uart2_pins[] = { PE10_PF_UART3_CTS,
98 PE9_PF_UART3_RXD,
99 PE10_PF_UART3_CTS,
100 PE9_PF_UART3_RXD };
101
102static int uart_mxc_port2_init(struct platform_device *pdev)
103{
104 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
105 ARRAY_SIZE(mxc_uart2_pins),
106 MXC_GPIO_ALLOC_MODE_NORMAL, "UART2");
107}
108
109static int uart_mxc_port2_exit(struct platform_device *pdev)
110{
111 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
112 ARRAY_SIZE(mxc_uart2_pins),
113 MXC_GPIO_ALLOC_MODE_RELEASE, "UART2");
114}
115
116static struct imxuart_platform_data uart_pdata[] = {
117 {
118 .init = uart_mxc_port0_init,
119 .exit = uart_mxc_port0_exit,
120 .flags = IMXUART_HAVE_RTSCTS,
121 }, {
122 .init = uart_mxc_port1_init,
123 .exit = uart_mxc_port1_exit,
124 .flags = IMXUART_HAVE_RTSCTS,
125 }, {
126 .init = uart_mxc_port2_init,
127 .exit = uart_mxc_port2_exit,
128 .flags = IMXUART_HAVE_RTSCTS,
129 },
130};
131
132static int mxc_fec_pins[] = {
133 PD0_AIN_FEC_TXD0,
134 PD1_AIN_FEC_TXD1,
135 PD2_AIN_FEC_TXD2,
136 PD3_AIN_FEC_TXD3,
137 PD4_AOUT_FEC_RX_ER,
138 PD5_AOUT_FEC_RXD1,
139 PD6_AOUT_FEC_RXD2,
140 PD7_AOUT_FEC_RXD3,
141 PD8_AF_FEC_MDIO,
142 PD9_AIN_FEC_MDC,
143 PD10_AOUT_FEC_CRS,
144 PD11_AOUT_FEC_TX_CLK,
145 PD12_AOUT_FEC_RXD0,
146 PD13_AOUT_FEC_RX_DV,
147 PD14_AOUT_FEC_CLR,
148 PD15_AOUT_FEC_COL,
149 PD16_AIN_FEC_TX_ER,
150 PF23_AIN_FEC_TX_EN
151};
152
153static void gpio_fec_active(void)
154{
155 mxc_gpio_setup_multiple_pins(mxc_fec_pins,
156 ARRAY_SIZE(mxc_fec_pins),
157 MXC_GPIO_ALLOC_MODE_NORMAL, "FEC");
158}
159
160static void gpio_fec_inactive(void)
161{
162 mxc_gpio_setup_multiple_pins(mxc_fec_pins,
163 ARRAY_SIZE(mxc_fec_pins),
164 MXC_GPIO_ALLOC_MODE_RELEASE, "FEC");
165}
166
167static struct platform_device *platform_devices[] __initdata = {
168 &pcm038_nor_mtd_device,
169};
170
171static void __init pcm038_init(void)
172{
173 int i;
174 gpio_fec_active();
175
176 for (i = 0; i < 3; i++)
177 imx_init_uart(i, &uart_pdata[i]);
178
179 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
180
181#ifdef CONFIG_MACH_PCM970_BASEBOARD
182 pcm970_baseboard_init();
183#endif
184}
185
186static void __init pcm038_timer_init(void)
187{
188 mxc_clocks_init(26000000);
189 mxc_timer_init("gpt_clk.0");
190}
191
192struct sys_timer pcm038_timer = {
193 .init = pcm038_timer_init,
194};
195
196MACHINE_START(PCM038, "phyCORE-i.MX27")
197 .phys_io = AIPI_BASE_ADDR,
198 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
199 .boot_params = PHYS_OFFSET + 0x100,
200 .map_io = mxc_map_io,
201 .init_irq = mxc_init_irq,
202 .init_machine = pcm038_init,
203 .timer = &pcm038_timer,
204MACHINE_END
diff --git a/arch/arm/mach-mx2/pcm970-baseboard.c b/arch/arm/mach-mx2/pcm970-baseboard.c
new file mode 100644
index 000000000000..028ac4d33684
--- /dev/null
+++ b/arch/arm/mach-mx2/pcm970-baseboard.c
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
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 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
17 */
18
19#include <linux/platform_device.h>
20#include <asm/hardware.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23
24/*
25 * system init for baseboard usage. Will be called by pcm038 init.
26 *
27 * Add platform devices present on this baseboard and init
28 * them from CPU side as far as required to use them later on
29 */
30void __init pcm970_baseboard_init(void)
31{
32}
diff --git a/arch/arm/mach-mx2/serial.c b/arch/arm/mach-mx2/serial.c
new file mode 100644
index 000000000000..570c02b8e5df
--- /dev/null
+++ b/arch/arm/mach-mx2/serial.c
@@ -0,0 +1,177 @@
1/*
2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/platform_device.h>
22#include <linux/serial.h>
23#include <asm/hardware.h>
24#include <asm/arch/imx-uart.h>
25
26static struct resource uart0[] = {
27 {
28 .start = UART1_BASE_ADDR,
29 .end = UART1_BASE_ADDR + 0x0B5,
30 .flags = IORESOURCE_MEM,
31 }, {
32 .start = MXC_INT_UART1,
33 .end = MXC_INT_UART1,
34 .flags = IORESOURCE_IRQ,
35 },
36};
37
38static struct platform_device mxc_uart_device0 = {
39 .name = "imx-uart",
40 .id = 0,
41 .resource = uart0,
42 .num_resources = ARRAY_SIZE(uart0),
43};
44
45static struct resource uart1[] = {
46 {
47 .start = UART2_BASE_ADDR,
48 .end = UART2_BASE_ADDR + 0x0B5,
49 .flags = IORESOURCE_MEM,
50 }, {
51 .start = MXC_INT_UART2,
52 .end = MXC_INT_UART2,
53 .flags = IORESOURCE_IRQ,
54 },
55};
56
57static struct platform_device mxc_uart_device1 = {
58 .name = "imx-uart",
59 .id = 1,
60 .resource = uart1,
61 .num_resources = ARRAY_SIZE(uart1),
62};
63
64static struct resource uart2[] = {
65 {
66 .start = UART3_BASE_ADDR,
67 .end = UART3_BASE_ADDR + 0x0B5,
68 .flags = IORESOURCE_MEM,
69 }, {
70 .start = MXC_INT_UART3,
71 .end = MXC_INT_UART3,
72 .flags = IORESOURCE_IRQ,
73 },
74};
75
76static struct platform_device mxc_uart_device2 = {
77 .name = "imx-uart",
78 .id = 2,
79 .resource = uart2,
80 .num_resources = ARRAY_SIZE(uart2),
81};
82
83static struct resource uart3[] = {
84 {
85 .start = UART4_BASE_ADDR,
86 .end = UART4_BASE_ADDR + 0x0B5,
87 .flags = IORESOURCE_MEM,
88 }, {
89 .start = MXC_INT_UART4,
90 .end = MXC_INT_UART4,
91 .flags = IORESOURCE_IRQ,
92 },
93};
94
95static struct platform_device mxc_uart_device3 = {
96 .name = "imx-uart",
97 .id = 3,
98 .resource = uart3,
99 .num_resources = ARRAY_SIZE(uart3),
100};
101
102static struct resource uart4[] = {
103 {
104 .start = UART5_BASE_ADDR,
105 .end = UART5_BASE_ADDR + 0x0B5,
106 .flags = IORESOURCE_MEM,
107 }, {
108 .start = MXC_INT_UART5,
109 .end = MXC_INT_UART5,
110 .flags = IORESOURCE_IRQ,
111 },
112};
113
114static struct platform_device mxc_uart_device4 = {
115 .name = "imx-uart",
116 .id = 4,
117 .resource = uart4,
118 .num_resources = ARRAY_SIZE(uart4),
119};
120
121static struct resource uart5[] = {
122 {
123 .start = UART6_BASE_ADDR,
124 .end = UART6_BASE_ADDR + 0x0B5,
125 .flags = IORESOURCE_MEM,
126 }, {
127 .start = MXC_INT_UART6,
128 .end = MXC_INT_UART6,
129 .flags = IORESOURCE_IRQ,
130 },
131};
132
133static struct platform_device mxc_uart_device5 = {
134 .name = "imx-uart",
135 .id = 5,
136 .resource = uart5,
137 .num_resources = ARRAY_SIZE(uart5),
138};
139
140/*
141 * Register only those UARTs that physically exists
142 */
143int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata)
144{
145 switch (uart_no) {
146 case 0:
147 mxc_uart_device0.dev.platform_data = pdata;
148 platform_device_register(&mxc_uart_device0);
149 break;
150 case 1:
151 mxc_uart_device1.dev.platform_data = pdata;
152 platform_device_register(&mxc_uart_device1);
153 break;
154#ifndef CONFIG_MXC_IRDA
155 case 2:
156 mxc_uart_device2.dev.platform_data = pdata;
157 platform_device_register(&mxc_uart_device2);
158 break;
159#endif
160 case 3:
161 mxc_uart_device3.dev.platform_data = pdata;
162 platform_device_register(&mxc_uart_device3);
163 break;
164 case 4:
165 mxc_uart_device4.dev.platform_data = pdata;
166 platform_device_register(&mxc_uart_device4);
167 break;
168 case 5:
169 mxc_uart_device5.dev.platform_data = pdata;
170 platform_device_register(&mxc_uart_device5);
171 break;
172 default:
173 return -ENODEV;
174 }
175
176 return 0;
177}
diff --git a/arch/arm/mach-mx2/system.c b/arch/arm/mach-mx2/system.c
new file mode 100644
index 000000000000..99304645299d
--- /dev/null
+++ b/arch/arm/mach-mx2/system.c
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright (C) 2000 Deep Blue Solutions Ltd
4 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
5 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
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/kernel.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25
26#include <asm/arch/hardware.h>
27#include <asm/proc-fns.h>
28#include <asm/system.h>
29
30/*
31 * Put the CPU into idle mode. It is called by default_idle()
32 * in process.c file.
33 */
34void arch_idle(void)
35{
36 /*
37 * This should do all the clock switching
38 * and wait for interrupt tricks.
39 */
40 cpu_do_idle();
41}
42
43#define WDOG_WCR_REG IO_ADDRESS(WDOG_BASE_ADDR)
44#define WDOG_WCR_SRS (1 << 4)
45
46/*
47 * Reset the system. It is called by machine_restart().
48 */
49void arch_reset(char mode)
50{
51 struct clk *clk;
52
53 clk = clk_get(NULL, "wdog_clk");
54 if (!clk) {
55 printk(KERN_ERR"Cannot activate the watchdog. Giving up\n");
56 return;
57 }
58
59 clk_enable(clk);
60
61 /* Assert SRS signal */
62 __raw_writew(__raw_readw(WDOG_WCR_REG) & ~WDOG_WCR_SRS, WDOG_WCR_REG);
63}
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 5fe8606cac08..db9431dee1b4 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -8,5 +8,18 @@ config MACH_MX31ADS
8 Include support for MX31ADS platform. This includes specific 8 Include support for MX31ADS platform. This includes specific
9 configurations for the board and its peripherals. 9 configurations for the board and its peripherals.
10 10
11config MACH_PCM037
12 bool "Support Phytec pcm037 platforms"
13 help
14 Include support for Phytec pcm037 platform. This includes
15 specific configurations for the board and its peripherals.
16
17config MACH_MX31LITE
18 bool "Support MX31 LITEKIT (LogicPD)"
19 default n
20 help
21 Include support for MX31 LITEKIT platform. This includes specific
22 configurations for the board and its peripherals.
23
11endmenu 24endmenu
12 25
diff --git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index cbec997f332a..8b21abb71fb0 100644
--- a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -4,5 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := mm.o time.o 7obj-y := mm.o clock.o devices.o iomux.o
8obj-$(CONFIG_MACH_MX31ADS) += mx31ads.o 8obj-$(CONFIG_MACH_MX31ADS) += mx31ads.o
9obj-$(CONFIG_MACH_MX31LITE) += mx31lite.o
10obj-$(CONFIG_MACH_PCM037) += pcm037.o
diff --git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
new file mode 100644
index 000000000000..2f3635943e70
--- /dev/null
+++ b/arch/arm/mach-mx3/clock.c
@@ -0,0 +1,1147 @@
1/*
2 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/spinlock.h>
22#include <linux/delay.h>
23#include <linux/clk.h>
24#include <linux/err.h>
25#include <linux/io.h>
26#include <asm/arch/clock.h>
27#include <asm/div64.h>
28
29#include "crm_regs.h"
30
31#define PRE_DIV_MIN_FREQ 10000000 /* Minimum Frequency after Predivider */
32
33static void __calc_pre_post_dividers(u32 div, u32 *pre, u32 *post)
34{
35 u32 min_pre, temp_pre, old_err, err;
36
37 if (div >= 512) {
38 *pre = 8;
39 *post = 64;
40 } else if (div >= 64) {
41 min_pre = (div - 1) / 64 + 1;
42 old_err = 8;
43 for (temp_pre = 8; temp_pre >= min_pre; temp_pre--) {
44 err = div % temp_pre;
45 if (err == 0) {
46 *pre = temp_pre;
47 break;
48 }
49 err = temp_pre - err;
50 if (err < old_err) {
51 old_err = err;
52 *pre = temp_pre;
53 }
54 }
55 *post = (div + *pre - 1) / *pre;
56 } else if (div <= 8) {
57 *pre = div;
58 *post = 1;
59 } else {
60 *pre = 1;
61 *post = div;
62 }
63}
64
65static struct clk mcu_pll_clk;
66static struct clk mcu_main_clk;
67static struct clk usb_pll_clk;
68static struct clk serial_pll_clk;
69static struct clk ipg_clk;
70static struct clk ckih_clk;
71static struct clk ahb_clk;
72
73static int _clk_enable(struct clk *clk)
74{
75 u32 reg;
76
77 reg = __raw_readl(clk->enable_reg);
78 reg |= 3 << clk->enable_shift;
79 __raw_writel(reg, clk->enable_reg);
80
81 return 0;
82}
83
84static void _clk_disable(struct clk *clk)
85{
86 u32 reg;
87
88 reg = __raw_readl(clk->enable_reg);
89 reg &= ~(3 << clk->enable_shift);
90 __raw_writel(reg, clk->enable_reg);
91}
92
93static void _clk_emi_disable(struct clk *clk)
94{
95 u32 reg;
96
97 reg = __raw_readl(clk->enable_reg);
98 reg &= ~(3 << clk->enable_shift);
99 reg |= (1 << clk->enable_shift);
100 __raw_writel(reg, clk->enable_reg);
101}
102
103static int _clk_pll_set_rate(struct clk *clk, unsigned long rate)
104{
105 u32 reg;
106 signed long pd = 1; /* Pre-divider */
107 signed long mfi; /* Multiplication Factor (Integer part) */
108 signed long mfn; /* Multiplication Factor (Integer part) */
109 signed long mfd; /* Multiplication Factor (Denominator Part) */
110 signed long tmp;
111 u32 ref_freq = clk_get_rate(clk->parent);
112
113 while (((ref_freq / pd) * 10) > rate)
114 pd++;
115
116 if ((ref_freq / pd) < PRE_DIV_MIN_FREQ)
117 return -EINVAL;
118
119 /* the ref_freq/2 in the following is to round up */
120 mfi = (((rate / 2) * pd) + (ref_freq / 2)) / ref_freq;
121 if (mfi < 5 || mfi > 15)
122 return -EINVAL;
123
124 /* pick a mfd value that will work
125 * then solve for mfn */
126 mfd = ref_freq / 50000;
127
128 /*
129 * pll_freq * pd * mfd
130 * mfn = -------------------- - (mfi * mfd)
131 * 2 * ref_freq
132 */
133 /* the tmp/2 is for rounding */
134 tmp = ref_freq / 10000;
135 mfn =
136 ((((((rate / 2) + (tmp / 2)) / tmp) * pd) * mfd) / 10000) -
137 (mfi * mfd);
138
139 mfn = mfn & 0x3ff;
140 pd--;
141 mfd--;
142
143 /* Change the Pll value */
144 reg = (mfi << MXC_CCM_PCTL_MFI_OFFSET) |
145 (mfn << MXC_CCM_PCTL_MFN_OFFSET) |
146 (mfd << MXC_CCM_PCTL_MFD_OFFSET) | (pd << MXC_CCM_PCTL_PD_OFFSET);
147
148 if (clk == &mcu_pll_clk)
149 __raw_writel(reg, MXC_CCM_MPCTL);
150 else if (clk == &usb_pll_clk)
151 __raw_writel(reg, MXC_CCM_UPCTL);
152 else if (clk == &serial_pll_clk)
153 __raw_writel(reg, MXC_CCM_SRPCTL);
154
155 return 0;
156}
157
158static unsigned long _clk_pll_get_rate(struct clk *clk)
159{
160 long mfi, mfn, mfd, pdf, ref_clk, mfn_abs;
161 unsigned long reg, ccmr;
162 s64 temp;
163 unsigned int prcs;
164
165 ccmr = __raw_readl(MXC_CCM_CCMR);
166 prcs = (ccmr & MXC_CCM_CCMR_PRCS_MASK) >> MXC_CCM_CCMR_PRCS_OFFSET;
167 if (prcs == 0x1)
168 ref_clk = CKIL_CLK_FREQ * 1024;
169 else
170 ref_clk = clk_get_rate(&ckih_clk);
171
172 if (clk == &mcu_pll_clk) {
173 if ((ccmr & MXC_CCM_CCMR_MPE) == 0)
174 return ref_clk;
175 if ((ccmr & MXC_CCM_CCMR_MDS) != 0)
176 return ref_clk;
177 reg = __raw_readl(MXC_CCM_MPCTL);
178 } else if (clk == &usb_pll_clk)
179 reg = __raw_readl(MXC_CCM_UPCTL);
180 else if (clk == &serial_pll_clk)
181 reg = __raw_readl(MXC_CCM_SRPCTL);
182 else {
183 BUG();
184 return 0;
185 }
186
187 pdf = (reg & MXC_CCM_PCTL_PD_MASK) >> MXC_CCM_PCTL_PD_OFFSET;
188 mfd = (reg & MXC_CCM_PCTL_MFD_MASK) >> MXC_CCM_PCTL_MFD_OFFSET;
189 mfi = (reg & MXC_CCM_PCTL_MFI_MASK) >> MXC_CCM_PCTL_MFI_OFFSET;
190 mfi = (mfi <= 5) ? 5 : mfi;
191 mfn = mfn_abs = reg & MXC_CCM_PCTL_MFN_MASK;
192
193 if (mfn >= 0x200) {
194 mfn |= 0xFFFFFE00;
195 mfn_abs = -mfn;
196 }
197
198 ref_clk *= 2;
199 ref_clk /= pdf + 1;
200
201 temp = (u64) ref_clk * mfn_abs;
202 do_div(temp, mfd + 1);
203 if (mfn < 0)
204 temp = -temp;
205 temp = (ref_clk * mfi) + temp;
206
207 return temp;
208}
209
210static int _clk_usb_pll_enable(struct clk *clk)
211{
212 u32 reg;
213
214 reg = __raw_readl(MXC_CCM_CCMR);
215 reg |= MXC_CCM_CCMR_UPE;
216 __raw_writel(reg, MXC_CCM_CCMR);
217
218 /* No lock bit on MX31, so using max time from spec */
219 udelay(80);
220
221 return 0;
222}
223
224static void _clk_usb_pll_disable(struct clk *clk)
225{
226 u32 reg;
227
228 reg = __raw_readl(MXC_CCM_CCMR);
229 reg &= ~MXC_CCM_CCMR_UPE;
230 __raw_writel(reg, MXC_CCM_CCMR);
231}
232
233static int _clk_serial_pll_enable(struct clk *clk)
234{
235 u32 reg;
236
237 reg = __raw_readl(MXC_CCM_CCMR);
238 reg |= MXC_CCM_CCMR_SPE;
239 __raw_writel(reg, MXC_CCM_CCMR);
240
241 /* No lock bit on MX31, so using max time from spec */
242 udelay(80);
243
244 return 0;
245}
246
247static void _clk_serial_pll_disable(struct clk *clk)
248{
249 u32 reg;
250
251 reg = __raw_readl(MXC_CCM_CCMR);
252 reg &= ~MXC_CCM_CCMR_SPE;
253 __raw_writel(reg, MXC_CCM_CCMR);
254}
255
256#define PDR0(mask, off) ((__raw_readl(MXC_CCM_PDR0) & mask) >> off)
257#define PDR1(mask, off) ((__raw_readl(MXC_CCM_PDR1) & mask) >> off)
258#define PDR2(mask, off) ((__raw_readl(MXC_CCM_PDR2) & mask) >> off)
259
260static unsigned long _clk_mcu_main_get_rate(struct clk *clk)
261{
262 u32 pmcr0 = __raw_readl(MXC_CCM_PMCR0);
263
264 if ((pmcr0 & MXC_CCM_PMCR0_DFSUP1) == MXC_CCM_PMCR0_DFSUP1_SPLL)
265 return clk_get_rate(&serial_pll_clk);
266 else
267 return clk_get_rate(&mcu_pll_clk);
268}
269
270static unsigned long _clk_hclk_get_rate(struct clk *clk)
271{
272 unsigned long max_pdf;
273
274 max_pdf = PDR0(MXC_CCM_PDR0_MAX_PODF_MASK,
275 MXC_CCM_PDR0_MAX_PODF_OFFSET);
276 return clk_get_rate(clk->parent) / (max_pdf + 1);
277}
278
279static unsigned long _clk_ipg_get_rate(struct clk *clk)
280{
281 unsigned long ipg_pdf;
282
283 ipg_pdf = PDR0(MXC_CCM_PDR0_IPG_PODF_MASK,
284 MXC_CCM_PDR0_IPG_PODF_OFFSET);
285 return clk_get_rate(clk->parent) / (ipg_pdf + 1);
286}
287
288static unsigned long _clk_nfc_get_rate(struct clk *clk)
289{
290 unsigned long nfc_pdf;
291
292 nfc_pdf = PDR0(MXC_CCM_PDR0_NFC_PODF_MASK,
293 MXC_CCM_PDR0_NFC_PODF_OFFSET);
294 return clk_get_rate(clk->parent) / (nfc_pdf + 1);
295}
296
297static unsigned long _clk_hsp_get_rate(struct clk *clk)
298{
299 unsigned long hsp_pdf;
300
301 hsp_pdf = PDR0(MXC_CCM_PDR0_HSP_PODF_MASK,
302 MXC_CCM_PDR0_HSP_PODF_OFFSET);
303 return clk_get_rate(clk->parent) / (hsp_pdf + 1);
304}
305
306static unsigned long _clk_usb_get_rate(struct clk *clk)
307{
308 unsigned long usb_pdf, usb_prepdf;
309
310 usb_pdf = PDR1(MXC_CCM_PDR1_USB_PODF_MASK,
311 MXC_CCM_PDR1_USB_PODF_OFFSET);
312 usb_prepdf = PDR1(MXC_CCM_PDR1_USB_PRDF_MASK,
313 MXC_CCM_PDR1_USB_PRDF_OFFSET);
314 return clk_get_rate(clk->parent) / (usb_prepdf + 1) / (usb_pdf + 1);
315}
316
317static unsigned long _clk_csi_get_rate(struct clk *clk)
318{
319 u32 reg, pre, post;
320
321 reg = __raw_readl(MXC_CCM_PDR0);
322 pre = (reg & MXC_CCM_PDR0_CSI_PRDF_MASK) >>
323 MXC_CCM_PDR0_CSI_PRDF_OFFSET;
324 pre++;
325 post = (reg & MXC_CCM_PDR0_CSI_PODF_MASK) >>
326 MXC_CCM_PDR0_CSI_PODF_OFFSET;
327 post++;
328 return clk_get_rate(clk->parent) / (pre * post);
329}
330
331static unsigned long _clk_csi_round_rate(struct clk *clk, unsigned long rate)
332{
333 u32 pre, post, parent = clk_get_rate(clk->parent);
334 u32 div = parent / rate;
335
336 if (parent % rate)
337 div++;
338
339 __calc_pre_post_dividers(div, &pre, &post);
340
341 return parent / (pre * post);
342}
343
344static int _clk_csi_set_rate(struct clk *clk, unsigned long rate)
345{
346 u32 reg, div, pre, post, parent = clk_get_rate(clk->parent);
347
348 div = parent / rate;
349
350 if ((parent / div) != rate)
351 return -EINVAL;
352
353 __calc_pre_post_dividers(div, &pre, &post);
354
355 /* Set CSI clock divider */
356 reg = __raw_readl(MXC_CCM_PDR0) &
357 ~(MXC_CCM_PDR0_CSI_PODF_MASK | MXC_CCM_PDR0_CSI_PRDF_MASK);
358 reg |= (post - 1) << MXC_CCM_PDR0_CSI_PODF_OFFSET;
359 reg |= (pre - 1) << MXC_CCM_PDR0_CSI_PRDF_OFFSET;
360 __raw_writel(reg, MXC_CCM_PDR0);
361
362 return 0;
363}
364
365static unsigned long _clk_per_get_rate(struct clk *clk)
366{
367 unsigned long per_pdf;
368
369 per_pdf = PDR0(MXC_CCM_PDR0_PER_PODF_MASK,
370 MXC_CCM_PDR0_PER_PODF_OFFSET);
371 return clk_get_rate(clk->parent) / (per_pdf + 1);
372}
373
374static unsigned long _clk_ssi1_get_rate(struct clk *clk)
375{
376 unsigned long ssi1_pdf, ssi1_prepdf;
377
378 ssi1_pdf = PDR1(MXC_CCM_PDR1_SSI1_PODF_MASK,
379 MXC_CCM_PDR1_SSI1_PODF_OFFSET);
380 ssi1_prepdf = PDR1(MXC_CCM_PDR1_SSI1_PRE_PODF_MASK,
381 MXC_CCM_PDR1_SSI1_PRE_PODF_OFFSET);
382 return clk_get_rate(clk->parent) / (ssi1_prepdf + 1) / (ssi1_pdf + 1);
383}
384
385static unsigned long _clk_ssi2_get_rate(struct clk *clk)
386{
387 unsigned long ssi2_pdf, ssi2_prepdf;
388
389 ssi2_pdf = PDR1(MXC_CCM_PDR1_SSI2_PODF_MASK,
390 MXC_CCM_PDR1_SSI2_PODF_OFFSET);
391 ssi2_prepdf = PDR1(MXC_CCM_PDR1_SSI2_PRE_PODF_MASK,
392 MXC_CCM_PDR1_SSI2_PRE_PODF_OFFSET);
393 return clk_get_rate(clk->parent) / (ssi2_prepdf + 1) / (ssi2_pdf + 1);
394}
395
396static unsigned long _clk_firi_get_rate(struct clk *clk)
397{
398 unsigned long firi_pdf, firi_prepdf;
399
400 firi_pdf = PDR1(MXC_CCM_PDR1_FIRI_PODF_MASK,
401 MXC_CCM_PDR1_FIRI_PODF_OFFSET);
402 firi_prepdf = PDR1(MXC_CCM_PDR1_FIRI_PRE_PODF_MASK,
403 MXC_CCM_PDR1_FIRI_PRE_PODF_OFFSET);
404 return clk_get_rate(clk->parent) / (firi_prepdf + 1) / (firi_pdf + 1);
405}
406
407static unsigned long _clk_firi_round_rate(struct clk *clk, unsigned long rate)
408{
409 u32 pre, post;
410 u32 parent = clk_get_rate(clk->parent);
411 u32 div = parent / rate;
412
413 if (parent % rate)
414 div++;
415
416 __calc_pre_post_dividers(div, &pre, &post);
417
418 return parent / (pre * post);
419
420}
421
422static int _clk_firi_set_rate(struct clk *clk, unsigned long rate)
423{
424 u32 reg, div, pre, post, parent = clk_get_rate(clk->parent);
425
426 div = parent / rate;
427
428 if ((parent / div) != rate)
429 return -EINVAL;
430
431 __calc_pre_post_dividers(div, &pre, &post);
432
433 /* Set FIRI clock divider */
434 reg = __raw_readl(MXC_CCM_PDR1) &
435 ~(MXC_CCM_PDR1_FIRI_PODF_MASK | MXC_CCM_PDR1_FIRI_PRE_PODF_MASK);
436 reg |= (pre - 1) << MXC_CCM_PDR1_FIRI_PRE_PODF_OFFSET;
437 reg |= (post - 1) << MXC_CCM_PDR1_FIRI_PODF_OFFSET;
438 __raw_writel(reg, MXC_CCM_PDR1);
439
440 return 0;
441}
442
443static unsigned long _clk_mbx_get_rate(struct clk *clk)
444{
445 return clk_get_rate(clk->parent) / 2;
446}
447
448static unsigned long _clk_mstick1_get_rate(struct clk *clk)
449{
450 unsigned long msti_pdf;
451
452 msti_pdf = PDR2(MXC_CCM_PDR2_MST1_PDF_MASK,
453 MXC_CCM_PDR2_MST1_PDF_OFFSET);
454 return clk_get_rate(clk->parent) / (msti_pdf + 1);
455}
456
457static unsigned long _clk_mstick2_get_rate(struct clk *clk)
458{
459 unsigned long msti_pdf;
460
461 msti_pdf = PDR2(MXC_CCM_PDR2_MST2_PDF_MASK,
462 MXC_CCM_PDR2_MST2_PDF_OFFSET);
463 return clk_get_rate(clk->parent) / (msti_pdf + 1);
464}
465
466static unsigned long ckih_rate;
467
468static unsigned long clk_ckih_get_rate(struct clk *clk)
469{
470 return ckih_rate;
471}
472
473static struct clk ckih_clk = {
474 .name = "ckih",
475 .get_rate = clk_ckih_get_rate,
476};
477
478static unsigned long clk_ckil_get_rate(struct clk *clk)
479{
480 return CKIL_CLK_FREQ;
481}
482
483static struct clk ckil_clk = {
484 .name = "ckil",
485 .get_rate = clk_ckil_get_rate,
486};
487
488static struct clk mcu_pll_clk = {
489 .name = "mcu_pll",
490 .parent = &ckih_clk,
491 .set_rate = _clk_pll_set_rate,
492 .get_rate = _clk_pll_get_rate,
493};
494
495static struct clk mcu_main_clk = {
496 .name = "mcu_main_clk",
497 .parent = &mcu_pll_clk,
498 .get_rate = _clk_mcu_main_get_rate,
499};
500
501static struct clk serial_pll_clk = {
502 .name = "serial_pll",
503 .parent = &ckih_clk,
504 .set_rate = _clk_pll_set_rate,
505 .get_rate = _clk_pll_get_rate,
506 .enable = _clk_serial_pll_enable,
507 .disable = _clk_serial_pll_disable,
508};
509
510static struct clk usb_pll_clk = {
511 .name = "usb_pll",
512 .parent = &ckih_clk,
513 .set_rate = _clk_pll_set_rate,
514 .get_rate = _clk_pll_get_rate,
515 .enable = _clk_usb_pll_enable,
516 .disable = _clk_usb_pll_disable,
517};
518
519static struct clk ahb_clk = {
520 .name = "ahb_clk",
521 .parent = &mcu_main_clk,
522 .get_rate = _clk_hclk_get_rate,
523};
524
525static struct clk per_clk = {
526 .name = "per_clk",
527 .parent = &usb_pll_clk,
528 .get_rate = _clk_per_get_rate,
529};
530
531static struct clk perclk_clk = {
532 .name = "perclk_clk",
533 .parent = &ipg_clk,
534};
535
536static struct clk cspi_clk[] = {
537 {
538 .name = "cspi_clk",
539 .id = 0,
540 .parent = &ipg_clk,
541 .enable = _clk_enable,
542 .enable_reg = MXC_CCM_CGR2,
543 .enable_shift = MXC_CCM_CGR2_CSPI1_OFFSET,
544 .disable = _clk_disable,},
545 {
546 .name = "cspi_clk",
547 .id = 1,
548 .parent = &ipg_clk,
549 .enable = _clk_enable,
550 .enable_reg = MXC_CCM_CGR2,
551 .enable_shift = MXC_CCM_CGR2_CSPI2_OFFSET,
552 .disable = _clk_disable,},
553 {
554 .name = "cspi_clk",
555 .id = 2,
556 .parent = &ipg_clk,
557 .enable = _clk_enable,
558 .enable_reg = MXC_CCM_CGR0,
559 .enable_shift = MXC_CCM_CGR0_CSPI3_OFFSET,
560 .disable = _clk_disable,},
561};
562
563static struct clk ipg_clk = {
564 .name = "ipg_clk",
565 .parent = &ahb_clk,
566 .get_rate = _clk_ipg_get_rate,
567};
568
569static struct clk emi_clk = {
570 .name = "emi_clk",
571 .parent = &ahb_clk,
572 .enable = _clk_enable,
573 .enable_reg = MXC_CCM_CGR2,
574 .enable_shift = MXC_CCM_CGR2_EMI_OFFSET,
575 .disable = _clk_emi_disable,
576};
577
578static struct clk gpt_clk = {
579 .name = "gpt_clk",
580 .parent = &perclk_clk,
581 .enable = _clk_enable,
582 .enable_reg = MXC_CCM_CGR0,
583 .enable_shift = MXC_CCM_CGR0_GPT_OFFSET,
584 .disable = _clk_disable,
585};
586
587static struct clk pwm_clk = {
588 .name = "pwm_clk",
589 .parent = &perclk_clk,
590 .enable = _clk_enable,
591 .enable_reg = MXC_CCM_CGR0,
592 .enable_shift = MXC_CCM_CGR1_PWM_OFFSET,
593 .disable = _clk_disable,
594};
595
596static struct clk epit_clk[] = {
597 {
598 .name = "epit_clk",
599 .id = 0,
600 .parent = &perclk_clk,
601 .enable = _clk_enable,
602 .enable_reg = MXC_CCM_CGR0,
603 .enable_shift = MXC_CCM_CGR0_EPIT1_OFFSET,
604 .disable = _clk_disable,},
605 {
606 .name = "epit_clk",
607 .id = 1,
608 .parent = &perclk_clk,
609 .enable = _clk_enable,
610 .enable_reg = MXC_CCM_CGR0,
611 .enable_shift = MXC_CCM_CGR0_EPIT2_OFFSET,
612 .disable = _clk_disable,},
613};
614
615static struct clk nfc_clk = {
616 .name = "nfc_clk",
617 .parent = &ahb_clk,
618 .get_rate = _clk_nfc_get_rate,
619};
620
621static struct clk scc_clk = {
622 .name = "scc_clk",
623 .parent = &ipg_clk,
624};
625
626static struct clk ipu_clk = {
627 .name = "ipu_clk",
628 .parent = &mcu_main_clk,
629 .get_rate = _clk_hsp_get_rate,
630 .enable = _clk_enable,
631 .enable_reg = MXC_CCM_CGR1,
632 .enable_shift = MXC_CCM_CGR1_IPU_OFFSET,
633 .disable = _clk_disable,
634};
635
636static struct clk kpp_clk = {
637 .name = "kpp_clk",
638 .parent = &ipg_clk,
639 .enable = _clk_enable,
640 .enable_reg = MXC_CCM_CGR1,
641 .enable_shift = MXC_CCM_CGR1_KPP_OFFSET,
642 .disable = _clk_disable,
643};
644
645static struct clk wdog_clk = {
646 .name = "wdog_clk",
647 .parent = &ipg_clk,
648 .enable = _clk_enable,
649 .enable_reg = MXC_CCM_CGR1,
650 .enable_shift = MXC_CCM_CGR1_WDOG_OFFSET,
651 .disable = _clk_disable,
652};
653static struct clk rtc_clk = {
654 .name = "rtc_clk",
655 .parent = &ipg_clk,
656 .enable = _clk_enable,
657 .enable_reg = MXC_CCM_CGR1,
658 .enable_shift = MXC_CCM_CGR1_RTC_OFFSET,
659 .disable = _clk_disable,
660};
661
662static struct clk usb_clk[] = {
663 {
664 .name = "usb_clk",
665 .parent = &usb_pll_clk,
666 .get_rate = _clk_usb_get_rate,},
667 {
668 .name = "usb_ahb_clk",
669 .parent = &ahb_clk,
670 .enable = _clk_enable,
671 .enable_reg = MXC_CCM_CGR1,
672 .enable_shift = MXC_CCM_CGR1_USBOTG_OFFSET,
673 .disable = _clk_disable,},
674};
675
676static struct clk csi_clk = {
677 .name = "csi_clk",
678 .parent = &serial_pll_clk,
679 .get_rate = _clk_csi_get_rate,
680 .round_rate = _clk_csi_round_rate,
681 .set_rate = _clk_csi_set_rate,
682 .enable = _clk_enable,
683 .enable_reg = MXC_CCM_CGR1,
684 .enable_shift = MXC_CCM_CGR1_CSI_OFFSET,
685 .disable = _clk_disable,
686};
687
688static struct clk uart_clk[] = {
689 {
690 .name = "uart_clk",
691 .id = 0,
692 .parent = &perclk_clk,
693 .enable = _clk_enable,
694 .enable_reg = MXC_CCM_CGR0,
695 .enable_shift = MXC_CCM_CGR0_UART1_OFFSET,
696 .disable = _clk_disable,},
697 {
698 .name = "uart_clk",
699 .id = 1,
700 .parent = &perclk_clk,
701 .enable = _clk_enable,
702 .enable_reg = MXC_CCM_CGR0,
703 .enable_shift = MXC_CCM_CGR0_UART2_OFFSET,
704 .disable = _clk_disable,},
705 {
706 .name = "uart_clk",
707 .id = 2,
708 .parent = &perclk_clk,
709 .enable = _clk_enable,
710 .enable_reg = MXC_CCM_CGR1,
711 .enable_shift = MXC_CCM_CGR1_UART3_OFFSET,
712 .disable = _clk_disable,},
713 {
714 .name = "uart_clk",
715 .id = 3,
716 .parent = &perclk_clk,
717 .enable = _clk_enable,
718 .enable_reg = MXC_CCM_CGR1,
719 .enable_shift = MXC_CCM_CGR1_UART4_OFFSET,
720 .disable = _clk_disable,},
721 {
722 .name = "uart_clk",
723 .id = 4,
724 .parent = &perclk_clk,
725 .enable = _clk_enable,
726 .enable_reg = MXC_CCM_CGR1,
727 .enable_shift = MXC_CCM_CGR1_UART5_OFFSET,
728 .disable = _clk_disable,},
729};
730
731static struct clk i2c_clk[] = {
732 {
733 .name = "i2c_clk",
734 .id = 0,
735 .parent = &perclk_clk,
736 .enable = _clk_enable,
737 .enable_reg = MXC_CCM_CGR0,
738 .enable_shift = MXC_CCM_CGR0_I2C1_OFFSET,
739 .disable = _clk_disable,},
740 {
741 .name = "i2c_clk",
742 .id = 1,
743 .parent = &perclk_clk,
744 .enable = _clk_enable,
745 .enable_reg = MXC_CCM_CGR0,
746 .enable_shift = MXC_CCM_CGR0_I2C2_OFFSET,
747 .disable = _clk_disable,},
748 {
749 .name = "i2c_clk",
750 .id = 2,
751 .parent = &perclk_clk,
752 .enable = _clk_enable,
753 .enable_reg = MXC_CCM_CGR0,
754 .enable_shift = MXC_CCM_CGR0_I2C3_OFFSET,
755 .disable = _clk_disable,},
756};
757
758static struct clk owire_clk = {
759 .name = "owire_clk",
760 .parent = &perclk_clk,
761 .enable_reg = MXC_CCM_CGR1,
762 .enable_shift = MXC_CCM_CGR1_OWIRE_OFFSET,
763 .enable = _clk_enable,
764 .disable = _clk_disable,
765};
766
767static struct clk sdhc_clk[] = {
768 {
769 .name = "sdhc_clk",
770 .id = 0,
771 .parent = &perclk_clk,
772 .enable = _clk_enable,
773 .enable_reg = MXC_CCM_CGR0,
774 .enable_shift = MXC_CCM_CGR0_SD_MMC1_OFFSET,
775 .disable = _clk_disable,},
776 {
777 .name = "sdhc_clk",
778 .id = 1,
779 .parent = &perclk_clk,
780 .enable = _clk_enable,
781 .enable_reg = MXC_CCM_CGR0,
782 .enable_shift = MXC_CCM_CGR0_SD_MMC2_OFFSET,
783 .disable = _clk_disable,},
784};
785
786static struct clk ssi_clk[] = {
787 {
788 .name = "ssi_clk",
789 .parent = &serial_pll_clk,
790 .get_rate = _clk_ssi1_get_rate,
791 .enable = _clk_enable,
792 .enable_reg = MXC_CCM_CGR0,
793 .enable_shift = MXC_CCM_CGR0_SSI1_OFFSET,
794 .disable = _clk_disable,},
795 {
796 .name = "ssi_clk",
797 .id = 1,
798 .parent = &serial_pll_clk,
799 .get_rate = _clk_ssi2_get_rate,
800 .enable = _clk_enable,
801 .enable_reg = MXC_CCM_CGR2,
802 .enable_shift = MXC_CCM_CGR2_SSI2_OFFSET,
803 .disable = _clk_disable,},
804};
805
806static struct clk firi_clk = {
807 .name = "firi_clk",
808 .parent = &usb_pll_clk,
809 .round_rate = _clk_firi_round_rate,
810 .set_rate = _clk_firi_set_rate,
811 .get_rate = _clk_firi_get_rate,
812 .enable = _clk_enable,
813 .enable_reg = MXC_CCM_CGR2,
814 .enable_shift = MXC_CCM_CGR2_FIRI_OFFSET,
815 .disable = _clk_disable,
816};
817
818static struct clk ata_clk = {
819 .name = "ata_clk",
820 .parent = &ipg_clk,
821 .enable = _clk_enable,
822 .enable_reg = MXC_CCM_CGR0,
823 .enable_shift = MXC_CCM_CGR0_ATA_OFFSET,
824 .disable = _clk_disable,
825};
826
827static struct clk mbx_clk = {
828 .name = "mbx_clk",
829 .parent = &ahb_clk,
830 .enable = _clk_enable,
831 .enable_reg = MXC_CCM_CGR2,
832 .enable_shift = MXC_CCM_CGR2_GACC_OFFSET,
833 .get_rate = _clk_mbx_get_rate,
834};
835
836static struct clk vpu_clk = {
837 .name = "vpu_clk",
838 .parent = &ahb_clk,
839 .enable = _clk_enable,
840 .enable_reg = MXC_CCM_CGR2,
841 .enable_shift = MXC_CCM_CGR2_GACC_OFFSET,
842 .get_rate = _clk_mbx_get_rate,
843};
844
845static struct clk rtic_clk = {
846 .name = "rtic_clk",
847 .parent = &ahb_clk,
848 .enable = _clk_enable,
849 .enable_reg = MXC_CCM_CGR2,
850 .enable_shift = MXC_CCM_CGR2_RTIC_OFFSET,
851 .disable = _clk_disable,
852};
853
854static struct clk rng_clk = {
855 .name = "rng_clk",
856 .parent = &ipg_clk,
857 .enable = _clk_enable,
858 .enable_reg = MXC_CCM_CGR0,
859 .enable_shift = MXC_CCM_CGR0_RNG_OFFSET,
860 .disable = _clk_disable,
861};
862
863static struct clk sdma_clk[] = {
864 {
865 .name = "sdma_ahb_clk",
866 .parent = &ahb_clk,
867 .enable = _clk_enable,
868 .enable_reg = MXC_CCM_CGR0,
869 .enable_shift = MXC_CCM_CGR0_SDMA_OFFSET,
870 .disable = _clk_disable,},
871 {
872 .name = "sdma_ipg_clk",
873 .parent = &ipg_clk,}
874};
875
876static struct clk mpeg4_clk = {
877 .name = "mpeg4_clk",
878 .parent = &ahb_clk,
879 .enable = _clk_enable,
880 .enable_reg = MXC_CCM_CGR1,
881 .enable_shift = MXC_CCM_CGR1_HANTRO_OFFSET,
882 .disable = _clk_disable,
883};
884
885static struct clk vl2cc_clk = {
886 .name = "vl2cc_clk",
887 .parent = &ahb_clk,
888 .enable = _clk_enable,
889 .enable_reg = MXC_CCM_CGR1,
890 .enable_shift = MXC_CCM_CGR1_HANTRO_OFFSET,
891 .disable = _clk_disable,
892};
893
894static struct clk mstick_clk[] = {
895 {
896 .name = "mstick_clk",
897 .id = 0,
898 .parent = &usb_pll_clk,
899 .get_rate = _clk_mstick1_get_rate,
900 .enable = _clk_enable,
901 .enable_reg = MXC_CCM_CGR1,
902 .enable_shift = MXC_CCM_CGR1_MEMSTICK1_OFFSET,
903 .disable = _clk_disable,},
904 {
905 .name = "mstick_clk",
906 .id = 1,
907 .parent = &usb_pll_clk,
908 .get_rate = _clk_mstick2_get_rate,
909 .enable = _clk_enable,
910 .enable_reg = MXC_CCM_CGR1,
911 .enable_shift = MXC_CCM_CGR1_MEMSTICK2_OFFSET,
912 .disable = _clk_disable,},
913};
914
915static struct clk iim_clk = {
916 .name = "iim_clk",
917 .parent = &ipg_clk,
918 .enable = _clk_enable,
919 .enable_reg = MXC_CCM_CGR0,
920 .enable_shift = MXC_CCM_CGR0_IIM_OFFSET,
921 .disable = _clk_disable,
922};
923
924static unsigned long _clk_cko1_round_rate(struct clk *clk, unsigned long rate)
925{
926 u32 div, parent = clk_get_rate(clk->parent);
927
928 div = parent / rate;
929 if (parent % rate)
930 div++;
931
932 if (div > 8)
933 div = 16;
934 else if (div > 4)
935 div = 8;
936 else if (div > 2)
937 div = 4;
938
939 return parent / div;
940}
941
942static int _clk_cko1_set_rate(struct clk *clk, unsigned long rate)
943{
944 u32 reg, div, parent = clk_get_rate(clk->parent);
945
946 div = parent / rate;
947
948 if (div == 16)
949 div = 4;
950 else if (div == 8)
951 div = 3;
952 else if (div == 4)
953 div = 2;
954 else if (div == 2)
955 div = 1;
956 else if (div == 1)
957 div = 0;
958 else
959 return -EINVAL;
960
961 reg = __raw_readl(MXC_CCM_COSR) & ~MXC_CCM_COSR_CLKOUTDIV_MASK;
962 reg |= div << MXC_CCM_COSR_CLKOUTDIV_OFFSET;
963 __raw_writel(reg, MXC_CCM_COSR);
964
965 return 0;
966}
967
968static unsigned long _clk_cko1_get_rate(struct clk *clk)
969{
970 u32 div;
971
972 div = __raw_readl(MXC_CCM_COSR) & MXC_CCM_COSR_CLKOUTDIV_MASK >>
973 MXC_CCM_COSR_CLKOUTDIV_OFFSET;
974
975 return clk_get_rate(clk->parent) / (1 << div);
976}
977
978static int _clk_cko1_set_parent(struct clk *clk, struct clk *parent)
979{
980 u32 reg;
981
982 reg = __raw_readl(MXC_CCM_COSR) & ~MXC_CCM_COSR_CLKOSEL_MASK;
983
984 if (parent == &mcu_main_clk)
985 reg |= 0 << MXC_CCM_COSR_CLKOSEL_OFFSET;
986 else if (parent == &ipg_clk)
987 reg |= 1 << MXC_CCM_COSR_CLKOSEL_OFFSET;
988 else if (parent == &usb_pll_clk)
989 reg |= 2 << MXC_CCM_COSR_CLKOSEL_OFFSET;
990 else if (parent == mcu_main_clk.parent)
991 reg |= 3 << MXC_CCM_COSR_CLKOSEL_OFFSET;
992 else if (parent == &ahb_clk)
993 reg |= 5 << MXC_CCM_COSR_CLKOSEL_OFFSET;
994 else if (parent == &serial_pll_clk)
995 reg |= 7 << MXC_CCM_COSR_CLKOSEL_OFFSET;
996 else if (parent == &ckih_clk)
997 reg |= 8 << MXC_CCM_COSR_CLKOSEL_OFFSET;
998 else if (parent == &emi_clk)
999 reg |= 9 << MXC_CCM_COSR_CLKOSEL_OFFSET;
1000 else if (parent == &ipu_clk)
1001 reg |= 0xA << MXC_CCM_COSR_CLKOSEL_OFFSET;
1002 else if (parent == &nfc_clk)
1003 reg |= 0xB << MXC_CCM_COSR_CLKOSEL_OFFSET;
1004 else if (parent == &uart_clk[0])
1005 reg |= 0xC << MXC_CCM_COSR_CLKOSEL_OFFSET;
1006 else
1007 return -EINVAL;
1008
1009 __raw_writel(reg, MXC_CCM_COSR);
1010
1011 return 0;
1012}
1013
1014static int _clk_cko1_enable(struct clk *clk)
1015{
1016 u32 reg;
1017
1018 reg = __raw_readl(MXC_CCM_COSR) | MXC_CCM_COSR_CLKOEN;
1019 __raw_writel(reg, MXC_CCM_COSR);
1020
1021 return 0;
1022}
1023
1024static void _clk_cko1_disable(struct clk *clk)
1025{
1026 u32 reg;
1027
1028 reg = __raw_readl(MXC_CCM_COSR) & ~MXC_CCM_COSR_CLKOEN;
1029 __raw_writel(reg, MXC_CCM_COSR);
1030}
1031
1032static struct clk cko1_clk = {
1033 .name = "cko1_clk",
1034 .get_rate = _clk_cko1_get_rate,
1035 .set_rate = _clk_cko1_set_rate,
1036 .round_rate = _clk_cko1_round_rate,
1037 .set_parent = _clk_cko1_set_parent,
1038 .enable = _clk_cko1_enable,
1039 .disable = _clk_cko1_disable,
1040};
1041
1042static struct clk *mxc_clks[] = {
1043 &ckih_clk,
1044 &ckil_clk,
1045 &mcu_pll_clk,
1046 &usb_pll_clk,
1047 &serial_pll_clk,
1048 &mcu_main_clk,
1049 &ahb_clk,
1050 &per_clk,
1051 &perclk_clk,
1052 &cko1_clk,
1053 &emi_clk,
1054 &cspi_clk[0],
1055 &cspi_clk[1],
1056 &cspi_clk[2],
1057 &ipg_clk,
1058 &gpt_clk,
1059 &pwm_clk,
1060 &wdog_clk,
1061 &rtc_clk,
1062 &epit_clk[0],
1063 &epit_clk[1],
1064 &nfc_clk,
1065 &ipu_clk,
1066 &kpp_clk,
1067 &usb_clk[0],
1068 &usb_clk[1],
1069 &csi_clk,
1070 &uart_clk[0],
1071 &uart_clk[1],
1072 &uart_clk[2],
1073 &uart_clk[3],
1074 &uart_clk[4],
1075 &i2c_clk[0],
1076 &i2c_clk[1],
1077 &i2c_clk[2],
1078 &owire_clk,
1079 &sdhc_clk[0],
1080 &sdhc_clk[1],
1081 &ssi_clk[0],
1082 &ssi_clk[1],
1083 &firi_clk,
1084 &ata_clk,
1085 &rtic_clk,
1086 &rng_clk,
1087 &sdma_clk[0],
1088 &sdma_clk[1],
1089 &mstick_clk[0],
1090 &mstick_clk[1],
1091 &scc_clk,
1092 &iim_clk,
1093};
1094
1095int __init mxc_clocks_init(unsigned long fref)
1096{
1097 u32 reg;
1098 struct clk **clkp;
1099
1100 ckih_rate = fref;
1101
1102 for (clkp = mxc_clks; clkp < mxc_clks + ARRAY_SIZE(mxc_clks); clkp++)
1103 clk_register(*clkp);
1104
1105 if (cpu_is_mx31()) {
1106 clk_register(&mpeg4_clk);
1107 clk_register(&mbx_clk);
1108 } else {
1109 clk_register(&vpu_clk);
1110 clk_register(&vl2cc_clk);
1111 }
1112
1113 /* Turn off all possible clocks */
1114 __raw_writel(MXC_CCM_CGR0_GPT_MASK, MXC_CCM_CGR0);
1115 __raw_writel(0, MXC_CCM_CGR1);
1116
1117 __raw_writel(MXC_CCM_CGR2_EMI_MASK |
1118 MXC_CCM_CGR2_IPMUX1_MASK |
1119 MXC_CCM_CGR2_IPMUX2_MASK |
1120 MXC_CCM_CGR2_MXCCLKENSEL_MASK | /* for MX32 */
1121 MXC_CCM_CGR2_CHIKCAMPEN_MASK | /* for MX32 */
1122 MXC_CCM_CGR2_OVRVPUBUSY_MASK | /* for MX32 */
1123 1 << 27 | 1 << 28, /* Bit 27 and 28 are not defined for
1124 MX32, but still required to be set */
1125 MXC_CCM_CGR2);
1126
1127 clk_disable(&cko1_clk);
1128 clk_disable(&usb_pll_clk);
1129
1130 pr_info("Clock input source is %ld\n", clk_get_rate(&ckih_clk));
1131
1132 clk_enable(&gpt_clk);
1133 clk_enable(&emi_clk);
1134 clk_enable(&iim_clk);
1135
1136 clk_enable(&serial_pll_clk);
1137
1138 if (mx31_revision() >= CHIP_REV_2_0) {
1139 reg = __raw_readl(MXC_CCM_PMCR1);
1140 /* No PLL restart on DVFS switch; enable auto EMI handshake */
1141 reg |= MXC_CCM_PMCR1_PLLRDIS | MXC_CCM_PMCR1_EMIRQ_EN;
1142 __raw_writel(reg, MXC_CCM_PMCR1);
1143 }
1144
1145 return 0;
1146}
1147
diff --git a/arch/arm/mach-mx3/crm_regs.h b/arch/arm/mach-mx3/crm_regs.h
new file mode 100644
index 000000000000..4a0e0ede23bb
--- /dev/null
+++ b/arch/arm/mach-mx3/crm_regs.h
@@ -0,0 +1,401 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#ifndef __ARCH_ARM_MACH_MX3_CRM_REGS_H__
21#define __ARCH_ARM_MACH_MX3_CRM_REGS_H__
22
23#define CKIH_CLK_FREQ 26000000
24#define CKIH_CLK_FREQ_27MHZ 27000000
25#define CKIL_CLK_FREQ 32768
26
27#define MXC_CCM_BASE IO_ADDRESS(CCM_BASE_ADDR)
28
29/* Register addresses */
30#define MXC_CCM_CCMR (MXC_CCM_BASE + 0x00)
31#define MXC_CCM_PDR0 (MXC_CCM_BASE + 0x04)
32#define MXC_CCM_PDR1 (MXC_CCM_BASE + 0x08)
33#define MXC_CCM_RCSR (MXC_CCM_BASE + 0x0C)
34#define MXC_CCM_MPCTL (MXC_CCM_BASE + 0x10)
35#define MXC_CCM_UPCTL (MXC_CCM_BASE + 0x14)
36#define MXC_CCM_SRPCTL (MXC_CCM_BASE + 0x18)
37#define MXC_CCM_COSR (MXC_CCM_BASE + 0x1C)
38#define MXC_CCM_CGR0 (MXC_CCM_BASE + 0x20)
39#define MXC_CCM_CGR1 (MXC_CCM_BASE + 0x24)
40#define MXC_CCM_CGR2 (MXC_CCM_BASE + 0x28)
41#define MXC_CCM_WIMR (MXC_CCM_BASE + 0x2C)
42#define MXC_CCM_LDC (MXC_CCM_BASE + 0x30)
43#define MXC_CCM_DCVR0 (MXC_CCM_BASE + 0x34)
44#define MXC_CCM_DCVR1 (MXC_CCM_BASE + 0x38)
45#define MXC_CCM_DCVR2 (MXC_CCM_BASE + 0x3C)
46#define MXC_CCM_DCVR3 (MXC_CCM_BASE + 0x40)
47#define MXC_CCM_LTR0 (MXC_CCM_BASE + 0x44)
48#define MXC_CCM_LTR1 (MXC_CCM_BASE + 0x48)
49#define MXC_CCM_LTR2 (MXC_CCM_BASE + 0x4C)
50#define MXC_CCM_LTR3 (MXC_CCM_BASE + 0x50)
51#define MXC_CCM_LTBR0 (MXC_CCM_BASE + 0x54)
52#define MXC_CCM_LTBR1 (MXC_CCM_BASE + 0x58)
53#define MXC_CCM_PMCR0 (MXC_CCM_BASE + 0x5C)
54#define MXC_CCM_PMCR1 (MXC_CCM_BASE + 0x60)
55#define MXC_CCM_PDR2 (MXC_CCM_BASE + 0x64)
56
57/* Register bit definitions */
58#define MXC_CCM_CCMR_WBEN (1 << 27)
59#define MXC_CCM_CCMR_CSCS (1 << 25)
60#define MXC_CCM_CCMR_PERCS (1 << 24)
61#define MXC_CCM_CCMR_SSI1S_OFFSET 18
62#define MXC_CCM_CCMR_SSI1S_MASK (0x3 << 18)
63#define MXC_CCM_CCMR_SSI2S_OFFSET 21
64#define MXC_CCM_CCMR_SSI2S_MASK (0x3 << 21)
65#define MXC_CCM_CCMR_LPM_OFFSET 14
66#define MXC_CCM_CCMR_LPM_MASK (0x3 << 14)
67#define MXC_CCM_CCMR_FIRS_OFFSET 11
68#define MXC_CCM_CCMR_FIRS_MASK (0x3 << 11)
69#define MXC_CCM_CCMR_UPE (1 << 9)
70#define MXC_CCM_CCMR_SPE (1 << 8)
71#define MXC_CCM_CCMR_MDS (1 << 7)
72#define MXC_CCM_CCMR_SBYCS (1 << 4)
73#define MXC_CCM_CCMR_MPE (1 << 3)
74#define MXC_CCM_CCMR_PRCS_OFFSET 1
75#define MXC_CCM_CCMR_PRCS_MASK (0x3 << 1)
76
77#define MXC_CCM_PDR0_CSI_PODF_OFFSET 26
78#define MXC_CCM_PDR0_CSI_PODF_MASK (0x3F << 26)
79#define MXC_CCM_PDR0_CSI_PRDF_OFFSET 23
80#define MXC_CCM_PDR0_CSI_PRDF_MASK (0x7 << 23)
81#define MXC_CCM_PDR0_PER_PODF_OFFSET 16
82#define MXC_CCM_PDR0_PER_PODF_MASK (0x1F << 16)
83#define MXC_CCM_PDR0_HSP_PODF_OFFSET 11
84#define MXC_CCM_PDR0_HSP_PODF_MASK (0x7 << 11)
85#define MXC_CCM_PDR0_NFC_PODF_OFFSET 8
86#define MXC_CCM_PDR0_NFC_PODF_MASK (0x7 << 8)
87#define MXC_CCM_PDR0_IPG_PODF_OFFSET 6
88#define MXC_CCM_PDR0_IPG_PODF_MASK (0x3 << 6)
89#define MXC_CCM_PDR0_MAX_PODF_OFFSET 3
90#define MXC_CCM_PDR0_MAX_PODF_MASK (0x7 << 3)
91#define MXC_CCM_PDR0_MCU_PODF_OFFSET 0
92#define MXC_CCM_PDR0_MCU_PODF_MASK 0x7
93
94#define MXC_CCM_PDR0_HSP_DIV_1 (0x0 << 11)
95#define MXC_CCM_PDR0_HSP_DIV_2 (0x1 << 11)
96#define MXC_CCM_PDR0_HSP_DIV_3 (0x2 << 11)
97#define MXC_CCM_PDR0_HSP_DIV_4 (0x3 << 11)
98#define MXC_CCM_PDR0_HSP_DIV_5 (0x4 << 11)
99#define MXC_CCM_PDR0_HSP_DIV_6 (0x5 << 11)
100#define MXC_CCM_PDR0_HSP_DIV_7 (0x6 << 11)
101#define MXC_CCM_PDR0_HSP_DIV_8 (0x7 << 11)
102
103#define MXC_CCM_PDR0_IPG_DIV_1 (0x0 << 6)
104#define MXC_CCM_PDR0_IPG_DIV_2 (0x1 << 6)
105#define MXC_CCM_PDR0_IPG_DIV_3 (0x2 << 6)
106#define MXC_CCM_PDR0_IPG_DIV_4 (0x3 << 6)
107
108#define MXC_CCM_PDR0_MAX_DIV_1 (0x0 << 3)
109#define MXC_CCM_PDR0_MAX_DIV_2 (0x1 << 3)
110#define MXC_CCM_PDR0_MAX_DIV_3 (0x2 << 3)
111#define MXC_CCM_PDR0_MAX_DIV_4 (0x3 << 3)
112#define MXC_CCM_PDR0_MAX_DIV_5 (0x4 << 3)
113#define MXC_CCM_PDR0_MAX_DIV_6 (0x5 << 3)
114#define MXC_CCM_PDR0_MAX_DIV_7 (0x6 << 3)
115#define MXC_CCM_PDR0_MAX_DIV_8 (0x7 << 3)
116
117#define MXC_CCM_PDR0_NFC_DIV_1 (0x0 << 8)
118#define MXC_CCM_PDR0_NFC_DIV_2 (0x1 << 8)
119#define MXC_CCM_PDR0_NFC_DIV_3 (0x2 << 8)
120#define MXC_CCM_PDR0_NFC_DIV_4 (0x3 << 8)
121#define MXC_CCM_PDR0_NFC_DIV_5 (0x4 << 8)
122#define MXC_CCM_PDR0_NFC_DIV_6 (0x5 << 8)
123#define MXC_CCM_PDR0_NFC_DIV_7 (0x6 << 8)
124#define MXC_CCM_PDR0_NFC_DIV_8 (0x7 << 8)
125
126#define MXC_CCM_PDR0_MCU_DIV_1 0x0
127#define MXC_CCM_PDR0_MCU_DIV_2 0x1
128#define MXC_CCM_PDR0_MCU_DIV_3 0x2
129#define MXC_CCM_PDR0_MCU_DIV_4 0x3
130#define MXC_CCM_PDR0_MCU_DIV_5 0x4
131#define MXC_CCM_PDR0_MCU_DIV_6 0x5
132#define MXC_CCM_PDR0_MCU_DIV_7 0x6
133#define MXC_CCM_PDR0_MCU_DIV_8 0x7
134
135#define MXC_CCM_PDR1_USB_PRDF_OFFSET 30
136#define MXC_CCM_PDR1_USB_PRDF_MASK (0x3 << 30)
137#define MXC_CCM_PDR1_USB_PODF_OFFSET 27
138#define MXC_CCM_PDR1_USB_PODF_MASK (0x7 << 27)
139#define MXC_CCM_PDR1_FIRI_PRE_PODF_OFFSET 24
140#define MXC_CCM_PDR1_FIRI_PRE_PODF_MASK (0x7 << 24)
141#define MXC_CCM_PDR1_FIRI_PODF_OFFSET 18
142#define MXC_CCM_PDR1_FIRI_PODF_MASK (0x3F << 18)
143#define MXC_CCM_PDR1_SSI2_PRE_PODF_OFFSET 15
144#define MXC_CCM_PDR1_SSI2_PRE_PODF_MASK (0x7 << 15)
145#define MXC_CCM_PDR1_SSI2_PODF_OFFSET 9
146#define MXC_CCM_PDR1_SSI2_PODF_MASK (0x3F << 9)
147#define MXC_CCM_PDR1_SSI1_PRE_PODF_OFFSET 6
148#define MXC_CCM_PDR1_SSI1_PRE_PODF_MASK (0x7 << 6)
149#define MXC_CCM_PDR1_SSI1_PODF_OFFSET 0
150#define MXC_CCM_PDR1_SSI1_PODF_MASK 0x3F
151
152/* Bit definitions for RCSR */
153#define MXC_CCM_RCSR_NF16B 0x80000000
154
155/* Bit definitions for both MCU, USB and SR PLL control registers */
156#define MXC_CCM_PCTL_BRM 0x80000000
157#define MXC_CCM_PCTL_PD_OFFSET 26
158#define MXC_CCM_PCTL_PD_MASK (0xF << 26)
159#define MXC_CCM_PCTL_MFD_OFFSET 16
160#define MXC_CCM_PCTL_MFD_MASK (0x3FF << 16)
161#define MXC_CCM_PCTL_MFI_OFFSET 10
162#define MXC_CCM_PCTL_MFI_MASK (0xF << 10)
163#define MXC_CCM_PCTL_MFN_OFFSET 0
164#define MXC_CCM_PCTL_MFN_MASK 0x3FF
165
166#define MXC_CCM_CGR0_SD_MMC1_OFFSET 0
167#define MXC_CCM_CGR0_SD_MMC1_MASK (0x3 << 0)
168#define MXC_CCM_CGR0_SD_MMC2_OFFSET 2
169#define MXC_CCM_CGR0_SD_MMC2_MASK (0x3 << 2)
170#define MXC_CCM_CGR0_GPT_OFFSET 4
171#define MXC_CCM_CGR0_GPT_MASK (0x3 << 4)
172#define MXC_CCM_CGR0_EPIT1_OFFSET 6
173#define MXC_CCM_CGR0_EPIT1_MASK (0x3 << 6)
174#define MXC_CCM_CGR0_EPIT2_OFFSET 8
175#define MXC_CCM_CGR0_EPIT2_MASK (0x3 << 8)
176#define MXC_CCM_CGR0_IIM_OFFSET 10
177#define MXC_CCM_CGR0_IIM_MASK (0x3 << 10)
178#define MXC_CCM_CGR0_ATA_OFFSET 12
179#define MXC_CCM_CGR0_ATA_MASK (0x3 << 12)
180#define MXC_CCM_CGR0_SDMA_OFFSET 14
181#define MXC_CCM_CGR0_SDMA_MASK (0x3 << 14)
182#define MXC_CCM_CGR0_CSPI3_OFFSET 16
183#define MXC_CCM_CGR0_CSPI3_MASK (0x3 << 16)
184#define MXC_CCM_CGR0_RNG_OFFSET 18
185#define MXC_CCM_CGR0_RNG_MASK (0x3 << 18)
186#define MXC_CCM_CGR0_UART1_OFFSET 20
187#define MXC_CCM_CGR0_UART1_MASK (0x3 << 20)
188#define MXC_CCM_CGR0_UART2_OFFSET 22
189#define MXC_CCM_CGR0_UART2_MASK (0x3 << 22)
190#define MXC_CCM_CGR0_SSI1_OFFSET 24
191#define MXC_CCM_CGR0_SSI1_MASK (0x3 << 24)
192#define MXC_CCM_CGR0_I2C1_OFFSET 26
193#define MXC_CCM_CGR0_I2C1_MASK (0x3 << 26)
194#define MXC_CCM_CGR0_I2C2_OFFSET 28
195#define MXC_CCM_CGR0_I2C2_MASK (0x3 << 28)
196#define MXC_CCM_CGR0_I2C3_OFFSET 30
197#define MXC_CCM_CGR0_I2C3_MASK (0x3 << 30)
198
199#define MXC_CCM_CGR1_HANTRO_OFFSET 0
200#define MXC_CCM_CGR1_HANTRO_MASK (0x3 << 0)
201#define MXC_CCM_CGR1_MEMSTICK1_OFFSET 2
202#define MXC_CCM_CGR1_MEMSTICK1_MASK (0x3 << 2)
203#define MXC_CCM_CGR1_MEMSTICK2_OFFSET 4
204#define MXC_CCM_CGR1_MEMSTICK2_MASK (0x3 << 4)
205#define MXC_CCM_CGR1_CSI_OFFSET 6
206#define MXC_CCM_CGR1_CSI_MASK (0x3 << 6)
207#define MXC_CCM_CGR1_RTC_OFFSET 8
208#define MXC_CCM_CGR1_RTC_MASK (0x3 << 8)
209#define MXC_CCM_CGR1_WDOG_OFFSET 10
210#define MXC_CCM_CGR1_WDOG_MASK (0x3 << 10)
211#define MXC_CCM_CGR1_PWM_OFFSET 12
212#define MXC_CCM_CGR1_PWM_MASK (0x3 << 12)
213#define MXC_CCM_CGR1_SIM_OFFSET 14
214#define MXC_CCM_CGR1_SIM_MASK (0x3 << 14)
215#define MXC_CCM_CGR1_ECT_OFFSET 16
216#define MXC_CCM_CGR1_ECT_MASK (0x3 << 16)
217#define MXC_CCM_CGR1_USBOTG_OFFSET 18
218#define MXC_CCM_CGR1_USBOTG_MASK (0x3 << 18)
219#define MXC_CCM_CGR1_KPP_OFFSET 20
220#define MXC_CCM_CGR1_KPP_MASK (0x3 << 20)
221#define MXC_CCM_CGR1_IPU_OFFSET 22
222#define MXC_CCM_CGR1_IPU_MASK (0x3 << 22)
223#define MXC_CCM_CGR1_UART3_OFFSET 24
224#define MXC_CCM_CGR1_UART3_MASK (0x3 << 24)
225#define MXC_CCM_CGR1_UART4_OFFSET 26
226#define MXC_CCM_CGR1_UART4_MASK (0x3 << 26)
227#define MXC_CCM_CGR1_UART5_OFFSET 28
228#define MXC_CCM_CGR1_UART5_MASK (0x3 << 28)
229#define MXC_CCM_CGR1_OWIRE_OFFSET 30
230#define MXC_CCM_CGR1_OWIRE_MASK (0x3 << 30)
231
232#define MXC_CCM_CGR2_SSI2_OFFSET 0
233#define MXC_CCM_CGR2_SSI2_MASK (0x3 << 0)
234#define MXC_CCM_CGR2_CSPI1_OFFSET 2
235#define MXC_CCM_CGR2_CSPI1_MASK (0x3 << 2)
236#define MXC_CCM_CGR2_CSPI2_OFFSET 4
237#define MXC_CCM_CGR2_CSPI2_MASK (0x3 << 4)
238#define MXC_CCM_CGR2_GACC_OFFSET 6
239#define MXC_CCM_CGR2_GACC_MASK (0x3 << 6)
240#define MXC_CCM_CGR2_EMI_OFFSET 8
241#define MXC_CCM_CGR2_EMI_MASK (0x3 << 8)
242#define MXC_CCM_CGR2_RTIC_OFFSET 10
243#define MXC_CCM_CGR2_RTIC_MASK (0x3 << 10)
244#define MXC_CCM_CGR2_FIRI_OFFSET 12
245#define MXC_CCM_CGR2_FIRI_MASK (0x3 << 12)
246#define MXC_CCM_CGR2_IPMUX1_OFFSET 14
247#define MXC_CCM_CGR2_IPMUX1_MASK (0x3 << 14)
248#define MXC_CCM_CGR2_IPMUX2_OFFSET 16
249#define MXC_CCM_CGR2_IPMUX2_MASK (0x3 << 16)
250
251/* These new CGR2 bits are added in MX32 */
252#define MXC_CCM_CGR2_APMSYSCLKSEL_OFFSET 18
253#define MXC_CCM_CGR2_APMSYSCLKSEL_MASK (0x3 << 18)
254#define MXC_CCM_CGR2_APMSSICLKSEL_OFFSET 20
255#define MXC_CCM_CGR2_APMSSICLKSEL_MASK (0x3 << 20)
256#define MXC_CCM_CGR2_APMPERCLKSEL_OFFSET 22
257#define MXC_CCM_CGR2_APMPERCLKSEL_MASK (0x3 << 22)
258#define MXC_CCM_CGR2_MXCCLKENSEL_OFFSET 24
259#define MXC_CCM_CGR2_MXCCLKENSEL_MASK (0x1 << 24)
260#define MXC_CCM_CGR2_CHIKCAMPEN_OFFSET 25
261#define MXC_CCM_CGR2_CHIKCAMPEN_MASK (0x1 << 25)
262#define MXC_CCM_CGR2_OVRVPUBUSY_OFFSET 26
263#define MXC_CCM_CGR2_OVRVPUBUSY_MASK (0x1 << 26)
264#define MXC_CCM_CGR2_APMENA_OFFSET 30
265#define MXC_CCM_CGR2_AOMENA_MASK (0x1 << 30)
266
267/*
268 * LTR0 register offsets
269 */
270#define MXC_CCM_LTR0_DIV3CK_OFFSET 1
271#define MXC_CCM_LTR0_DIV3CK_MASK (0x3 << 1)
272#define MXC_CCM_LTR0_DNTHR_OFFSET 16
273#define MXC_CCM_LTR0_DNTHR_MASK (0x3F << 16)
274#define MXC_CCM_LTR0_UPTHR_OFFSET 22
275#define MXC_CCM_LTR0_UPTHR_MASK (0x3F << 22)
276
277/*
278 * LTR1 register offsets
279 */
280#define MXC_CCM_LTR1_PNCTHR_OFFSET 0
281#define MXC_CCM_LTR1_PNCTHR_MASK 0x3F
282#define MXC_CCM_LTR1_UPCNT_OFFSET 6
283#define MXC_CCM_LTR1_UPCNT_MASK (0xFF << 6)
284#define MXC_CCM_LTR1_DNCNT_OFFSET 14
285#define MXC_CCM_LTR1_DNCNT_MASK (0xFF << 14)
286#define MXC_CCM_LTR1_LTBRSR_MASK 0x400000
287#define MXC_CCM_LTR1_LTBRSR_OFFSET 22
288#define MXC_CCM_LTR1_LTBRSR 0x400000
289#define MXC_CCM_LTR1_LTBRSH 0x800000
290
291/*
292 * LTR2 bit definitions. x ranges from 0 for WSW9 to 6 for WSW15
293 */
294#define MXC_CCM_LTR2_WSW_OFFSET(x) (11 + (x) * 3)
295#define MXC_CCM_LTR2_WSW_MASK(x) (0x7 << \
296 MXC_CCM_LTR2_WSW_OFFSET((x)))
297#define MXC_CCM_LTR2_EMAC_OFFSET 0
298#define MXC_CCM_LTR2_EMAC_MASK 0x1FF
299
300/*
301 * LTR3 bit definitions. x ranges from 0 for WSW0 to 8 for WSW8
302 */
303#define MXC_CCM_LTR3_WSW_OFFSET(x) (5 + (x) * 3)
304#define MXC_CCM_LTR3_WSW_MASK(x) (0x7 << \
305 MXC_CCM_LTR3_WSW_OFFSET((x)))
306
307#define MXC_CCM_PMCR0_DFSUP1 0x80000000
308#define MXC_CCM_PMCR0_DFSUP1_SPLL (0 << 31)
309#define MXC_CCM_PMCR0_DFSUP1_MPLL (1 << 31)
310#define MXC_CCM_PMCR0_DFSUP0 0x40000000
311#define MXC_CCM_PMCR0_DFSUP0_PLL (0 << 30)
312#define MXC_CCM_PMCR0_DFSUP0_PDR (1 << 30)
313#define MXC_CCM_PMCR0_DFSUP_MASK (0x3 << 30)
314
315#define DVSUP_TURBO 0
316#define DVSUP_HIGH 1
317#define DVSUP_MEDIUM 2
318#define DVSUP_LOW 3
319#define MXC_CCM_PMCR0_DVSUP_TURBO (DVSUP_TURBO << 28)
320#define MXC_CCM_PMCR0_DVSUP_HIGH (DVSUP_HIGH << 28)
321#define MXC_CCM_PMCR0_DVSUP_MEDIUM (DVSUP_MEDIUM << 28)
322#define MXC_CCM_PMCR0_DVSUP_LOW (DVSUP_LOW << 28)
323#define MXC_CCM_PMCR0_DVSUP_OFFSET 28
324#define MXC_CCM_PMCR0_DVSUP_MASK (0x3 << 28)
325#define MXC_CCM_PMCR0_UDSC 0x08000000
326#define MXC_CCM_PMCR0_UDSC_MASK (1 << 27)
327#define MXC_CCM_PMCR0_UDSC_UP (1 << 27)
328#define MXC_CCM_PMCR0_UDSC_DOWN (0 << 27)
329
330#define MXC_CCM_PMCR0_VSCNT_1 (0x0 << 24)
331#define MXC_CCM_PMCR0_VSCNT_2 (0x1 << 24)
332#define MXC_CCM_PMCR0_VSCNT_3 (0x2 << 24)
333#define MXC_CCM_PMCR0_VSCNT_4 (0x3 << 24)
334#define MXC_CCM_PMCR0_VSCNT_5 (0x4 << 24)
335#define MXC_CCM_PMCR0_VSCNT_6 (0x5 << 24)
336#define MXC_CCM_PMCR0_VSCNT_7 (0x6 << 24)
337#define MXC_CCM_PMCR0_VSCNT_8 (0x7 << 24)
338#define MXC_CCM_PMCR0_VSCNT_OFFSET 24
339#define MXC_CCM_PMCR0_VSCNT_MASK (0x7 << 24)
340#define MXC_CCM_PMCR0_DVFEV 0x00800000
341#define MXC_CCM_PMCR0_DVFIS 0x00400000
342#define MXC_CCM_PMCR0_LBMI 0x00200000
343#define MXC_CCM_PMCR0_LBFL 0x00100000
344#define MXC_CCM_PMCR0_LBCF_4 (0x0 << 18)
345#define MXC_CCM_PMCR0_LBCF_8 (0x1 << 18)
346#define MXC_CCM_PMCR0_LBCF_12 (0x2 << 18)
347#define MXC_CCM_PMCR0_LBCF_16 (0x3 << 18)
348#define MXC_CCM_PMCR0_LBCF_OFFSET 18
349#define MXC_CCM_PMCR0_LBCF_MASK (0x3 << 18)
350#define MXC_CCM_PMCR0_PTVIS 0x00020000
351#define MXC_CCM_PMCR0_UPDTEN 0x00010000
352#define MXC_CCM_PMCR0_UPDTEN_MASK (0x1 << 16)
353#define MXC_CCM_PMCR0_FSVAIM 0x00008000
354#define MXC_CCM_PMCR0_FSVAI_OFFSET 13
355#define MXC_CCM_PMCR0_FSVAI_MASK (0x3 << 13)
356#define MXC_CCM_PMCR0_DPVCR 0x00001000
357#define MXC_CCM_PMCR0_DPVV 0x00000800
358#define MXC_CCM_PMCR0_WFIM 0x00000400
359#define MXC_CCM_PMCR0_DRCE3 0x00000200
360#define MXC_CCM_PMCR0_DRCE2 0x00000100
361#define MXC_CCM_PMCR0_DRCE1 0x00000080
362#define MXC_CCM_PMCR0_DRCE0 0x00000040
363#define MXC_CCM_PMCR0_DCR 0x00000020
364#define MXC_CCM_PMCR0_DVFEN 0x00000010
365#define MXC_CCM_PMCR0_PTVAIM 0x00000008
366#define MXC_CCM_PMCR0_PTVAI_OFFSET 1
367#define MXC_CCM_PMCR0_PTVAI_MASK (0x3 << 1)
368#define MXC_CCM_PMCR0_DPTEN 0x00000001
369
370#define MXC_CCM_PMCR1_DVGP_OFFSET 0
371#define MXC_CCM_PMCR1_DVGP_MASK (0xF)
372
373#define MXC_CCM_PMCR1_PLLRDIS (0x1 << 7)
374#define MXC_CCM_PMCR1_EMIRQ_EN (0x1 << 8)
375
376#define MXC_CCM_DCVR_ULV_MASK (0x3FF << 22)
377#define MXC_CCM_DCVR_ULV_OFFSET 22
378#define MXC_CCM_DCVR_LLV_MASK (0x3FF << 12)
379#define MXC_CCM_DCVR_LLV_OFFSET 12
380#define MXC_CCM_DCVR_ELV_MASK (0x3FF << 2)
381#define MXC_CCM_DCVR_ELV_OFFSET 2
382
383#define MXC_CCM_PDR2_MST2_PDF_MASK (0x3F << 7)
384#define MXC_CCM_PDR2_MST2_PDF_OFFSET 7
385#define MXC_CCM_PDR2_MST1_PDF_MASK 0x3F
386#define MXC_CCM_PDR2_MST1_PDF_OFFSET 0
387
388#define MXC_CCM_COSR_CLKOSEL_MASK 0x0F
389#define MXC_CCM_COSR_CLKOSEL_OFFSET 0
390#define MXC_CCM_COSR_CLKOUTDIV_MASK (0x07 << 6)
391#define MXC_CCM_COSR_CLKOUTDIV_OFFSET 6
392#define MXC_CCM_COSR_CLKOEN (1 << 9)
393
394/*
395 * PMCR0 register offsets
396 */
397#define MXC_CCM_PMCR0_LBFL_OFFSET 20
398#define MXC_CCM_PMCR0_DFSUP0_OFFSET 30
399#define MXC_CCM_PMCR0_DFSUP1_OFFSET 31
400
401#endif /* __ARCH_ARM_MACH_MX3_CRM_REGS_H__ */
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
new file mode 100644
index 000000000000..5c0320fce5b6
--- /dev/null
+++ b/arch/arm/mach-mx3/devices.c
@@ -0,0 +1,180 @@
1/*
2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/platform_device.h>
22#include <linux/serial.h>
23#include <linux/gpio.h>
24#include <asm/hardware.h>
25#include <asm/arch/imx-uart.h>
26
27static struct resource uart0[] = {
28 {
29 .start = UART1_BASE_ADDR,
30 .end = UART1_BASE_ADDR + 0x0B5,
31 .flags = IORESOURCE_MEM,
32 }, {
33 .start = MXC_INT_UART1,
34 .end = MXC_INT_UART1,
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39static struct platform_device mxc_uart_device0 = {
40 .name = "imx-uart",
41 .id = 0,
42 .resource = uart0,
43 .num_resources = ARRAY_SIZE(uart0),
44};
45
46static struct resource uart1[] = {
47 {
48 .start = UART2_BASE_ADDR,
49 .end = UART2_BASE_ADDR + 0x0B5,
50 .flags = IORESOURCE_MEM,
51 }, {
52 .start = MXC_INT_UART2,
53 .end = MXC_INT_UART2,
54 .flags = IORESOURCE_IRQ,
55 },
56};
57
58static struct platform_device mxc_uart_device1 = {
59 .name = "imx-uart",
60 .id = 1,
61 .resource = uart1,
62 .num_resources = ARRAY_SIZE(uart1),
63};
64
65static struct resource uart2[] = {
66 {
67 .start = UART3_BASE_ADDR,
68 .end = UART3_BASE_ADDR + 0x0B5,
69 .flags = IORESOURCE_MEM,
70 }, {
71 .start = MXC_INT_UART3,
72 .end = MXC_INT_UART3,
73 .flags = IORESOURCE_IRQ,
74 },
75};
76
77static struct platform_device mxc_uart_device2 = {
78 .name = "imx-uart",
79 .id = 2,
80 .resource = uart2,
81 .num_resources = ARRAY_SIZE(uart2),
82};
83
84static struct resource uart3[] = {
85 {
86 .start = UART4_BASE_ADDR,
87 .end = UART4_BASE_ADDR + 0x0B5,
88 .flags = IORESOURCE_MEM,
89 }, {
90 .start = MXC_INT_UART4,
91 .end = MXC_INT_UART4,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96static struct platform_device mxc_uart_device3 = {
97 .name = "imx-uart",
98 .id = 3,
99 .resource = uart3,
100 .num_resources = ARRAY_SIZE(uart3),
101};
102
103static struct resource uart4[] = {
104 {
105 .start = UART5_BASE_ADDR,
106 .end = UART5_BASE_ADDR + 0x0B5,
107 .flags = IORESOURCE_MEM,
108 }, {
109 .start = MXC_INT_UART5,
110 .end = MXC_INT_UART5,
111 .flags = IORESOURCE_IRQ,
112 },
113};
114
115static struct platform_device mxc_uart_device4 = {
116 .name = "imx-uart",
117 .id = 4,
118 .resource = uart4,
119 .num_resources = ARRAY_SIZE(uart4),
120};
121
122/*
123 * Register only those UARTs that physically exist
124 */
125int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata)
126{
127 switch (uart_no) {
128 case 0:
129 mxc_uart_device0.dev.platform_data = pdata;
130 platform_device_register(&mxc_uart_device0);
131 break;
132 case 1:
133 mxc_uart_device1.dev.platform_data = pdata;
134 platform_device_register(&mxc_uart_device1);
135 break;
136 case 2:
137 mxc_uart_device2.dev.platform_data = pdata;
138 platform_device_register(&mxc_uart_device2);
139 break;
140 case 3:
141 mxc_uart_device3.dev.platform_data = pdata;
142 platform_device_register(&mxc_uart_device3);
143 break;
144 case 4:
145 mxc_uart_device4.dev.platform_data = pdata;
146 platform_device_register(&mxc_uart_device4);
147 break;
148 default:
149 return -ENODEV;
150 }
151
152 return 0;
153}
154
155/* GPIO port description */
156static struct mxc_gpio_port imx_gpio_ports[] = {
157 [0] = {
158 .chip.label = "gpio-0",
159 .base = IO_ADDRESS(GPIO1_BASE_ADDR),
160 .irq = MXC_INT_GPIO1,
161 .virtual_irq_start = MXC_GPIO_INT_BASE
162 },
163 [1] = {
164 .chip.label = "gpio-1",
165 .base = IO_ADDRESS(GPIO2_BASE_ADDR),
166 .irq = MXC_INT_GPIO2,
167 .virtual_irq_start = MXC_GPIO_INT_BASE + GPIO_NUM_PIN
168 },
169 [2] = {
170 .chip.label = "gpio-2",
171 .base = IO_ADDRESS(GPIO3_BASE_ADDR),
172 .irq = MXC_INT_GPIO3,
173 .virtual_irq_start = MXC_GPIO_INT_BASE + GPIO_NUM_PIN * 2
174 }
175};
176
177int __init mxc_register_gpios(void)
178{
179 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
180}
diff --git a/arch/arm/mach-mx3/iomux.c b/arch/arm/mach-mx3/iomux.c
new file mode 100644
index 000000000000..adc51feefc1d
--- /dev/null
+++ b/arch/arm/mach-mx3/iomux.c
@@ -0,0 +1,111 @@
1/*
2 * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/spinlock.h>
22#include <linux/io.h>
23#include <linux/gpio.h>
24#include <asm/hardware.h>
25#include <asm/arch/gpio.h>
26#include <asm/arch/iomux-mx3.h>
27
28/*
29 * IOMUX register (base) addresses
30 */
31#define IOMUX_BASE IO_ADDRESS(IOMUXC_BASE_ADDR)
32#define IOMUXINT_OBS1 (IOMUX_BASE + 0x000)
33#define IOMUXINT_OBS2 (IOMUX_BASE + 0x004)
34#define IOMUXGPR (IOMUX_BASE + 0x008)
35#define IOMUXSW_MUX_CTL (IOMUX_BASE + 0x00C)
36#define IOMUXSW_PAD_CTL (IOMUX_BASE + 0x154)
37
38static DEFINE_SPINLOCK(gpio_mux_lock);
39
40#define IOMUX_REG_MASK (IOMUX_PADNUM_MASK & ~0x3)
41/*
42 * set the mode for a IOMUX pin.
43 */
44int mxc_iomux_mode(unsigned int pin_mode)
45{
46 u32 reg, field, l, mode, ret = 0;
47
48 reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK);
49 field = pin_mode & 0x3;
50 mode = (pin_mode & IOMUX_MODE_MASK) >> IOMUX_MODE_SHIFT;
51
52 pr_debug("%s: reg offset = 0x%x field = %d mode = 0x%02x\n",
53 __func__, (pin_mode & IOMUX_REG_MASK), field, mode);
54
55 spin_lock(&gpio_mux_lock);
56
57 l = __raw_readl(reg);
58 l &= ~(0xff << (field * 8));
59 l |= mode << (field * 8);
60 __raw_writel(l, reg);
61
62 spin_unlock(&gpio_mux_lock);
63
64 return ret;
65}
66EXPORT_SYMBOL(mxc_iomux_mode);
67
68/*
69 * This function configures the pad value for a IOMUX pin.
70 */
71void mxc_iomux_set_pad(enum iomux_pins pin, u32 config)
72{
73 u32 reg, field, l;
74
75 reg = IOMUXSW_PAD_CTL + (pin + 2) / 3;
76 field = (pin + 2) % 3;
77
78 pr_debug("%s: reg offset = 0x%x field = %d\n",
79 __func__, (pin + 2) / 3, field);
80
81 spin_lock(&gpio_mux_lock);
82
83 l = __raw_readl(reg);
84 l &= ~(0x1ff << (field * 9));
85 l |= config << (field * 9);
86 __raw_writel(l, reg);
87
88 spin_unlock(&gpio_mux_lock);
89}
90EXPORT_SYMBOL(mxc_iomux_set_pad);
91
92/*
93 * This function enables/disables the general purpose function for a particular
94 * signal.
95 */
96void mxc_iomux_set_gpr(enum iomux_gp_func gp, bool en)
97{
98 u32 l;
99
100 spin_lock(&gpio_mux_lock);
101 l = __raw_readl(IOMUXGPR);
102 if (en)
103 l |= gp;
104 else
105 l &= ~gp;
106
107 __raw_writel(l, IOMUXGPR);
108 spin_unlock(&gpio_mux_lock);
109}
110EXPORT_SYMBOL(mxc_iomux_set_gpr);
111
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c
index 7e89bdc23a9f..eba3e0cd4283 100644
--- a/arch/arm/mach-mx3/mx31ads.c
+++ b/arch/arm/mach-mx3/mx31ads.c
@@ -26,9 +26,11 @@
26#include <asm/hardware.h> 26#include <asm/hardware.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/time.h>
29#include <asm/memory.h> 30#include <asm/memory.h>
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31#include <asm/arch/common.h> 32#include <asm/arch/common.h>
33#include <asm/arch/board-mx31ads.h>
32 34
33/*! 35/*!
34 * @file mx31ads.c 36 * @file mx31ads.c
@@ -126,6 +128,16 @@ static void __init mxc_board_init(void)
126 mxc_init_extuart(); 128 mxc_init_extuart();
127} 129}
128 130
131static void __init mx31ads_timer_init(void)
132{
133 mxc_clocks_init(26000000);
134 mxc_timer_init("ipg_clk.0");
135}
136
137struct sys_timer mx31ads_timer = {
138 .init = mx31ads_timer_init,
139};
140
129/* 141/*
130 * The following uses standard kernel macros defined in arch.h in order to 142 * The following uses standard kernel macros defined in arch.h in order to
131 * initialize __mach_desc_MX31ADS data structure. 143 * initialize __mach_desc_MX31ADS data structure.
@@ -138,5 +150,5 @@ MACHINE_START(MX31ADS, "Freescale MX31ADS")
138 .map_io = mx31ads_map_io, 150 .map_io = mx31ads_map_io,
139 .init_irq = mxc_init_irq, 151 .init_irq = mxc_init_irq,
140 .init_machine = mxc_board_init, 152 .init_machine = mxc_board_init,
141 .timer = &mxc_timer, 153 .timer = &mx31ads_timer,
142MACHINE_END 154MACHINE_END
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
new file mode 100644
index 000000000000..1372c1a1fc3f
--- /dev/null
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2000 Deep Blue Solutions Ltd
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
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/types.h>
22#include <linux/init.h>
23#include <linux/kernel.h>
24#include <linux/memory.h>
25
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/time.h>
30#include <asm/mach/map.h>
31#include <asm/arch/common.h>
32#include <asm/page.h>
33#include <asm/setup.h>
34#include <asm/arch/board-mx31lite.h>
35
36/*
37 * This file contains the board-specific initialization routines.
38 */
39
40/*
41 * This structure defines the MX31 memory map.
42 */
43static struct map_desc mx31lite_io_desc[] __initdata = {
44 {
45 .virtual = AIPS1_BASE_ADDR_VIRT,
46 .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
47 .length = AIPS1_SIZE,
48 .type = MT_NONSHARED_DEVICE
49 }, {
50 .virtual = SPBA0_BASE_ADDR_VIRT,
51 .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
52 .length = SPBA0_SIZE,
53 .type = MT_NONSHARED_DEVICE
54 }, {
55 .virtual = AIPS2_BASE_ADDR_VIRT,
56 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
57 .length = AIPS2_SIZE,
58 .type = MT_NONSHARED_DEVICE
59 }, {
60 .virtual = CS4_BASE_ADDR_VIRT,
61 .pfn = __phys_to_pfn(CS4_BASE_ADDR),
62 .length = CS4_SIZE,
63 .type = MT_DEVICE
64 }
65};
66
67/*
68 * Set up static virtual mappings.
69 */
70void __init mx31lite_map_io(void)
71{
72 mxc_map_io();
73 iotable_init(mx31lite_io_desc, ARRAY_SIZE(mx31lite_io_desc));
74}
75
76/*
77 * Board specific initialization.
78 */
79static void __init mxc_board_init(void)
80{
81}
82
83static void __init mx31lite_timer_init(void)
84{
85 mxc_clocks_init(26000000);
86 mxc_timer_init("ipg_clk.0");
87}
88
89struct sys_timer mx31lite_timer = {
90 .init = mx31lite_timer_init,
91};
92
93/*
94 * The following uses standard kernel macros defined in arch.h in order to
95 * initialize __mach_desc_MX31LITE data structure.
96 */
97
98MACHINE_START(MX31LITE, "LogicPD MX31 LITEKIT")
99 /* Maintainer: Freescale Semiconductor, Inc. */
100 .phys_io = AIPS1_BASE_ADDR,
101 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
102 .boot_params = PHYS_OFFSET + 0x100,
103 .map_io = mx31lite_map_io,
104 .init_irq = mxc_init_irq,
105 .init_machine = mxc_board_init,
106 .timer = &mx31lite_timer,
107MACHINE_END
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
new file mode 100644
index 000000000000..a34ae6de266f
--- /dev/null
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -0,0 +1,130 @@
1/*
2 * Copyright (C) 2008 Sascha Hauer, Pengutronix
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/types.h>
20#include <linux/init.h>
21
22#include <linux/platform_device.h>
23#include <linux/mtd/physmap.h>
24#include <linux/memory.h>
25
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/time.h>
30#include <asm/mach/map.h>
31#include <asm/arch/common.h>
32#include <asm/arch/imx-uart.h>
33#include <asm/arch/iomux-mx3.h>
34#include <asm/arch/board-pcm037.h>
35
36static struct physmap_flash_data pcm037_flash_data = {
37 .width = 2,
38};
39
40static struct resource pcm037_flash_resource = {
41 .start = 0xa0000000,
42 .end = 0xa1ffffff,
43 .flags = IORESOURCE_MEM,
44};
45
46static struct platform_device pcm037_flash = {
47 .name = "physmap-flash",
48 .id = 0,
49 .dev = {
50 .platform_data = &pcm037_flash_data,
51 },
52 .resource = &pcm037_flash_resource,
53 .num_resources = 1,
54};
55
56static struct imxuart_platform_data uart_pdata = {
57 .flags = 0,
58};
59
60static struct platform_device *devices[] __initdata = {
61 &pcm037_flash,
62};
63
64/*
65 * Board specific initialization.
66 */
67static void __init mxc_board_init(void)
68{
69 platform_add_devices(devices, ARRAY_SIZE(devices));
70
71 mxc_iomux_mode(MX31_PIN_CTS1__CTS1);
72 mxc_iomux_mode(MX31_PIN_RTS1__RTS1);
73 mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
74 mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
75
76 imx_init_uart(0, &uart_pdata);
77
78 mxc_iomux_mode(MX31_PIN_CSPI3_MOSI__RXD3);
79 mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3);
80
81 imx_init_uart(2, &uart_pdata);
82}
83
84/*
85 * This structure defines static mappings for the pcm037 board.
86 */
87static struct map_desc pcm037_io_desc[] __initdata = {
88 {
89 .virtual = AIPS1_BASE_ADDR_VIRT,
90 .pfn = __phys_to_pfn(AIPS1_BASE_ADDR),
91 .length = AIPS1_SIZE,
92 .type = MT_DEVICE
93 }, {
94 .virtual = AIPS2_BASE_ADDR_VIRT,
95 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
96 .length = AIPS2_SIZE,
97 .type = MT_DEVICE
98 },
99};
100
101/*
102 * Set up static virtual mappings.
103 */
104void __init pcm037_map_io(void)
105{
106 mxc_map_io();
107 iotable_init(pcm037_io_desc, ARRAY_SIZE(pcm037_io_desc));
108}
109
110static void __init pcm037_timer_init(void)
111{
112 mxc_clocks_init(26000000);
113 mxc_timer_init("ipg_clk.0");
114}
115
116struct sys_timer pcm037_timer = {
117 .init = pcm037_timer_init,
118};
119
120MACHINE_START(PCM037, "Phytec Phycore pcm037")
121 /* Maintainer: Pengutronix */
122 .phys_io = AIPS1_BASE_ADDR,
123 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
124 .boot_params = PHYS_OFFSET + 0x100,
125 .map_io = pcm037_map_io,
126 .init_irq = mxc_init_irq,
127 .init_machine = mxc_board_init,
128 .timer = &pcm037_timer,
129MACHINE_END
130
diff --git a/arch/arm/mach-mx3/time.c b/arch/arm/mach-mx3/time.c
deleted file mode 100644
index fb565c98dbfb..000000000000
--- a/arch/arm/mach-mx3/time.c
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 * System Timer Interrupt reconfigured to run in free-run mode.
3 * Author: Vitaly Wool
4 * Copyright 2004 MontaVista Software Inc.
5 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
6 */
7
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 version 2 as
11 * published by the Free Software Foundation.
12 */
13
14/*!
15 * @file time.c
16 * @brief This file contains OS tick and wdog timer implementations.
17 *
18 * This file contains OS tick and wdog timer implementations.
19 *
20 * @ingroup Timers
21 */
22
23#include <linux/module.h>
24#include <linux/init.h>
25#include <linux/interrupt.h>
26#include <linux/irq.h>
27#include <asm/hardware.h>
28#include <asm/mach/time.h>
29#include <asm/io.h>
30#include <asm/arch/common.h>
31
32/*!
33 * This is the timer interrupt service routine to do required tasks.
34 * It also services the WDOG timer at the frequency of twice per WDOG
35 * timeout value. For example, if the WDOG's timeout value is 4 (2
36 * seconds since the WDOG runs at 0.5Hz), it will be serviced once
37 * every 2/2=1 second.
38 *
39 * @param irq GPT interrupt source number (not used)
40 * @param dev_id this parameter is not used
41 * @return always returns \b IRQ_HANDLED as defined in
42 * include/linux/interrupt.h.
43 */
44static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
45{
46 unsigned int next_match;
47
48 if (__raw_readl(MXC_GPT_GPTSR) & GPTSR_OF1) {
49 do {
50 timer_tick();
51 next_match = __raw_readl(MXC_GPT_GPTOCR1) + LATCH;
52 __raw_writel(GPTSR_OF1, MXC_GPT_GPTSR);
53 __raw_writel(next_match, MXC_GPT_GPTOCR1);
54 } while ((signed long)(next_match -
55 __raw_readl(MXC_GPT_GPTCNT)) <= 0);
56 }
57
58 return IRQ_HANDLED;
59}
60
61/*!
62 * This function is used to obtain the number of microseconds since the last
63 * timer interrupt. Note that interrupts is disabled by do_gettimeofday().
64 *
65 * @return the number of microseconds since the last timer interrupt.
66 */
67static unsigned long mxc_gettimeoffset(void)
68{
69 unsigned long ticks_to_match, elapsed, usec, tick_usec, i;
70
71 /* Get ticks before next timer match */
72 ticks_to_match =
73 __raw_readl(MXC_GPT_GPTOCR1) - __raw_readl(MXC_GPT_GPTCNT);
74
75 /* We need elapsed ticks since last match */
76 elapsed = LATCH - ticks_to_match;
77
78 /* Now convert them to usec */
79 /* Insure no overflow when calculating the usec below */
80 for (i = 1, tick_usec = tick_nsec / 1000;; i *= 2) {
81 tick_usec /= i;
82 if ((0xFFFFFFFF / tick_usec) > elapsed)
83 break;
84 }
85 usec = (unsigned long)(elapsed * tick_usec) / (LATCH / i);
86
87 return usec;
88}
89
90/*!
91 * The OS tick timer interrupt structure.
92 */
93static struct irqaction timer_irq = {
94 .name = "MXC Timer Tick",
95 .flags = IRQF_DISABLED | IRQF_TIMER,
96 .handler = mxc_timer_interrupt
97};
98
99/*!
100 * This function is used to initialize the GPT to produce an interrupt
101 * based on HZ. It is called by start_kernel() during system startup.
102 */
103void __init mxc_init_time(void)
104{
105 u32 reg, v;
106 reg = __raw_readl(MXC_GPT_GPTCR);
107 reg &= ~GPTCR_ENABLE;
108 __raw_writel(reg, MXC_GPT_GPTCR);
109 reg |= GPTCR_SWR;
110 __raw_writel(reg, MXC_GPT_GPTCR);
111
112 while ((__raw_readl(MXC_GPT_GPTCR) & GPTCR_SWR) != 0)
113 cpu_relax();
114
115 reg = GPTCR_FRR | GPTCR_CLKSRC_HIGHFREQ;
116 __raw_writel(reg, MXC_GPT_GPTCR);
117
118 /* TODO: get timer rate from clk driver */
119 v = 66500000;
120
121 __raw_writel((v / CLOCK_TICK_RATE) - 1, MXC_GPT_GPTPR);
122
123 if ((v % CLOCK_TICK_RATE) != 0) {
124 pr_info("\nWARNING: Can't generate CLOCK_TICK_RATE at %d Hz\n",
125 CLOCK_TICK_RATE);
126 }
127 pr_info("Actual CLOCK_TICK_RATE is %d Hz\n",
128 v / ((__raw_readl(MXC_GPT_GPTPR) & 0xFFF) + 1));
129
130 reg = __raw_readl(MXC_GPT_GPTCNT);
131 reg += LATCH;
132 __raw_writel(reg, MXC_GPT_GPTOCR1);
133
134 setup_irq(MXC_INT_GPT, &timer_irq);
135
136 reg = __raw_readl(MXC_GPT_GPTCR);
137 reg =
138 GPTCR_FRR | GPTCR_CLKSRC_HIGHFREQ | GPTCR_STOPEN | GPTCR_DOZEN |
139 GPTCR_WAITEN | GPTCR_ENMOD | GPTCR_ENABLE;
140 __raw_writel(reg, MXC_GPT_GPTCR);
141
142 __raw_writel(GPTIR_OF1IE, MXC_GPT_GPTIR);
143}
144
145struct sys_timer mxc_timer = {
146 .init = mxc_init_time,
147 .offset = mxc_gettimeoffset,
148};
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index c06f5254c0f3..1bda8f5d7546 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,9 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := io.o id.o clock.o irq.o mux.o serial.o devices.o 6obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
7
8obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
7 9
8obj-$(CONFIG_OMAP_MPU_TIMER) += time.o 10obj-$(CONFIG_OMAP_MPU_TIMER) += time.o
9obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o 11obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index bcb984f2300f..3f39e0e79c9f 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mutex.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
14#include <linux/input.h> 15#include <linux/input.h>
15#include <linux/clk.h> 16#include <linux/clk.h>
@@ -202,7 +203,7 @@ static struct omap_board_config_kernel nokia770_config[] __initdata = {
202#define AMPLIFIER_CTRL_GPIO 58 203#define AMPLIFIER_CTRL_GPIO 58
203 204
204static struct clk *dspxor_ck; 205static struct clk *dspxor_ck;
205static DECLARE_MUTEX(audio_pwr_sem); 206static DEFINE_MUTEX(audio_pwr_lock);
206/* 207/*
207 * audio_pwr_state 208 * audio_pwr_state
208 * +--+-------------------------+---------------------------------------+ 209 * +--+-------------------------+---------------------------------------+
@@ -218,7 +219,7 @@ static DECLARE_MUTEX(audio_pwr_sem);
218static int audio_pwr_state = -1; 219static int audio_pwr_state = -1;
219 220
220/* 221/*
221 * audio_pwr_up / down should be called under audio_pwr_sem 222 * audio_pwr_up / down should be called under audio_pwr_lock
222 */ 223 */
223static void nokia770_audio_pwr_up(void) 224static void nokia770_audio_pwr_up(void)
224{ 225{
@@ -237,11 +238,11 @@ static void nokia770_audio_pwr_up(void)
237 238
238static void codec_delayed_power_down(struct work_struct *work) 239static void codec_delayed_power_down(struct work_struct *work)
239{ 240{
240 down(&audio_pwr_sem); 241 mutex_lock(&audio_pwr_lock);
241 if (audio_pwr_state == -1) 242 if (audio_pwr_state == -1)
242 aic23_power_down(); 243 aic23_power_down();
243 clk_disable(dspxor_ck); 244 clk_disable(dspxor_ck);
244 up(&audio_pwr_sem); 245 mutex_unlock(&audio_pwr_lock);
245} 246}
246 247
247static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); 248static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down);
@@ -258,19 +259,19 @@ static void nokia770_audio_pwr_down(void)
258static int 259static int
259nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage) 260nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
260{ 261{
261 down(&audio_pwr_sem); 262 mutex_lock(&audio_pwr_lock);
262 if (audio_pwr_state == -1) 263 if (audio_pwr_state == -1)
263 nokia770_audio_pwr_up(); 264 nokia770_audio_pwr_up();
264 /* force audio_pwr_state = 0, even if it was 1. */ 265 /* force audio_pwr_state = 0, even if it was 1. */
265 audio_pwr_state = 0; 266 audio_pwr_state = 0;
266 up(&audio_pwr_sem); 267 mutex_unlock(&audio_pwr_lock);
267 return 0; 268 return 0;
268} 269}
269 270
270static int 271static int
271nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) 272nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
272{ 273{
273 down(&audio_pwr_sem); 274 mutex_lock(&audio_pwr_lock);
274 switch (stage) { 275 switch (stage) {
275 case 1: 276 case 1:
276 if (audio_pwr_state == 0) 277 if (audio_pwr_state == 0)
@@ -283,7 +284,7 @@ nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
283 } 284 }
284 break; 285 break;
285 } 286 }
286 up(&audio_pwr_sem); 287 mutex_unlock(&audio_pwr_lock);
287 return 0; 288 return 0;
288} 289}
289 290
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index a66505f58b15..845c66371ca3 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -267,13 +267,17 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = {
267 267
268static void __init osk_init_smc91x(void) 268static void __init osk_init_smc91x(void)
269{ 269{
270 u32 l;
271
270 if ((gpio_request(0, "smc_irq")) < 0) { 272 if ((gpio_request(0, "smc_irq")) < 0) {
271 printk("Error requesting gpio 0 for smc91x irq\n"); 273 printk("Error requesting gpio 0 for smc91x irq\n");
272 return; 274 return;
273 } 275 }
274 276
275 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ 277 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
276 EMIFS_CCS(1) |= 0x3; 278 l = omap_readl(EMIFS_CCS(1));
279 l |= 0x3;
280 omap_writel(l, EMIFS_CCS(1));
277} 281}
278 282
279static void __init osk_init_cf(void) 283static void __init osk_init_cf(void)
@@ -526,20 +530,26 @@ static void __init osk_mistral_init(void) { }
526 530
527static void __init osk_init(void) 531static void __init osk_init(void)
528{ 532{
533 u32 l;
534
529 /* Workaround for wrong CS3 (NOR flash) timing 535 /* Workaround for wrong CS3 (NOR flash) timing
530 * There are some U-Boot versions out there which configure 536 * There are some U-Boot versions out there which configure
531 * wrong CS3 memory timings. This mainly leads to CRC 537 * wrong CS3 memory timings. This mainly leads to CRC
532 * or similar errors if you use NOR flash (e.g. with JFFS2) 538 * or similar errors if you use NOR flash (e.g. with JFFS2)
533 */ 539 */
534 if (EMIFS_CCS(3) != EMIFS_CS3_VAL) 540 l = omap_readl(EMIFS_CCS(3));
535 EMIFS_CCS(3) = EMIFS_CS3_VAL; 541 if (l != EMIFS_CS3_VAL)
542 omap_writel(EMIFS_CS3_VAL, EMIFS_CCS(3));
536 543
537 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); 544 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
538 osk_flash_resource.end += SZ_32M - 1; 545 osk_flash_resource.end += SZ_32M - 1;
539 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 546 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
540 omap_board_config = osk_config; 547 omap_board_config = osk_config;
541 omap_board_config_size = ARRAY_SIZE(osk_config); 548 omap_board_config_size = ARRAY_SIZE(osk_config);
542 USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 549
550 l = omap_readl(USB_TRANSCEIVER_CTRL);
551 l |= (3 << 1);
552 omap_writel(l, USB_TRANSCEIVER_CTRL);
543 553
544 /* irq for tps65010 chip */ 554 /* irq for tps65010 chip */
545 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */ 555 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 30e188109046..0cf62ef5ecb7 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -32,7 +32,7 @@
32 32
33static void fpga_mask_irq(unsigned int irq) 33static void fpga_mask_irq(unsigned int irq)
34{ 34{
35 irq -= OMAP1510_IH_FPGA_BASE; 35 irq -= OMAP_FPGA_IRQ_BASE;
36 36
37 if (irq < 8) 37 if (irq < 8)
38 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) 38 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO)
@@ -65,7 +65,7 @@ static void fpga_ack_irq(unsigned int irq)
65 65
66static void fpga_unmask_irq(unsigned int irq) 66static void fpga_unmask_irq(unsigned int irq)
67{ 67{
68 irq -= OMAP1510_IH_FPGA_BASE; 68 irq -= OMAP_FPGA_IRQ_BASE;
69 69
70 if (irq < 8) 70 if (irq < 8)
71 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)), 71 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)),
@@ -95,8 +95,8 @@ void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc)
95 if (!stat) 95 if (!stat)
96 return; 96 return;
97 97
98 for (fpga_irq = OMAP1510_IH_FPGA_BASE; 98 for (fpga_irq = OMAP_FPGA_IRQ_BASE;
99 (fpga_irq < (OMAP1510_IH_FPGA_BASE + NR_FPGA_IRQS)) && stat; 99 (fpga_irq < OMAP_FPGA_IRQ_END) && stat;
100 fpga_irq++, stat >>= 1) { 100 fpga_irq++, stat >>= 1) {
101 if (stat & 1) { 101 if (stat & 1) {
102 d = irq_desc + fpga_irq; 102 d = irq_desc + fpga_irq;
@@ -151,7 +151,7 @@ void omap1510_fpga_init_irq(void)
151 __raw_writeb(0, OMAP1510_FPGA_IMR_HI); 151 __raw_writeb(0, OMAP1510_FPGA_IMR_HI);
152 __raw_writeb(0, INNOVATOR_FPGA_IMR2); 152 __raw_writeb(0, INNOVATOR_FPGA_IMR2);
153 153
154 for (i = OMAP1510_IH_FPGA_BASE; i < (OMAP1510_IH_FPGA_BASE + NR_FPGA_IRQS); i++) { 154 for (i = OMAP_FPGA_IRQ_BASE; i < OMAP_FPGA_IRQ_END; i++) {
155 155
156 if (i == OMAP1510_INT_FPGA_TS) { 156 if (i == OMAP1510_INT_FPGA_TS) {
157 /* 157 /*
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
new file mode 100644
index 000000000000..2d2c2522b048
--- /dev/null
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -0,0 +1,280 @@
1/*
2 * linux/arch/arm/mach-omap1/mcbsp.c
3 *
4 * Copyright (C) 2008 Instituto Nokia de Tecnologia
5 * Contact: Eduardo Valentin <eduardo.valentin@indt.org.br>
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 * Multichannel mode not supported.
12 */
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/platform_device.h>
19
20#include <asm/arch/dma.h>
21#include <asm/arch/mux.h>
22#include <asm/arch/cpu.h>
23#include <asm/arch/mcbsp.h>
24#include <asm/arch/dsp_common.h>
25
26#define DPS_RSTCT2_PER_EN (1 << 0)
27#define DSP_RSTCT2_WD_PER_EN (1 << 1)
28
29struct mcbsp_internal_clk {
30 struct clk clk;
31 struct clk **childs;
32 int n_childs;
33};
34
35#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
36static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
37{
38 const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
39 int i;
40
41 mclk->n_childs = ARRAY_SIZE(clk_names);
42 mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
43 GFP_KERNEL);
44
45 for (i = 0; i < mclk->n_childs; i++) {
46 /* We fake a platform device to get correct device id */
47 struct platform_device pdev;
48
49 pdev.dev.bus = &platform_bus_type;
50 pdev.id = mclk->clk.id;
51 mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
52 if (IS_ERR(mclk->childs[i]))
53 printk(KERN_ERR "Could not get clock %s (%d).\n",
54 clk_names[i], mclk->clk.id);
55 }
56}
57
58static int omap_mcbsp_clk_enable(struct clk *clk)
59{
60 struct mcbsp_internal_clk *mclk = container_of(clk,
61 struct mcbsp_internal_clk, clk);
62 int i;
63
64 for (i = 0; i < mclk->n_childs; i++)
65 clk_enable(mclk->childs[i]);
66 return 0;
67}
68
69static void omap_mcbsp_clk_disable(struct clk *clk)
70{
71 struct mcbsp_internal_clk *mclk = container_of(clk,
72 struct mcbsp_internal_clk, clk);
73 int i;
74
75 for (i = 0; i < mclk->n_childs; i++)
76 clk_disable(mclk->childs[i]);
77}
78
79static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
80 {
81 .clk = {
82 .name = "mcbsp_clk",
83 .id = 1,
84 .enable = omap_mcbsp_clk_enable,
85 .disable = omap_mcbsp_clk_disable,
86 },
87 },
88 {
89 .clk = {
90 .name = "mcbsp_clk",
91 .id = 3,
92 .enable = omap_mcbsp_clk_enable,
93 .disable = omap_mcbsp_clk_disable,
94 },
95 },
96};
97
98#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks)
99#else
100#define omap_mcbsp_clks_size 0
101static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
102static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
103{ }
104#endif
105
106static int omap1_mcbsp_check(unsigned int id)
107{
108 /* REVISIT: Check correctly for number of registered McBSPs */
109 if (cpu_is_omap730()) {
110 if (id > OMAP_MAX_MCBSP_COUNT - 2) {
111 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n",
112 id + 1);
113 return -ENODEV;
114 }
115 return 0;
116 }
117
118 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
119 if (id > OMAP_MAX_MCBSP_COUNT - 1) {
120 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n",
121 id + 1);
122 return -ENODEV;
123 }
124 return 0;
125 }
126
127 return -ENODEV;
128}
129
130static void omap1_mcbsp_request(unsigned int id)
131{
132 /*
133 * On 1510, 1610 and 1710, McBSP1 and McBSP3
134 * are DSP public peripherals.
135 */
136 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) {
137 omap_dsp_request_mem();
138 /*
139 * DSP external peripheral reset
140 * FIXME: This should be moved to dsp code
141 */
142 __raw_writew(__raw_readw(DSP_RSTCT2) | DPS_RSTCT2_PER_EN |
143 DSP_RSTCT2_WD_PER_EN, DSP_RSTCT2);
144 }
145}
146
147static void omap1_mcbsp_free(unsigned int id)
148{
149 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3)
150 omap_dsp_release_mem();
151}
152
153static struct omap_mcbsp_ops omap1_mcbsp_ops = {
154 .check = omap1_mcbsp_check,
155 .request = omap1_mcbsp_request,
156 .free = omap1_mcbsp_free,
157};
158
159#ifdef CONFIG_ARCH_OMAP730
160static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
161 {
162 .virt_base = io_p2v(OMAP730_MCBSP1_BASE),
163 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
164 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
165 .rx_irq = INT_730_McBSP1RX,
166 .tx_irq = INT_730_McBSP1TX,
167 .ops = &omap1_mcbsp_ops,
168 },
169 {
170 .virt_base = io_p2v(OMAP730_MCBSP2_BASE),
171 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
172 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
173 .rx_irq = INT_730_McBSP2RX,
174 .tx_irq = INT_730_McBSP2TX,
175 .ops = &omap1_mcbsp_ops,
176 },
177};
178#define OMAP730_MCBSP_PDATA_SZ ARRAY_SIZE(omap730_mcbsp_pdata)
179#else
180#define omap730_mcbsp_pdata NULL
181#define OMAP730_MCBSP_PDATA_SZ 0
182#endif
183
184#ifdef CONFIG_ARCH_OMAP15XX
185static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
186 {
187 .virt_base = OMAP1510_MCBSP1_BASE,
188 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
189 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
190 .rx_irq = INT_McBSP1RX,
191 .tx_irq = INT_McBSP1TX,
192 .ops = &omap1_mcbsp_ops,
193 .clk_name = "mcbsp_clk",
194 },
195 {
196 .virt_base = io_p2v(OMAP1510_MCBSP2_BASE),
197 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
198 .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
199 .rx_irq = INT_1510_SPI_RX,
200 .tx_irq = INT_1510_SPI_TX,
201 .ops = &omap1_mcbsp_ops,
202 },
203 {
204 .virt_base = OMAP1510_MCBSP3_BASE,
205 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
206 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
207 .rx_irq = INT_McBSP3RX,
208 .tx_irq = INT_McBSP3TX,
209 .ops = &omap1_mcbsp_ops,
210 .clk_name = "mcbsp_clk",
211 },
212};
213#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata)
214#else
215#define omap15xx_mcbsp_pdata NULL
216#define OMAP15XX_MCBSP_PDATA_SZ 0
217#endif
218
219#ifdef CONFIG_ARCH_OMAP16XX
220static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
221 {
222 .virt_base = OMAP1610_MCBSP1_BASE,
223 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
224 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
225 .rx_irq = INT_McBSP1RX,
226 .tx_irq = INT_McBSP1TX,
227 .ops = &omap1_mcbsp_ops,
228 .clk_name = "mcbsp_clk",
229 },
230 {
231 .virt_base = io_p2v(OMAP1610_MCBSP2_BASE),
232 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
233 .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
234 .rx_irq = INT_1610_McBSP2_RX,
235 .tx_irq = INT_1610_McBSP2_TX,
236 .ops = &omap1_mcbsp_ops,
237 },
238 {
239 .virt_base = OMAP1610_MCBSP3_BASE,
240 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
241 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
242 .rx_irq = INT_McBSP3RX,
243 .tx_irq = INT_McBSP3TX,
244 .ops = &omap1_mcbsp_ops,
245 .clk_name = "mcbsp_clk",
246 },
247};
248#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata)
249#else
250#define omap16xx_mcbsp_pdata NULL
251#define OMAP16XX_MCBSP_PDATA_SZ 0
252#endif
253
254int __init omap1_mcbsp_init(void)
255{
256 int i;
257
258 for (i = 0; i < omap_mcbsp_clks_size; i++) {
259 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
260 omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
261 clk_register(&omap_mcbsp_clks[i].clk);
262 }
263 }
264
265 if (cpu_is_omap730())
266 omap_mcbsp_register_board_cfg(omap730_mcbsp_pdata,
267 OMAP730_MCBSP_PDATA_SZ);
268
269 if (cpu_is_omap15xx())
270 omap_mcbsp_register_board_cfg(omap15xx_mcbsp_pdata,
271 OMAP15XX_MCBSP_PDATA_SZ);
272
273 if (cpu_is_omap16xx())
274 omap_mcbsp_register_board_cfg(omap16xx_mcbsp_pdata,
275 OMAP16XX_MCBSP_PDATA_SZ);
276
277 return omap_mcbsp_init();
278}
279
280arch_initcall(omap1_mcbsp_init);
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index e6c64e10b7ec..742f79e73bd7 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -116,13 +116,6 @@ void omap_pm_idle(void)
116 return; 116 return;
117 } 117 }
118 118
119 /*
120 * Since an interrupt may set up a timer, we don't want to
121 * reprogram the hardware timer with interrupts enabled.
122 * Re-enable interrupts only after returning from idle.
123 */
124 timer_dyn_reprogram();
125
126#ifdef CONFIG_OMAP_MPU_TIMER 119#ifdef CONFIG_OMAP_MPU_TIMER
127#warning Enable 32kHz OS timer in order to allow sleep states in idle 120#warning Enable 32kHz OS timer in order to allow sleep states in idle
128 use_idlect1 = use_idlect1 & ~(1 << 9); 121 use_idlect1 = use_idlect1 & ~(1 << 9);
diff --git a/arch/arm/plat-omap/sram-fn.S b/arch/arm/mach-omap1/sram.S
index 9e1813c77e05..126d252062d7 100644
--- a/arch/arm/plat-omap/sram-fn.S
+++ b/arch/arm/mach-omap1/sram.S
@@ -18,7 +18,7 @@
18/* 18/*
19 * Reprograms ULPD and CKCTL. 19 * Reprograms ULPD and CKCTL.
20 */ 20 */
21ENTRY(sram_reprogram_clock) 21ENTRY(omap1_sram_reprogram_clock)
22 stmfd sp!, {r0 - r12, lr} @ save registers on stack 22 stmfd sp!, {r0 - r12, lr} @ save registers on stack
23 23
24 mov r2, #IO_ADDRESS(DPLL_CTL) & 0xff000000 24 mov r2, #IO_ADDRESS(DPLL_CTL) & 0xff000000
@@ -53,5 +53,5 @@ lock: ldrh r4, [r2], #0 @ read back dpll value
53 53
54out: 54out:
55 ldmfd sp!, {r0 - r12, pc} @ restore regs and return 55 ldmfd sp!, {r0 - r12, pc} @ restore regs and return
56ENTRY(sram_reprogram_clock_sz) 56ENTRY(omap1_sram_reprogram_clock_sz)
57 .word . - sram_reprogram_clock 57 .word . - omap1_sram_reprogram_clock
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 2feb6870b735..93ee990618ef 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -3,9 +3,15 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := irq.o id.o io.o sram-fn.o memory.o control.o prcm.o clock.o mux.o \ 6obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \
7 devices.o serial.o gpmc.o timer-gp.o 7 devices.o serial.o gpmc.o timer-gp.o
8 8
9obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
10
11# Functions loaded to SRAM
12obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o
13obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o
14
9# Power Management 15# Power Management
10obj-$(CONFIG_PM) += pm.o sleep.o 16obj-$(CONFIG_PM) += pm.o sleep.o
11 17
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index ab9fc57d25f1..15675bce8012 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -41,6 +41,24 @@
41 41
42#define MAX_CLOCK_ENABLE_WAIT 100000 42#define MAX_CLOCK_ENABLE_WAIT 100000
43 43
44/* DPLL rate rounding: minimum DPLL multiplier, divider values */
45#define DPLL_MIN_MULTIPLIER 1
46#define DPLL_MIN_DIVIDER 1
47
48/* Possible error results from _dpll_test_mult */
49#define DPLL_MULT_UNDERFLOW (1 << 0)
50
51/*
52 * Scale factor to mitigate roundoff errors in DPLL rate rounding.
53 * The higher the scale factor, the greater the risk of arithmetic overflow,
54 * but the closer the rounded rate to the target rate. DPLL_SCALE_FACTOR
55 * must be a power of DPLL_SCALE_BASE.
56 */
57#define DPLL_SCALE_FACTOR 64
58#define DPLL_SCALE_BASE 2
59#define DPLL_ROUNDING_VAL ((DPLL_SCALE_BASE / 2) * \
60 (DPLL_SCALE_FACTOR / DPLL_SCALE_BASE))
61
44u8 cpu_mask; 62u8 cpu_mask;
45 63
46/*------------------------------------------------------------------------- 64/*-------------------------------------------------------------------------
@@ -95,7 +113,7 @@ u32 omap2_get_dpll_rate(struct clk *clk)
95{ 113{
96 long long dpll_clk; 114 long long dpll_clk;
97 u32 dpll_mult, dpll_div, dpll; 115 u32 dpll_mult, dpll_div, dpll;
98 const struct dpll_data *dd; 116 struct dpll_data *dd;
99 117
100 dd = clk->dpll_data; 118 dd = clk->dpll_data;
101 /* REVISIT: What do we return on error? */ 119 /* REVISIT: What do we return on error? */
@@ -603,7 +621,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
603 clk->rate = clk->parent->rate / new_div; 621 clk->rate = clk->parent->rate / new_div;
604 622
605 if (clk->flags & DELAYED_APP && cpu_is_omap24xx()) { 623 if (clk->flags & DELAYED_APP && cpu_is_omap24xx()) {
606 __raw_writel(OMAP24XX_VALID_CONFIG, OMAP24XX_PRCM_CLKCFG_CTRL); 624 prm_write_mod_reg(OMAP24XX_VALID_CONFIG,
625 OMAP24XX_GR_MOD, OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET);
607 wmb(); 626 wmb();
608 } 627 }
609 628
@@ -723,6 +742,184 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
723 return 0; 742 return 0;
724} 743}
725 744
745/* DPLL rate rounding code */
746
747/**
748 * omap2_dpll_set_rate_tolerance: set the error tolerance during rate rounding
749 * @clk: struct clk * of the DPLL
750 * @tolerance: maximum rate error tolerance
751 *
752 * Set the maximum DPLL rate error tolerance for the rate rounding
753 * algorithm. The rate tolerance is an attempt to balance DPLL power
754 * saving (the least divider value "n") vs. rate fidelity (the least
755 * difference between the desired DPLL target rate and the rounded
756 * rate out of the algorithm). So, increasing the tolerance is likely
757 * to decrease DPLL power consumption and increase DPLL rate error.
758 * Returns -EINVAL if provided a null clock ptr or a clk that is not a
759 * DPLL; or 0 upon success.
760 */
761int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance)
762{
763 if (!clk || !clk->dpll_data)
764 return -EINVAL;
765
766 clk->dpll_data->rate_tolerance = tolerance;
767
768 return 0;
769}
770
771static unsigned long _dpll_compute_new_rate(unsigned long parent_rate, unsigned int m, unsigned int n)
772{
773 unsigned long long num;
774
775 num = (unsigned long long)parent_rate * m;
776 do_div(num, n);
777 return num;
778}
779
780/*
781 * _dpll_test_mult - test a DPLL multiplier value
782 * @m: pointer to the DPLL m (multiplier) value under test
783 * @n: current DPLL n (divider) value under test
784 * @new_rate: pointer to storage for the resulting rounded rate
785 * @target_rate: the desired DPLL rate
786 * @parent_rate: the DPLL's parent clock rate
787 *
788 * This code tests a DPLL multiplier value, ensuring that the
789 * resulting rate will not be higher than the target_rate, and that
790 * the multiplier value itself is valid for the DPLL. Initially, the
791 * integer pointed to by the m argument should be prescaled by
792 * multiplying by DPLL_SCALE_FACTOR. The code will replace this with
793 * a non-scaled m upon return. This non-scaled m will result in a
794 * new_rate as close as possible to target_rate (but not greater than
795 * target_rate) given the current (parent_rate, n, prescaled m)
796 * triple. Returns DPLL_MULT_UNDERFLOW in the event that the
797 * non-scaled m attempted to underflow, which can allow the calling
798 * function to bail out early; or 0 upon success.
799 */
800static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
801 unsigned long target_rate,
802 unsigned long parent_rate)
803{
804 int flags = 0, carry = 0;
805
806 /* Unscale m and round if necessary */
807 if (*m % DPLL_SCALE_FACTOR >= DPLL_ROUNDING_VAL)
808 carry = 1;
809 *m = (*m / DPLL_SCALE_FACTOR) + carry;
810
811 /*
812 * The new rate must be <= the target rate to avoid programming
813 * a rate that is impossible for the hardware to handle
814 */
815 *new_rate = _dpll_compute_new_rate(parent_rate, *m, n);
816 if (*new_rate > target_rate) {
817 (*m)--;
818 *new_rate = 0;
819 }
820
821 /* Guard against m underflow */
822 if (*m < DPLL_MIN_MULTIPLIER) {
823 *m = DPLL_MIN_MULTIPLIER;
824 *new_rate = 0;
825 flags = DPLL_MULT_UNDERFLOW;
826 }
827
828 if (*new_rate == 0)
829 *new_rate = _dpll_compute_new_rate(parent_rate, *m, n);
830
831 return flags;
832}
833
834/**
835 * omap2_dpll_round_rate - round a target rate for an OMAP DPLL
836 * @clk: struct clk * for a DPLL
837 * @target_rate: desired DPLL clock rate
838 *
839 * Given a DPLL, a desired target rate, and a rate tolerance, round
840 * the target rate to a possible, programmable rate for this DPLL.
841 * Rate tolerance is assumed to be set by the caller before this
842 * function is called. Attempts to select the minimum possible n
843 * within the tolerance to reduce power consumption. Stores the
844 * computed (m, n) in the DPLL's dpll_data structure so set_rate()
845 * will not need to call this (expensive) function again. Returns ~0
846 * if the target rate cannot be rounded, either because the rate is
847 * too low or because the rate tolerance is set too tightly; or the
848 * rounded rate upon success.
849 */
850long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
851{
852 int m, n, r, e, scaled_max_m;
853 unsigned long scaled_rt_rp, new_rate;
854 int min_e = -1, min_e_m = -1, min_e_n = -1;
855
856 if (!clk || !clk->dpll_data)
857 return ~0;
858
859 pr_debug("clock: starting DPLL round_rate for clock %s, target rate "
860 "%ld\n", clk->name, target_rate);
861
862 scaled_rt_rp = target_rate / (clk->parent->rate / DPLL_SCALE_FACTOR);
863 scaled_max_m = clk->dpll_data->max_multiplier * DPLL_SCALE_FACTOR;
864
865 clk->dpll_data->last_rounded_rate = 0;
866
867 for (n = clk->dpll_data->max_divider; n >= DPLL_MIN_DIVIDER; n--) {
868
869 /* Compute the scaled DPLL multiplier, based on the divider */
870 m = scaled_rt_rp * n;
871
872 /*
873 * Since we're counting n down, a m overflow means we can
874 * can immediately skip to the next n
875 */
876 if (m > scaled_max_m)
877 continue;
878
879 r = _dpll_test_mult(&m, n, &new_rate, target_rate,
880 clk->parent->rate);
881
882 e = target_rate - new_rate;
883 pr_debug("clock: n = %d: m = %d: rate error is %d "
884 "(new_rate = %ld)\n", n, m, e, new_rate);
885
886 if (min_e == -1 ||
887 min_e >= (int)(abs(e) - clk->dpll_data->rate_tolerance)) {
888 min_e = e;
889 min_e_m = m;
890 min_e_n = n;
891
892 pr_debug("clock: found new least error %d\n", min_e);
893 }
894
895 /*
896 * Since we're counting n down, a m underflow means we
897 * can bail out completely (since as n decreases in
898 * the next iteration, there's no way that m can
899 * increase beyond the current m)
900 */
901 if (r & DPLL_MULT_UNDERFLOW)
902 break;
903 }
904
905 if (min_e < 0) {
906 pr_debug("clock: error: target rate or tolerance too low\n");
907 return ~0;
908 }
909
910 clk->dpll_data->last_rounded_m = min_e_m;
911 clk->dpll_data->last_rounded_n = min_e_n;
912 clk->dpll_data->last_rounded_rate =
913 _dpll_compute_new_rate(clk->parent->rate, min_e_m, min_e_n);
914
915 pr_debug("clock: final least error: e = %d, m = %d, n = %d\n",
916 min_e, min_e_m, min_e_n);
917 pr_debug("clock: final rate: %ld (target rate: %ld)\n",
918 clk->dpll_data->last_rounded_rate, target_rate);
919
920 return clk->dpll_data->last_rounded_rate;
921}
922
726/*------------------------------------------------------------------------- 923/*-------------------------------------------------------------------------
727 * Omap2 clock reset and init functions 924 * Omap2 clock reset and init functions
728 *-------------------------------------------------------------------------*/ 925 *-------------------------------------------------------------------------*/
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index d5980a9e09a4..3cd37cb57c5a 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -18,11 +18,16 @@
18 18
19#include <asm/arch/clock.h> 19#include <asm/arch/clock.h>
20 20
21/* The maximum error between a target DPLL rate and the rounded rate in Hz */
22#define DEFAULT_DPLL_RATE_TOLERANCE 50000
23
21int omap2_clk_enable(struct clk *clk); 24int omap2_clk_enable(struct clk *clk);
22void omap2_clk_disable(struct clk *clk); 25void omap2_clk_disable(struct clk *clk);
23long omap2_clk_round_rate(struct clk *clk, unsigned long rate); 26long omap2_clk_round_rate(struct clk *clk, unsigned long rate);
24int omap2_clk_set_rate(struct clk *clk, unsigned long rate); 27int omap2_clk_set_rate(struct clk *clk, unsigned long rate);
25int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); 28int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent);
29int omap2_dpll_rate_tolerance_set(struct clk *clk, unsigned int tolerance);
30long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate);
26 31
27#ifdef CONFIG_OMAP_RESET_CLOCKS 32#ifdef CONFIG_OMAP_RESET_CLOCKS
28void omap2_clk_disable_unused(struct clk *clk); 33void omap2_clk_disable_unused(struct clk *clk);
@@ -42,6 +47,7 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
42int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 47int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
43u32 omap2_get_dpll_rate(struct clk *clk); 48u32 omap2_get_dpll_rate(struct clk *clk);
44int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); 49int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
50void omap2_clk_prepare_for_reboot(void);
45 51
46extern u8 cpu_mask; 52extern u8 cpu_mask;
47 53
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index ece32d8acba4..aa567876651d 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -154,7 +154,7 @@ static void omap2_clk_fixed_disable(struct clk *clk)
154 * Uses the current prcm set to tell if a rate is valid. 154 * Uses the current prcm set to tell if a rate is valid.
155 * You can go slower, but not faster within a given rate set. 155 * You can go slower, but not faster within a given rate set.
156 */ 156 */
157static u32 omap2_dpll_round_rate(unsigned long target_rate) 157long omap2_dpllcore_round_rate(unsigned long target_rate)
158{ 158{
159 u32 high, low, core_clk_src; 159 u32 high, low, core_clk_src;
160 160
@@ -183,14 +183,14 @@ static u32 omap2_dpll_round_rate(unsigned long target_rate)
183 183
184} 184}
185 185
186static void omap2_dpll_recalc(struct clk *clk) 186static void omap2_dpllcore_recalc(struct clk *clk)
187{ 187{
188 clk->rate = omap2_get_dpll_rate_24xx(clk); 188 clk->rate = omap2_get_dpll_rate_24xx(clk);
189 189
190 propagate_rate(clk); 190 propagate_rate(clk);
191} 191}
192 192
193static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate) 193static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
194{ 194{
195 u32 cur_rate, low, mult, div, valid_rate, done_rate; 195 u32 cur_rate, low, mult, div, valid_rate, done_rate;
196 u32 bypass = 0; 196 u32 bypass = 0;
@@ -209,7 +209,7 @@ static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate)
209 } else if ((rate == (cur_rate * 2)) && (mult == 1)) { 209 } else if ((rate == (cur_rate * 2)) && (mult == 1)) {
210 omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); 210 omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1);
211 } else if (rate != cur_rate) { 211 } else if (rate != cur_rate) {
212 valid_rate = omap2_dpll_round_rate(rate); 212 valid_rate = omap2_dpllcore_round_rate(rate);
213 if (valid_rate != rate) 213 if (valid_rate != rate)
214 goto dpll_exit; 214 goto dpll_exit;
215 215
@@ -256,7 +256,7 @@ static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate)
256 omap2_init_memory_params(omap2_dll_force_needed()); 256 omap2_init_memory_params(omap2_dll_force_needed());
257 omap2_reprogram_sdrc(done_rate, 0); 257 omap2_reprogram_sdrc(done_rate, 0);
258 } 258 }
259 omap2_dpll_recalc(&dpll_ck); 259 omap2_dpllcore_recalc(&dpll_ck);
260 ret = 0; 260 ret = 0;
261 261
262dpll_exit: 262dpll_exit:
@@ -383,7 +383,7 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
383 383
384 local_irq_restore(flags); 384 local_irq_restore(flags);
385 } 385 }
386 omap2_dpll_recalc(&dpll_ck); 386 omap2_dpllcore_recalc(&dpll_ck);
387 387
388 return 0; 388 return 0;
389} 389}
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index 88081ed13f96..be4e25554e05 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -30,12 +30,12 @@ static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate);
30static void omap2_sys_clk_recalc(struct clk *clk); 30static void omap2_sys_clk_recalc(struct clk *clk);
31static void omap2_osc_clk_recalc(struct clk *clk); 31static void omap2_osc_clk_recalc(struct clk *clk);
32static void omap2_sys_clk_recalc(struct clk *clk); 32static void omap2_sys_clk_recalc(struct clk *clk);
33static void omap2_dpll_recalc(struct clk *clk); 33static void omap2_dpllcore_recalc(struct clk *clk);
34static int omap2_clk_fixed_enable(struct clk *clk); 34static int omap2_clk_fixed_enable(struct clk *clk);
35static void omap2_clk_fixed_disable(struct clk *clk); 35static void omap2_clk_fixed_disable(struct clk *clk);
36static int omap2_enable_osc_ck(struct clk *clk); 36static int omap2_enable_osc_ck(struct clk *clk);
37static void omap2_disable_osc_ck(struct clk *clk); 37static void omap2_disable_osc_ck(struct clk *clk);
38static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate); 38static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);
39 39
40/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. 40/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
41 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP 41 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP
@@ -665,20 +665,27 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
665 * deal with this 665 * deal with this
666 */ 666 */
667 667
668static const struct dpll_data dpll_dd = { 668static struct dpll_data dpll_dd = {
669 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), 669 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
670 .mult_mask = OMAP24XX_DPLL_MULT_MASK, 670 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
671 .div1_mask = OMAP24XX_DPLL_DIV_MASK, 671 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
672 .max_multiplier = 1024,
673 .max_divider = 16,
674 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
672}; 675};
673 676
677/*
678 * XXX Cannot add round_rate here yet, as this is still a composite clock,
679 * not just a DPLL
680 */
674static struct clk dpll_ck = { 681static struct clk dpll_ck = {
675 .name = "dpll_ck", 682 .name = "dpll_ck",
676 .parent = &sys_ck, /* Can be func_32k also */ 683 .parent = &sys_ck, /* Can be func_32k also */
677 .dpll_data = &dpll_dd, 684 .dpll_data = &dpll_dd,
678 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 685 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
679 RATE_PROPAGATES | ALWAYS_ENABLED, 686 RATE_PROPAGATES | ALWAYS_ENABLED,
680 .recalc = &omap2_dpll_recalc, 687 .recalc = &omap2_dpllcore_recalc,
681 .set_rate = &omap2_reprogram_dpll, 688 .set_rate = &omap2_reprogram_dpllcore,
682}; 689};
683 690
684static struct clk apll96_ck = { 691static struct clk apll96_ck = {
@@ -1747,7 +1754,8 @@ static struct clk gpt12_fck = {
1747}; 1754};
1748 1755
1749static struct clk mcbsp1_ick = { 1756static struct clk mcbsp1_ick = {
1750 .name = "mcbsp1_ick", 1757 .name = "mcbsp_ick",
1758 .id = 1,
1751 .parent = &l4_ck, 1759 .parent = &l4_ck,
1752 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1760 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1753 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1761 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1756,7 +1764,8 @@ static struct clk mcbsp1_ick = {
1756}; 1764};
1757 1765
1758static struct clk mcbsp1_fck = { 1766static struct clk mcbsp1_fck = {
1759 .name = "mcbsp1_fck", 1767 .name = "mcbsp_fck",
1768 .id = 1,
1760 .parent = &func_96m_ck, 1769 .parent = &func_96m_ck,
1761 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1770 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1762 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1771 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
@@ -1765,7 +1774,8 @@ static struct clk mcbsp1_fck = {
1765}; 1774};
1766 1775
1767static struct clk mcbsp2_ick = { 1776static struct clk mcbsp2_ick = {
1768 .name = "mcbsp2_ick", 1777 .name = "mcbsp_ick",
1778 .id = 2,
1769 .parent = &l4_ck, 1779 .parent = &l4_ck,
1770 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1780 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1771 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1781 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1774,7 +1784,8 @@ static struct clk mcbsp2_ick = {
1774}; 1784};
1775 1785
1776static struct clk mcbsp2_fck = { 1786static struct clk mcbsp2_fck = {
1777 .name = "mcbsp2_fck", 1787 .name = "mcbsp_fck",
1788 .id = 2,
1778 .parent = &func_96m_ck, 1789 .parent = &func_96m_ck,
1779 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1790 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1780 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1791 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
@@ -1783,7 +1794,8 @@ static struct clk mcbsp2_fck = {
1783}; 1794};
1784 1795
1785static struct clk mcbsp3_ick = { 1796static struct clk mcbsp3_ick = {
1786 .name = "mcbsp3_ick", 1797 .name = "mcbsp_ick",
1798 .id = 3,
1787 .parent = &l4_ck, 1799 .parent = &l4_ck,
1788 .flags = CLOCK_IN_OMAP243X, 1800 .flags = CLOCK_IN_OMAP243X,
1789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1801 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1792,7 +1804,8 @@ static struct clk mcbsp3_ick = {
1792}; 1804};
1793 1805
1794static struct clk mcbsp3_fck = { 1806static struct clk mcbsp3_fck = {
1795 .name = "mcbsp3_fck", 1807 .name = "mcbsp_fck",
1808 .id = 3,
1796 .parent = &func_96m_ck, 1809 .parent = &func_96m_ck,
1797 .flags = CLOCK_IN_OMAP243X, 1810 .flags = CLOCK_IN_OMAP243X,
1798 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 1811 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
@@ -1801,7 +1814,8 @@ static struct clk mcbsp3_fck = {
1801}; 1814};
1802 1815
1803static struct clk mcbsp4_ick = { 1816static struct clk mcbsp4_ick = {
1804 .name = "mcbsp4_ick", 1817 .name = "mcbsp_ick",
1818 .id = 4,
1805 .parent = &l4_ck, 1819 .parent = &l4_ck,
1806 .flags = CLOCK_IN_OMAP243X, 1820 .flags = CLOCK_IN_OMAP243X,
1807 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1821 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1810,7 +1824,8 @@ static struct clk mcbsp4_ick = {
1810}; 1824};
1811 1825
1812static struct clk mcbsp4_fck = { 1826static struct clk mcbsp4_fck = {
1813 .name = "mcbsp4_fck", 1827 .name = "mcbsp_fck",
1828 .id = 4,
1814 .parent = &func_96m_ck, 1829 .parent = &func_96m_ck,
1815 .flags = CLOCK_IN_OMAP243X, 1830 .flags = CLOCK_IN_OMAP243X,
1816 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 1831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
@@ -1819,7 +1834,8 @@ static struct clk mcbsp4_fck = {
1819}; 1834};
1820 1835
1821static struct clk mcbsp5_ick = { 1836static struct clk mcbsp5_ick = {
1822 .name = "mcbsp5_ick", 1837 .name = "mcbsp_ick",
1838 .id = 5,
1823 .parent = &l4_ck, 1839 .parent = &l4_ck,
1824 .flags = CLOCK_IN_OMAP243X, 1840 .flags = CLOCK_IN_OMAP243X,
1825 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1841 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1828,7 +1844,8 @@ static struct clk mcbsp5_ick = {
1828}; 1844};
1829 1845
1830static struct clk mcbsp5_fck = { 1846static struct clk mcbsp5_fck = {
1831 .name = "mcbsp5_fck", 1847 .name = "mcbsp_fck",
1848 .id = 5,
1832 .parent = &func_96m_ck, 1849 .parent = &func_96m_ck,
1833 .flags = CLOCK_IN_OMAP243X, 1850 .flags = CLOCK_IN_OMAP243X,
1834 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 1851 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index b42bdd6079a5..4263099b1ad3 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -1,10 +1,11 @@
1/* 1/*
2 * OMAP3-specific clock framework functions 2 * OMAP3-specific clock framework functions
3 * 3 *
4 * Copyright (C) 2007 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007 Nokia Corporation 5 * Copyright (C) 2007-2008 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * Testing and integration fixes by Jouni Högander
8 * 9 *
9 * Parts of this code are based on code written by 10 * Parts of this code are based on code written by
10 * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu 11 * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu
@@ -23,6 +24,7 @@
23#include <linux/delay.h> 24#include <linux/delay.h>
24#include <linux/clk.h> 25#include <linux/clk.h>
25#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/limits.h>
26 28
27#include <asm/arch/clock.h> 29#include <asm/arch/clock.h>
28#include <asm/arch/sram.h> 30#include <asm/arch/sram.h>
@@ -37,8 +39,11 @@
37#include "cm.h" 39#include "cm.h"
38#include "cm-regbits-34xx.h" 40#include "cm-regbits-34xx.h"
39 41
40/* CM_CLKEN_PLL*.EN* bit values */ 42/* CM_AUTOIDLE_PLL*.AUTO_* bit values */
41#define DPLL_LOCKED 0x7 43#define DPLL_AUTOIDLE_DISABLE 0x0
44#define DPLL_AUTOIDLE_LOW_POWER_STOP 0x1
45
46#define MAX_DPLL_WAIT_TRIES 1000000
42 47
43/** 48/**
44 * omap3_dpll_recalc - recalculate DPLL rate 49 * omap3_dpll_recalc - recalculate DPLL rate
@@ -53,6 +58,290 @@ static void omap3_dpll_recalc(struct clk *clk)
53 propagate_rate(clk); 58 propagate_rate(clk);
54} 59}
55 60
61/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
62static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
63{
64 const struct dpll_data *dd;
65
66 dd = clk->dpll_data;
67
68 cm_rmw_reg_bits(dd->enable_mask, clken_bits << __ffs(dd->enable_mask),
69 dd->control_reg);
70}
71
72/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
73static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
74{
75 const struct dpll_data *dd;
76 int i = 0;
77 int ret = -EINVAL;
78 u32 idlest_mask;
79
80 dd = clk->dpll_data;
81
82 state <<= dd->idlest_bit;
83 idlest_mask = 1 << dd->idlest_bit;
84
85 while (((cm_read_reg(dd->idlest_reg) & idlest_mask) != state) &&
86 i < MAX_DPLL_WAIT_TRIES) {
87 i++;
88 udelay(1);
89 }
90
91 if (i == MAX_DPLL_WAIT_TRIES) {
92 printk(KERN_ERR "clock: %s failed transition to '%s'\n",
93 clk->name, (state) ? "locked" : "bypassed");
94 } else {
95 pr_debug("clock: %s transition to '%s' in %d loops\n",
96 clk->name, (state) ? "locked" : "bypassed", i);
97
98 ret = 0;
99 }
100
101 return ret;
102}
103
104/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */
105
106/*
107 * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness
108 * @clk: pointer to a DPLL struct clk
109 *
110 * Instructs a non-CORE DPLL to lock. Waits for the DPLL to report
111 * readiness before returning. Will save and restore the DPLL's
112 * autoidle state across the enable, per the CDP code. If the DPLL
113 * locked successfully, return 0; if the DPLL did not lock in the time
114 * allotted, or DPLL3 was passed in, return -EINVAL.
115 */
116static int _omap3_noncore_dpll_lock(struct clk *clk)
117{
118 u8 ai;
119 int r;
120
121 if (clk == &dpll3_ck)
122 return -EINVAL;
123
124 pr_debug("clock: locking DPLL %s\n", clk->name);
125
126 ai = omap3_dpll_autoidle_read(clk);
127
128 _omap3_dpll_write_clken(clk, DPLL_LOCKED);
129
130 if (ai) {
131 /*
132 * If no downstream clocks are enabled, CM_IDLEST bit
133 * may never become active, so don't wait for DPLL to lock.
134 */
135 r = 0;
136 omap3_dpll_allow_idle(clk);
137 } else {
138 r = _omap3_wait_dpll_status(clk, 1);
139 omap3_dpll_deny_idle(clk);
140 };
141
142 return r;
143}
144
145/*
146 * omap3_noncore_dpll_bypass - instruct a DPLL to bypass and wait for readiness
147 * @clk: pointer to a DPLL struct clk
148 *
149 * Instructs a non-CORE DPLL to enter low-power bypass mode. In
150 * bypass mode, the DPLL's rate is set equal to its parent clock's
151 * rate. Waits for the DPLL to report readiness before returning.
152 * Will save and restore the DPLL's autoidle state across the enable,
153 * per the CDP code. If the DPLL entered bypass mode successfully,
154 * return 0; if the DPLL did not enter bypass in the time allotted, or
155 * DPLL3 was passed in, or the DPLL does not support low-power bypass,
156 * return -EINVAL.
157 */
158static int _omap3_noncore_dpll_bypass(struct clk *clk)
159{
160 int r;
161 u8 ai;
162
163 if (clk == &dpll3_ck)
164 return -EINVAL;
165
166 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS)))
167 return -EINVAL;
168
169 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
170 clk->name);
171
172 ai = omap3_dpll_autoidle_read(clk);
173
174 _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_BYPASS);
175
176 r = _omap3_wait_dpll_status(clk, 0);
177
178 if (ai)
179 omap3_dpll_allow_idle(clk);
180 else
181 omap3_dpll_deny_idle(clk);
182
183 return r;
184}
185
186/*
187 * _omap3_noncore_dpll_stop - instruct a DPLL to stop
188 * @clk: pointer to a DPLL struct clk
189 *
190 * Instructs a non-CORE DPLL to enter low-power stop. Will save and
191 * restore the DPLL's autoidle state across the stop, per the CDP
192 * code. If DPLL3 was passed in, or the DPLL does not support
193 * low-power stop, return -EINVAL; otherwise, return 0.
194 */
195static int _omap3_noncore_dpll_stop(struct clk *clk)
196{
197 u8 ai;
198
199 if (clk == &dpll3_ck)
200 return -EINVAL;
201
202 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
203 return -EINVAL;
204
205 pr_debug("clock: stopping DPLL %s\n", clk->name);
206
207 ai = omap3_dpll_autoidle_read(clk);
208
209 _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_STOP);
210
211 if (ai)
212 omap3_dpll_allow_idle(clk);
213 else
214 omap3_dpll_deny_idle(clk);
215
216 return 0;
217}
218
219/**
220 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
221 * @clk: pointer to a DPLL struct clk
222 *
223 * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
224 * The choice of modes depends on the DPLL's programmed rate: if it is
225 * the same as the DPLL's parent clock, it will enter bypass;
226 * otherwise, it will enter lock. This code will wait for the DPLL to
227 * indicate readiness before returning, unless the DPLL takes too long
228 * to enter the target state. Intended to be used as the struct clk's
229 * enable function. If DPLL3 was passed in, or the DPLL does not
230 * support low-power stop, or if the DPLL took too long to enter
231 * bypass or lock, return -EINVAL; otherwise, return 0.
232 */
233static int omap3_noncore_dpll_enable(struct clk *clk)
234{
235 int r;
236
237 if (clk == &dpll3_ck)
238 return -EINVAL;
239
240 if (clk->parent->rate == clk_get_rate(clk))
241 r = _omap3_noncore_dpll_bypass(clk);
242 else
243 r = _omap3_noncore_dpll_lock(clk);
244
245 return r;
246}
247
248/**
249 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
250 * @clk: pointer to a DPLL struct clk
251 *
252 * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
253 * The choice of modes depends on the DPLL's programmed rate: if it is
254 * the same as the DPLL's parent clock, it will enter bypass;
255 * otherwise, it will enter lock. This code will wait for the DPLL to
256 * indicate readiness before returning, unless the DPLL takes too long
257 * to enter the target state. Intended to be used as the struct clk's
258 * enable function. If DPLL3 was passed in, or the DPLL does not
259 * support low-power stop, or if the DPLL took too long to enter
260 * bypass or lock, return -EINVAL; otherwise, return 0.
261 */
262static void omap3_noncore_dpll_disable(struct clk *clk)
263{
264 if (clk == &dpll3_ck)
265 return;
266
267 _omap3_noncore_dpll_stop(clk);
268}
269
270/**
271 * omap3_dpll_autoidle_read - read a DPLL's autoidle bits
272 * @clk: struct clk * of the DPLL to read
273 *
274 * Return the DPLL's autoidle bits, shifted down to bit 0. Returns
275 * -EINVAL if passed a null pointer or if the struct clk does not
276 * appear to refer to a DPLL.
277 */
278static u32 omap3_dpll_autoidle_read(struct clk *clk)
279{
280 const struct dpll_data *dd;
281 u32 v;
282
283 if (!clk || !clk->dpll_data)
284 return -EINVAL;
285
286 dd = clk->dpll_data;
287
288 v = cm_read_reg(dd->autoidle_reg);
289 v &= dd->autoidle_mask;
290 v >>= __ffs(dd->autoidle_mask);
291
292 return v;
293}
294
295/**
296 * omap3_dpll_allow_idle - enable DPLL autoidle bits
297 * @clk: struct clk * of the DPLL to operate on
298 *
299 * Enable DPLL automatic idle control. This automatic idle mode
300 * switching takes effect only when the DPLL is locked, at least on
301 * OMAP3430. The DPLL will enter low-power stop when its downstream
302 * clocks are gated. No return value.
303 */
304static void omap3_dpll_allow_idle(struct clk *clk)
305{
306 const struct dpll_data *dd;
307
308 if (!clk || !clk->dpll_data)
309 return;
310
311 dd = clk->dpll_data;
312
313 /*
314 * REVISIT: CORE DPLL can optionally enter low-power bypass
315 * by writing 0x5 instead of 0x1. Add some mechanism to
316 * optionally enter this mode.
317 */
318 cm_rmw_reg_bits(dd->autoidle_mask,
319 DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask),
320 dd->autoidle_reg);
321}
322
323/**
324 * omap3_dpll_deny_idle - prevent DPLL from automatically idling
325 * @clk: struct clk * of the DPLL to operate on
326 *
327 * Disable DPLL automatic idle control. No return value.
328 */
329static void omap3_dpll_deny_idle(struct clk *clk)
330{
331 const struct dpll_data *dd;
332
333 if (!clk || !clk->dpll_data)
334 return;
335
336 dd = clk->dpll_data;
337
338 cm_rmw_reg_bits(dd->autoidle_mask,
339 DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask),
340 dd->autoidle_reg);
341}
342
343/* Clock control for DPLL outputs */
344
56/** 345/**
57 * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate 346 * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate
58 * @clk: DPLL output struct clk 347 * @clk: DPLL output struct clk
@@ -89,6 +378,8 @@ static void omap3_clkoutx2_recalc(struct clk *clk)
89 propagate_rate(clk); 378 propagate_rate(clk);
90} 379}
91 380
381/* Common clock code */
382
92/* 383/*
93 * As it is structured now, this will prevent an OMAP2/3 multiboot 384 * As it is structured now, this will prevent an OMAP2/3 multiboot
94 * kernel from compiling. This will need further attention. 385 * kernel from compiling. This will need further attention.
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index c9c5972a2e25..05757eb032bc 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -1,14 +1,19 @@
1/* 1/*
2 * OMAP3 clock framework 2 * OMAP3 clock framework
3 * 3 *
4 * Virtual clocks are introduced as a convenient tools.
5 * They are sources for other clocks and not supposed
6 * to be requested from drivers directly.
7 *
8 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
9 * Copyright (C) 2007-2008 Nokia Corporation 5 * Copyright (C) 2007-2008 Nokia Corporation
10 * 6 *
11 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander
9 * DPLL bypass clock support added by Roman Tereshonkov
10 *
11 */
12
13/*
14 * Virtual clocks are introduced as convenient tools.
15 * They are sources for other clocks and not supposed
16 * to be requested from drivers directly.
12 */ 17 */
13 18
14#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H 19#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
@@ -24,6 +29,15 @@
24 29
25static void omap3_dpll_recalc(struct clk *clk); 30static void omap3_dpll_recalc(struct clk *clk);
26static void omap3_clkoutx2_recalc(struct clk *clk); 31static void omap3_clkoutx2_recalc(struct clk *clk);
32static void omap3_dpll_allow_idle(struct clk *clk);
33static void omap3_dpll_deny_idle(struct clk *clk);
34static u32 omap3_dpll_autoidle_read(struct clk *clk);
35static int omap3_noncore_dpll_enable(struct clk *clk);
36static void omap3_noncore_dpll_disable(struct clk *clk);
37
38/* Maximum DPLL multiplier, divider values for OMAP3 */
39#define OMAP3_MAX_DPLL_MULT 2048
40#define OMAP3_MAX_DPLL_DIV 128
27 41
28/* 42/*
29 * DPLL1 supplies clock to the MPU. 43 * DPLL1 supplies clock to the MPU.
@@ -33,6 +47,11 @@ static void omap3_clkoutx2_recalc(struct clk *clk);
33 * DPLL5 supplies other peripheral clocks (USBHOST, USIM). 47 * DPLL5 supplies other peripheral clocks (USBHOST, USIM).
34 */ 48 */
35 49
50/* CM_CLKEN_PLL*.EN* bit values - not all are available for every DPLL */
51#define DPLL_LOW_POWER_STOP 0x1
52#define DPLL_LOW_POWER_BYPASS 0x5
53#define DPLL_LOCKED 0x7
54
36/* PRM CLOCKS */ 55/* PRM CLOCKS */
37 56
38/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */ 57/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */
@@ -240,15 +259,23 @@ static const struct clksel_rate div16_dpll_rates[] = {
240/* DPLL1 */ 259/* DPLL1 */
241/* MPU clock source */ 260/* MPU clock source */
242/* Type: DPLL */ 261/* Type: DPLL */
243static const struct dpll_data dpll1_dd = { 262static struct dpll_data dpll1_dd = {
244 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL), 263 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
245 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK, 264 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
246 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK, 265 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
247 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL), 266 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
248 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK, 267 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
268 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
249 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT, 269 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
250 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT, 270 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
251 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT, 271 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
272 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
273 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
274 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
275 .idlest_bit = OMAP3430_ST_MPU_CLK_SHIFT,
276 .max_multiplier = OMAP3_MAX_DPLL_MULT,
277 .max_divider = OMAP3_MAX_DPLL_DIV,
278 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
252}; 279};
253 280
254static struct clk dpll1_ck = { 281static struct clk dpll1_ck = {
@@ -256,6 +283,7 @@ static struct clk dpll1_ck = {
256 .parent = &sys_ck, 283 .parent = &sys_ck,
257 .dpll_data = &dpll1_dd, 284 .dpll_data = &dpll1_dd,
258 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, 285 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED,
286 .round_rate = &omap2_dpll_round_rate,
259 .recalc = &omap3_dpll_recalc, 287 .recalc = &omap3_dpll_recalc,
260}; 288};
261 289
@@ -297,22 +325,34 @@ static struct clk dpll1_x2m2_ck = {
297/* IVA2 clock source */ 325/* IVA2 clock source */
298/* Type: DPLL */ 326/* Type: DPLL */
299 327
300static const struct dpll_data dpll2_dd = { 328static struct dpll_data dpll2_dd = {
301 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL), 329 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
302 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK, 330 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
303 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK, 331 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
304 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL), 332 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
305 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK, 333 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
334 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
335 (1 << DPLL_LOW_POWER_BYPASS),
306 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT, 336 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
307 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT, 337 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
308 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT, 338 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
339 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
340 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
341 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
342 .idlest_bit = OMAP3430_ST_IVA2_CLK_SHIFT,
343 .max_multiplier = OMAP3_MAX_DPLL_MULT,
344 .max_divider = OMAP3_MAX_DPLL_DIV,
345 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
309}; 346};
310 347
311static struct clk dpll2_ck = { 348static struct clk dpll2_ck = {
312 .name = "dpll2_ck", 349 .name = "dpll2_ck",
313 .parent = &sys_ck, 350 .parent = &sys_ck,
314 .dpll_data = &dpll2_dd, 351 .dpll_data = &dpll2_dd,
315 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, 352 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES,
353 .enable = &omap3_noncore_dpll_enable,
354 .disable = &omap3_noncore_dpll_disable,
355 .round_rate = &omap2_dpll_round_rate,
316 .recalc = &omap3_dpll_recalc, 356 .recalc = &omap3_dpll_recalc,
317}; 357};
318 358
@@ -338,10 +378,12 @@ static struct clk dpll2_m2_ck = {
338 .recalc = &omap2_clksel_recalc, 378 .recalc = &omap2_clksel_recalc,
339}; 379};
340 380
341/* DPLL3 */ 381/*
342/* Source clock for all interfaces and for some device fclks */ 382 * DPLL3
343/* Type: DPLL */ 383 * Source clock for all interfaces and for some device fclks
344static const struct dpll_data dpll3_dd = { 384 * REVISIT: Also supports fast relock bypass - not included below
385 */
386static struct dpll_data dpll3_dd = {
345 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), 387 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
346 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK, 388 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
347 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK, 389 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
@@ -350,6 +392,11 @@ static const struct dpll_data dpll3_dd = {
350 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT, 392 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
351 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT, 393 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
352 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT, 394 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
395 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
396 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
397 .max_multiplier = OMAP3_MAX_DPLL_MULT,
398 .max_divider = OMAP3_MAX_DPLL_DIV,
399 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
353}; 400};
354 401
355static struct clk dpll3_ck = { 402static struct clk dpll3_ck = {
@@ -357,6 +404,7 @@ static struct clk dpll3_ck = {
357 .parent = &sys_ck, 404 .parent = &sys_ck,
358 .dpll_data = &dpll3_dd, 405 .dpll_data = &dpll3_dd,
359 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, 406 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED,
407 .round_rate = &omap2_dpll_round_rate,
360 .recalc = &omap3_dpll_recalc, 408 .recalc = &omap3_dpll_recalc,
361}; 409};
362 410
@@ -439,7 +487,7 @@ static struct clk core_ck = {
439 .name = "core_ck", 487 .name = "core_ck",
440 .init = &omap2_init_clksel_parent, 488 .init = &omap2_init_clksel_parent,
441 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 489 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
442 .clksel_mask = OMAP3430_ST_CORE_CLK, 490 .clksel_mask = OMAP3430_ST_CORE_CLK_MASK,
443 .clksel = core_ck_clksel, 491 .clksel = core_ck_clksel,
444 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 492 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
445 PARENT_CONTROLS_CLOCK, 493 PARENT_CONTROLS_CLOCK,
@@ -456,7 +504,7 @@ static struct clk dpll3_m2x2_ck = {
456 .name = "dpll3_m2x2_ck", 504 .name = "dpll3_m2x2_ck",
457 .init = &omap2_init_clksel_parent, 505 .init = &omap2_init_clksel_parent,
458 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 506 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
459 .clksel_mask = OMAP3430_ST_CORE_CLK, 507 .clksel_mask = OMAP3430_ST_CORE_CLK_MASK,
460 .clksel = dpll3_m2x2_ck_clksel, 508 .clksel = dpll3_m2x2_ck_clksel,
461 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 509 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
462 PARENT_CONTROLS_CLOCK, 510 PARENT_CONTROLS_CLOCK,
@@ -503,7 +551,7 @@ static struct clk emu_core_alwon_ck = {
503 .parent = &dpll3_m3x2_ck, 551 .parent = &dpll3_m3x2_ck,
504 .init = &omap2_init_clksel_parent, 552 .init = &omap2_init_clksel_parent,
505 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 553 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
506 .clksel_mask = OMAP3430_ST_CORE_CLK, 554 .clksel_mask = OMAP3430_ST_CORE_CLK_MASK,
507 .clksel = emu_core_alwon_ck_clksel, 555 .clksel = emu_core_alwon_ck_clksel,
508 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 556 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
509 PARENT_CONTROLS_CLOCK, 557 PARENT_CONTROLS_CLOCK,
@@ -513,22 +561,33 @@ static struct clk emu_core_alwon_ck = {
513/* DPLL4 */ 561/* DPLL4 */
514/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */ 562/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
515/* Type: DPLL */ 563/* Type: DPLL */
516static const struct dpll_data dpll4_dd = { 564static struct dpll_data dpll4_dd = {
517 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2), 565 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
518 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK, 566 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
519 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK, 567 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
520 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 568 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
521 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK, 569 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
570 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
522 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT, 571 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
523 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT, 572 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
524 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT, 573 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
574 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
575 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
576 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
577 .idlest_bit = OMAP3430_ST_PERIPH_CLK_SHIFT,
578 .max_multiplier = OMAP3_MAX_DPLL_MULT,
579 .max_divider = OMAP3_MAX_DPLL_DIV,
580 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
525}; 581};
526 582
527static struct clk dpll4_ck = { 583static struct clk dpll4_ck = {
528 .name = "dpll4_ck", 584 .name = "dpll4_ck",
529 .parent = &sys_ck, 585 .parent = &sys_ck,
530 .dpll_data = &dpll4_dd, 586 .dpll_data = &dpll4_dd,
531 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | ALWAYS_ENABLED, 587 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES,
588 .enable = &omap3_noncore_dpll_enable,
589 .disable = &omap3_noncore_dpll_disable,
590 .round_rate = &omap2_dpll_round_rate,
532 .recalc = &omap3_dpll_recalc, 591 .recalc = &omap3_dpll_recalc,
533}; 592};
534 593
@@ -584,7 +643,7 @@ static struct clk omap_96m_alwon_fck = {
584 .parent = &dpll4_m2x2_ck, 643 .parent = &dpll4_m2x2_ck,
585 .init = &omap2_init_clksel_parent, 644 .init = &omap2_init_clksel_parent,
586 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 645 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
587 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 646 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
588 .clksel = omap_96m_alwon_fck_clksel, 647 .clksel = omap_96m_alwon_fck_clksel,
589 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 648 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
590 PARENT_CONTROLS_CLOCK, 649 PARENT_CONTROLS_CLOCK,
@@ -610,7 +669,7 @@ static struct clk cm_96m_fck = {
610 .parent = &dpll4_m2x2_ck, 669 .parent = &dpll4_m2x2_ck,
611 .init = &omap2_init_clksel_parent, 670 .init = &omap2_init_clksel_parent,
612 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 671 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
613 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 672 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
614 .clksel = cm_96m_fck_clksel, 673 .clksel = cm_96m_fck_clksel,
615 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 674 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
616 PARENT_CONTROLS_CLOCK, 675 PARENT_CONTROLS_CLOCK,
@@ -652,7 +711,7 @@ static struct clk virt_omap_54m_fck = {
652 .parent = &dpll4_m3x2_ck, 711 .parent = &dpll4_m3x2_ck,
653 .init = &omap2_init_clksel_parent, 712 .init = &omap2_init_clksel_parent,
654 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 713 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
655 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 714 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
656 .clksel = virt_omap_54m_fck_clksel, 715 .clksel = virt_omap_54m_fck_clksel,
657 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES | 716 .flags = CLOCK_IN_OMAP343X | RATE_PROPAGATES |
658 PARENT_CONTROLS_CLOCK, 717 PARENT_CONTROLS_CLOCK,
@@ -804,23 +863,33 @@ static struct clk emu_per_alwon_ck = {
804/* Supplies 120MHz clock, USIM source clock */ 863/* Supplies 120MHz clock, USIM source clock */
805/* Type: DPLL */ 864/* Type: DPLL */
806/* 3430ES2 only */ 865/* 3430ES2 only */
807static const struct dpll_data dpll5_dd = { 866static struct dpll_data dpll5_dd = {
808 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4), 867 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
809 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK, 868 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
810 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK, 869 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
811 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2), 870 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
812 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK, 871 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
872 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
813 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT, 873 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
814 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT, 874 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
815 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT, 875 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
876 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
877 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
878 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
879 .idlest_bit = OMAP3430ES2_ST_PERIPH2_CLK_SHIFT,
880 .max_multiplier = OMAP3_MAX_DPLL_MULT,
881 .max_divider = OMAP3_MAX_DPLL_DIV,
882 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
816}; 883};
817 884
818static struct clk dpll5_ck = { 885static struct clk dpll5_ck = {
819 .name = "dpll5_ck", 886 .name = "dpll5_ck",
820 .parent = &sys_ck, 887 .parent = &sys_ck,
821 .dpll_data = &dpll5_dd, 888 .dpll_data = &dpll5_dd,
822 .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES | 889 .flags = CLOCK_IN_OMAP3430ES2 | RATE_PROPAGATES,
823 ALWAYS_ENABLED, 890 .enable = &omap3_noncore_dpll_enable,
891 .disable = &omap3_noncore_dpll_disable,
892 .round_rate = &omap2_dpll_round_rate,
824 .recalc = &omap3_dpll_recalc, 893 .recalc = &omap3_dpll_recalc,
825}; 894};
826 895
@@ -1365,7 +1434,8 @@ static const struct clksel mcbsp_15_clksel[] = {
1365}; 1434};
1366 1435
1367static struct clk mcbsp5_fck = { 1436static struct clk mcbsp5_fck = {
1368 .name = "mcbsp5_fck", 1437 .name = "mcbsp_fck",
1438 .id = 5,
1369 .init = &omap2_init_clksel_parent, 1439 .init = &omap2_init_clksel_parent,
1370 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1440 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1371 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT, 1441 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
@@ -1377,7 +1447,8 @@ static struct clk mcbsp5_fck = {
1377}; 1447};
1378 1448
1379static struct clk mcbsp1_fck = { 1449static struct clk mcbsp1_fck = {
1380 .name = "mcbsp1_fck", 1450 .name = "mcbsp_fck",
1451 .id = 1,
1381 .init = &omap2_init_clksel_parent, 1452 .init = &omap2_init_clksel_parent,
1382 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1453 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1383 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT, 1454 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
@@ -1789,7 +1860,8 @@ static struct clk gpt10_ick = {
1789}; 1860};
1790 1861
1791static struct clk mcbsp5_ick = { 1862static struct clk mcbsp5_ick = {
1792 .name = "mcbsp5_ick", 1863 .name = "mcbsp_ick",
1864 .id = 5,
1793 .parent = &core_l4_ick, 1865 .parent = &core_l4_ick,
1794 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1866 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1795 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT, 1867 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
@@ -1798,7 +1870,8 @@ static struct clk mcbsp5_ick = {
1798}; 1870};
1799 1871
1800static struct clk mcbsp1_ick = { 1872static struct clk mcbsp1_ick = {
1801 .name = "mcbsp1_ick", 1873 .name = "mcbsp_ick",
1874 .id = 1,
1802 .parent = &core_l4_ick, 1875 .parent = &core_l4_ick,
1803 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1876 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1804 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT, 1877 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
@@ -1935,7 +2008,7 @@ static struct clk dss1_alwon_fck = {
1935 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 2008 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
1936 .enable_bit = OMAP3430_EN_DSS1_SHIFT, 2009 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
1937 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 2010 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
1938 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 2011 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
1939 .clksel = dss1_alwon_fck_clksel, 2012 .clksel = dss1_alwon_fck_clksel,
1940 .flags = CLOCK_IN_OMAP343X, 2013 .flags = CLOCK_IN_OMAP343X,
1941 .recalc = &omap2_clksel_recalc, 2014 .recalc = &omap2_clksel_recalc,
@@ -1991,7 +2064,7 @@ static struct clk cam_mclk = {
1991 .parent = &dpll4_m5x2_ck, 2064 .parent = &dpll4_m5x2_ck,
1992 .init = &omap2_init_clksel_parent, 2065 .init = &omap2_init_clksel_parent,
1993 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 2066 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
1994 .clksel_mask = OMAP3430_ST_PERIPH_CLK, 2067 .clksel_mask = OMAP3430_ST_PERIPH_CLK_MASK,
1995 .clksel = cam_mclk_clksel, 2068 .clksel = cam_mclk_clksel,
1996 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), 2069 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
1997 .enable_bit = OMAP3430_EN_CAM_SHIFT, 2070 .enable_bit = OMAP3430_EN_CAM_SHIFT,
@@ -2541,7 +2614,8 @@ static struct clk gpt2_ick = {
2541}; 2614};
2542 2615
2543static struct clk mcbsp2_ick = { 2616static struct clk mcbsp2_ick = {
2544 .name = "mcbsp2_ick", 2617 .name = "mcbsp_ick",
2618 .id = 2,
2545 .parent = &per_l4_ick, 2619 .parent = &per_l4_ick,
2546 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2620 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2547 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT, 2621 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
@@ -2550,7 +2624,8 @@ static struct clk mcbsp2_ick = {
2550}; 2624};
2551 2625
2552static struct clk mcbsp3_ick = { 2626static struct clk mcbsp3_ick = {
2553 .name = "mcbsp3_ick", 2627 .name = "mcbsp_ick",
2628 .id = 3,
2554 .parent = &per_l4_ick, 2629 .parent = &per_l4_ick,
2555 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2630 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2556 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT, 2631 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
@@ -2559,7 +2634,8 @@ static struct clk mcbsp3_ick = {
2559}; 2634};
2560 2635
2561static struct clk mcbsp4_ick = { 2636static struct clk mcbsp4_ick = {
2562 .name = "mcbsp4_ick", 2637 .name = "mcbsp_ick",
2638 .id = 4,
2563 .parent = &per_l4_ick, 2639 .parent = &per_l4_ick,
2564 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2640 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2565 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT, 2641 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
@@ -2574,7 +2650,8 @@ static const struct clksel mcbsp_234_clksel[] = {
2574}; 2650};
2575 2651
2576static struct clk mcbsp2_fck = { 2652static struct clk mcbsp2_fck = {
2577 .name = "mcbsp2_fck", 2653 .name = "mcbsp_fck",
2654 .id = 2,
2578 .init = &omap2_init_clksel_parent, 2655 .init = &omap2_init_clksel_parent,
2579 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2656 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2580 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT, 2657 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
@@ -2586,7 +2663,8 @@ static struct clk mcbsp2_fck = {
2586}; 2663};
2587 2664
2588static struct clk mcbsp3_fck = { 2665static struct clk mcbsp3_fck = {
2589 .name = "mcbsp3_fck", 2666 .name = "mcbsp_fck",
2667 .id = 3,
2590 .init = &omap2_init_clksel_parent, 2668 .init = &omap2_init_clksel_parent,
2591 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2669 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2592 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT, 2670 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
@@ -2598,7 +2676,8 @@ static struct clk mcbsp3_fck = {
2598}; 2676};
2599 2677
2600static struct clk mcbsp4_fck = { 2678static struct clk mcbsp4_fck = {
2601 .name = "mcbsp4_fck", 2679 .name = "mcbsp_fck",
2680 .id = 4,
2602 .init = &omap2_init_clksel_parent, 2681 .init = &omap2_init_clksel_parent,
2603 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2682 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2604 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT, 2683 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 3c38395f6442..ee4c0ca1a708 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -72,7 +72,8 @@
72#define OMAP3430_ST_IVA2 (1 << 0) 72#define OMAP3430_ST_IVA2 (1 << 0)
73 73
74/* CM_IDLEST_PLL_IVA2 */ 74/* CM_IDLEST_PLL_IVA2 */
75#define OMAP3430_ST_IVA2_CLK (1 << 0) 75#define OMAP3430_ST_IVA2_CLK_SHIFT 0
76#define OMAP3430_ST_IVA2_CLK_MASK (1 << 0)
76 77
77/* CM_AUTOIDLE_PLL_IVA2 */ 78/* CM_AUTOIDLE_PLL_IVA2 */
78#define OMAP3430_AUTO_IVA2_DPLL_SHIFT 0 79#define OMAP3430_AUTO_IVA2_DPLL_SHIFT 0
@@ -115,10 +116,7 @@
115#define OMAP3430_ST_MPU (1 << 0) 116#define OMAP3430_ST_MPU (1 << 0)
116 117
117/* CM_IDLEST_PLL_MPU */ 118/* CM_IDLEST_PLL_MPU */
118#define OMAP3430_ST_MPU_CLK (1 << 0) 119#define OMAP3430_ST_MPU_CLK_SHIFT 0
119#define OMAP3430_ST_IVA2_CLK_MASK (1 << 0)
120
121/* CM_IDLEST_PLL_MPU */
122#define OMAP3430_ST_MPU_CLK_MASK (1 << 0) 120#define OMAP3430_ST_MPU_CLK_MASK (1 << 0)
123 121
124/* CM_AUTOIDLE_PLL_MPU */ 122/* CM_AUTOIDLE_PLL_MPU */
@@ -408,8 +406,10 @@
408#define OMAP3430_ST_12M_CLK (1 << 4) 406#define OMAP3430_ST_12M_CLK (1 << 4)
409#define OMAP3430_ST_48M_CLK (1 << 3) 407#define OMAP3430_ST_48M_CLK (1 << 3)
410#define OMAP3430_ST_96M_CLK (1 << 2) 408#define OMAP3430_ST_96M_CLK (1 << 2)
411#define OMAP3430_ST_PERIPH_CLK (1 << 1) 409#define OMAP3430_ST_PERIPH_CLK_SHIFT 1
412#define OMAP3430_ST_CORE_CLK (1 << 0) 410#define OMAP3430_ST_PERIPH_CLK_MASK (1 << 1)
411#define OMAP3430_ST_CORE_CLK_SHIFT 0
412#define OMAP3430_ST_CORE_CLK_MASK (1 << 0)
413 413
414/* CM_IDLEST2_CKGEN */ 414/* CM_IDLEST2_CKGEN */
415#define OMAP3430ES2_ST_120M_CLK_SHIFT 1 415#define OMAP3430ES2_ST_120M_CLK_SHIFT 1
@@ -423,6 +423,10 @@
423#define OMAP3430_AUTO_CORE_DPLL_SHIFT 0 423#define OMAP3430_AUTO_CORE_DPLL_SHIFT 0
424#define OMAP3430_AUTO_CORE_DPLL_MASK (0x7 << 0) 424#define OMAP3430_AUTO_CORE_DPLL_MASK (0x7 << 0)
425 425
426/* CM_AUTOIDLE2_PLL */
427#define OMAP3430ES2_AUTO_PERIPH2_DPLL_SHIFT 0
428#define OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK (0x7 << 0)
429
426/* CM_CLKSEL1_PLL */ 430/* CM_CLKSEL1_PLL */
427/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */ 431/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */
428#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27 432#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index 8489f3029fed..87a44c715aa4 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -81,6 +81,7 @@
81#define OMAP3430ES2_CM_FCLKEN3 0x0008 81#define OMAP3430ES2_CM_FCLKEN3 0x0008
82#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2 82#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
83#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2 83#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
84#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
84#define OMAP3430_CM_CLKSEL1 CM_CLKSEL 85#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
85#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL 86#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
86#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2 87#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
@@ -96,15 +97,21 @@
96/* Clock management domain register get/set */ 97/* Clock management domain register get/set */
97 98
98#ifndef __ASSEMBLER__ 99#ifndef __ASSEMBLER__
99static inline void cm_write_mod_reg(u32 val, s16 module, s16 idx) 100
101extern u32 cm_read_mod_reg(s16 module, u16 idx);
102extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
103extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
104
105static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
100{ 106{
101 __raw_writel(val, OMAP_CM_REGADDR(module, idx)); 107 return cm_rmw_mod_reg_bits(bits, bits, module, idx);
102} 108}
103 109
104static inline u32 cm_read_mod_reg(s16 module, s16 idx) 110static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
105{ 111{
106 return __raw_readl(OMAP_CM_REGADDR(module, idx)); 112 return cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
107} 113}
114
108#endif 115#endif
109 116
110/* CM register bits shared between 24XX and 3430 */ 117/* CM register bits shared between 24XX and 3430 */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index a5d86a49c213..51f70300996f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -13,22 +13,21 @@
13#undef DEBUG 13#undef DEBUG
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h>
16 17
17#include <asm/io.h> 18#include <asm/arch/common.h>
18
19#include <asm/arch/control.h> 19#include <asm/arch/control.h>
20 20
21static u32 omap2_ctrl_base; 21static void __iomem *omap2_ctrl_base;
22 22
23#define OMAP_CTRL_REGADDR(reg) (void __iomem *)IO_ADDRESS(omap2_ctrl_base \ 23#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
24 + (reg))
25 24
26void omap_ctrl_base_set(u32 base) 25void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
27{ 26{
28 omap2_ctrl_base = base; 27 omap2_ctrl_base = omap2_globals->ctrl;
29} 28}
30 29
31u32 omap_ctrl_base_get(void) 30void __iomem *omap_ctrl_base_get(void)
32{ 31{
33 return omap2_ctrl_base; 32 return omap2_ctrl_base;
34} 33}
@@ -50,25 +49,16 @@ u32 omap_ctrl_readl(u16 offset)
50 49
51void omap_ctrl_writeb(u8 val, u16 offset) 50void omap_ctrl_writeb(u8 val, u16 offset)
52{ 51{
53 pr_debug("omap_ctrl_writeb: writing 0x%0x to 0x%0x\n", val,
54 (u32)OMAP_CTRL_REGADDR(offset));
55
56 __raw_writeb(val, OMAP_CTRL_REGADDR(offset)); 52 __raw_writeb(val, OMAP_CTRL_REGADDR(offset));
57} 53}
58 54
59void omap_ctrl_writew(u16 val, u16 offset) 55void omap_ctrl_writew(u16 val, u16 offset)
60{ 56{
61 pr_debug("omap_ctrl_writew: writing 0x%0x to 0x%0x\n", val,
62 (u32)OMAP_CTRL_REGADDR(offset));
63
64 __raw_writew(val, OMAP_CTRL_REGADDR(offset)); 57 __raw_writew(val, OMAP_CTRL_REGADDR(offset));
65} 58}
66 59
67void omap_ctrl_writel(u32 val, u16 offset) 60void omap_ctrl_writel(u32 val, u16 offset)
68{ 61{
69 pr_debug("omap_ctrl_writel: writing 0x%0x to 0x%0x\n", val,
70 (u32)OMAP_CTRL_REGADDR(offset));
71
72 __raw_writel(val, OMAP_CTRL_REGADDR(offset)); 62 __raw_writel(val, OMAP_CTRL_REGADDR(offset));
73} 63}
74 64
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 4dfd878d7968..dff4b16cead6 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -17,16 +17,23 @@
17 17
18#include <asm/io.h> 18#include <asm/io.h>
19 19
20#if defined(CONFIG_ARCH_OMAP2420) 20#include <asm/arch/control.h>
21#define OMAP24XX_TAP_BASE io_p2v(0x48014000) 21#include <asm/arch/cpu.h>
22#endif
23 22
24#if defined(CONFIG_ARCH_OMAP2430) 23#if defined(CONFIG_ARCH_OMAP2420)
25#define OMAP24XX_TAP_BASE io_p2v(0x4900A000) 24#define TAP_BASE io_p2v(0x48014000)
25#elif defined(CONFIG_ARCH_OMAP2430)
26#define TAP_BASE io_p2v(0x4900A000)
27#elif defined(CONFIG_ARCH_OMAP34XX)
28#define TAP_BASE io_p2v(0x4830A000)
26#endif 29#endif
27 30
28#define OMAP_TAP_IDCODE 0x0204 31#define OMAP_TAP_IDCODE 0x0204
32#if defined(CONFIG_ARCH_OMAP34XX)
33#define OMAP_TAP_PROD_ID 0x0210
34#else
29#define OMAP_TAP_PROD_ID 0x0208 35#define OMAP_TAP_PROD_ID 0x0208
36#endif
30 37
31#define OMAP_TAP_DIE_ID_0 0x0218 38#define OMAP_TAP_DIE_ID_0 0x0218
32#define OMAP_TAP_DIE_ID_1 0x021C 39#define OMAP_TAP_DIE_ID_1 0x021C
@@ -56,9 +63,134 @@ static struct omap_id omap_ids[] __initdata = {
56 { .hawkeye = 0xb68a, .dev = 0x0, .type = 0x24300000 }, 63 { .hawkeye = 0xb68a, .dev = 0x0, .type = 0x24300000 },
57}; 64};
58 65
66static struct omap_chip_id omap_chip;
67
68/**
69 * omap_chip_is - test whether currently running OMAP matches a chip type
70 * @oc: omap_chip_t to test against
71 *
72 * Test whether the currently-running OMAP chip matches the supplied
73 * chip type 'oc'. Returns 1 upon a match; 0 upon failure.
74 */
75int omap_chip_is(struct omap_chip_id oci)
76{
77 return (oci.oc & omap_chip.oc) ? 1 : 0;
78}
79EXPORT_SYMBOL(omap_chip_is);
80
59static u32 __init read_tap_reg(int reg) 81static u32 __init read_tap_reg(int reg)
60{ 82{
61 return __raw_readl(OMAP24XX_TAP_BASE + reg); 83 unsigned int regval = 0;
84 u32 cpuid;
85
86 /* Reading the IDCODE register on 3430 ES1 results in a
87 * data abort as the register is not exposed on the OCP
88 * Hence reading the Cortex Rev
89 */
90 cpuid = read_cpuid(CPUID_ID);
91
92 /* If the processor type is Cortex-A8 and the revision is 0x0
93 * it means its Cortex r0p0 which is 3430 ES1
94 */
95 if ((((cpuid >> 4) & 0xFFF) == 0xC08) && ((cpuid & 0xF) == 0x0)) {
96 switch (reg) {
97 case OMAP_TAP_IDCODE : regval = 0x0B7AE02F; break;
98 /* Making DevType as 0xF in ES1 to differ from ES2 */
99 case OMAP_TAP_PROD_ID : regval = 0x000F00F0; break;
100 case OMAP_TAP_DIE_ID_0: regval = 0x01000000; break;
101 case OMAP_TAP_DIE_ID_1: regval = 0x1012d687; break;
102 case OMAP_TAP_DIE_ID_2: regval = 0x00000000; break;
103 case OMAP_TAP_DIE_ID_3: regval = 0x2d2c0000; break;
104 }
105 } else
106 regval = __raw_readl(TAP_BASE + reg);
107
108 return regval;
109
110}
111
112/*
113 * _set_system_rev - set the system_rev global based on current OMAP chip type
114 *
115 * Set the system_rev global. This is primarily used by the cpu_is_omapxxxx()
116 * macros.
117 */
118static void __init _set_system_rev(u32 type, u8 rev)
119{
120 u32 i, ctrl_status;
121
122 /*
123 * system_rev encoding is as follows
124 * system_rev & 0xff000000 -> Omap Class (24xx/34xx)
125 * system_rev & 0xfff00000 -> Omap Sub Class (242x/343x)
126 * system_rev & 0xffff0000 -> Omap type (2420/2422/2423/2430/3430)
127 * system_rev & 0x0000f000 -> Silicon revision (ES1, ES2 )
128 * system_rev & 0x00000700 -> Device Type ( EMU/HS/GP/BAD )
129 * system_rev & 0x000000c0 -> IDCODE revision[6:7]
130 * system_rev & 0x0000003f -> sys_boot[0:5]
131 */
132 /* Embedding the ES revision info in type field */
133 system_rev = type;
134 /* Also add IDCODE revision info only two lower bits */
135 system_rev |= ((rev & 0x3) << 6);
136
137 /* Add in the device type and sys_boot fields (see above) */
138 if (cpu_is_omap24xx()) {
139 i = OMAP24XX_CONTROL_STATUS;
140 } else if (cpu_is_omap343x()) {
141 i = OMAP343X_CONTROL_STATUS;
142 } else {
143 printk(KERN_ERR "id: unknown CPU type\n");
144 BUG();
145 }
146 ctrl_status = omap_ctrl_readl(i);
147 system_rev |= (ctrl_status & (OMAP2_SYSBOOT_5_MASK |
148 OMAP2_SYSBOOT_4_MASK |
149 OMAP2_SYSBOOT_3_MASK |
150 OMAP2_SYSBOOT_2_MASK |
151 OMAP2_SYSBOOT_1_MASK |
152 OMAP2_SYSBOOT_0_MASK));
153 system_rev |= (ctrl_status & OMAP2_DEVICETYPE_MASK);
154}
155
156
157/*
158 * _set_omap_chip - set the omap_chip global based on OMAP chip type
159 *
160 * Build the omap_chip bits. This variable is used by powerdomain and
161 * clockdomain code to indicate whether structures are applicable for
162 * the current OMAP chip type by ANDing it against a 'platform' bitfield
163 * in the structure.
164 */
165static void __init _set_omap_chip(void)
166{
167 if (cpu_is_omap343x()) {
168
169 omap_chip.oc = CHIP_IS_OMAP3430;
170 if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0))
171 omap_chip.oc |= CHIP_IS_OMAP3430ES1;
172 else if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0))
173 omap_chip.oc |= CHIP_IS_OMAP3430ES2;
174
175 } else if (cpu_is_omap243x()) {
176
177 /* Currently only supports 2430ES2.1 and 2430-all */
178 omap_chip.oc |= CHIP_IS_OMAP2430;
179
180 } else if (cpu_is_omap242x()) {
181
182 /* Currently only supports 2420ES2.1.1 and 2420-all */
183 omap_chip.oc |= CHIP_IS_OMAP2420;
184
185 } else {
186
187 /* Current CPU not supported by this code. */
188 printk(KERN_WARNING "OMAP chip type code does not yet support "
189 "this CPU type.\n");
190 WARN_ON(1);
191
192 }
193
62} 194}
63 195
64void __init omap2_check_revision(void) 196void __init omap2_check_revision(void)
@@ -76,21 +208,31 @@ void __init omap2_check_revision(void)
76 rev = (idcode >> 28) & 0x0f; 208 rev = (idcode >> 28) & 0x0f;
77 dev_type = (prod_id >> 16) & 0x0f; 209 dev_type = (prod_id >> 16) & 0x0f;
78 210
79#ifdef DEBUG 211 pr_debug("OMAP_TAP_IDCODE 0x%08x REV %i HAWKEYE 0x%04x MANF %03x\n",
80 printk(KERN_DEBUG "OMAP_TAP_IDCODE 0x%08x REV %i HAWKEYE 0x%04x MANF %03x\n", 212 idcode, rev, hawkeye, (idcode >> 1) & 0x7ff);
81 idcode, rev, hawkeye, (idcode >> 1) & 0x7ff); 213 pr_debug("OMAP_TAP_DIE_ID_0: 0x%08x\n",
82 printk(KERN_DEBUG "OMAP_TAP_DIE_ID_0: 0x%08x\n", 214 read_tap_reg(OMAP_TAP_DIE_ID_0));
83 read_tap_reg(OMAP_TAP_DIE_ID_0)); 215 pr_debug("OMAP_TAP_DIE_ID_1: 0x%08x DEV_REV: %i\n",
84 printk(KERN_DEBUG "OMAP_TAP_DIE_ID_1: 0x%08x DEV_REV: %i\n", 216 read_tap_reg(OMAP_TAP_DIE_ID_1),
85 read_tap_reg(OMAP_TAP_DIE_ID_1), 217 (read_tap_reg(OMAP_TAP_DIE_ID_1) >> 28) & 0xf);
86 (read_tap_reg(OMAP_TAP_DIE_ID_1) >> 28) & 0xf); 218 pr_debug("OMAP_TAP_DIE_ID_2: 0x%08x\n",
87 printk(KERN_DEBUG "OMAP_TAP_DIE_ID_2: 0x%08x\n", 219 read_tap_reg(OMAP_TAP_DIE_ID_2));
88 read_tap_reg(OMAP_TAP_DIE_ID_2)); 220 pr_debug("OMAP_TAP_DIE_ID_3: 0x%08x\n",
89 printk(KERN_DEBUG "OMAP_TAP_DIE_ID_3: 0x%08x\n", 221 read_tap_reg(OMAP_TAP_DIE_ID_3));
90 read_tap_reg(OMAP_TAP_DIE_ID_3)); 222 pr_debug("OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n",
91 printk(KERN_DEBUG "OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n", 223 prod_id, dev_type);
92 prod_id, dev_type); 224
93#endif 225 /*
226 * Detection for 34xx ES2.0 and above can be done with just
227 * hawkeye and rev. See TRM 1.5.2 Device Identification.
228 * Note that rev cannot be used directly as ES1.0 uses value 0.
229 */
230 if (hawkeye == 0xb7ae) {
231 system_rev = 0x34300000 | ((1 + rev) << 12);
232 pr_info("OMAP%04x ES2.%i\n", system_rev >> 16, rev);
233 _set_omap_chip();
234 return;
235 }
94 236
95 /* Check hawkeye ids */ 237 /* Check hawkeye ids */
96 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) { 238 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
@@ -114,16 +256,15 @@ void __init omap2_check_revision(void)
114 omap_ids[i].type >> 16); 256 omap_ids[i].type >> 16);
115 j = i; 257 j = i;
116 } 258 }
117 system_rev = omap_ids[j].type;
118 259
119 system_rev |= rev << 8; 260 _set_system_rev(omap_ids[j].type, rev);
120 261
121 /* Add the cpu class info (24xx) */ 262 _set_omap_chip();
122 system_rev |= 0x24;
123 263
124 pr_info("OMAP%04x", system_rev >> 16); 264 pr_info("OMAP%04x", system_rev >> 16);
125 if ((system_rev >> 8) & 0x0f) 265 if ((system_rev >> 8) & 0x0f)
126 printk("%x", (system_rev >> 8) & 0x0f); 266 pr_info("ES%x", (system_rev >> 12) & 0xf);
127 printk("\n"); 267 pr_info("\n");
268
128} 269}
129 270
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
new file mode 100644
index 000000000000..17cf199d1130
--- /dev/null
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -0,0 +1,208 @@
1/*
2 * linux/arch/arm/mach-omap2/mcbsp.c
3 *
4 * Copyright (C) 2008 Instituto Nokia de Tecnologia
5 * Contact: Eduardo Valentin <eduardo.valentin@indt.org.br>
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 * Multichannel mode not supported.
12 */
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/platform_device.h>
19
20#include <asm/arch/dma.h>
21#include <asm/arch/mux.h>
22#include <asm/arch/cpu.h>
23#include <asm/arch/mcbsp.h>
24
25struct mcbsp_internal_clk {
26 struct clk clk;
27 struct clk **childs;
28 int n_childs;
29};
30
31#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
32static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
33{
34 const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" };
35 int i;
36
37 mclk->n_childs = ARRAY_SIZE(clk_names);
38 mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
39 GFP_KERNEL);
40
41 for (i = 0; i < mclk->n_childs; i++) {
42 /* We fake a platform device to get correct device id */
43 struct platform_device pdev;
44
45 pdev.dev.bus = &platform_bus_type;
46 pdev.id = mclk->clk.id;
47 mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
48 if (IS_ERR(mclk->childs[i]))
49 printk(KERN_ERR "Could not get clock %s (%d).\n",
50 clk_names[i], mclk->clk.id);
51 }
52}
53
54static int omap_mcbsp_clk_enable(struct clk *clk)
55{
56 struct mcbsp_internal_clk *mclk = container_of(clk,
57 struct mcbsp_internal_clk, clk);
58 int i;
59
60 for (i = 0; i < mclk->n_childs; i++)
61 clk_enable(mclk->childs[i]);
62 return 0;
63}
64
65static void omap_mcbsp_clk_disable(struct clk *clk)
66{
67 struct mcbsp_internal_clk *mclk = container_of(clk,
68 struct mcbsp_internal_clk, clk);
69 int i;
70
71 for (i = 0; i < mclk->n_childs; i++)
72 clk_disable(mclk->childs[i]);
73}
74
75static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
76 {
77 .clk = {
78 .name = "mcbsp_clk",
79 .id = 1,
80 .enable = omap_mcbsp_clk_enable,
81 .disable = omap_mcbsp_clk_disable,
82 },
83 },
84 {
85 .clk = {
86 .name = "mcbsp_clk",
87 .id = 2,
88 .enable = omap_mcbsp_clk_enable,
89 .disable = omap_mcbsp_clk_disable,
90 },
91 },
92};
93
94#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks)
95#else
96#define omap_mcbsp_clks_size 0
97static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
98static inline void omap_mcbsp_clk_init(struct clk *clk)
99{ }
100#endif
101
102static void omap2_mcbsp2_mux_setup(void)
103{
104 omap_cfg_reg(Y15_24XX_MCBSP2_CLKX);
105 omap_cfg_reg(R14_24XX_MCBSP2_FSX);
106 omap_cfg_reg(W15_24XX_MCBSP2_DR);
107 omap_cfg_reg(V15_24XX_MCBSP2_DX);
108 omap_cfg_reg(V14_24XX_GPIO117);
109 /*
110 * TODO: Need to add MUX settings for OMAP 2430 SDP
111 */
112}
113
114static void omap2_mcbsp_request(unsigned int id)
115{
116 if (cpu_is_omap2420() && (id == OMAP_MCBSP2))
117 omap2_mcbsp2_mux_setup();
118}
119
120static int omap2_mcbsp_check(unsigned int id)
121{
122 if (id > OMAP_MAX_MCBSP_COUNT - 1) {
123 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1);
124 return -ENODEV;
125 }
126 return 0;
127}
128
129static struct omap_mcbsp_ops omap2_mcbsp_ops = {
130 .request = omap2_mcbsp_request,
131 .check = omap2_mcbsp_check,
132};
133
134#ifdef CONFIG_ARCH_OMAP24XX
135static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = {
136 {
137 .virt_base = IO_ADDRESS(OMAP24XX_MCBSP1_BASE),
138 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
139 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
140 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
141 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
142 .ops = &omap2_mcbsp_ops,
143 .clk_name = "mcbsp_clk",
144 },
145 {
146 .virt_base = IO_ADDRESS(OMAP24XX_MCBSP2_BASE),
147 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
148 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
149 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
150 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
151 .ops = &omap2_mcbsp_ops,
152 .clk_name = "mcbsp_clk",
153 },
154};
155#define OMAP24XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap24xx_mcbsp_pdata)
156#else
157#define omap24xx_mcbsp_pdata NULL
158#define OMAP24XX_MCBSP_PDATA_SZ 0
159#endif
160
161#ifdef CONFIG_ARCH_OMAP34XX
162static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
163 {
164 .virt_base = IO_ADDRESS(OMAP34XX_MCBSP1_BASE),
165 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
166 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
167 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
168 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
169 .ops = &omap2_mcbsp_ops,
170 .clk_name = "mcbsp_clk",
171 },
172 {
173 .virt_base = IO_ADDRESS(OMAP34XX_MCBSP2_BASE),
174 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
175 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
176 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
177 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
178 .ops = &omap2_mcbsp_ops,
179 .clk_name = "mcbsp_clk",
180 },
181};
182#define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata)
183#else
184#define omap34xx_mcbsp_pdata NULL
185#define OMAP34XX_MCBSP_PDATA_SZ 0
186#endif
187
188int __init omap2_mcbsp_init(void)
189{
190 int i;
191
192 for (i = 0; i < omap_mcbsp_clks_size; i++) {
193 /* Once we call clk_get inside init, we do not register it */
194 omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
195 clk_register(&omap_mcbsp_clks[i].clk);
196 }
197
198 if (cpu_is_omap24xx())
199 omap_mcbsp_register_board_cfg(omap24xx_mcbsp_pdata,
200 OMAP24XX_MCBSP_PDATA_SZ);
201
202 if (cpu_is_omap34xx())
203 omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata,
204 OMAP34XX_MCBSP_PDATA_SZ);
205
206 return omap_mcbsp_init();
207}
208arch_initcall(omap2_mcbsp_init);
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c
index 12479081881a..73cadb2c75cf 100644
--- a/arch/arm/mach-omap2/memory.c
+++ b/arch/arm/mach-omap2/memory.c
@@ -24,6 +24,7 @@
24 24
25#include <asm/io.h> 25#include <asm/io.h>
26 26
27#include <asm/arch/common.h>
27#include <asm/arch/clock.h> 28#include <asm/arch/clock.h>
28#include <asm/arch/sram.h> 29#include <asm/arch/sram.h>
29 30
@@ -32,8 +33,8 @@
32#include "memory.h" 33#include "memory.h"
33#include "sdrc.h" 34#include "sdrc.h"
34 35
35unsigned long omap2_sdrc_base; 36void __iomem *omap2_sdrc_base;
36unsigned long omap2_sms_base; 37void __iomem *omap2_sms_base;
37 38
38static struct memory_timings mem_timings; 39static struct memory_timings mem_timings;
39static u32 curr_perf_level = CORE_CLK_SRC_DPLL_X2; 40static u32 curr_perf_level = CORE_CLK_SRC_DPLL_X2;
@@ -154,6 +155,12 @@ void omap2_init_memory_params(u32 force_lock_to_unlock_mode)
154 mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8)); 155 mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8));
155} 156}
156 157
158void __init omap2_set_globals_memory(struct omap_globals *omap2_globals)
159{
160 omap2_sdrc_base = omap2_globals->sdrc;
161 omap2_sms_base = omap2_globals->sms;
162}
163
157/* turn on smart idle modes for SDRAM scheduler and controller */ 164/* turn on smart idle modes for SDRAM scheduler and controller */
158void __init omap2_init_memory(void) 165void __init omap2_init_memory(void)
159{ 166{
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 930770012a75..8f98b20f30a1 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -236,7 +236,7 @@ void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u8 reg)
236 warn = (orig != reg); 236 warn = (orig != reg);
237 if (debug || warn) 237 if (debug || warn)
238 printk(KERN_WARNING 238 printk(KERN_WARNING
239 "MUX: setup %s (0x%08x): 0x%02x -> 0x%02x\n", 239 "MUX: setup %s (0x%p): 0x%04x -> 0x%04x\n",
240 cfg->name, omap_ctrl_base_get() + cfg->mux_reg, 240 cfg->name, omap_ctrl_base_get() + cfg->mux_reg,
241 orig, reg); 241 orig, reg);
242} 242}
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index aad781dcf1b1..d6c9de82ca0c 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -57,13 +57,6 @@ void omap2_pm_idle(void)
57 return; 57 return;
58 } 58 }
59 59
60 /*
61 * Since an interrupt may set up a timer, we don't want to
62 * reprogram the hardware timer with interrupts enabled.
63 * Re-enable interrupts only after returning from idle.
64 */
65 timer_dyn_reprogram();
66
67 omap2_sram_idle(); 60 omap2_sram_idle();
68 local_fiq_enable(); 61 local_fiq_enable();
69 local_irq_enable(); 62 local_irq_enable();
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index cacb34086e35..54c32f482131 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -32,6 +32,7 @@
32 32
33 33
34/* Chip-specific module offsets */ 34/* Chip-specific module offsets */
35#define OMAP24XX_GR_MOD OCP_MOD
35#define OMAP24XX_DSP_MOD 0x800 36#define OMAP24XX_DSP_MOD 0x800
36 37
37#define OMAP2430_MDM_MOD 0xc00 38#define OMAP2430_MDM_MOD 0xc00
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index b12f423b8595..fd92a80f38f2 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -16,16 +16,21 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/io.h>
19 20
20#include <asm/io.h> 21#include <asm/arch/common.h>
22#include <asm/arch/prcm.h>
21 23
24#include "clock.h"
22#include "prm.h" 25#include "prm.h"
23#include "prm-regbits-24xx.h" 26#include "prm-regbits-24xx.h"
24 27
25extern void omap2_clk_prepare_for_reboot(void); 28static void __iomem *prm_base;
29static void __iomem *cm_base;
26 30
27u32 omap_prcm_get_reset_sources(void) 31u32 omap_prcm_get_reset_sources(void)
28{ 32{
33 /* XXX This presumably needs modification for 34XX */
29 return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f; 34 return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f;
30} 35}
31EXPORT_SYMBOL(omap_prcm_get_reset_sources); 36EXPORT_SYMBOL(omap_prcm_get_reset_sources);
@@ -33,11 +38,90 @@ EXPORT_SYMBOL(omap_prcm_get_reset_sources);
33/* Resets clock rates and reboots the system. Only called from system.h */ 38/* Resets clock rates and reboots the system. Only called from system.h */
34void omap_prcm_arch_reset(char mode) 39void omap_prcm_arch_reset(char mode)
35{ 40{
36 u32 wkup; 41 s16 prcm_offs;
37 omap2_clk_prepare_for_reboot(); 42 omap2_clk_prepare_for_reboot();
38 43
39 if (cpu_is_omap24xx()) { 44 if (cpu_is_omap24xx())
40 wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3; 45 prcm_offs = WKUP_MOD;
41 prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL); 46 else if (cpu_is_omap34xx())
42 } 47 prcm_offs = OMAP3430_GR_MOD;
48 else
49 WARN_ON(1);
50
51 prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL);
52}
53
54static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg)
55{
56 BUG_ON(!base);
57 return __raw_readl(base + module + reg);
58}
59
60static inline void __omap_prcm_write(u32 value, void __iomem *base,
61 s16 module, u16 reg)
62{
63 BUG_ON(!base);
64 __raw_writel(value, base + module + reg);
65}
66
67/* Read a register in a PRM module */
68u32 prm_read_mod_reg(s16 module, u16 idx)
69{
70 return __omap_prcm_read(prm_base, module, idx);
71}
72EXPORT_SYMBOL(prm_read_mod_reg);
73
74/* Write into a register in a PRM module */
75void prm_write_mod_reg(u32 val, s16 module, u16 idx)
76{
77 __omap_prcm_write(val, prm_base, module, idx);
78}
79EXPORT_SYMBOL(prm_write_mod_reg);
80
81/* Read-modify-write a register in a PRM module. Caller must lock */
82u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
83{
84 u32 v;
85
86 v = prm_read_mod_reg(module, idx);
87 v &= ~mask;
88 v |= bits;
89 prm_write_mod_reg(v, module, idx);
90
91 return v;
92}
93EXPORT_SYMBOL(prm_rmw_mod_reg_bits);
94
95/* Read a register in a CM module */
96u32 cm_read_mod_reg(s16 module, u16 idx)
97{
98 return __omap_prcm_read(cm_base, module, idx);
99}
100EXPORT_SYMBOL(cm_read_mod_reg);
101
102/* Write into a register in a CM module */
103void cm_write_mod_reg(u32 val, s16 module, u16 idx)
104{
105 __omap_prcm_write(val, cm_base, module, idx);
106}
107EXPORT_SYMBOL(cm_write_mod_reg);
108
109/* Read-modify-write a register in a CM module. Caller must lock */
110u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
111{
112 u32 v;
113
114 v = cm_read_mod_reg(module, idx);
115 v &= ~mask;
116 v |= bits;
117 cm_write_mod_reg(v, module, idx);
118
119 return v;
120}
121EXPORT_SYMBOL(cm_rmw_mod_reg_bits);
122
123void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
124{
125 prm_base = omap2_globals->prm;
126 cm_base = omap2_globals->cm;
43} 127}
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 618f8111658a..bbf41fc8e9a9 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -38,13 +38,29 @@
38 * 38 *
39 */ 39 */
40 40
41/* Global 24xx registers in GR_MOD (Same as OCP_MOD for 24xx) */
42#define OMAP24XX_PRCM_VOLTCTRL_OFFSET 0x0050
43#define OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET 0x0080
44
45/* 242x GR_MOD registers, use these only for assembly code */
46#define OMAP242X_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OMAP24XX_GR_MOD, \
47 OMAP24XX_PRCM_VOLTCTRL_OFFSET)
48#define OMAP242X_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OMAP24XX_GR_MOD, \
49 OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET)
50
51/* 243x GR_MOD registers, use these only for assembly code */
52#define OMAP243X_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OMAP24XX_GR_MOD, \
53 OMAP24XX_PRCM_VOLTCTRL_OFFSET)
54#define OMAP243X_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OMAP24XX_GR_MOD, \
55 OMAP24XX_PRCM_CLKCFG_CTRL_OFFSET)
56
57/* These will disappear */
41#define OMAP24XX_PRCM_REVISION OMAP_PRM_REGADDR(OCP_MOD, 0x0000) 58#define OMAP24XX_PRCM_REVISION OMAP_PRM_REGADDR(OCP_MOD, 0x0000)
42#define OMAP24XX_PRCM_SYSCONFIG OMAP_PRM_REGADDR(OCP_MOD, 0x0010) 59#define OMAP24XX_PRCM_SYSCONFIG OMAP_PRM_REGADDR(OCP_MOD, 0x0010)
43 60
44#define OMAP24XX_PRCM_IRQSTATUS_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x0018) 61#define OMAP24XX_PRCM_IRQSTATUS_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x0018)
45#define OMAP24XX_PRCM_IRQENABLE_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x001c) 62#define OMAP24XX_PRCM_IRQENABLE_MPU OMAP_PRM_REGADDR(OCP_MOD, 0x001c)
46 63
47#define OMAP24XX_PRCM_VOLTCTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0050)
48#define OMAP24XX_PRCM_VOLTST OMAP_PRM_REGADDR(OCP_MOD, 0x0054) 64#define OMAP24XX_PRCM_VOLTST OMAP_PRM_REGADDR(OCP_MOD, 0x0054)
49#define OMAP24XX_PRCM_CLKSRC_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0060) 65#define OMAP24XX_PRCM_CLKSRC_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0060)
50#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0070) 66#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP_PRM_REGADDR(OCP_MOD, 0x0070)
@@ -150,15 +166,19 @@
150#ifndef __ASSEMBLER__ 166#ifndef __ASSEMBLER__
151 167
152/* Power/reset management domain register get/set */ 168/* Power/reset management domain register get/set */
169extern u32 prm_read_mod_reg(s16 module, u16 idx);
170extern void prm_write_mod_reg(u32 val, s16 module, u16 idx);
171extern u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
153 172
154static inline void prm_write_mod_reg(u32 val, s16 module, s16 idx) 173/* Read-modify-write bits in a PRM register (by domain) */
174static inline u32 prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
155{ 175{
156 __raw_writel(val, OMAP_PRM_REGADDR(module, idx)); 176 return prm_rmw_mod_reg_bits(bits, bits, module, idx);
157} 177}
158 178
159static inline u32 prm_read_mod_reg(s16 module, s16 idx) 179static inline u32 prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
160{ 180{
161 return __raw_readl(OMAP_PRM_REGADDR(module, idx)); 181 return prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
162} 182}
163 183
164#endif 184#endif
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index d7f23bc9550a..1b1fe4f6e030 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -18,13 +18,11 @@
18#include <asm/arch/sdrc.h> 18#include <asm/arch/sdrc.h>
19 19
20#ifndef __ASSEMBLER__ 20#ifndef __ASSEMBLER__
21extern unsigned long omap2_sdrc_base; 21extern void __iomem *omap2_sdrc_base;
22extern unsigned long omap2_sms_base; 22extern void __iomem *omap2_sms_base;
23 23
24#define OMAP_SDRC_REGADDR(reg) \ 24#define OMAP_SDRC_REGADDR(reg) (omap2_sdrc_base + (reg))
25 (void __iomem *)IO_ADDRESS(omap2_sdrc_base + (reg)) 25#define OMAP_SMS_REGADDR(reg) (omap2_sms_base + (reg))
26#define OMAP_SMS_REGADDR(reg) \
27 (void __iomem *)IO_ADDRESS(omap2_sms_base + (reg))
28 26
29/* SDRC global register get/set */ 27/* SDRC global register get/set */
30 28
diff --git a/arch/arm/mach-omap2/sram-fn.S b/arch/arm/mach-omap2/sram242x.S
index 4a9e49140716..4c274510f3e9 100644
--- a/arch/arm/mach-omap2/sram-fn.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/sram-fn.S 2 * linux/arch/arm/mach-omap2/sram242x.S
3 * 3 *
4 * Omap2 specific functions that need to be run in internal SRAM 4 * Omap2 specific functions that need to be run in internal SRAM
5 * 5 *
@@ -27,22 +27,20 @@
27#include <asm/arch/io.h> 27#include <asm/arch/io.h>
28#include <asm/hardware.h> 28#include <asm/hardware.h>
29 29
30#include "sdrc.h"
31#include "prm.h" 30#include "prm.h"
32#include "cm.h" 31#include "cm.h"
33 32#include "sdrc.h"
34#define TIMER_32KSYNCT_CR_V IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010)
35 33
36 .text 34 .text
37 35
38ENTRY(sram_ddr_init) 36ENTRY(omap242x_sram_ddr_init)
39 stmfd sp!, {r0 - r12, lr} @ save registers on stack 37 stmfd sp!, {r0 - r12, lr} @ save registers on stack
40 38
41 mov r12, r2 @ capture CS1 vs CS0 39 mov r12, r2 @ capture CS1 vs CS0
42 mov r8, r3 @ capture force parameter 40 mov r8, r3 @ capture force parameter
43 41
44 /* frequency shift down */ 42 /* frequency shift down */
45 ldr r2, cm_clksel2_pll @ get address of dpllout reg 43 ldr r2, omap242x_sdi_cm_clksel2_pll @ get address of dpllout reg
46 mov r3, #0x1 @ value for 1x operation 44 mov r3, #0x1 @ value for 1x operation
47 str r3, [r2] @ go to L1-freq operation 45 str r3, [r2] @ go to L1-freq operation
48 46
@@ -51,7 +49,7 @@ ENTRY(sram_ddr_init)
51 bl voltage_shift @ go drop voltage 49 bl voltage_shift @ go drop voltage
52 50
53 /* dll lock mode */ 51 /* dll lock mode */
54 ldr r11, sdrc_dlla_ctrl @ addr of dlla ctrl 52 ldr r11, omap242x_sdi_sdrc_dlla_ctrl @ addr of dlla ctrl
55 ldr r10, [r11] @ get current val 53 ldr r10, [r11] @ get current val
56 cmp r12, #0x1 @ cs1 base (2422 es2.05/1) 54 cmp r12, #0x1 @ cs1 base (2422 es2.05/1)
57 addeq r11, r11, #0x8 @ if cs1 base, move to DLLB 55 addeq r11, r11, #0x8 @ if cs1 base, move to DLLB
@@ -102,7 +100,7 @@ i_dll_delay:
102 * wait for it to finish, use 32k sync counter, 1tick=31uS. 100 * wait for it to finish, use 32k sync counter, 1tick=31uS.
103 */ 101 */
104voltage_shift: 102voltage_shift:
105 ldr r4, prcm_voltctrl @ get addr of volt ctrl. 103 ldr r4, omap242x_sdi_prcm_voltctrl @ get addr of volt ctrl.
106 ldr r5, [r4] @ get value. 104 ldr r5, [r4] @ get value.
107 ldr r6, prcm_mask_val @ get value of mask 105 ldr r6, prcm_mask_val @ get value of mask
108 and r5, r5, r6 @ apply mask to clear bits 106 and r5, r5, r6 @ apply mask to clear bits
@@ -112,7 +110,7 @@ voltage_shift:
112 orr r5, r5, r3 @ build value for force 110 orr r5, r5, r3 @ build value for force
113 str r5, [r4] @ Force transition to L1 111 str r5, [r4] @ Force transition to L1
114 112
115 ldr r3, timer_32ksynct_cr @ get addr of counter 113 ldr r3, omap242x_sdi_timer_32ksynct_cr @ get addr of counter
116 ldr r5, [r3] @ get value 114 ldr r5, [r3] @ get value
117 add r5, r5, #0x3 @ give it at most 93uS 115 add r5, r5, #0x3 @ give it at most 93uS
118volt_delay: 116volt_delay:
@@ -121,32 +119,31 @@ volt_delay:
121 bhi volt_delay @ not yet->branch 119 bhi volt_delay @ not yet->branch
122 mov pc, lr @ back to caller. 120 mov pc, lr @ back to caller.
123 121
124/* relative load constants */ 122omap242x_sdi_cm_clksel2_pll:
125cm_clksel2_pll:
126 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2) 123 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
127sdrc_dlla_ctrl: 124omap242x_sdi_sdrc_dlla_ctrl:
128 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) 125 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL)
129prcm_voltctrl: 126omap242x_sdi_prcm_voltctrl:
130 .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x50) 127 .word OMAP242X_PRCM_VOLTCTRL
131prcm_mask_val: 128prcm_mask_val:
132 .word 0xFFFF3FFC 129 .word 0xFFFF3FFC
133timer_32ksynct_cr: 130omap242x_sdi_timer_32ksynct_cr:
134 .word TIMER_32KSYNCT_CR_V 131 .word IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010)
135ENTRY(sram_ddr_init_sz) 132ENTRY(omap242x_sram_ddr_init_sz)
136 .word . - sram_ddr_init 133 .word . - omap242x_sram_ddr_init
137 134
138/* 135/*
139 * Reprograms memory timings. 136 * Reprograms memory timings.
140 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR] 137 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR]
141 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0 138 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0
142 */ 139 */
143ENTRY(sram_reprogram_sdrc) 140ENTRY(omap242x_sram_reprogram_sdrc)
144 stmfd sp!, {r0 - r10, lr} @ save registers on stack 141 stmfd sp!, {r0 - r10, lr} @ save registers on stack
145 mov r3, #0x0 @ clear for mrc call 142 mov r3, #0x0 @ clear for mrc call
146 mcr p15, 0, r3, c7, c10, 4 @ memory barrier, finish ARM SDR/DDR 143 mcr p15, 0, r3, c7, c10, 4 @ memory barrier, finish ARM SDR/DDR
147 nop 144 nop
148 nop 145 nop
149 ldr r6, ddr_sdrc_rfr_ctrl @ get addr of refresh reg 146 ldr r6, omap242x_srs_sdrc_rfr_ctrl @ get addr of refresh reg
150 ldr r5, [r6] @ get value 147 ldr r5, [r6] @ get value
151 mov r5, r5, lsr #8 @ isolate rfr field and drop burst 148 mov r5, r5, lsr #8 @ isolate rfr field and drop burst
152 149
@@ -160,7 +157,7 @@ ENTRY(sram_reprogram_sdrc)
160 movne r5, r5, lsl #1 @ mult by 2 if to full 157 movne r5, r5, lsl #1 @ mult by 2 if to full
161 mov r5, r5, lsl #8 @ put rfr field back into place 158 mov r5, r5, lsl #8 @ put rfr field back into place
162 add r5, r5, #0x1 @ turn on burst of 1 159 add r5, r5, #0x1 @ turn on burst of 1
163 ldr r4, ddr_cm_clksel2_pll @ get address of out reg 160 ldr r4, omap242x_srs_cm_clksel2_pll @ get address of out reg
164 ldr r3, [r4] @ get curr value 161 ldr r3, [r4] @ get curr value
165 orr r3, r3, #0x3 162 orr r3, r3, #0x3
166 bic r3, r3, #0x3 @ clear lower bits 163 bic r3, r3, #0x3 @ clear lower bits
@@ -181,7 +178,7 @@ ENTRY(sram_reprogram_sdrc)
181 bne freq_out @ leave if SDR, no DLL function 178 bne freq_out @ leave if SDR, no DLL function
182 179
183 /* With DDR, we need to take care of the DLL for the frequency change */ 180 /* With DDR, we need to take care of the DLL for the frequency change */
184 ldr r2, ddr_sdrc_dlla_ctrl @ addr of dlla ctrl 181 ldr r2, omap242x_srs_sdrc_dlla_ctrl @ addr of dlla ctrl
185 str r1, [r2] @ write out new SDRC_DLLA_CTRL 182 str r1, [r2] @ write out new SDRC_DLLA_CTRL
186 add r2, r2, #0x8 @ addr to SDRC_DLLB_CTRL 183 add r2, r2, #0x8 @ addr to SDRC_DLLB_CTRL
187 str r1, [r2] @ commit to SDRC_DLLB_CTRL 184 str r1, [r2] @ commit to SDRC_DLLB_CTRL
@@ -197,7 +194,7 @@ freq_out:
197 * wait for it to finish, use 32k sync counter, 1tick=31uS. 194 * wait for it to finish, use 32k sync counter, 1tick=31uS.
198 */ 195 */
199voltage_shift_c: 196voltage_shift_c:
200 ldr r10, ddr_prcm_voltctrl @ get addr of volt ctrl 197 ldr r10, omap242x_srs_prcm_voltctrl @ get addr of volt ctrl
201 ldr r8, [r10] @ get value 198 ldr r8, [r10] @ get value
202 ldr r7, ddr_prcm_mask_val @ get value of mask 199 ldr r7, ddr_prcm_mask_val @ get value of mask
203 and r8, r8, r7 @ apply mask to clear bits 200 and r8, r8, r7 @ apply mask to clear bits
@@ -207,7 +204,7 @@ voltage_shift_c:
207 orr r8, r8, r7 @ build value for force 204 orr r8, r8, r7 @ build value for force
208 str r8, [r10] @ Force transition to L1 205 str r8, [r10] @ Force transition to L1
209 206
210 ldr r10, ddr_timer_32ksynct @ get addr of counter 207 ldr r10, omap242x_srs_timer_32ksynct @ get addr of counter
211 ldr r8, [r10] @ get value 208 ldr r8, [r10] @ get value
212 add r8, r8, #0x2 @ give it at most 62uS (min 31+) 209 add r8, r8, #0x2 @ give it at most 62uS (min 31+)
213volt_delay_c: 210volt_delay_c:
@@ -216,39 +213,39 @@ volt_delay_c:
216 bhi volt_delay_c @ not yet->branch 213 bhi volt_delay_c @ not yet->branch
217 mov pc, lr @ back to caller 214 mov pc, lr @ back to caller
218 215
219ddr_cm_clksel2_pll: 216omap242x_srs_cm_clksel2_pll:
220 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2) 217 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
221ddr_sdrc_dlla_ctrl: 218omap242x_srs_sdrc_dlla_ctrl:
222 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) 219 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL)
223ddr_sdrc_rfr_ctrl: 220omap242x_srs_sdrc_rfr_ctrl:
224 .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0) 221 .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0)
225ddr_prcm_voltctrl: 222omap242x_srs_prcm_voltctrl:
226 .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x50) 223 .word OMAP242X_PRCM_VOLTCTRL
227ddr_prcm_mask_val: 224ddr_prcm_mask_val:
228 .word 0xFFFF3FFC 225 .word 0xFFFF3FFC
229ddr_timer_32ksynct: 226omap242x_srs_timer_32ksynct:
230 .word TIMER_32KSYNCT_CR_V 227 .word IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010)
231 228
232ENTRY(sram_reprogram_sdrc_sz) 229ENTRY(omap242x_sram_reprogram_sdrc_sz)
233 .word . - sram_reprogram_sdrc 230 .word . - omap242x_sram_reprogram_sdrc
234 231
235/* 232/*
236 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode. 233 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode.
237 */ 234 */
238ENTRY(sram_set_prcm) 235ENTRY(omap242x_sram_set_prcm)
239 stmfd sp!, {r0-r12, lr} @ regs to stack 236 stmfd sp!, {r0-r12, lr} @ regs to stack
240 adr r4, pbegin @ addr of preload start 237 adr r4, pbegin @ addr of preload start
241 adr r8, pend @ addr of preload end 238 adr r8, pend @ addr of preload end
242 mcrr p15, 1, r8, r4, c12 @ preload into icache 239 mcrr p15, 1, r8, r4, c12 @ preload into icache
243pbegin: 240pbegin:
244 /* move into fast relock bypass */ 241 /* move into fast relock bypass */
245 ldr r8, pll_ctl @ get addr 242 ldr r8, omap242x_ssp_pll_ctl @ get addr
246 ldr r5, [r8] @ get val 243 ldr r5, [r8] @ get val
247 mvn r6, #0x3 @ clear mask 244 mvn r6, #0x3 @ clear mask
248 and r5, r5, r6 @ clear field 245 and r5, r5, r6 @ clear field
249 orr r7, r5, #0x2 @ fast relock val 246 orr r7, r5, #0x2 @ fast relock val
250 str r7, [r8] @ go to fast relock 247 str r7, [r8] @ go to fast relock
251 ldr r4, pll_stat @ addr of stat 248 ldr r4, omap242x_ssp_pll_stat @ addr of stat
252block: 249block:
253 /* wait for bypass */ 250 /* wait for bypass */
254 ldr r8, [r4] @ stat value 251 ldr r8, [r4] @ stat value
@@ -257,10 +254,10 @@ block:
257 bne block @ loop if not 254 bne block @ loop if not
258 255
259 /* set new dpll dividers _after_ in bypass */ 256 /* set new dpll dividers _after_ in bypass */
260 ldr r4, pll_div @ get addr 257 ldr r4, omap242x_ssp_pll_div @ get addr
261 str r0, [r4] @ set dpll ctrl val 258 str r0, [r4] @ set dpll ctrl val
262 259
263 ldr r4, set_config @ get addr 260 ldr r4, omap242x_ssp_set_config @ get addr
264 mov r8, #1 @ valid cfg msk 261 mov r8, #1 @ valid cfg msk
265 str r8, [r4] @ make dividers take 262 str r8, [r4] @ make dividers take
266 263
@@ -274,8 +271,8 @@ wait_a_bit:
274 beq pend @ jump over dpll relock 271 beq pend @ jump over dpll relock
275 272
276 /* relock DPLL with new vals */ 273 /* relock DPLL with new vals */
277 ldr r5, pll_stat @ get addr 274 ldr r5, omap242x_ssp_pll_stat @ get addr
278 ldr r4, pll_ctl @ get addr 275 ldr r4, omap242x_ssp_pll_ctl @ get addr
279 orr r8, r7, #0x3 @ val for lock dpll 276 orr r8, r7, #0x3 @ val for lock dpll
280 str r8, [r4] @ set val 277 str r8, [r4] @ set val
281 mov r0, #1000 @ dead spin a bit 278 mov r0, #1000 @ dead spin a bit
@@ -289,9 +286,9 @@ wait_lock:
289 bne wait_lock @ wait if not 286 bne wait_lock @ wait if not
290pend: 287pend:
291 /* update memory timings & briefly lock dll */ 288 /* update memory timings & briefly lock dll */
292 ldr r4, sdrc_rfr @ get addr 289 ldr r4, omap242x_ssp_sdrc_rfr @ get addr
293 str r1, [r4] @ update refresh timing 290 str r1, [r4] @ update refresh timing
294 ldr r11, dlla_ctrl @ get addr of DLLA ctrl 291 ldr r11, omap242x_ssp_dlla_ctrl @ get addr of DLLA ctrl
295 ldr r10, [r11] @ get current val 292 ldr r10, [r11] @ get current val
296 mvn r9, #0x4 @ mask to get clear bit2 293 mvn r9, #0x4 @ mask to get clear bit2
297 and r10, r10, r9 @ clear bit2 for lock mode 294 and r10, r10, r9 @ clear bit2 for lock mode
@@ -307,18 +304,18 @@ wait_dll_lock:
307 nop 304 nop
308 ldmfd sp!, {r0-r12, pc} @ restore regs and return 305 ldmfd sp!, {r0-r12, pc} @ restore regs and return
309 306
310set_config: 307omap242x_ssp_set_config:
311 .word OMAP2420_PRM_REGADDR(OCP_MOD, 0x80) 308 .word OMAP242X_PRCM_CLKCFG_CTRL
312pll_ctl: 309omap242x_ssp_pll_ctl:
313 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_FCLKEN1) 310 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKEN)
314pll_stat: 311omap242x_ssp_pll_stat:
315 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_IDLEST1) 312 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_IDLEST)
316pll_div: 313omap242x_ssp_pll_div:
317 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL) 314 .word OMAP2420_CM_REGADDR(PLL_MOD, CM_CLKSEL1)
318sdrc_rfr: 315omap242x_ssp_sdrc_rfr:
319 .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0) 316 .word OMAP242X_SDRC_REGADDR(SDRC_RFR_CTRL_0)
320dlla_ctrl: 317omap242x_ssp_dlla_ctrl:
321 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL) 318 .word OMAP242X_SDRC_REGADDR(SDRC_DLLA_CTRL)
322 319
323ENTRY(sram_set_prcm_sz) 320ENTRY(omap242x_sram_set_prcm_sz)
324 .word . - sram_set_prcm 321 .word . - omap242x_sram_set_prcm
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
new file mode 100644
index 000000000000..a3fa48dc08cd
--- /dev/null
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -0,0 +1,321 @@
1/*
2 * linux/arch/arm/mach-omap2/sram243x.S
3 *
4 * Omap2 specific functions that need to be run in internal SRAM
5 *
6 * (C) Copyright 2004
7 * Texas Instruments, <www.ti.com>
8 * Richard Woodruff <r-woodruff2@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25#include <linux/linkage.h>
26#include <asm/assembler.h>
27#include <asm/arch/io.h>
28#include <asm/hardware.h>
29
30#include "prm.h"
31#include "cm.h"
32#include "sdrc.h"
33
34 .text
35
36ENTRY(omap243x_sram_ddr_init)
37 stmfd sp!, {r0 - r12, lr} @ save registers on stack
38
39 mov r12, r2 @ capture CS1 vs CS0
40 mov r8, r3 @ capture force parameter
41
42 /* frequency shift down */
43 ldr r2, omap243x_sdi_cm_clksel2_pll @ get address of dpllout reg
44 mov r3, #0x1 @ value for 1x operation
45 str r3, [r2] @ go to L1-freq operation
46
47 /* voltage shift down */
48 mov r9, #0x1 @ set up for L1 voltage call
49 bl voltage_shift @ go drop voltage
50
51 /* dll lock mode */
52 ldr r11, omap243x_sdi_sdrc_dlla_ctrl @ addr of dlla ctrl
53 ldr r10, [r11] @ get current val
54 cmp r12, #0x1 @ cs1 base (2422 es2.05/1)
55 addeq r11, r11, #0x8 @ if cs1 base, move to DLLB
56 mvn r9, #0x4 @ mask to get clear bit2
57 and r10, r10, r9 @ clear bit2 for lock mode.
58 orr r10, r10, #0x8 @ make sure DLL on (es2 bit pos)
59 orr r10, r10, #0x2 @ 90 degree phase for all below 133Mhz
60 str r10, [r11] @ commit to DLLA_CTRL
61 bl i_dll_wait @ wait for dll to lock
62
63 /* get dll value */
64 add r11, r11, #0x4 @ get addr of status reg
65 ldr r10, [r11] @ get locked value
66
67 /* voltage shift up */
68 mov r9, #0x0 @ shift back to L0-voltage
69 bl voltage_shift @ go raise voltage
70
71 /* frequency shift up */
72 mov r3, #0x2 @ value for 2x operation
73 str r3, [r2] @ go to L0-freq operation
74
75 /* reset entry mode for dllctrl */
76 sub r11, r11, #0x4 @ move from status to ctrl
77 cmp r12, #0x1 @ normalize if cs1 based
78 subeq r11, r11, #0x8 @ possibly back to DLLA
79 cmp r8, #0x1 @ if forced unlock exit
80 orreq r1, r1, #0x4 @ make sure exit with unlocked value
81 str r1, [r11] @ restore DLLA_CTRL high value
82 add r11, r11, #0x8 @ move to DLLB_CTRL addr
83 str r1, [r11] @ set value DLLB_CTRL
84 bl i_dll_wait @ wait for possible lock
85
86 /* set up for return, DDR should be good */
87 str r10, [r0] @ write dll_status and return counter
88 ldmfd sp!, {r0 - r12, pc} @ restore regs and return
89
90 /* ensure the DLL has relocked */
91i_dll_wait:
92 mov r4, #0x800 @ delay DLL relock, min 0x400 L3 clocks
93i_dll_delay:
94 subs r4, r4, #0x1
95 bne i_dll_delay
96 mov pc, lr
97
98 /*
99 * shift up or down voltage, use R9 as input to tell level.
100 * wait for it to finish, use 32k sync counter, 1tick=31uS.
101 */
102voltage_shift:
103 ldr r4, omap243x_sdi_prcm_voltctrl @ get addr of volt ctrl.
104 ldr r5, [r4] @ get value.
105 ldr r6, prcm_mask_val @ get value of mask
106 and r5, r5, r6 @ apply mask to clear bits
107 orr r5, r5, r9 @ bulld value for L0/L1-volt operation.
108 str r5, [r4] @ set up for change.
109 mov r3, #0x4000 @ get val for force
110 orr r5, r5, r3 @ build value for force
111 str r5, [r4] @ Force transition to L1
112
113 ldr r3, omap243x_sdi_timer_32ksynct_cr @ get addr of counter
114 ldr r5, [r3] @ get value
115 add r5, r5, #0x3 @ give it at most 93uS
116volt_delay:
117 ldr r7, [r3] @ get timer value
118 cmp r5, r7 @ time up?
119 bhi volt_delay @ not yet->branch
120 mov pc, lr @ back to caller.
121
122omap243x_sdi_cm_clksel2_pll:
123 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
124omap243x_sdi_sdrc_dlla_ctrl:
125 .word OMAP243X_SDRC_REGADDR(SDRC_DLLA_CTRL)
126omap243x_sdi_prcm_voltctrl:
127 .word OMAP243X_PRCM_VOLTCTRL
128prcm_mask_val:
129 .word 0xFFFF3FFC
130omap243x_sdi_timer_32ksynct_cr:
131 .word IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010)
132ENTRY(omap243x_sram_ddr_init_sz)
133 .word . - omap243x_sram_ddr_init
134
135/*
136 * Reprograms memory timings.
137 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR]
138 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0
139 */
140ENTRY(omap243x_sram_reprogram_sdrc)
141 stmfd sp!, {r0 - r10, lr} @ save registers on stack
142 mov r3, #0x0 @ clear for mrc call
143 mcr p15, 0, r3, c7, c10, 4 @ memory barrier, finish ARM SDR/DDR
144 nop
145 nop
146 ldr r6, omap243x_srs_sdrc_rfr_ctrl @ get addr of refresh reg
147 ldr r5, [r6] @ get value
148 mov r5, r5, lsr #8 @ isolate rfr field and drop burst
149
150 cmp r0, #0x1 @ going to half speed?
151 movne r9, #0x0 @ if up set flag up for pre up, hi volt
152
153 blne voltage_shift_c @ adjust voltage
154
155 cmp r0, #0x1 @ going to half speed (post branch link)
156 moveq r5, r5, lsr #1 @ divide by 2 if to half
157 movne r5, r5, lsl #1 @ mult by 2 if to full
158 mov r5, r5, lsl #8 @ put rfr field back into place
159 add r5, r5, #0x1 @ turn on burst of 1
160 ldr r4, omap243x_srs_cm_clksel2_pll @ get address of out reg
161 ldr r3, [r4] @ get curr value
162 orr r3, r3, #0x3
163 bic r3, r3, #0x3 @ clear lower bits
164 orr r3, r3, r0 @ new state value
165 str r3, [r4] @ set new state (pll/x, x=1 or 2)
166 nop
167 nop
168
169 moveq r9, #0x1 @ if speed down, post down, drop volt
170 bleq voltage_shift_c
171
172 mcr p15, 0, r3, c7, c10, 4 @ memory barrier
173 str r5, [r6] @ set new RFR_1 value
174 add r6, r6, #0x30 @ get RFR_2 addr
175 str r5, [r6] @ set RFR_2
176 nop
177 cmp r2, #0x1 @ (SDR or DDR) do we need to adjust DLL
178 bne freq_out @ leave if SDR, no DLL function
179
180 /* With DDR, we need to take care of the DLL for the frequency change */
181 ldr r2, omap243x_srs_sdrc_dlla_ctrl @ addr of dlla ctrl
182 str r1, [r2] @ write out new SDRC_DLLA_CTRL
183 add r2, r2, #0x8 @ addr to SDRC_DLLB_CTRL
184 str r1, [r2] @ commit to SDRC_DLLB_CTRL
185 mov r1, #0x2000 @ wait DLL relock, min 0x400 L3 clocks
186dll_wait:
187 subs r1, r1, #0x1
188 bne dll_wait
189freq_out:
190 ldmfd sp!, {r0 - r10, pc} @ restore regs and return
191
192 /*
193 * shift up or down voltage, use R9 as input to tell level.
194 * wait for it to finish, use 32k sync counter, 1tick=31uS.
195 */
196voltage_shift_c:
197 ldr r10, omap243x_srs_prcm_voltctrl @ get addr of volt ctrl
198 ldr r8, [r10] @ get value
199 ldr r7, ddr_prcm_mask_val @ get value of mask
200 and r8, r8, r7 @ apply mask to clear bits
201 orr r8, r8, r9 @ bulld value for L0/L1-volt operation.
202 str r8, [r10] @ set up for change.
203 mov r7, #0x4000 @ get val for force
204 orr r8, r8, r7 @ build value for force
205 str r8, [r10] @ Force transition to L1
206
207 ldr r10, omap243x_srs_timer_32ksynct @ get addr of counter
208 ldr r8, [r10] @ get value
209 add r8, r8, #0x2 @ give it at most 62uS (min 31+)
210volt_delay_c:
211 ldr r7, [r10] @ get timer value
212 cmp r8, r7 @ time up?
213 bhi volt_delay_c @ not yet->branch
214 mov pc, lr @ back to caller
215
216omap243x_srs_cm_clksel2_pll:
217 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL2)
218omap243x_srs_sdrc_dlla_ctrl:
219 .word OMAP243X_SDRC_REGADDR(SDRC_DLLA_CTRL)
220omap243x_srs_sdrc_rfr_ctrl:
221 .word OMAP243X_SDRC_REGADDR(SDRC_RFR_CTRL_0)
222omap243x_srs_prcm_voltctrl:
223 .word OMAP243X_PRCM_VOLTCTRL
224ddr_prcm_mask_val:
225 .word 0xFFFF3FFC
226omap243x_srs_timer_32ksynct:
227 .word IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010)
228
229ENTRY(omap243x_sram_reprogram_sdrc_sz)
230 .word . - omap243x_sram_reprogram_sdrc
231
232/*
233 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode.
234 */
235ENTRY(omap243x_sram_set_prcm)
236 stmfd sp!, {r0-r12, lr} @ regs to stack
237 adr r4, pbegin @ addr of preload start
238 adr r8, pend @ addr of preload end
239 mcrr p15, 1, r8, r4, c12 @ preload into icache
240pbegin:
241 /* move into fast relock bypass */
242 ldr r8, omap243x_ssp_pll_ctl @ get addr
243 ldr r5, [r8] @ get val
244 mvn r6, #0x3 @ clear mask
245 and r5, r5, r6 @ clear field
246 orr r7, r5, #0x2 @ fast relock val
247 str r7, [r8] @ go to fast relock
248 ldr r4, omap243x_ssp_pll_stat @ addr of stat
249block:
250 /* wait for bypass */
251 ldr r8, [r4] @ stat value
252 and r8, r8, #0x3 @ mask for stat
253 cmp r8, #0x1 @ there yet
254 bne block @ loop if not
255
256 /* set new dpll dividers _after_ in bypass */
257 ldr r4, omap243x_ssp_pll_div @ get addr
258 str r0, [r4] @ set dpll ctrl val
259
260 ldr r4, omap243x_ssp_set_config @ get addr
261 mov r8, #1 @ valid cfg msk
262 str r8, [r4] @ make dividers take
263
264 mov r4, #100 @ dead spin a bit
265wait_a_bit:
266 subs r4, r4, #1 @ dec loop
267 bne wait_a_bit @ delay done?
268
269 /* check if staying in bypass */
270 cmp r2, #0x1 @ stay in bypass?
271 beq pend @ jump over dpll relock
272
273 /* relock DPLL with new vals */
274 ldr r5, omap243x_ssp_pll_stat @ get addr
275 ldr r4, omap243x_ssp_pll_ctl @ get addr
276 orr r8, r7, #0x3 @ val for lock dpll
277 str r8, [r4] @ set val
278 mov r0, #1000 @ dead spin a bit
279wait_more:
280 subs r0, r0, #1 @ dec loop
281 bne wait_more @ delay done?
282wait_lock:
283 ldr r8, [r5] @ get lock val
284 and r8, r8, #3 @ isolate field
285 cmp r8, #2 @ locked?
286 bne wait_lock @ wait if not
287pend:
288 /* update memory timings & briefly lock dll */
289 ldr r4, omap243x_ssp_sdrc_rfr @ get addr
290 str r1, [r4] @ update refresh timing
291 ldr r11, omap243x_ssp_dlla_ctrl @ get addr of DLLA ctrl
292 ldr r10, [r11] @ get current val
293 mvn r9, #0x4 @ mask to get clear bit2
294 and r10, r10, r9 @ clear bit2 for lock mode
295 orr r10, r10, #0x8 @ make sure DLL on (es2 bit pos)
296 str r10, [r11] @ commit to DLLA_CTRL
297 add r11, r11, #0x8 @ move to dllb
298 str r10, [r11] @ hit DLLB also
299
300 mov r4, #0x800 @ relock time (min 0x400 L3 clocks)
301wait_dll_lock:
302 subs r4, r4, #0x1
303 bne wait_dll_lock
304 nop
305 ldmfd sp!, {r0-r12, pc} @ restore regs and return
306
307omap243x_ssp_set_config:
308 .word OMAP243X_PRCM_CLKCFG_CTRL
309omap243x_ssp_pll_ctl:
310 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKEN)
311omap243x_ssp_pll_stat:
312 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_IDLEST)
313omap243x_ssp_pll_div:
314 .word OMAP2430_CM_REGADDR(PLL_MOD, CM_CLKSEL1)
315omap243x_ssp_sdrc_rfr:
316 .word OMAP243X_SDRC_REGADDR(SDRC_RFR_CTRL_0)
317omap243x_ssp_dlla_ctrl:
318 .word OMAP243X_SDRC_REGADDR(SDRC_DLLA_CTRL)
319
320ENTRY(omap243x_sram_set_prcm_sz)
321 .word . - omap243x_sram_set_prcm
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 78d05f203fff..557603f99313 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -59,8 +59,7 @@ static struct irqaction omap2_gp_timer_irq = {
59static int omap2_gp_timer_set_next_event(unsigned long cycles, 59static int omap2_gp_timer_set_next_event(unsigned long cycles,
60 struct clock_event_device *evt) 60 struct clock_event_device *evt)
61{ 61{
62 omap_dm_timer_set_load(gptimer, 0, 0xffffffff - cycles); 62 omap_dm_timer_set_load_start(gptimer, 0, 0xffffffff - cycles);
63 omap_dm_timer_start(gptimer);
64 63
65 return 0; 64 return 0;
66} 65}
@@ -77,8 +76,7 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
77 period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ; 76 period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ;
78 period -= 1; 77 period -= 1;
79 78
80 omap_dm_timer_set_load(gptimer, 1, 0xffffffff - period); 79 omap_dm_timer_set_load_start(gptimer, 1, 0xffffffff - period);
81 omap_dm_timer_start(gptimer);
82 break; 80 break;
83 case CLOCK_EVT_MODE_ONESHOT: 81 case CLOCK_EVT_MODE_ONESHOT:
84 break; 82 break;
@@ -172,8 +170,7 @@ static void __init omap2_gp_clocksource_init(void)
172 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt)); 170 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt));
173 tick_period = (tick_rate / HZ) - 1; 171 tick_period = (tick_rate / HZ) - 1;
174 172
175 omap_dm_timer_set_load(gpt, 1, 0); 173 omap_dm_timer_set_load_start(gpt, 1, 0);
176 omap_dm_timer_start(gpt);
177 174
178 clocksource_gpt.mult = 175 clocksource_gpt.mult =
179 clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift); 176 clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift);
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 93debf336155..ddcd41b15d17 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -44,6 +44,54 @@ config MACH_LINKSTATION_PRO
44 Buffalo Linkstation Pro/Live platform. Both v1 and 44 Buffalo Linkstation Pro/Live platform. Both v1 and
45 v2 devices are supported. 45 v2 devices are supported.
46 46
47config MACH_TS409
48 bool "QNAP TS-409"
49 help
50 Say 'Y' here if you want your kernel to support the
51 QNAP TS-409 platform.
52
53config MACH_WRT350N_V2
54 bool "Linksys WRT350N v2"
55 help
56 Say 'Y' here if you want your kernel to support the
57 Linksys WRT350N v2 platform.
58
59config MACH_TS78XX
60 bool "Technologic Systems TS-78xx"
61 help
62 Say 'Y' here if you want your kernel to support the
63 Technologic Systems TS-78xx platform.
64
65config MACH_MV2120
66 bool "HP Media Vault mv2120"
67 help
68 Say 'Y' here if you want your kernel to support the
69 HP Media Vault mv2120 or mv5100.
70
71config MACH_MSS2
72 bool "Maxtor Shared Storage II"
73 help
74 Say 'Y' here if you want your kernel to support the
75 Maxtor Shared Storage II platform.
76
77config MACH_WNR854T
78 bool "Netgear WNR854T"
79 help
80 Say 'Y' here if you want your kernel to support the
81 Netgear WNR854T platform.
82
83config MACH_RD88F5181L_GE
84 bool "Marvell Orion-VoIP GE Reference Design"
85 help
86 Say 'Y' here if you want your kernel to support the
87 Marvell Orion-VoIP GE (88F5181L) RD.
88
89config MACH_RD88F5181L_FXO
90 bool "Marvell Orion-VoIP FXO Reference Design"
91 help
92 Say 'Y' here if you want your kernel to support the
93 Marvell Orion-VoIP FXO (88F5181L) RD.
94
47endmenu 95endmenu
48 96
49endif 97endif
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index 9301bf55910b..fcc48a8864f3 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -1,7 +1,15 @@
1obj-y += common.o addr-map.o pci.o gpio.o irq.o 1obj-y += common.o addr-map.o pci.o gpio.o irq.o mpp.o
2obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o 2obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o
3obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o 3obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o
4obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o 4obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o
5obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o 5obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o
6obj-$(CONFIG_MACH_DNS323) += dns323-setup.o 6obj-$(CONFIG_MACH_DNS323) += dns323-setup.o
7obj-$(CONFIG_MACH_TS209) += ts209-setup.o 7obj-$(CONFIG_MACH_TS209) += ts209-setup.o tsx09-common.o
8obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o
9obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o
10obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o
11obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
12obj-$(CONFIG_MACH_MSS2) += mss2-setup.o
13obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o
14obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
15obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index e63fb05dc893..6f0dbda6c44c 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -70,6 +70,7 @@
70 70
71 71
72struct mbus_dram_target_info orion5x_mbus_dram_info; 72struct mbus_dram_target_info orion5x_mbus_dram_info;
73static int __initdata win_alloc_count;
73 74
74static int __init orion5x_cpu_win_can_remap(int win) 75static int __init orion5x_cpu_win_can_remap(int win)
75{ 76{
@@ -87,16 +88,22 @@ static int __init orion5x_cpu_win_can_remap(int win)
87static void __init setup_cpu_win(int win, u32 base, u32 size, 88static void __init setup_cpu_win(int win, u32 base, u32 size,
88 u8 target, u8 attr, int remap) 89 u8 target, u8 attr, int remap)
89{ 90{
90 orion5x_write(CPU_WIN_BASE(win), base & 0xffff0000); 91 if (win >= 8) {
91 orion5x_write(CPU_WIN_CTRL(win), 92 printk(KERN_ERR "setup_cpu_win: trying to allocate "
92 ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1); 93 "window %d\n", win);
94 return;
95 }
96
97 writel(base & 0xffff0000, CPU_WIN_BASE(win));
98 writel(((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1,
99 CPU_WIN_CTRL(win));
93 100
94 if (orion5x_cpu_win_can_remap(win)) { 101 if (orion5x_cpu_win_can_remap(win)) {
95 if (remap < 0) 102 if (remap < 0)
96 remap = base; 103 remap = base;
97 104
98 orion5x_write(CPU_WIN_REMAP_LO(win), remap & 0xffff0000); 105 writel(remap & 0xffff0000, CPU_WIN_REMAP_LO(win));
99 orion5x_write(CPU_WIN_REMAP_HI(win), 0); 106 writel(0, CPU_WIN_REMAP_HI(win));
100 } 107 }
101} 108}
102 109
@@ -109,11 +116,11 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
109 * First, disable and clear windows. 116 * First, disable and clear windows.
110 */ 117 */
111 for (i = 0; i < 8; i++) { 118 for (i = 0; i < 8; i++) {
112 orion5x_write(CPU_WIN_BASE(i), 0); 119 writel(0, CPU_WIN_BASE(i));
113 orion5x_write(CPU_WIN_CTRL(i), 0); 120 writel(0, CPU_WIN_CTRL(i));
114 if (orion5x_cpu_win_can_remap(i)) { 121 if (orion5x_cpu_win_can_remap(i)) {
115 orion5x_write(CPU_WIN_REMAP_LO(i), 0); 122 writel(0, CPU_WIN_REMAP_LO(i));
116 orion5x_write(CPU_WIN_REMAP_HI(i), 0); 123 writel(0, CPU_WIN_REMAP_HI(i));
117 } 124 }
118 } 125 }
119 126
@@ -128,6 +135,7 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
128 TARGET_PCIE, ATTR_PCIE_MEM, -1); 135 TARGET_PCIE, ATTR_PCIE_MEM, -1);
129 setup_cpu_win(3, ORION5X_PCI_MEM_PHYS_BASE, ORION5X_PCI_MEM_SIZE, 136 setup_cpu_win(3, ORION5X_PCI_MEM_PHYS_BASE, ORION5X_PCI_MEM_SIZE,
130 TARGET_PCI, ATTR_PCI_MEM, -1); 137 TARGET_PCI, ATTR_PCI_MEM, -1);
138 win_alloc_count = 4;
131 139
132 /* 140 /*
133 * Setup MBUS dram target info. 141 * Setup MBUS dram target info.
@@ -147,8 +155,8 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
147 w = &orion5x_mbus_dram_info.cs[cs++]; 155 w = &orion5x_mbus_dram_info.cs[cs++];
148 w->cs_index = i; 156 w->cs_index = i;
149 w->mbus_attr = 0xf & ~(1 << i); 157 w->mbus_attr = 0xf & ~(1 << i);
150 w->base = base & 0xff000000; 158 w->base = base & 0xffff0000;
151 w->size = (size | 0x00ffffff) + 1; 159 w->size = (size | 0x0000ffff) + 1;
152 } 160 }
153 } 161 }
154 orion5x_mbus_dram_info.num_cs = cs; 162 orion5x_mbus_dram_info.num_cs = cs;
@@ -156,25 +164,30 @@ void __init orion5x_setup_cpu_mbus_bridge(void)
156 164
157void __init orion5x_setup_dev_boot_win(u32 base, u32 size) 165void __init orion5x_setup_dev_boot_win(u32 base, u32 size)
158{ 166{
159 setup_cpu_win(4, base, size, TARGET_DEV_BUS, ATTR_DEV_BOOT, -1); 167 setup_cpu_win(win_alloc_count++, base, size,
168 TARGET_DEV_BUS, ATTR_DEV_BOOT, -1);
160} 169}
161 170
162void __init orion5x_setup_dev0_win(u32 base, u32 size) 171void __init orion5x_setup_dev0_win(u32 base, u32 size)
163{ 172{
164 setup_cpu_win(5, base, size, TARGET_DEV_BUS, ATTR_DEV_CS0, -1); 173 setup_cpu_win(win_alloc_count++, base, size,
174 TARGET_DEV_BUS, ATTR_DEV_CS0, -1);
165} 175}
166 176
167void __init orion5x_setup_dev1_win(u32 base, u32 size) 177void __init orion5x_setup_dev1_win(u32 base, u32 size)
168{ 178{
169 setup_cpu_win(6, base, size, TARGET_DEV_BUS, ATTR_DEV_CS1, -1); 179 setup_cpu_win(win_alloc_count++, base, size,
180 TARGET_DEV_BUS, ATTR_DEV_CS1, -1);
170} 181}
171 182
172void __init orion5x_setup_dev2_win(u32 base, u32 size) 183void __init orion5x_setup_dev2_win(u32 base, u32 size)
173{ 184{
174 setup_cpu_win(7, base, size, TARGET_DEV_BUS, ATTR_DEV_CS2, -1); 185 setup_cpu_win(win_alloc_count++, base, size,
186 TARGET_DEV_BUS, ATTR_DEV_CS2, -1);
175} 187}
176 188
177void __init orion5x_setup_pcie_wa_win(u32 base, u32 size) 189void __init orion5x_setup_pcie_wa_win(u32 base, u32 size)
178{ 190{
179 setup_cpu_win(7, base, size, TARGET_PCIE, ATTR_PCIE_WA, -1); 191 setup_cpu_win(win_alloc_count++, base, size,
192 TARGET_PCIE, ATTR_PCIE_WA, -1);
180} 193}
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 4f13fd037f04..faf4e3211918 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -39,25 +39,22 @@ static struct map_desc orion5x_io_desc[] __initdata = {
39 .virtual = ORION5X_REGS_VIRT_BASE, 39 .virtual = ORION5X_REGS_VIRT_BASE,
40 .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE), 40 .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE),
41 .length = ORION5X_REGS_SIZE, 41 .length = ORION5X_REGS_SIZE,
42 .type = MT_DEVICE 42 .type = MT_DEVICE,
43 }, 43 }, {
44 {
45 .virtual = ORION5X_PCIE_IO_VIRT_BASE, 44 .virtual = ORION5X_PCIE_IO_VIRT_BASE,
46 .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE), 45 .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE),
47 .length = ORION5X_PCIE_IO_SIZE, 46 .length = ORION5X_PCIE_IO_SIZE,
48 .type = MT_DEVICE 47 .type = MT_DEVICE,
49 }, 48 }, {
50 {
51 .virtual = ORION5X_PCI_IO_VIRT_BASE, 49 .virtual = ORION5X_PCI_IO_VIRT_BASE,
52 .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE), 50 .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE),
53 .length = ORION5X_PCI_IO_SIZE, 51 .length = ORION5X_PCI_IO_SIZE,
54 .type = MT_DEVICE 52 .type = MT_DEVICE,
55 }, 53 }, {
56 {
57 .virtual = ORION5X_PCIE_WA_VIRT_BASE, 54 .virtual = ORION5X_PCIE_WA_VIRT_BASE,
58 .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE), 55 .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE),
59 .length = ORION5X_PCIE_WA_SIZE, 56 .length = ORION5X_PCIE_WA_SIZE,
60 .type = MT_DEVICE 57 .type = MT_DEVICE,
61 }, 58 },
62}; 59};
63 60
@@ -66,101 +63,32 @@ void __init orion5x_map_io(void)
66 iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc)); 63 iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc));
67} 64}
68 65
66
69/***************************************************************************** 67/*****************************************************************************
70 * UART 68 * EHCI
71 ****************************************************************************/ 69 ****************************************************************************/
72 70static struct orion_ehci_data orion5x_ehci_data = {
73static struct resource orion5x_uart_resources[] = { 71 .dram = &orion5x_mbus_dram_info,
74 {
75 .start = UART0_PHYS_BASE,
76 .end = UART0_PHYS_BASE + 0xff,
77 .flags = IORESOURCE_MEM,
78 },
79 {
80 .start = IRQ_ORION5X_UART0,
81 .end = IRQ_ORION5X_UART0,
82 .flags = IORESOURCE_IRQ,
83 },
84 {
85 .start = UART1_PHYS_BASE,
86 .end = UART1_PHYS_BASE + 0xff,
87 .flags = IORESOURCE_MEM,
88 },
89 {
90 .start = IRQ_ORION5X_UART1,
91 .end = IRQ_ORION5X_UART1,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96static struct plat_serial8250_port orion5x_uart_data[] = {
97 {
98 .mapbase = UART0_PHYS_BASE,
99 .membase = (char *)UART0_VIRT_BASE,
100 .irq = IRQ_ORION5X_UART0,
101 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
102 .iotype = UPIO_MEM,
103 .regshift = 2,
104 .uartclk = ORION5X_TCLK,
105 },
106 {
107 .mapbase = UART1_PHYS_BASE,
108 .membase = (char *)UART1_VIRT_BASE,
109 .irq = IRQ_ORION5X_UART1,
110 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
111 .iotype = UPIO_MEM,
112 .regshift = 2,
113 .uartclk = ORION5X_TCLK,
114 },
115 { },
116}; 72};
117 73
118static struct platform_device orion5x_uart = { 74static u64 ehci_dmamask = 0xffffffffUL;
119 .name = "serial8250",
120 .id = PLAT8250_DEV_PLATFORM,
121 .dev = {
122 .platform_data = orion5x_uart_data,
123 },
124 .resource = orion5x_uart_resources,
125 .num_resources = ARRAY_SIZE(orion5x_uart_resources),
126};
127 75
128/*******************************************************************************
129 * USB Controller - 2 interfaces
130 ******************************************************************************/
131 76
77/*****************************************************************************
78 * EHCI0
79 ****************************************************************************/
132static struct resource orion5x_ehci0_resources[] = { 80static struct resource orion5x_ehci0_resources[] = {
133 { 81 {
134 .start = ORION5X_USB0_PHYS_BASE, 82 .start = ORION5X_USB0_PHYS_BASE,
135 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1, 83 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
136 .flags = IORESOURCE_MEM, 84 .flags = IORESOURCE_MEM,
137 }, 85 }, {
138 {
139 .start = IRQ_ORION5X_USB0_CTRL, 86 .start = IRQ_ORION5X_USB0_CTRL,
140 .end = IRQ_ORION5X_USB0_CTRL, 87 .end = IRQ_ORION5X_USB0_CTRL,
141 .flags = IORESOURCE_IRQ, 88 .flags = IORESOURCE_IRQ,
142 }, 89 },
143}; 90};
144 91
145static struct resource orion5x_ehci1_resources[] = {
146 {
147 .start = ORION5X_USB1_PHYS_BASE,
148 .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
149 .flags = IORESOURCE_MEM,
150 },
151 {
152 .start = IRQ_ORION5X_USB1_CTRL,
153 .end = IRQ_ORION5X_USB1_CTRL,
154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158static struct orion_ehci_data orion5x_ehci_data = {
159 .dram = &orion5x_mbus_dram_info,
160};
161
162static u64 ehci_dmamask = 0xffffffffUL;
163
164static struct platform_device orion5x_ehci0 = { 92static struct platform_device orion5x_ehci0 = {
165 .name = "orion-ehci", 93 .name = "orion-ehci",
166 .id = 0, 94 .id = 0,
@@ -173,6 +101,27 @@ static struct platform_device orion5x_ehci0 = {
173 .num_resources = ARRAY_SIZE(orion5x_ehci0_resources), 101 .num_resources = ARRAY_SIZE(orion5x_ehci0_resources),
174}; 102};
175 103
104void __init orion5x_ehci0_init(void)
105{
106 platform_device_register(&orion5x_ehci0);
107}
108
109
110/*****************************************************************************
111 * EHCI1
112 ****************************************************************************/
113static struct resource orion5x_ehci1_resources[] = {
114 {
115 .start = ORION5X_USB1_PHYS_BASE,
116 .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
117 .flags = IORESOURCE_MEM,
118 }, {
119 .start = IRQ_ORION5X_USB1_CTRL,
120 .end = IRQ_ORION5X_USB1_CTRL,
121 .flags = IORESOURCE_IRQ,
122 },
123};
124
176static struct platform_device orion5x_ehci1 = { 125static struct platform_device orion5x_ehci1 = {
177 .name = "orion-ehci", 126 .name = "orion-ehci",
178 .id = 1, 127 .id = 1,
@@ -185,11 +134,15 @@ static struct platform_device orion5x_ehci1 = {
185 .num_resources = ARRAY_SIZE(orion5x_ehci1_resources), 134 .num_resources = ARRAY_SIZE(orion5x_ehci1_resources),
186}; 135};
187 136
137void __init orion5x_ehci1_init(void)
138{
139 platform_device_register(&orion5x_ehci1);
140}
141
142
188/***************************************************************************** 143/*****************************************************************************
189 * Gigabit Ethernet port 144 * GigE
190 * (The Orion and Discovery (MV643xx) families use the same Ethernet driver)
191 ****************************************************************************/ 145 ****************************************************************************/
192
193struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = { 146struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = {
194 .dram = &orion5x_mbus_dram_info, 147 .dram = &orion5x_mbus_dram_info,
195 .t_clk = ORION5X_TCLK, 148 .t_clk = ORION5X_TCLK,
@@ -219,7 +172,7 @@ static struct resource orion5x_eth_resources[] = {
219 .start = IRQ_ORION5X_ETH_SUM, 172 .start = IRQ_ORION5X_ETH_SUM,
220 .end = IRQ_ORION5X_ETH_SUM, 173 .end = IRQ_ORION5X_ETH_SUM,
221 .flags = IORESOURCE_IRQ, 174 .flags = IORESOURCE_IRQ,
222 } 175 },
223}; 176};
224 177
225static struct platform_device orion5x_eth = { 178static struct platform_device orion5x_eth = {
@@ -238,11 +191,10 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
238 platform_device_register(&orion5x_eth); 191 platform_device_register(&orion5x_eth);
239} 192}
240 193
194
241/***************************************************************************** 195/*****************************************************************************
242 * I2C controller 196 * I2C
243 * (The Orion and Discovery (MV643xx) families share the same I2C controller)
244 ****************************************************************************/ 197 ****************************************************************************/
245
246static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = { 198static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
247 .freq_m = 8, /* assumes 166 MHz TCLK */ 199 .freq_m = 8, /* assumes 166 MHz TCLK */
248 .freq_n = 3, 200 .freq_n = 3,
@@ -251,16 +203,15 @@ static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
251 203
252static struct resource orion5x_i2c_resources[] = { 204static struct resource orion5x_i2c_resources[] = {
253 { 205 {
254 .name = "i2c base", 206 .name = "i2c base",
255 .start = I2C_PHYS_BASE, 207 .start = I2C_PHYS_BASE,
256 .end = I2C_PHYS_BASE + 0x20 -1, 208 .end = I2C_PHYS_BASE + 0x1f,
257 .flags = IORESOURCE_MEM, 209 .flags = IORESOURCE_MEM,
258 }, 210 }, {
259 { 211 .name = "i2c irq",
260 .name = "i2c irq", 212 .start = IRQ_ORION5X_I2C,
261 .start = IRQ_ORION5X_I2C, 213 .end = IRQ_ORION5X_I2C,
262 .end = IRQ_ORION5X_I2C, 214 .flags = IORESOURCE_IRQ,
263 .flags = IORESOURCE_IRQ,
264 }, 215 },
265}; 216};
266 217
@@ -270,36 +221,41 @@ static struct platform_device orion5x_i2c = {
270 .num_resources = ARRAY_SIZE(orion5x_i2c_resources), 221 .num_resources = ARRAY_SIZE(orion5x_i2c_resources),
271 .resource = orion5x_i2c_resources, 222 .resource = orion5x_i2c_resources,
272 .dev = { 223 .dev = {
273 .platform_data = &orion5x_i2c_pdata, 224 .platform_data = &orion5x_i2c_pdata,
274 }, 225 },
275}; 226};
276 227
228void __init orion5x_i2c_init(void)
229{
230 platform_device_register(&orion5x_i2c);
231}
232
233
277/***************************************************************************** 234/*****************************************************************************
278 * Sata port 235 * SATA
279 ****************************************************************************/ 236 ****************************************************************************/
280static struct resource orion5x_sata_resources[] = { 237static struct resource orion5x_sata_resources[] = {
281 {
282 .name = "sata base",
283 .start = ORION5X_SATA_PHYS_BASE,
284 .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1,
285 .flags = IORESOURCE_MEM,
286 },
287 { 238 {
288 .name = "sata irq", 239 .name = "sata base",
289 .start = IRQ_ORION5X_SATA, 240 .start = ORION5X_SATA_PHYS_BASE,
290 .end = IRQ_ORION5X_SATA, 241 .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1,
291 .flags = IORESOURCE_IRQ, 242 .flags = IORESOURCE_MEM,
292 }, 243 }, {
244 .name = "sata irq",
245 .start = IRQ_ORION5X_SATA,
246 .end = IRQ_ORION5X_SATA,
247 .flags = IORESOURCE_IRQ,
248 },
293}; 249};
294 250
295static struct platform_device orion5x_sata = { 251static struct platform_device orion5x_sata = {
296 .name = "sata_mv", 252 .name = "sata_mv",
297 .id = 0, 253 .id = 0,
298 .dev = { 254 .dev = {
299 .coherent_dma_mask = 0xffffffff, 255 .coherent_dma_mask = 0xffffffff,
300 }, 256 },
301 .num_resources = ARRAY_SIZE(orion5x_sata_resources), 257 .num_resources = ARRAY_SIZE(orion5x_sata_resources),
302 .resource = orion5x_sata_resources, 258 .resource = orion5x_sata_resources,
303}; 259};
304 260
305void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) 261void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
@@ -309,23 +265,111 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
309 platform_device_register(&orion5x_sata); 265 platform_device_register(&orion5x_sata);
310} 266}
311 267
268
312/***************************************************************************** 269/*****************************************************************************
313 * Time handling 270 * UART0
271 ****************************************************************************/
272static struct plat_serial8250_port orion5x_uart0_data[] = {
273 {
274 .mapbase = UART0_PHYS_BASE,
275 .membase = (char *)UART0_VIRT_BASE,
276 .irq = IRQ_ORION5X_UART0,
277 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
278 .iotype = UPIO_MEM,
279 .regshift = 2,
280 .uartclk = ORION5X_TCLK,
281 }, {
282 },
283};
284
285static struct resource orion5x_uart0_resources[] = {
286 {
287 .start = UART0_PHYS_BASE,
288 .end = UART0_PHYS_BASE + 0xff,
289 .flags = IORESOURCE_MEM,
290 }, {
291 .start = IRQ_ORION5X_UART0,
292 .end = IRQ_ORION5X_UART0,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297static struct platform_device orion5x_uart0 = {
298 .name = "serial8250",
299 .id = PLAT8250_DEV_PLATFORM,
300 .dev = {
301 .platform_data = orion5x_uart0_data,
302 },
303 .resource = orion5x_uart0_resources,
304 .num_resources = ARRAY_SIZE(orion5x_uart0_resources),
305};
306
307void __init orion5x_uart0_init(void)
308{
309 platform_device_register(&orion5x_uart0);
310}
311
312
313/*****************************************************************************
314 * UART1
314 ****************************************************************************/ 315 ****************************************************************************/
316static struct plat_serial8250_port orion5x_uart1_data[] = {
317 {
318 .mapbase = UART1_PHYS_BASE,
319 .membase = (char *)UART1_VIRT_BASE,
320 .irq = IRQ_ORION5X_UART1,
321 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
322 .iotype = UPIO_MEM,
323 .regshift = 2,
324 .uartclk = ORION5X_TCLK,
325 }, {
326 },
327};
328
329static struct resource orion5x_uart1_resources[] = {
330 {
331 .start = UART1_PHYS_BASE,
332 .end = UART1_PHYS_BASE + 0xff,
333 .flags = IORESOURCE_MEM,
334 }, {
335 .start = IRQ_ORION5X_UART1,
336 .end = IRQ_ORION5X_UART1,
337 .flags = IORESOURCE_IRQ,
338 },
339};
340
341static struct platform_device orion5x_uart1 = {
342 .name = "serial8250",
343 .id = PLAT8250_DEV_PLATFORM1,
344 .dev = {
345 .platform_data = orion5x_uart1_data,
346 },
347 .resource = orion5x_uart1_resources,
348 .num_resources = ARRAY_SIZE(orion5x_uart1_resources),
349};
350
351void __init orion5x_uart1_init(void)
352{
353 platform_device_register(&orion5x_uart1);
354}
355
315 356
357/*****************************************************************************
358 * Time handling
359 ****************************************************************************/
316static void orion5x_timer_init(void) 360static void orion5x_timer_init(void)
317{ 361{
318 orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK); 362 orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK);
319} 363}
320 364
321struct sys_timer orion5x_timer = { 365struct sys_timer orion5x_timer = {
322 .init = orion5x_timer_init, 366 .init = orion5x_timer_init,
323}; 367};
324 368
369
325/***************************************************************************** 370/*****************************************************************************
326 * General 371 * General
327 ****************************************************************************/ 372 ****************************************************************************/
328
329/* 373/*
330 * Identify device ID and rev from PCIe configuration header space '0'. 374 * Identify device ID and rev from PCIe configuration header space '0'.
331 */ 375 */
@@ -350,8 +394,10 @@ static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
350 } else if (*dev == MV88F5181_DEV_ID) { 394 } else if (*dev == MV88F5181_DEV_ID) {
351 if (*rev == MV88F5181_REV_B1) { 395 if (*rev == MV88F5181_REV_B1) {
352 *dev_name = "MV88F5181-Rev-B1"; 396 *dev_name = "MV88F5181-Rev-B1";
397 } else if (*rev == MV88F5181L_REV_A1) {
398 *dev_name = "MV88F5181L-Rev-A1";
353 } else { 399 } else {
354 *dev_name = "MV88F5181-Rev-Unsupported"; 400 *dev_name = "MV88F5181(L)-Rev-Unsupported";
355 } 401 }
356 } else { 402 } else {
357 *dev_name = "Device-Unknown"; 403 *dev_name = "Device-Unknown";
@@ -370,15 +416,6 @@ void __init orion5x_init(void)
370 * Setup Orion address map 416 * Setup Orion address map
371 */ 417 */
372 orion5x_setup_cpu_mbus_bridge(); 418 orion5x_setup_cpu_mbus_bridge();
373
374 /*
375 * Register devices.
376 */
377 platform_device_register(&orion5x_uart);
378 platform_device_register(&orion5x_ehci0);
379 if (dev == MV88F5182_DEV_ID)
380 platform_device_register(&orion5x_ehci1);
381 platform_device_register(&orion5x_i2c);
382} 419}
383 420
384/* 421/*
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index bd0f05de6e18..f72cf0e77544 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -1,10 +1,12 @@
1#ifndef __ARCH_ORION5X_COMMON_H 1#ifndef __ARCH_ORION5X_COMMON_H
2#define __ARCH_ORION5X_COMMON_H 2#define __ARCH_ORION5X_COMMON_H
3 3
4struct mv643xx_eth_platform_data;
5struct mv_sata_platform_data;
6
4/* 7/*
5 * Basic Orion init functions used early by machine-setup. 8 * Basic Orion init functions used early by machine-setup.
6 */ 9 */
7
8void orion5x_map_io(void); 10void orion5x_map_io(void);
9void orion5x_init_irq(void); 11void orion5x_init_irq(void);
10void orion5x_init(void); 12void orion5x_init(void);
@@ -23,15 +25,22 @@ void orion5x_setup_dev1_win(u32 base, u32 size);
23void orion5x_setup_dev2_win(u32 base, u32 size); 25void orion5x_setup_dev2_win(u32 base, u32 size);
24void orion5x_setup_pcie_wa_win(u32 base, u32 size); 26void orion5x_setup_pcie_wa_win(u32 base, u32 size);
25 27
28void orion5x_ehci0_init(void);
29void orion5x_ehci1_init(void);
30void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
31void orion5x_i2c_init(void);
32void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
33void orion5x_uart0_init(void);
34void orion5x_uart1_init(void);
35
26/* 36/*
27 * Shared code used internally by other Orion core functions. 37 * PCIe/PCI functions.
28 * (/mach-orion/pci.c)
29 */ 38 */
30
31struct pci_sys_data;
32struct pci_bus; 39struct pci_bus;
40struct pci_sys_data;
33 41
34void orion5x_pcie_id(u32 *dev, u32 *rev); 42void orion5x_pcie_id(u32 *dev, u32 *rev);
43void orion5x_pci_set_cardbus_mode(void);
35int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); 44int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
36struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); 45struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
37int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin); 46int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
@@ -40,26 +49,9 @@ int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
40 * Valid GPIO pins according to MPP setup, used by machine-setup. 49 * Valid GPIO pins according to MPP setup, used by machine-setup.
41 * (/mach-orion/gpio.c). 50 * (/mach-orion/gpio.c).
42 */ 51 */
43 52void orion5x_gpio_set_valid(unsigned pin, int valid);
44void orion5x_gpio_set_valid_pins(u32 pins);
45void gpio_display(void); /* debug */ 53void gpio_display(void); /* debug */
46 54
47/*
48 * Pull in Orion Ethernet platform_data, used by machine-setup
49 */
50
51struct mv643xx_eth_platform_data;
52
53void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
54
55/*
56 * Orion Sata platform_data, used by machine-setup
57 */
58
59struct mv_sata_platform_data;
60
61void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
62
63struct machine_desc; 55struct machine_desc;
64struct meminfo; 56struct meminfo;
65struct tag; 57struct tag;
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index 44c64342dacb..88405e74e5e3 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -27,6 +27,7 @@
27#include <asm/arch/orion5x.h> 27#include <asm/arch/orion5x.h>
28#include <asm/plat-orion/orion_nand.h> 28#include <asm/plat-orion/orion_nand.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h"
30 31
31/***************************************************************************** 32/*****************************************************************************
32 * DB-88F5281 on board devices 33 * DB-88F5281 on board devices
@@ -86,7 +87,7 @@ static struct platform_device db88f5281_boot_flash = {
86 .name = "physmap-flash", 87 .name = "physmap-flash",
87 .id = 0, 88 .id = 0,
88 .dev = { 89 .dev = {
89 .platform_data = &db88f5281_boot_flash_data, 90 .platform_data = &db88f5281_boot_flash_data,
90 }, 91 },
91 .num_resources = 1, 92 .num_resources = 1,
92 .resource = &db88f5281_boot_flash_resource, 93 .resource = &db88f5281_boot_flash_resource,
@@ -110,7 +111,7 @@ static struct platform_device db88f5281_nor_flash = {
110 .name = "physmap-flash", 111 .name = "physmap-flash",
111 .id = 1, 112 .id = 1,
112 .dev = { 113 .dev = {
113 .platform_data = &db88f5281_nor_flash_data, 114 .platform_data = &db88f5281_nor_flash_data,
114 }, 115 },
115 .num_resources = 1, 116 .num_resources = 1,
116 .resource = &db88f5281_nor_flash_resource, 117 .resource = &db88f5281_nor_flash_resource,
@@ -125,18 +126,15 @@ static struct mtd_partition db88f5281_nand_parts[] = {
125 .name = "kernel", 126 .name = "kernel",
126 .offset = 0, 127 .offset = 0,
127 .size = SZ_2M, 128 .size = SZ_2M,
128 }, 129 }, {
129 {
130 .name = "root", 130 .name = "root",
131 .offset = SZ_2M, 131 .offset = SZ_2M,
132 .size = (SZ_16M - SZ_2M), 132 .size = (SZ_16M - SZ_2M),
133 }, 133 }, {
134 {
135 .name = "user", 134 .name = "user",
136 .offset = SZ_16M, 135 .offset = SZ_16M,
137 .size = SZ_8M, 136 .size = SZ_8M,
138 }, 137 }, {
139 {
140 .name = "recovery", 138 .name = "recovery",
141 .offset = (SZ_16M + SZ_8M), 139 .offset = (SZ_16M + SZ_8M),
142 .size = SZ_8M, 140 .size = SZ_8M,
@@ -288,7 +286,6 @@ subsys_initcall(db88f5281_pci_init);
288 ****************************************************************************/ 286 ****************************************************************************/
289static struct mv643xx_eth_platform_data db88f5281_eth_data = { 287static struct mv643xx_eth_platform_data db88f5281_eth_data = {
290 .phy_addr = 8, 288 .phy_addr = 8,
291 .force_phy_addr = 1,
292}; 289};
293 290
294/***************************************************************************** 291/*****************************************************************************
@@ -301,11 +298,28 @@ static struct i2c_board_info __initdata db88f5281_i2c_rtc = {
301/***************************************************************************** 298/*****************************************************************************
302 * General Setup 299 * General Setup
303 ****************************************************************************/ 300 ****************************************************************************/
304 301static struct orion5x_mpp_mode db88f5281_mpp_modes[] __initdata = {
305static struct platform_device *db88f5281_devs[] __initdata = { 302 { 0, MPP_GPIO }, /* USB Over Current */
306 &db88f5281_boot_flash, 303 { 1, MPP_GPIO }, /* USB Vbat input */
307 &db88f5281_nor_flash, 304 { 2, MPP_PCI_ARB }, /* PCI_REQn[2] */
308 &db88f5281_nand_flash, 305 { 3, MPP_PCI_ARB }, /* PCI_GNTn[2] */
306 { 4, MPP_PCI_ARB }, /* PCI_REQn[3] */
307 { 5, MPP_PCI_ARB }, /* PCI_GNTn[3] */
308 { 6, MPP_GPIO }, /* JP0, CON17.2 */
309 { 7, MPP_GPIO }, /* JP1, CON17.1 */
310 { 8, MPP_GPIO }, /* JP2, CON11.2 */
311 { 9, MPP_GPIO }, /* JP3, CON11.3 */
312 { 10, MPP_GPIO }, /* RTC int */
313 { 11, MPP_GPIO }, /* Baud Rate Generator */
314 { 12, MPP_GPIO }, /* PCI int 1 */
315 { 13, MPP_GPIO }, /* PCI int 2 */
316 { 14, MPP_NAND }, /* NAND_REn[2] */
317 { 15, MPP_NAND }, /* NAND_WEn[2] */
318 { 16, MPP_UART }, /* UART1_RX */
319 { 17, MPP_UART }, /* UART1_TX */
320 { 18, MPP_UART }, /* UART1_CTSn */
321 { 19, MPP_UART }, /* UART1_RTSn */
322 { -1 },
309}; 323};
310 324
311static void __init db88f5281_init(void) 325static void __init db88f5281_init(void)
@@ -315,39 +329,31 @@ static void __init db88f5281_init(void)
315 */ 329 */
316 orion5x_init(); 330 orion5x_init();
317 331
332 orion5x_mpp_conf(db88f5281_mpp_modes);
333 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */
334
318 /* 335 /*
319 * Setup the CPU address decode windows for our on-board devices 336 * Configure peripherals.
320 */ 337 */
338 orion5x_ehci0_init();
339 orion5x_eth_init(&db88f5281_eth_data);
340 orion5x_i2c_init();
341 orion5x_uart0_init();
342 orion5x_uart1_init();
343
321 orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE, 344 orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE,
322 DB88F5281_NOR_BOOT_SIZE); 345 DB88F5281_NOR_BOOT_SIZE);
346 platform_device_register(&db88f5281_boot_flash);
347
323 orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE); 348 orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE);
324 orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
325 orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
326 349
327 /* 350 orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
328 * Setup Multiplexing Pins: 351 platform_device_register(&db88f5281_nor_flash);
329 * MPP0: GPIO (USB Over Current) MPP1: GPIO (USB Vbat input)
330 * MPP2: PCI_REQn[2] MPP3: PCI_GNTn[2]
331 * MPP4: PCI_REQn[3] MPP5: PCI_GNTn[3]
332 * MPP6: GPIO (JP0, CON17.2) MPP7: GPIO (JP1, CON17.1)
333 * MPP8: GPIO (JP2, CON11.2) MPP9: GPIO (JP3, CON11.3)
334 * MPP10: GPIO (RTC int) MPP11: GPIO (Baud Rate Generator)
335 * MPP12: GPIO (PCI int 1) MPP13: GPIO (PCI int 2)
336 * MPP14: NAND_REn[2] MPP15: NAND_WEn[2]
337 * MPP16: UART1_RX MPP17: UART1_TX
338 * MPP18: UART1_CTS MPP19: UART1_RTS
339 * MPP-DEV: DEV_D[16:31]
340 */
341 orion5x_write(MPP_0_7_CTRL, 0x00222203);
342 orion5x_write(MPP_8_15_CTRL, 0x44000000);
343 orion5x_write(MPP_16_19_CTRL, 0);
344 orion5x_write(MPP_DEV_CTRL, 0);
345 352
346 orion5x_gpio_set_valid_pins(0x00003fc3); 353 orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
354 platform_device_register(&db88f5281_nand_flash);
347 355
348 platform_add_devices(db88f5281_devs, ARRAY_SIZE(db88f5281_devs));
349 i2c_register_board_info(0, &db88f5281_i2c_rtc, 1); 356 i2c_register_board_info(0, &db88f5281_i2c_rtc, 1);
350 orion5x_eth_init(&db88f5281_eth_data);
351} 357}
352 358
353MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board") 359MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board")
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 27ce967ab9e5..3791ca6f001a 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -27,6 +27,7 @@
27#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
28#include <asm/arch/orion5x.h> 28#include <asm/arch/orion5x.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h"
30 31
31#define DNS323_GPIO_LED_RIGHT_AMBER 1 32#define DNS323_GPIO_LED_RIGHT_AMBER 1
32#define DNS323_GPIO_LED_LEFT_AMBER 2 33#define DNS323_GPIO_LED_LEFT_AMBER 2
@@ -52,8 +53,6 @@ static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
52 if (irq != -1) 53 if (irq != -1)
53 return irq; 54 return irq;
54 55
55 pr_err("%s: requested mapping for unknown device\n", __func__);
56
57 return -1; 56 return -1;
58} 57}
59 58
@@ -81,7 +80,6 @@ subsys_initcall(dns323_pci_init);
81 80
82static struct mv643xx_eth_platform_data dns323_eth_data = { 81static struct mv643xx_eth_platform_data dns323_eth_data = {
83 .phy_addr = 8, 82 .phy_addr = 8,
84 .force_phy_addr = 1,
85}; 83};
86 84
87/**************************************************************************** 85/****************************************************************************
@@ -119,7 +117,7 @@ static struct mtd_partition dns323_partitions[] = {
119 .name = "u-boot", 117 .name = "u-boot",
120 .size = 0x00030000, 118 .size = 0x00030000,
121 .offset = 0x007d0000, 119 .offset = 0x007d0000,
122 } 120 },
123}; 121};
124 122
125static struct physmap_flash_data dns323_nor_flash_data = { 123static struct physmap_flash_data dns323_nor_flash_data = {
@@ -137,7 +135,9 @@ static struct resource dns323_nor_flash_resource = {
137static struct platform_device dns323_nor_flash = { 135static struct platform_device dns323_nor_flash = {
138 .name = "physmap-flash", 136 .name = "physmap-flash",
139 .id = 0, 137 .id = 0,
140 .dev = { .platform_data = &dns323_nor_flash_data, }, 138 .dev = {
139 .platform_data = &dns323_nor_flash_data,
140 },
141 .resource = &dns323_nor_flash_resource, 141 .resource = &dns323_nor_flash_resource,
142 .num_resources = 1, 142 .num_resources = 1,
143}; 143};
@@ -170,7 +170,9 @@ static struct gpio_led_platform_data dns323_led_data = {
170static struct platform_device dns323_gpio_leds = { 170static struct platform_device dns323_gpio_leds = {
171 .name = "leds-gpio", 171 .name = "leds-gpio",
172 .id = -1, 172 .id = -1,
173 .dev = { .platform_data = &dns323_led_data, }, 173 .dev = {
174 .platform_data = &dns323_led_data,
175 },
174}; 176};
175 177
176/**************************************************************************** 178/****************************************************************************
@@ -183,35 +185,53 @@ static struct gpio_keys_button dns323_buttons[] = {
183 .gpio = DNS323_GPIO_KEY_RESET, 185 .gpio = DNS323_GPIO_KEY_RESET,
184 .desc = "Reset Button", 186 .desc = "Reset Button",
185 .active_low = 1, 187 .active_low = 1,
186 }, 188 }, {
187 {
188 .code = KEY_POWER, 189 .code = KEY_POWER,
189 .gpio = DNS323_GPIO_KEY_POWER, 190 .gpio = DNS323_GPIO_KEY_POWER,
190 .desc = "Power Button", 191 .desc = "Power Button",
191 .active_low = 1, 192 .active_low = 1,
192 } 193 },
193}; 194};
194 195
195static struct gpio_keys_platform_data dns323_button_data = { 196static struct gpio_keys_platform_data dns323_button_data = {
196 .buttons = dns323_buttons, 197 .buttons = dns323_buttons,
197 .nbuttons = ARRAY_SIZE(dns323_buttons), 198 .nbuttons = ARRAY_SIZE(dns323_buttons),
198}; 199};
199 200
200static struct platform_device dns323_button_device = { 201static struct platform_device dns323_button_device = {
201 .name = "gpio-keys", 202 .name = "gpio-keys",
202 .id = -1, 203 .id = -1,
203 .num_resources = 0, 204 .num_resources = 0,
204 .dev = { .platform_data = &dns323_button_data, }, 205 .dev = {
206 .platform_data = &dns323_button_data,
207 },
205}; 208};
206 209
207/**************************************************************************** 210/****************************************************************************
208 * General Setup 211 * General Setup
209 */ 212 */
210 213static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = {
211static struct platform_device *dns323_plat_devices[] __initdata = { 214 { 0, MPP_PCIE_RST_OUTn },
212 &dns323_nor_flash, 215 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
213 &dns323_gpio_leds, 216 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
214 &dns323_button_device, 217 { 3, MPP_UNUSED },
218 { 4, MPP_GPIO }, /* power button LED */
219 { 5, MPP_GPIO }, /* power button LED */
220 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */
221 { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */
222 { 8, MPP_GPIO }, /* triggers power off */
223 { 9, MPP_GPIO }, /* power button switch */
224 { 10, MPP_GPIO }, /* reset button switch */
225 { 11, MPP_UNUSED },
226 { 12, MPP_UNUSED },
227 { 13, MPP_UNUSED },
228 { 14, MPP_UNUSED },
229 { 15, MPP_UNUSED },
230 { 16, MPP_UNUSED },
231 { 17, MPP_UNUSED },
232 { 18, MPP_UNUSED },
233 { 19, MPP_UNUSED },
234 { -1 },
215}; 235};
216 236
217/* 237/*
@@ -225,17 +245,15 @@ static struct platform_device *dns323_plat_devices[] __initdata = {
225static struct i2c_board_info __initdata dns323_i2c_devices[] = { 245static struct i2c_board_info __initdata dns323_i2c_devices[] = {
226 { 246 {
227 I2C_BOARD_INFO("g760a", 0x3e), 247 I2C_BOARD_INFO("g760a", 0x3e),
228 },
229#if 0 248#if 0
230 /* this entry requires the new-style driver model lm75 driver, 249 /* this entry requires the new-style driver model lm75 driver,
231 * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */ 250 * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */
232 { 251 }, {
233 I2C_BOARD_INFO("g751", 0x48), 252 I2C_BOARD_INFO("g751", 0x48),
234 },
235#endif 253#endif
236 { 254 }, {
237 I2C_BOARD_INFO("m41t80", 0x68), 255 I2C_BOARD_INFO("m41t80", 0x68),
238 } 256 },
239}; 257};
240 258
241/* DNS-323 specific power off method */ 259/* DNS-323 specific power off method */
@@ -250,62 +268,35 @@ static void __init dns323_init(void)
250 /* Setup basic Orion functions. Need to be called early. */ 268 /* Setup basic Orion functions. Need to be called early. */
251 orion5x_init(); 269 orion5x_init();
252 270
271 orion5x_mpp_conf(dns323_mpp_modes);
272 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */
273
274 /*
275 * Configure peripherals.
276 */
277 orion5x_ehci0_init();
278 orion5x_eth_init(&dns323_eth_data);
279 orion5x_i2c_init();
280 orion5x_uart0_init();
281
253 /* setup flash mapping 282 /* setup flash mapping
254 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4 283 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
255 */ 284 */
256 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE); 285 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
286 platform_device_register(&dns323_nor_flash);
257 287
258 /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIe 288 platform_device_register(&dns323_gpio_leds);
259 *
260 * Open a special address decode windows for the PCIe WA.
261 */
262 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
263 ORION5X_PCIE_WA_SIZE);
264
265 /* set MPP to 0 as D-Link's 2.6.12.6 kernel did */
266 orion5x_write(MPP_0_7_CTRL, 0);
267 orion5x_write(MPP_8_15_CTRL, 0);
268 orion5x_write(MPP_16_19_CTRL, 0);
269 orion5x_write(MPP_DEV_CTRL, 0);
270
271 /* Define used GPIO pins
272
273 GPIO Map:
274
275 | 0 | | PEX_RST_OUT (not controlled by GPIO)
276 | 1 | Out | right amber LED (= sata ch0 LED) (low-active)
277 | 2 | Out | left amber LED (= sata ch1 LED) (low-active)
278 | 3 | Out | //unknown//
279 | 4 | Out | power button LED (low-active, together with pin #5)
280 | 5 | Out | power button LED (low-active, together with pin #4)
281 | 6 | In | GMT G751-2f overtemp. shutdown signal (low-active)
282 | 7 | In | M41T80 nIRQ/OUT/SQW signal
283 | 8 | Out | triggers power off (high-active)
284 | 9 | In | power button switch (low-active)
285 | 10 | In | reset button switch (low-active)
286 | 11 | Out | //unknown//
287 | 12 | Out | //unknown//
288 | 13 | Out | //unknown//
289 | 14 | Out | //unknown//
290 | 15 | Out | //unknown//
291 */
292 orion5x_gpio_set_valid_pins(0x07f6);
293
294 /* register dns323 specific power-off method */
295 if ((gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0)
296 || (gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0))
297 pr_err("DNS323: failed to setup power-off GPIO\n");
298
299 pm_power_off = dns323_power_off;
300 289
301 /* register flash and other platform devices */ 290 platform_device_register(&dns323_button_device);
302 platform_add_devices(dns323_plat_devices,
303 ARRAY_SIZE(dns323_plat_devices));
304 291
305 i2c_register_board_info(0, dns323_i2c_devices, 292 i2c_register_board_info(0, dns323_i2c_devices,
306 ARRAY_SIZE(dns323_i2c_devices)); 293 ARRAY_SIZE(dns323_i2c_devices));
307 294
308 orion5x_eth_init(&dns323_eth_data); 295 /* register dns323 specific power-off method */
296 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
297 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
298 pr_err("DNS323: failed to setup power-off GPIO\n");
299 pm_power_off = dns323_power_off;
309} 300}
310 301
311/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ 302/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
diff --git a/arch/arm/mach-orion5x/gpio.c b/arch/arm/mach-orion5x/gpio.c
index 8108c316c426..d09797990f41 100644
--- a/arch/arm/mach-orion5x/gpio.c
+++ b/arch/arm/mach-orion5x/gpio.c
@@ -24,9 +24,12 @@ static DEFINE_SPINLOCK(gpio_lock);
24static unsigned long gpio_valid[BITS_TO_LONGS(GPIO_MAX)]; 24static unsigned long gpio_valid[BITS_TO_LONGS(GPIO_MAX)];
25static const char *gpio_label[GPIO_MAX]; /* non null for allocated GPIOs */ 25static const char *gpio_label[GPIO_MAX]; /* non null for allocated GPIOs */
26 26
27void __init orion5x_gpio_set_valid_pins(u32 pins) 27void __init orion5x_gpio_set_valid(unsigned pin, int valid)
28{ 28{
29 gpio_valid[0] = pins; 29 if (valid)
30 __set_bit(pin, gpio_valid);
31 else
32 __clear_bit(pin, gpio_valid);
30} 33}
31 34
32/* 35/*
@@ -93,10 +96,10 @@ int gpio_get_value(unsigned pin)
93{ 96{
94 int val, mask = 1 << pin; 97 int val, mask = 1 << pin;
95 98
96 if (orion5x_read(GPIO_IO_CONF) & mask) 99 if (readl(GPIO_IO_CONF) & mask)
97 val = orion5x_read(GPIO_DATA_IN) ^ orion5x_read(GPIO_IN_POL); 100 val = readl(GPIO_DATA_IN) ^ readl(GPIO_IN_POL);
98 else 101 else
99 val = orion5x_read(GPIO_OUT); 102 val = readl(GPIO_OUT);
100 103
101 return val & mask; 104 return val & mask;
102} 105}
@@ -188,39 +191,39 @@ void gpio_display(void)
188 printk("GPIO, free\n"); 191 printk("GPIO, free\n");
189 } else { 192 } else {
190 printk("GPIO, used by %s, ", gpio_label[i]); 193 printk("GPIO, used by %s, ", gpio_label[i]);
191 if (orion5x_read(GPIO_IO_CONF) & (1 << i)) { 194 if (readl(GPIO_IO_CONF) & (1 << i)) {
192 printk("input, active %s, level %s, edge %s\n", 195 printk("input, active %s, level %s, edge %s\n",
193 ((orion5x_read(GPIO_IN_POL) >> i) & 1) ? "low" : "high", 196 ((readl(GPIO_IN_POL) >> i) & 1) ? "low" : "high",
194 ((orion5x_read(GPIO_LEVEL_MASK) >> i) & 1) ? "enabled" : "masked", 197 ((readl(GPIO_LEVEL_MASK) >> i) & 1) ? "enabled" : "masked",
195 ((orion5x_read(GPIO_EDGE_MASK) >> i) & 1) ? "enabled" : "masked"); 198 ((readl(GPIO_EDGE_MASK) >> i) & 1) ? "enabled" : "masked");
196 } else { 199 } else {
197 printk("output, val=%d\n", (orion5x_read(GPIO_OUT) >> i) & 1); 200 printk("output, val=%d\n", (readl(GPIO_OUT) >> i) & 1);
198 } 201 }
199 } 202 }
200 } 203 }
201 204
202 printk(KERN_DEBUG "MPP_0_7_CTRL (0x%08x) = 0x%08x\n", 205 printk(KERN_DEBUG "MPP_0_7_CTRL (0x%08x) = 0x%08x\n",
203 MPP_0_7_CTRL, orion5x_read(MPP_0_7_CTRL)); 206 MPP_0_7_CTRL, readl(MPP_0_7_CTRL));
204 printk(KERN_DEBUG "MPP_8_15_CTRL (0x%08x) = 0x%08x\n", 207 printk(KERN_DEBUG "MPP_8_15_CTRL (0x%08x) = 0x%08x\n",
205 MPP_8_15_CTRL, orion5x_read(MPP_8_15_CTRL)); 208 MPP_8_15_CTRL, readl(MPP_8_15_CTRL));
206 printk(KERN_DEBUG "MPP_16_19_CTRL (0x%08x) = 0x%08x\n", 209 printk(KERN_DEBUG "MPP_16_19_CTRL (0x%08x) = 0x%08x\n",
207 MPP_16_19_CTRL, orion5x_read(MPP_16_19_CTRL)); 210 MPP_16_19_CTRL, readl(MPP_16_19_CTRL));
208 printk(KERN_DEBUG "MPP_DEV_CTRL (0x%08x) = 0x%08x\n", 211 printk(KERN_DEBUG "MPP_DEV_CTRL (0x%08x) = 0x%08x\n",
209 MPP_DEV_CTRL, orion5x_read(MPP_DEV_CTRL)); 212 MPP_DEV_CTRL, readl(MPP_DEV_CTRL));
210 printk(KERN_DEBUG "GPIO_OUT (0x%08x) = 0x%08x\n", 213 printk(KERN_DEBUG "GPIO_OUT (0x%08x) = 0x%08x\n",
211 GPIO_OUT, orion5x_read(GPIO_OUT)); 214 GPIO_OUT, readl(GPIO_OUT));
212 printk(KERN_DEBUG "GPIO_IO_CONF (0x%08x) = 0x%08x\n", 215 printk(KERN_DEBUG "GPIO_IO_CONF (0x%08x) = 0x%08x\n",
213 GPIO_IO_CONF, orion5x_read(GPIO_IO_CONF)); 216 GPIO_IO_CONF, readl(GPIO_IO_CONF));
214 printk(KERN_DEBUG "GPIO_BLINK_EN (0x%08x) = 0x%08x\n", 217 printk(KERN_DEBUG "GPIO_BLINK_EN (0x%08x) = 0x%08x\n",
215 GPIO_BLINK_EN, orion5x_read(GPIO_BLINK_EN)); 218 GPIO_BLINK_EN, readl(GPIO_BLINK_EN));
216 printk(KERN_DEBUG "GPIO_IN_POL (0x%08x) = 0x%08x\n", 219 printk(KERN_DEBUG "GPIO_IN_POL (0x%08x) = 0x%08x\n",
217 GPIO_IN_POL, orion5x_read(GPIO_IN_POL)); 220 GPIO_IN_POL, readl(GPIO_IN_POL));
218 printk(KERN_DEBUG "GPIO_DATA_IN (0x%08x) = 0x%08x\n", 221 printk(KERN_DEBUG "GPIO_DATA_IN (0x%08x) = 0x%08x\n",
219 GPIO_DATA_IN, orion5x_read(GPIO_DATA_IN)); 222 GPIO_DATA_IN, readl(GPIO_DATA_IN));
220 printk(KERN_DEBUG "GPIO_LEVEL_MASK (0x%08x) = 0x%08x\n", 223 printk(KERN_DEBUG "GPIO_LEVEL_MASK (0x%08x) = 0x%08x\n",
221 GPIO_LEVEL_MASK, orion5x_read(GPIO_LEVEL_MASK)); 224 GPIO_LEVEL_MASK, readl(GPIO_LEVEL_MASK));
222 printk(KERN_DEBUG "GPIO_EDGE_CAUSE (0x%08x) = 0x%08x\n", 225 printk(KERN_DEBUG "GPIO_EDGE_CAUSE (0x%08x) = 0x%08x\n",
223 GPIO_EDGE_CAUSE, orion5x_read(GPIO_EDGE_CAUSE)); 226 GPIO_EDGE_CAUSE, readl(GPIO_EDGE_CAUSE));
224 printk(KERN_DEBUG "GPIO_EDGE_MASK (0x%08x) = 0x%08x\n", 227 printk(KERN_DEBUG "GPIO_EDGE_MASK (0x%08x) = 0x%08x\n",
225 GPIO_EDGE_MASK, orion5x_read(GPIO_EDGE_MASK)); 228 GPIO_EDGE_MASK, readl(GPIO_EDGE_MASK));
226} 229}
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index dd21f38c5d37..e2a0084ab4a3 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -82,7 +82,7 @@ static int orion5x_gpio_set_irq_type(u32 irq, u32 type)
82 int pin = irq_to_gpio(irq); 82 int pin = irq_to_gpio(irq);
83 struct irq_desc *desc; 83 struct irq_desc *desc;
84 84
85 if ((orion5x_read(GPIO_IO_CONF) & (1 << pin)) == 0) { 85 if ((readl(GPIO_IO_CONF) & (1 << pin)) == 0) {
86 printk(KERN_ERR "orion5x_gpio_set_irq_type failed " 86 printk(KERN_ERR "orion5x_gpio_set_irq_type failed "
87 "(irq %d, pin %d).\n", irq, pin); 87 "(irq %d, pin %d).\n", irq, pin);
88 return -EINVAL; 88 return -EINVAL;
@@ -117,7 +117,7 @@ static int orion5x_gpio_set_irq_type(u32 irq, u32 type)
117 /* 117 /*
118 * set initial polarity based on current input level 118 * set initial polarity based on current input level
119 */ 119 */
120 if ((orion5x_read(GPIO_IN_POL) ^ orion5x_read(GPIO_DATA_IN)) 120 if ((readl(GPIO_IN_POL) ^ readl(GPIO_DATA_IN))
121 & (1 << pin)) 121 & (1 << pin))
122 orion5x_setbits(GPIO_IN_POL, (1 << pin)); /* falling */ 122 orion5x_setbits(GPIO_IN_POL, (1 << pin)); /* falling */
123 else 123 else
@@ -149,8 +149,8 @@ static void orion5x_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
149 149
150 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31); 150 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31);
151 offs = (irq - IRQ_ORION5X_GPIO_0_7) * 8; 151 offs = (irq - IRQ_ORION5X_GPIO_0_7) * 8;
152 cause = (orion5x_read(GPIO_DATA_IN) & orion5x_read(GPIO_LEVEL_MASK)) | 152 cause = (readl(GPIO_DATA_IN) & readl(GPIO_LEVEL_MASK)) |
153 (orion5x_read(GPIO_EDGE_CAUSE) & orion5x_read(GPIO_EDGE_MASK)); 153 (readl(GPIO_EDGE_CAUSE) & readl(GPIO_EDGE_MASK));
154 154
155 for (pin = offs; pin < offs + 8; pin++) { 155 for (pin = offs; pin < offs + 8; pin++) {
156 if (cause & (1 << pin)) { 156 if (cause & (1 << pin)) {
@@ -158,9 +158,9 @@ static void orion5x_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
158 desc = irq_desc + irq; 158 desc = irq_desc + irq;
159 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQT_BOTHEDGE) { 159 if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQT_BOTHEDGE) {
160 /* Swap polarity (race with GPIO line) */ 160 /* Swap polarity (race with GPIO line) */
161 u32 polarity = orion5x_read(GPIO_IN_POL); 161 u32 polarity = readl(GPIO_IN_POL);
162 polarity ^= 1 << pin; 162 polarity ^= 1 << pin;
163 orion5x_write(GPIO_IN_POL, polarity); 163 writel(polarity, GPIO_IN_POL);
164 } 164 }
165 desc_handle_irq(irq, desc); 165 desc_handle_irq(irq, desc);
166 } 166 }
@@ -175,9 +175,9 @@ static void __init orion5x_init_gpio_irq(void)
175 /* 175 /*
176 * Mask and clear GPIO IRQ interrupts 176 * Mask and clear GPIO IRQ interrupts
177 */ 177 */
178 orion5x_write(GPIO_LEVEL_MASK, 0x0); 178 writel(0x0, GPIO_LEVEL_MASK);
179 orion5x_write(GPIO_EDGE_MASK, 0x0); 179 writel(0x0, GPIO_EDGE_MASK);
180 orion5x_write(GPIO_EDGE_CAUSE, 0x0); 180 writel(0x0, GPIO_EDGE_CAUSE);
181 181
182 /* 182 /*
183 * Register chained level handlers for GPIO IRQs by default. 183 * Register chained level handlers for GPIO IRQs by default.
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index f5074b877b7f..84feac4a1fe2 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -13,10 +13,12 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/delay.h>
16#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
18#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
19#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/serial_reg.h>
20#include <linux/ata_platform.h> 22#include <linux/ata_platform.h>
21#include <asm/mach-types.h> 23#include <asm/mach-types.h>
22#include <asm/gpio.h> 24#include <asm/gpio.h>
@@ -25,6 +27,7 @@
25#include <asm/arch/orion5x.h> 27#include <asm/arch/orion5x.h>
26#include <asm/plat-orion/orion_nand.h> 28#include <asm/plat-orion/orion_nand.h>
27#include "common.h" 29#include "common.h"
30#include "mpp.h"
28 31
29/***************************************************************************** 32/*****************************************************************************
30 * KUROBOX-PRO Info 33 * KUROBOX-PRO Info
@@ -53,13 +56,11 @@ static struct mtd_partition kurobox_pro_nand_parts[] = {
53 .name = "uImage", 56 .name = "uImage",
54 .offset = 0, 57 .offset = 0,
55 .size = SZ_4M, 58 .size = SZ_4M,
56 }, 59 }, {
57 {
58 .name = "rootfs", 60 .name = "rootfs",
59 .offset = SZ_4M, 61 .offset = SZ_4M,
60 .size = SZ_64M, 62 .size = SZ_64M,
61 }, 63 }, {
62 {
63 .name = "extra", 64 .name = "extra",
64 .offset = SZ_4M + SZ_64M, 65 .offset = SZ_4M + SZ_64M,
65 .size = SZ_256M - (SZ_4M + SZ_64M), 66 .size = SZ_256M - (SZ_4M + SZ_64M),
@@ -132,8 +133,6 @@ static int __init kurobox_pro_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
132 /* 133 /*
133 * PCI isn't used on the Kuro 134 * PCI isn't used on the Kuro
134 */ 135 */
135 printk(KERN_ERR "kurobox_pro_pci_map_irq failed, unknown bus\n");
136
137 return -1; 136 return -1;
138} 137}
139 138
@@ -161,7 +160,6 @@ subsys_initcall(kurobox_pro_pci_init);
161 160
162static struct mv643xx_eth_platform_data kurobox_pro_eth_data = { 161static struct mv643xx_eth_platform_data kurobox_pro_eth_data = {
163 .phy_addr = 8, 162 .phy_addr = 8,
164 .force_phy_addr = 1,
165}; 163};
166 164
167/***************************************************************************** 165/*****************************************************************************
@@ -175,12 +173,169 @@ static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = {
175 * SATA 173 * SATA
176 ****************************************************************************/ 174 ****************************************************************************/
177static struct mv_sata_platform_data kurobox_pro_sata_data = { 175static struct mv_sata_platform_data kurobox_pro_sata_data = {
178 .n_ports = 2, 176 .n_ports = 2,
179}; 177};
180 178
181/***************************************************************************** 179/*****************************************************************************
180 * Kurobox Pro specific power off method via UART1-attached microcontroller
181 ****************************************************************************/
182
183#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
184
185static int kurobox_pro_miconread(unsigned char *buf, int count)
186{
187 int i;
188 int timeout;
189
190 for (i = 0; i < count; i++) {
191 timeout = 10;
192
193 while (!(readl(UART1_REG(LSR)) & UART_LSR_DR)) {
194 if (--timeout == 0)
195 break;
196 udelay(1000);
197 }
198
199 if (timeout == 0)
200 break;
201 buf[i] = readl(UART1_REG(RX));
202 }
203
204 /* return read bytes */
205 return i;
206}
207
208static int kurobox_pro_miconwrite(const unsigned char *buf, int count)
209{
210 int i = 0;
211
212 while (count--) {
213 while (!(readl(UART1_REG(LSR)) & UART_LSR_THRE))
214 barrier();
215 writel(buf[i++], UART1_REG(TX));
216 }
217
218 return 0;
219}
220
221static int kurobox_pro_miconsend(const unsigned char *data, int count)
222{
223 int i;
224 unsigned char checksum = 0;
225 unsigned char recv_buf[40];
226 unsigned char send_buf[40];
227 unsigned char correct_ack[3];
228 int retry = 2;
229
230 /* Generate checksum */
231 for (i = 0; i < count; i++)
232 checksum -= data[i];
233
234 do {
235 /* Send data */
236 kurobox_pro_miconwrite(data, count);
237
238 /* send checksum */
239 kurobox_pro_miconwrite(&checksum, 1);
240
241 if (kurobox_pro_miconread(recv_buf, sizeof(recv_buf)) <= 3) {
242 printk(KERN_ERR ">%s: receive failed.\n", __func__);
243
244 /* send preamble to clear the receive buffer */
245 memset(&send_buf, 0xff, sizeof(send_buf));
246 kurobox_pro_miconwrite(send_buf, sizeof(send_buf));
247
248 /* make dummy reads */
249 mdelay(100);
250 kurobox_pro_miconread(recv_buf, sizeof(recv_buf));
251 } else {
252 /* Generate expected ack */
253 correct_ack[0] = 0x01;
254 correct_ack[1] = data[1];
255 correct_ack[2] = 0x00;
256
257 /* checksum Check */
258 if ((recv_buf[0] + recv_buf[1] + recv_buf[2] +
259 recv_buf[3]) & 0xFF) {
260 printk(KERN_ERR ">%s: Checksum Error : "
261 "Received data[%02x, %02x, %02x, %02x]"
262 "\n", __func__, recv_buf[0],
263 recv_buf[1], recv_buf[2], recv_buf[3]);
264 } else {
265 /* Check Received Data */
266 if (correct_ack[0] == recv_buf[0] &&
267 correct_ack[1] == recv_buf[1] &&
268 correct_ack[2] == recv_buf[2]) {
269 /* Interval for next command */
270 mdelay(10);
271
272 /* Receive ACK */
273 return 0;
274 }
275 }
276 /* Received NAK or illegal Data */
277 printk(KERN_ERR ">%s: Error : NAK or Illegal Data "
278 "Received\n", __func__);
279 }
280 } while (retry--);
281
282 /* Interval for next command */
283 mdelay(10);
284
285 return -1;
286}
287
288static void kurobox_pro_power_off(void)
289{
290 const unsigned char watchdogkill[] = {0x01, 0x35, 0x00};
291 const unsigned char shutdownwait[] = {0x00, 0x0c};
292 const unsigned char poweroff[] = {0x00, 0x06};
293 /* 38400 baud divisor */
294 const unsigned divisor = ((ORION5X_TCLK + (8 * 38400)) / (16 * 38400));
295
296 pr_info("%s: triggering power-off...\n", __func__);
297
298 /* hijack uart1 and reset into sane state (38400,8n1,even parity) */
299 writel(0x83, UART1_REG(LCR));
300 writel(divisor & 0xff, UART1_REG(DLL));
301 writel((divisor >> 8) & 0xff, UART1_REG(DLM));
302 writel(0x1b, UART1_REG(LCR));
303 writel(0x00, UART1_REG(IER));
304 writel(0x07, UART1_REG(FCR));
305 writel(0x00, UART1_REG(MCR));
306
307 /* Send the commands to shutdown the Kurobox Pro */
308 kurobox_pro_miconsend(watchdogkill, sizeof(watchdogkill)) ;
309 kurobox_pro_miconsend(shutdownwait, sizeof(shutdownwait)) ;
310 kurobox_pro_miconsend(poweroff, sizeof(poweroff));
311}
312
313/*****************************************************************************
182 * General Setup 314 * General Setup
183 ****************************************************************************/ 315 ****************************************************************************/
316static struct orion5x_mpp_mode kurobox_pro_mpp_modes[] __initdata = {
317 { 0, MPP_UNUSED },
318 { 1, MPP_UNUSED },
319 { 2, MPP_GPIO }, /* GPIO Micon */
320 { 3, MPP_GPIO }, /* GPIO Rtc */
321 { 4, MPP_UNUSED },
322 { 5, MPP_UNUSED },
323 { 6, MPP_NAND }, /* NAND Flash REn */
324 { 7, MPP_NAND }, /* NAND Flash WEn */
325 { 8, MPP_UNUSED },
326 { 9, MPP_UNUSED },
327 { 10, MPP_UNUSED },
328 { 11, MPP_UNUSED },
329 { 12, MPP_SATA_LED }, /* SATA 0 presence */
330 { 13, MPP_SATA_LED }, /* SATA 1 presence */
331 { 14, MPP_SATA_LED }, /* SATA 0 active */
332 { 15, MPP_SATA_LED }, /* SATA 1 active */
333 { 16, MPP_UART }, /* UART1 RXD */
334 { 17, MPP_UART }, /* UART1 TXD */
335 { 18, MPP_UART }, /* UART1 CTSn */
336 { 19, MPP_UART }, /* UART1 RTSn */
337 { -1 },
338};
184 339
185static void __init kurobox_pro_init(void) 340static void __init kurobox_pro_init(void)
186{ 341{
@@ -189,46 +344,33 @@ static void __init kurobox_pro_init(void)
189 */ 344 */
190 orion5x_init(); 345 orion5x_init();
191 346
192 /* 347 orion5x_mpp_conf(kurobox_pro_mpp_modes);
193 * Setup the CPU address decode windows for our devices
194 */
195 orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
196 KUROBOX_PRO_NOR_BOOT_SIZE);
197 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, KUROBOX_PRO_NAND_SIZE);
198 348
199 /* 349 /*
200 * Open a special address decode windows for the PCIe WA. 350 * Configure peripherals.
201 */ 351 */
202 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 352 orion5x_ehci0_init();
203 ORION5X_PCIE_WA_SIZE); 353 orion5x_ehci1_init();
204 354 orion5x_eth_init(&kurobox_pro_eth_data);
205 /* 355 orion5x_i2c_init();
206 * Setup Multiplexing Pins -- 356 orion5x_sata_init(&kurobox_pro_sata_data);
207 * MPP[0-1] Not used 357 orion5x_uart0_init();
208 * MPP[2] GPIO Micon 358 orion5x_uart1_init();
209 * MPP[3] GPIO RTC
210 * MPP[4-5] Not used
211 * MPP[6] Nand Flash REn
212 * MPP[7] Nand Flash WEn
213 * MPP[8-11] Not used
214 * MPP[12] SATA 0 presence Indication
215 * MPP[13] SATA 1 presence Indication
216 * MPP[14] SATA 0 active Indication
217 * MPP[15] SATA 1 active indication
218 * MPP[16-19] Not used
219 */
220 orion5x_write(MPP_0_7_CTRL, 0x44220003);
221 orion5x_write(MPP_8_15_CTRL, 0x55550000);
222 orion5x_write(MPP_16_19_CTRL, 0x0);
223
224 orion5x_gpio_set_valid_pins(0x0000000c);
225 359
360 orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
361 KUROBOX_PRO_NOR_BOOT_SIZE);
226 platform_device_register(&kurobox_pro_nor_flash); 362 platform_device_register(&kurobox_pro_nor_flash);
227 if (machine_is_kurobox_pro()) 363
364 if (machine_is_kurobox_pro()) {
365 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE,
366 KUROBOX_PRO_NAND_SIZE);
228 platform_device_register(&kurobox_pro_nand_flash); 367 platform_device_register(&kurobox_pro_nand_flash);
368 }
369
229 i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1); 370 i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
230 orion5x_eth_init(&kurobox_pro_eth_data); 371
231 orion5x_sata_init(&kurobox_pro_sata_data); 372 /* register Kurobox Pro specific power-off method */
373 pm_power_off = kurobox_pro_power_off;
232} 374}
233 375
234#ifdef CONFIG_MACH_KUROBOX_PRO 376#ifdef CONFIG_MACH_KUROBOX_PRO
diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
new file mode 100644
index 000000000000..a48cadb01590
--- /dev/null
+++ b/arch/arm/mach-orion5x/mpp.c
@@ -0,0 +1,163 @@
1/*
2 * arch/arm/mach-orion5x/mpp.c
3 *
4 * MPP functions for Marvell Orion 5x SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <asm/hardware.h>
15#include <asm/io.h>
16#include "common.h"
17#include "mpp.h"
18
19static int is_5181l(void)
20{
21 u32 dev;
22 u32 rev;
23
24 orion5x_pcie_id(&dev, &rev);
25
26 return !!(dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0);
27}
28
29static int is_5182(void)
30{
31 u32 dev;
32 u32 rev;
33
34 orion5x_pcie_id(&dev, &rev);
35
36 return !!(dev == MV88F5182_DEV_ID);
37}
38
39static int is_5281(void)
40{
41 u32 dev;
42 u32 rev;
43
44 orion5x_pcie_id(&dev, &rev);
45
46 return !!(dev == MV88F5281_DEV_ID);
47}
48
49static int __init determine_type_encoding(int mpp, enum orion5x_mpp_type type)
50{
51 switch (type) {
52 case MPP_UNUSED:
53 case MPP_GPIO:
54 if (mpp == 0)
55 return 3;
56 if (mpp >= 1 && mpp <= 15)
57 return 0;
58 if (mpp >= 16 && mpp <= 19) {
59 if (is_5182())
60 return 5;
61 if (type == MPP_UNUSED)
62 return 0;
63 }
64 return -1;
65
66 case MPP_PCIE_RST_OUTn:
67 if (mpp == 0)
68 return 0;
69 return -1;
70
71 case MPP_PCI_ARB:
72 if (mpp >= 0 && mpp <= 7)
73 return 2;
74 return -1;
75
76 case MPP_PCI_PMEn:
77 if (mpp == 2)
78 return 3;
79 return -1;
80
81 case MPP_GIGE:
82 if (mpp >= 8 && mpp <= 19)
83 return 1;
84 return -1;
85
86 case MPP_NAND:
87 if (is_5182() || is_5281()) {
88 if (mpp >= 4 && mpp <= 7)
89 return 4;
90 if (mpp >= 12 && mpp <= 17)
91 return 4;
92 }
93 return -1;
94
95 case MPP_PCI_CLK:
96 if (is_5181l() && mpp >= 6 && mpp <= 7)
97 return 5;
98 return -1;
99
100 case MPP_SATA_LED:
101 if (is_5182()) {
102 if (mpp >= 4 && mpp <= 7)
103 return 5;
104 if (mpp >= 12 && mpp <= 15)
105 return 5;
106 }
107 return -1;
108
109 case MPP_UART:
110 if (mpp >= 16 && mpp <= 19)
111 return 0;
112 return -1;
113 }
114
115 printk(KERN_INFO "unknown MPP type %d\n", type);
116
117 return -1;
118}
119
120void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
121{
122 u32 mpp_0_7_ctrl = readl(MPP_0_7_CTRL);
123 u32 mpp_8_15_ctrl = readl(MPP_8_15_CTRL);
124 u32 mpp_16_19_ctrl = readl(MPP_16_19_CTRL);
125
126 while (mode->mpp >= 0) {
127 u32 *reg;
128 int num_type;
129 int shift;
130
131 if (mode->mpp >= 0 && mode->mpp <= 7)
132 reg = &mpp_0_7_ctrl;
133 else if (mode->mpp >= 8 && mode->mpp <= 15)
134 reg = &mpp_8_15_ctrl;
135 else if (mode->mpp >= 16 && mode->mpp <= 19)
136 reg = &mpp_16_19_ctrl;
137 else {
138 printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
139 "(%d)\n", mode->mpp);
140 continue;
141 }
142
143 num_type = determine_type_encoding(mode->mpp, mode->type);
144 if (num_type < 0) {
145 printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
146 "combination (%d, %d)\n", mode->mpp,
147 mode->type);
148 continue;
149 }
150
151 shift = (mode->mpp & 7) << 2;
152 *reg &= ~(0xf << shift);
153 *reg |= (num_type & 0xf) << shift;
154
155 orion5x_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));
156
157 mode++;
158 }
159
160 writel(mpp_0_7_ctrl, MPP_0_7_CTRL);
161 writel(mpp_8_15_ctrl, MPP_8_15_CTRL);
162 writel(mpp_16_19_ctrl, MPP_16_19_CTRL);
163}
diff --git a/arch/arm/mach-orion5x/mpp.h b/arch/arm/mach-orion5x/mpp.h
new file mode 100644
index 000000000000..290e610dc012
--- /dev/null
+++ b/arch/arm/mach-orion5x/mpp.h
@@ -0,0 +1,74 @@
1#ifndef __ARCH_ORION5X_MPP_H
2#define __ARCH_ORION5X_MPP_H
3
4enum orion5x_mpp_type {
5 /*
6 * This MPP is unused.
7 */
8 MPP_UNUSED,
9
10 /*
11 * This MPP pin is used as a generic GPIO pin. Valid for
12 * MPPs 0-15 and device bus data pins 16-31. On 5182, also
13 * valid for MPPs 16-19.
14 */
15 MPP_GPIO,
16
17 /*
18 * This MPP is used as PCIe_RST_OUTn pin. Valid for
19 * MPP 0 only.
20 */
21 MPP_PCIE_RST_OUTn,
22
23 /*
24 * This MPP is used as PCI arbiter pin (REQn/GNTn).
25 * Valid for MPPs 0-7 only.
26 */
27 MPP_PCI_ARB,
28
29 /*
30 * This MPP is used as PCI_PMEn pin. Valid for MPP 2 only.
31 */
32 MPP_PCI_PMEn,
33
34 /*
35 * This MPP is used as GigE half-duplex (COL, CRS) or GMII
36 * (RXERR, CRS, TXERR, TXD[7:4], RXD[7:4]) pin. Valid for
37 * MPPs 8-19 only.
38 */
39 MPP_GIGE,
40
41 /*
42 * This MPP is used as NAND REn/WEn pin. Valid for MPPs
43 * 4-7 and 12-17 only, and only on the 5181l/5182/5281.
44 */
45 MPP_NAND,
46
47 /*
48 * This MPP is used as a PCI clock output pin. Valid for
49 * MPPs 6-7 only, and only on the 5181l.
50 */
51 MPP_PCI_CLK,
52
53 /*
54 * This MPP is used as a SATA presence/activity LED.
55 * Valid for MPPs 4-7 and 12-15 only, and only on the 5182.
56 */
57 MPP_SATA_LED,
58
59 /*
60 * This MPP is used as UART1 RXD/TXD/CTSn/RTSn pin.
61 * Valid for MPPs 16-19 only.
62 */
63 MPP_UART,
64};
65
66struct orion5x_mpp_mode {
67 int mpp;
68 enum orion5x_mpp_type type;
69};
70
71void orion5x_mpp_conf(struct orion5x_mpp_mode *mode);
72
73
74#endif
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c
new file mode 100644
index 000000000000..7ce9e407d9d1
--- /dev/null
+++ b/arch/arm/mach-orion5x/mss2-setup.c
@@ -0,0 +1,270 @@
1/*
2 * Maxtor Shared Storage II Board Setup
3 *
4 * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/pci.h>
16#include <linux/irq.h>
17#include <linux/mtd/physmap.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/leds.h>
20#include <linux/gpio_keys.h>
21#include <linux/input.h>
22#include <linux/i2c.h>
23#include <linux/ata_platform.h>
24#include <linux/gpio.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <asm/mach/pci.h>
28#include <asm/arch/orion5x.h>
29#include "common.h"
30#include "mpp.h"
31
32#define MSS2_NOR_BOOT_BASE 0xff800000
33#define MSS2_NOR_BOOT_SIZE SZ_256K
34
35/*****************************************************************************
36 * Maxtor Shared Storage II Info
37 ****************************************************************************/
38
39/*
40 * Maxtor Shared Storage II hardware :
41 * - Marvell 88F5182-A2 C500
42 * - Marvell 88E1111 Gigabit Ethernet PHY
43 * - RTC M41T81 (@0x68) on I2C bus
44 * - 256KB NOR flash
45 * - 64MB of RAM
46 */
47
48/*****************************************************************************
49 * 256KB NOR Flash on BOOT Device
50 ****************************************************************************/
51
52static struct physmap_flash_data mss2_nor_flash_data = {
53 .width = 1,
54};
55
56static struct resource mss2_nor_flash_resource = {
57 .flags = IORESOURCE_MEM,
58 .start = MSS2_NOR_BOOT_BASE,
59 .end = MSS2_NOR_BOOT_BASE + MSS2_NOR_BOOT_SIZE - 1,
60};
61
62static struct platform_device mss2_nor_flash = {
63 .name = "physmap-flash",
64 .id = 0,
65 .dev = {
66 .platform_data = &mss2_nor_flash_data,
67 },
68 .resource = &mss2_nor_flash_resource,
69 .num_resources = 1,
70};
71
72/****************************************************************************
73 * PCI setup
74 ****************************************************************************/
75static int __init mss2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
76{
77 int irq;
78
79 /*
80 * Check for devices with hard-wired IRQs.
81 */
82 irq = orion5x_pci_map_irq(dev, slot, pin);
83 if (irq != -1)
84 return irq;
85
86 return -1;
87}
88
89static struct hw_pci mss2_pci __initdata = {
90 .nr_controllers = 2,
91 .swizzle = pci_std_swizzle,
92 .setup = orion5x_pci_sys_setup,
93 .scan = orion5x_pci_sys_scan_bus,
94 .map_irq = mss2_pci_map_irq,
95};
96
97static int __init mss2_pci_init(void)
98{
99 if (machine_is_mss2())
100 pci_common_init(&mss2_pci);
101
102 return 0;
103}
104subsys_initcall(mss2_pci_init);
105
106
107/*****************************************************************************
108 * Ethernet
109 ****************************************************************************/
110
111static struct mv643xx_eth_platform_data mss2_eth_data = {
112 .phy_addr = 8,
113};
114
115/*****************************************************************************
116 * SATA
117 ****************************************************************************/
118
119static struct mv_sata_platform_data mss2_sata_data = {
120 .n_ports = 2,
121};
122
123/*****************************************************************************
124 * GPIO buttons
125 ****************************************************************************/
126
127#define MSS2_GPIO_KEY_RESET 12
128#define MSS2_GPIO_KEY_POWER 11
129
130static struct gpio_keys_button mss2_buttons[] = {
131 {
132 .code = KEY_POWER,
133 .gpio = MSS2_GPIO_KEY_POWER,
134 .desc = "Power",
135 .active_low = 1,
136 }, {
137 .code = KEY_RESTART,
138 .gpio = MSS2_GPIO_KEY_RESET,
139 .desc = "Reset",
140 .active_low = 1,
141 },
142};
143
144static struct gpio_keys_platform_data mss2_button_data = {
145 .buttons = mss2_buttons,
146 .nbuttons = ARRAY_SIZE(mss2_buttons),
147};
148
149static struct platform_device mss2_button_device = {
150 .name = "gpio-keys",
151 .id = -1,
152 .dev = {
153 .platform_data = &mss2_button_data,
154 },
155};
156
157/*****************************************************************************
158 * RTC m41t81 on I2C bus
159 ****************************************************************************/
160
161#define MSS2_GPIO_RTC_IRQ 3
162
163static struct i2c_board_info __initdata mss2_i2c_rtc = {
164 I2C_BOARD_INFO("m41t81", 0x68),
165};
166
167/*****************************************************************************
168 * MSS2 power off method
169 ****************************************************************************/
170/*
171 * On the Maxtor Shared Storage II, the shutdown process is the following :
172 * - Userland modifies U-boot env to tell U-boot to go idle at next boot
173 * - The board reboots
174 * - U-boot starts and go into an idle mode until the user press "power"
175 */
176static void mss2_power_off(void)
177{
178 u32 reg;
179
180 /*
181 * Enable and issue soft reset
182 */
183 reg = readl(CPU_RESET_MASK);
184 reg |= 1 << 2;
185 writel(reg, CPU_RESET_MASK);
186
187 reg = readl(CPU_SOFT_RESET);
188 reg |= 1;
189 writel(reg, CPU_SOFT_RESET);
190}
191
192/****************************************************************************
193 * General Setup
194 ****************************************************************************/
195static struct orion5x_mpp_mode mss2_mpp_modes[] __initdata = {
196 { 0, MPP_GPIO }, /* Power LED */
197 { 1, MPP_GPIO }, /* Error LED */
198 { 2, MPP_UNUSED },
199 { 3, MPP_GPIO }, /* RTC interrupt */
200 { 4, MPP_GPIO }, /* HDD ind. (Single/Dual)*/
201 { 5, MPP_GPIO }, /* HD0 5V control */
202 { 6, MPP_GPIO }, /* HD0 12V control */
203 { 7, MPP_GPIO }, /* HD1 5V control */
204 { 8, MPP_GPIO }, /* HD1 12V control */
205 { 9, MPP_UNUSED },
206 { 10, MPP_GPIO }, /* Fan control */
207 { 11, MPP_GPIO }, /* Power button */
208 { 12, MPP_GPIO }, /* Reset button */
209 { 13, MPP_UNUSED },
210 { 14, MPP_SATA_LED }, /* SATA 0 active */
211 { 15, MPP_SATA_LED }, /* SATA 1 active */
212 { 16, MPP_UNUSED },
213 { 17, MPP_UNUSED },
214 { 18, MPP_UNUSED },
215 { 19, MPP_UNUSED },
216 { -1 },
217};
218
219static void __init mss2_init(void)
220{
221 /* Setup basic Orion functions. Need to be called early. */
222 orion5x_init();
223
224 orion5x_mpp_conf(mss2_mpp_modes);
225
226 /*
227 * MPP[20] Unused
228 * MPP[21] PCI clock
229 * MPP[22] USB 0 over current
230 * MPP[23] USB 1 over current
231 */
232
233 /*
234 * Configure peripherals.
235 */
236 orion5x_ehci0_init();
237 orion5x_ehci1_init();
238 orion5x_eth_init(&mss2_eth_data);
239 orion5x_i2c_init();
240 orion5x_sata_init(&mss2_sata_data);
241 orion5x_uart0_init();
242
243 orion5x_setup_dev_boot_win(MSS2_NOR_BOOT_BASE, MSS2_NOR_BOOT_SIZE);
244 platform_device_register(&mss2_nor_flash);
245
246 platform_device_register(&mss2_button_device);
247
248 if (gpio_request(MSS2_GPIO_RTC_IRQ, "rtc") == 0) {
249 if (gpio_direction_input(MSS2_GPIO_RTC_IRQ) == 0)
250 mss2_i2c_rtc.irq = gpio_to_irq(MSS2_GPIO_RTC_IRQ);
251 else
252 gpio_free(MSS2_GPIO_RTC_IRQ);
253 }
254 i2c_register_board_info(0, &mss2_i2c_rtc, 1);
255
256 /* register mss2 specific power-off method */
257 pm_power_off = mss2_power_off;
258}
259
260MACHINE_START(MSS2, "Maxtor Shared Storage II")
261 /* Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com> */
262 .phys_io = ORION5X_REGS_PHYS_BASE,
263 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
264 .boot_params = 0x00000100,
265 .init_machine = mss2_init,
266 .map_io = orion5x_map_io,
267 .init_irq = orion5x_init_irq,
268 .timer = &orion5x_timer,
269 .fixup = tag_fixup_mem32
270MACHINE_END
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c
new file mode 100644
index 000000000000..55f3b0fdef8b
--- /dev/null
+++ b/arch/arm/mach-orion5x/mv2120-setup.c
@@ -0,0 +1,239 @@
1/*
2 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
3 * Copyright (C) 2008 Martin Michlmayr <tbm@cyrius.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/irq.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/leds.h>
18#include <linux/gpio_keys.h>
19#include <linux/input.h>
20#include <linux/i2c.h>
21#include <linux/ata_platform.h>
22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/mach/arch.h>
25#include <asm/arch/orion5x.h>
26#include "common.h"
27#include "mpp.h"
28
29#define MV2120_NOR_BOOT_BASE 0xf4000000
30#define MV2120_NOR_BOOT_SIZE SZ_512K
31
32#define MV2120_GPIO_RTC_IRQ 3
33#define MV2120_GPIO_KEY_RESET 17
34#define MV2120_GPIO_KEY_POWER 18
35#define MV2120_GPIO_POWER_OFF 19
36
37
38/*****************************************************************************
39 * Ethernet
40 ****************************************************************************/
41static struct mv643xx_eth_platform_data mv2120_eth_data = {
42 .phy_addr = 8,
43};
44
45static struct mv_sata_platform_data mv2120_sata_data = {
46 .n_ports = 2,
47};
48
49static struct mtd_partition mv2120_partitions[] = {
50 {
51 .name = "firmware",
52 .size = 0x00080000,
53 .offset = 0,
54 },
55};
56
57static struct physmap_flash_data mv2120_nor_flash_data = {
58 .width = 1,
59 .parts = mv2120_partitions,
60 .nr_parts = ARRAY_SIZE(mv2120_partitions)
61};
62
63static struct resource mv2120_nor_flash_resource = {
64 .flags = IORESOURCE_MEM,
65 .start = MV2120_NOR_BOOT_BASE,
66 .end = MV2120_NOR_BOOT_BASE + MV2120_NOR_BOOT_SIZE - 1,
67};
68
69static struct platform_device mv2120_nor_flash = {
70 .name = "physmap-flash",
71 .id = 0,
72 .dev = {
73 .platform_data = &mv2120_nor_flash_data,
74 },
75 .resource = &mv2120_nor_flash_resource,
76 .num_resources = 1,
77};
78
79static struct gpio_keys_button mv2120_buttons[] = {
80 {
81 .code = KEY_RESTART,
82 .gpio = MV2120_GPIO_KEY_RESET,
83 .desc = "reset",
84 .active_low = 1,
85 }, {
86 .code = KEY_POWER,
87 .gpio = MV2120_GPIO_KEY_POWER,
88 .desc = "power",
89 .active_low = 1,
90 },
91};
92
93static struct gpio_keys_platform_data mv2120_button_data = {
94 .buttons = mv2120_buttons,
95 .nbuttons = ARRAY_SIZE(mv2120_buttons),
96};
97
98static struct platform_device mv2120_button_device = {
99 .name = "gpio-keys",
100 .id = -1,
101 .num_resources = 0,
102 .dev = {
103 .platform_data = &mv2120_button_data,
104 },
105};
106
107
108/****************************************************************************
109 * General Setup
110 ****************************************************************************/
111static struct orion5x_mpp_mode mv2120_mpp_modes[] __initdata = {
112 { 0, MPP_GPIO }, /* Sys status LED */
113 { 1, MPP_GPIO }, /* Sys error LED */
114 { 2, MPP_GPIO }, /* OverTemp interrupt */
115 { 3, MPP_GPIO }, /* RTC interrupt */
116 { 4, MPP_GPIO }, /* V_LED 5V */
117 { 5, MPP_GPIO }, /* V_LED 3.3V */
118 { 6, MPP_UNUSED },
119 { 7, MPP_UNUSED },
120 { 8, MPP_GPIO }, /* SATA 0 fail LED */
121 { 9, MPP_GPIO }, /* SATA 1 fail LED */
122 { 10, MPP_UNUSED },
123 { 11, MPP_UNUSED },
124 { 12, MPP_SATA_LED }, /* SATA 0 presence */
125 { 13, MPP_SATA_LED }, /* SATA 1 presence */
126 { 14, MPP_SATA_LED }, /* SATA 0 active */
127 { 15, MPP_SATA_LED }, /* SATA 1 active */
128 { 16, MPP_UNUSED },
129 { 17, MPP_GPIO }, /* Reset button */
130 { 18, MPP_GPIO }, /* Power button */
131 { 19, MPP_GPIO }, /* Power off */
132 { -1 },
133};
134
135static struct i2c_board_info __initdata mv2120_i2c_rtc = {
136 I2C_BOARD_INFO("pcf8563", 0x51),
137 .irq = 0,
138};
139
140static struct gpio_led mv2120_led_pins[] = {
141 {
142 .name = "mv2120:blue:health",
143 .gpio = 0,
144 },
145 {
146 .name = "mv2120:red:health",
147 .gpio = 1,
148 },
149 {
150 .name = "mv2120:led:bright",
151 .gpio = 4,
152 .default_trigger = "default-on",
153 },
154 {
155 .name = "mv2120:led:dimmed",
156 .gpio = 5,
157 },
158 {
159 .name = "mv2120:red:sata0",
160 .gpio = 8,
161 .active_low = 1,
162 },
163 {
164 .name = "mv2120:red:sata1",
165 .gpio = 9,
166 .active_low = 1,
167 },
168
169};
170
171static struct gpio_led_platform_data mv2120_led_data = {
172 .leds = mv2120_led_pins,
173 .num_leds = ARRAY_SIZE(mv2120_led_pins),
174};
175
176static struct platform_device mv2120_leds = {
177 .name = "leds-gpio",
178 .id = -1,
179 .dev = {
180 .platform_data = &mv2120_led_data,
181 }
182};
183
184static void mv2120_power_off(void)
185{
186 pr_info("%s: triggering power-off...\n", __func__);
187 gpio_set_value(MV2120_GPIO_POWER_OFF, 0);
188}
189
190static void __init mv2120_init(void)
191{
192 /* Setup basic Orion functions. Need to be called early. */
193 orion5x_init();
194
195 orion5x_mpp_conf(mv2120_mpp_modes);
196
197 /*
198 * Configure peripherals.
199 */
200 orion5x_ehci0_init();
201 orion5x_ehci1_init();
202 orion5x_eth_init(&mv2120_eth_data);
203 orion5x_i2c_init();
204 orion5x_sata_init(&mv2120_sata_data);
205 orion5x_uart0_init();
206
207 orion5x_setup_dev_boot_win(MV2120_NOR_BOOT_BASE, MV2120_NOR_BOOT_SIZE);
208 platform_device_register(&mv2120_nor_flash);
209
210 platform_device_register(&mv2120_button_device);
211
212 if (gpio_request(MV2120_GPIO_RTC_IRQ, "rtc") == 0) {
213 if (gpio_direction_input(MV2120_GPIO_RTC_IRQ) == 0)
214 mv2120_i2c_rtc.irq = gpio_to_irq(MV2120_GPIO_RTC_IRQ);
215 else
216 gpio_free(MV2120_GPIO_RTC_IRQ);
217 }
218 i2c_register_board_info(0, &mv2120_i2c_rtc, 1);
219 platform_device_register(&mv2120_leds);
220
221 /* register mv2120 specific power-off method */
222 if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
223 gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
224 pr_err("mv2120: failed to setup power-off GPIO\n");
225 pm_power_off = mv2120_power_off;
226}
227
228/* Warning: HP uses a wrong mach-type (=526) in their bootloader */
229MACHINE_START(MV2120, "HP Media Vault mv2120")
230 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
231 .phys_io = ORION5X_REGS_PHYS_BASE,
232 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
233 .boot_params = 0x00000100,
234 .init_machine = mv2120_init,
235 .map_io = orion5x_map_io,
236 .init_irq = orion5x_init_irq,
237 .timer = &orion5x_timer,
238 .fixup = tag_fixup_mem32
239MACHINE_END
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index 9d5d39fa19c3..256a4f680935 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -152,6 +152,8 @@ static int __init pcie_setup(struct pci_sys_data *sys)
152 if (dev == MV88F5181_DEV_ID || dev == MV88F5182_DEV_ID) { 152 if (dev == MV88F5181_DEV_ID || dev == MV88F5182_DEV_ID) {
153 printk(KERN_NOTICE "Applying Orion-1/Orion-NAS PCIe config " 153 printk(KERN_NOTICE "Applying Orion-1/Orion-NAS PCIe config "
154 "read transaction workaround\n"); 154 "read transaction workaround\n");
155 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
156 ORION5X_PCIE_WA_SIZE);
155 pcie_ops.read = pcie_rd_conf_wa; 157 pcie_ops.read = pcie_rd_conf_wa;
156 } 158 }
157 159
@@ -240,13 +242,13 @@ static int __init pcie_setup(struct pci_sys_data *sys)
240 * PCI Address Decode Windows registers 242 * PCI Address Decode Windows registers
241 */ 243 */
242#define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \ 244#define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \
243 ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \ 245 ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \
244 ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \ 246 ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \
245 ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : 0) 247 ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : 0)
246#define PCI_BAR_REMAP_DDR_CS(n) (((n) ==0) ? ORION5X_PCI_REG(0xc48) : \ 248#define PCI_BAR_REMAP_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc48) : \
247 ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \ 249 ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \
248 ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \ 250 ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \
249 ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : 0) 251 ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : 0)
250#define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c) 252#define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c)
251#define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c) 253#define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c)
252 254
@@ -264,9 +266,11 @@ static int __init pcie_setup(struct pci_sys_data *sys)
264 */ 266 */
265static DEFINE_SPINLOCK(orion5x_pci_lock); 267static DEFINE_SPINLOCK(orion5x_pci_lock);
266 268
269static int orion5x_pci_cardbus_mode;
270
267static int orion5x_pci_local_bus_nr(void) 271static int orion5x_pci_local_bus_nr(void)
268{ 272{
269 u32 conf = orion5x_read(PCI_P2P_CONF); 273 u32 conf = readl(PCI_P2P_CONF);
270 return((conf & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS); 274 return((conf & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS);
271} 275}
272 276
@@ -276,11 +280,11 @@ static int orion5x_pci_hw_rd_conf(int bus, int dev, u32 func,
276 unsigned long flags; 280 unsigned long flags;
277 spin_lock_irqsave(&orion5x_pci_lock, flags); 281 spin_lock_irqsave(&orion5x_pci_lock, flags);
278 282
279 orion5x_write(PCI_CONF_ADDR, PCI_CONF_BUS(bus) | 283 writel(PCI_CONF_BUS(bus) |
280 PCI_CONF_DEV(dev) | PCI_CONF_REG(where) | 284 PCI_CONF_DEV(dev) | PCI_CONF_REG(where) |
281 PCI_CONF_FUNC(func) | PCI_CONF_ADDR_EN); 285 PCI_CONF_FUNC(func) | PCI_CONF_ADDR_EN, PCI_CONF_ADDR);
282 286
283 *val = orion5x_read(PCI_CONF_DATA); 287 *val = readl(PCI_CONF_DATA);
284 288
285 if (size == 1) 289 if (size == 1)
286 *val = (*val >> (8*(where & 0x3))) & 0xff; 290 *val = (*val >> (8*(where & 0x3))) & 0xff;
@@ -300,9 +304,9 @@ static int orion5x_pci_hw_wr_conf(int bus, int dev, u32 func,
300 304
301 spin_lock_irqsave(&orion5x_pci_lock, flags); 305 spin_lock_irqsave(&orion5x_pci_lock, flags);
302 306
303 orion5x_write(PCI_CONF_ADDR, PCI_CONF_BUS(bus) | 307 writel(PCI_CONF_BUS(bus) |
304 PCI_CONF_DEV(dev) | PCI_CONF_REG(where) | 308 PCI_CONF_DEV(dev) | PCI_CONF_REG(where) |
305 PCI_CONF_FUNC(func) | PCI_CONF_ADDR_EN); 309 PCI_CONF_FUNC(func) | PCI_CONF_ADDR_EN, PCI_CONF_ADDR);
306 310
307 if (size == 4) { 311 if (size == 4) {
308 __raw_writel(val, PCI_CONF_DATA); 312 __raw_writel(val, PCI_CONF_DATA);
@@ -319,14 +323,30 @@ static int orion5x_pci_hw_wr_conf(int bus, int dev, u32 func,
319 return ret; 323 return ret;
320} 324}
321 325
326static int orion5x_pci_valid_config(int bus, u32 devfn)
327{
328 if (bus == orion5x_pci_local_bus_nr()) {
329 /*
330 * Don't go out for local device
331 */
332 if (PCI_SLOT(devfn) == 0 && PCI_FUNC(devfn) != 0)
333 return 0;
334
335 /*
336 * When the PCI signals are directly connected to a
337 * Cardbus slot, ignore all but device IDs 0 and 1.
338 */
339 if (orion5x_pci_cardbus_mode && PCI_SLOT(devfn) > 1)
340 return 0;
341 }
342
343 return 1;
344}
345
322static int orion5x_pci_rd_conf(struct pci_bus *bus, u32 devfn, 346static int orion5x_pci_rd_conf(struct pci_bus *bus, u32 devfn,
323 int where, int size, u32 *val) 347 int where, int size, u32 *val)
324{ 348{
325 /* 349 if (!orion5x_pci_valid_config(bus->number, devfn)) {
326 * Don't go out for local device
327 */
328 if (bus->number == orion5x_pci_local_bus_nr() &&
329 PCI_SLOT(devfn) == 0 && PCI_FUNC(devfn) != 0) {
330 *val = 0xffffffff; 350 *val = 0xffffffff;
331 return PCIBIOS_DEVICE_NOT_FOUND; 351 return PCIBIOS_DEVICE_NOT_FOUND;
332 } 352 }
@@ -338,8 +358,7 @@ static int orion5x_pci_rd_conf(struct pci_bus *bus, u32 devfn,
338static int orion5x_pci_wr_conf(struct pci_bus *bus, u32 devfn, 358static int orion5x_pci_wr_conf(struct pci_bus *bus, u32 devfn,
339 int where, int size, u32 val) 359 int where, int size, u32 val)
340{ 360{
341 if (bus->number == orion5x_pci_local_bus_nr() && 361 if (!orion5x_pci_valid_config(bus->number, devfn))
342 PCI_SLOT(devfn) == 0 && PCI_FUNC(devfn) != 0)
343 return PCIBIOS_DEVICE_NOT_FOUND; 362 return PCIBIOS_DEVICE_NOT_FOUND;
344 363
345 return orion5x_pci_hw_wr_conf(bus->number, PCI_SLOT(devfn), 364 return orion5x_pci_hw_wr_conf(bus->number, PCI_SLOT(devfn),
@@ -353,9 +372,9 @@ static struct pci_ops pci_ops = {
353 372
354static void __init orion5x_pci_set_bus_nr(int nr) 373static void __init orion5x_pci_set_bus_nr(int nr)
355{ 374{
356 u32 p2p = orion5x_read(PCI_P2P_CONF); 375 u32 p2p = readl(PCI_P2P_CONF);
357 376
358 if (orion5x_read(PCI_MODE) & PCI_MODE_PCIX) { 377 if (readl(PCI_MODE) & PCI_MODE_PCIX) {
359 /* 378 /*
360 * PCI-X mode 379 * PCI-X mode
361 */ 380 */
@@ -372,7 +391,7 @@ static void __init orion5x_pci_set_bus_nr(int nr)
372 */ 391 */
373 p2p &= ~PCI_P2P_BUS_MASK; 392 p2p &= ~PCI_P2P_BUS_MASK;
374 p2p |= (nr << PCI_P2P_BUS_OFFS); 393 p2p |= (nr << PCI_P2P_BUS_OFFS);
375 orion5x_write(PCI_P2P_CONF, p2p); 394 writel(p2p, PCI_P2P_CONF);
376 } 395 }
377} 396}
378 397
@@ -399,7 +418,7 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
399 * First, disable windows. 418 * First, disable windows.
400 */ 419 */
401 win_enable = 0xffffffff; 420 win_enable = 0xffffffff;
402 orion5x_write(PCI_BAR_ENABLE, win_enable); 421 writel(win_enable, PCI_BAR_ENABLE);
403 422
404 /* 423 /*
405 * Setup windows for DDR banks. 424 * Setup windows for DDR banks.
@@ -425,10 +444,10 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
425 */ 444 */
426 reg = PCI_CONF_REG_BAR_HI_CS(cs->cs_index); 445 reg = PCI_CONF_REG_BAR_HI_CS(cs->cs_index);
427 orion5x_pci_hw_wr_conf(bus, 0, func, reg, 4, 0); 446 orion5x_pci_hw_wr_conf(bus, 0, func, reg, 4, 0);
428 orion5x_write(PCI_BAR_SIZE_DDR_CS(cs->cs_index), 447 writel((cs->size - 1) & 0xfffff000,
429 (cs->size - 1) & 0xfffff000); 448 PCI_BAR_SIZE_DDR_CS(cs->cs_index));
430 orion5x_write(PCI_BAR_REMAP_DDR_CS(cs->cs_index), 449 writel(cs->base & 0xfffff000,
431 cs->base & 0xfffff000); 450 PCI_BAR_REMAP_DDR_CS(cs->cs_index));
432 451
433 /* 452 /*
434 * Enable decode window for this chip select. 453 * Enable decode window for this chip select.
@@ -439,7 +458,7 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
439 /* 458 /*
440 * Re-enable decode windows. 459 * Re-enable decode windows.
441 */ 460 */
442 orion5x_write(PCI_BAR_ENABLE, win_enable); 461 writel(win_enable, PCI_BAR_ENABLE);
443 462
444 /* 463 /*
445 * Disable automatic update of address remaping when writing to BARs. 464 * Disable automatic update of address remaping when writing to BARs.
@@ -522,6 +541,11 @@ static void __devinit rc_pci_fixup(struct pci_dev *dev)
522} 541}
523DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup); 542DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup);
524 543
544void __init orion5x_pci_set_cardbus_mode(void)
545{
546 orion5x_pci_cardbus_mode = 1;
547}
548
525int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys) 549int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys)
526{ 550{
527 int ret = 0; 551 int ret = 0;
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
new file mode 100644
index 000000000000..d50e3650a09e
--- /dev/null
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -0,0 +1,161 @@
1/*
2 * arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
3 *
4 * Marvell Orion-VoIP FXO Reference Design Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h>
18#include <asm/mach-types.h>
19#include <asm/gpio.h>
20#include <asm/leds.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/pci.h>
23#include <asm/arch/orion5x.h>
24#include "common.h"
25#include "mpp.h"
26
27/*****************************************************************************
28 * RD-88F5181L FXO Info
29 ****************************************************************************/
30/*
31 * 8M NOR flash Device bus boot chip select
32 */
33#define RD88F5181L_FXO_NOR_BOOT_BASE 0xff800000
34#define RD88F5181L_FXO_NOR_BOOT_SIZE SZ_8M
35
36
37/*****************************************************************************
38 * 8M NOR Flash on Device bus Boot chip select
39 ****************************************************************************/
40static struct physmap_flash_data rd88f5181l_fxo_nor_boot_flash_data = {
41 .width = 1,
42};
43
44static struct resource rd88f5181l_fxo_nor_boot_flash_resource = {
45 .flags = IORESOURCE_MEM,
46 .start = RD88F5181L_FXO_NOR_BOOT_BASE,
47 .end = RD88F5181L_FXO_NOR_BOOT_BASE +
48 RD88F5181L_FXO_NOR_BOOT_SIZE - 1,
49};
50
51static struct platform_device rd88f5181l_fxo_nor_boot_flash = {
52 .name = "physmap-flash",
53 .id = 0,
54 .dev = {
55 .platform_data = &rd88f5181l_fxo_nor_boot_flash_data,
56 },
57 .num_resources = 1,
58 .resource = &rd88f5181l_fxo_nor_boot_flash_resource,
59};
60
61
62/*****************************************************************************
63 * General Setup
64 ****************************************************************************/
65static struct orion5x_mpp_mode rd88f5181l_fxo_mpp_modes[] __initdata = {
66 { 0, MPP_GPIO }, /* LED1 CardBus LED (front panel) */
67 { 1, MPP_GPIO }, /* PCI_intA */
68 { 2, MPP_GPIO }, /* Hard Reset / Factory Init*/
69 { 3, MPP_GPIO }, /* FXS or DAA select */
70 { 4, MPP_GPIO }, /* LED6 - phone LED (front panel) */
71 { 5, MPP_GPIO }, /* LED5 - phone LED (front panel) */
72 { 6, MPP_PCI_CLK }, /* CPU PCI refclk */
73 { 7, MPP_PCI_CLK }, /* PCI/PCIe refclk */
74 { 8, MPP_GPIO }, /* CardBus reset */
75 { 9, MPP_GPIO }, /* GE_RXERR */
76 { 10, MPP_GPIO }, /* LED2 MiniPCI LED (front panel) */
77 { 11, MPP_GPIO }, /* Lifeline control */
78 { 12, MPP_GIGE }, /* GE_TXD[4] */
79 { 13, MPP_GIGE }, /* GE_TXD[5] */
80 { 14, MPP_GIGE }, /* GE_TXD[6] */
81 { 15, MPP_GIGE }, /* GE_TXD[7] */
82 { 16, MPP_GIGE }, /* GE_RXD[4] */
83 { 17, MPP_GIGE }, /* GE_RXD[5] */
84 { 18, MPP_GIGE }, /* GE_RXD[6] */
85 { 19, MPP_GIGE }, /* GE_RXD[7] */
86 { -1 },
87};
88
89static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = {
90 .phy_addr = -1,
91};
92
93static void __init rd88f5181l_fxo_init(void)
94{
95 /*
96 * Setup basic Orion functions. Need to be called early.
97 */
98 orion5x_init();
99
100 orion5x_mpp_conf(rd88f5181l_fxo_mpp_modes);
101
102 /*
103 * Configure peripherals.
104 */
105 orion5x_ehci0_init();
106 orion5x_eth_init(&rd88f5181l_fxo_eth_data);
107 orion5x_uart0_init();
108
109 orion5x_setup_dev_boot_win(RD88F5181L_FXO_NOR_BOOT_BASE,
110 RD88F5181L_FXO_NOR_BOOT_SIZE);
111 platform_device_register(&rd88f5181l_fxo_nor_boot_flash);
112}
113
114static int __init
115rd88f5181l_fxo_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
116{
117 int irq;
118
119 /*
120 * Check for devices with hard-wired IRQs.
121 */
122 irq = orion5x_pci_map_irq(dev, slot, pin);
123 if (irq != -1)
124 return irq;
125
126 /*
127 * Mini-PCI / Cardbus slot.
128 */
129 return gpio_to_irq(1);
130}
131
132static struct hw_pci rd88f5181l_fxo_pci __initdata = {
133 .nr_controllers = 2,
134 .swizzle = pci_std_swizzle,
135 .setup = orion5x_pci_sys_setup,
136 .scan = orion5x_pci_sys_scan_bus,
137 .map_irq = rd88f5181l_fxo_pci_map_irq,
138};
139
140static int __init rd88f5181l_fxo_pci_init(void)
141{
142 if (machine_is_rd88f5181l_fxo()) {
143 orion5x_pci_set_cardbus_mode();
144 pci_common_init(&rd88f5181l_fxo_pci);
145 }
146
147 return 0;
148}
149subsys_initcall(rd88f5181l_fxo_pci_init);
150
151MACHINE_START(RD88F5181L_FXO, "Marvell Orion-VoIP FXO Reference Design")
152 /* Maintainer: Nicolas Pitre <nico@marvell.com> */
153 .phys_io = ORION5X_REGS_PHYS_BASE,
154 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
155 .boot_params = 0x00000100,
156 .init_machine = rd88f5181l_fxo_init,
157 .map_io = orion5x_map_io,
158 .init_irq = orion5x_init_irq,
159 .timer = &orion5x_timer,
160 .fixup = tag_fixup_mem32,
161MACHINE_END
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
new file mode 100644
index 000000000000..b56447d32e17
--- /dev/null
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -0,0 +1,172 @@
1/*
2 * arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
3 *
4 * Marvell Orion-VoIP GE Reference Design Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/irq.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h>
18#include <linux/i2c.h>
19#include <asm/mach-types.h>
20#include <asm/gpio.h>
21#include <asm/leds.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/pci.h>
24#include <asm/arch/orion5x.h>
25#include "common.h"
26#include "mpp.h"
27
28/*****************************************************************************
29 * RD-88F5181L GE Info
30 ****************************************************************************/
31/*
32 * 16M NOR flash Device bus boot chip select
33 */
34#define RD88F5181L_GE_NOR_BOOT_BASE 0xff000000
35#define RD88F5181L_GE_NOR_BOOT_SIZE SZ_16M
36
37
38/*****************************************************************************
39 * 16M NOR Flash on Device bus Boot chip select
40 ****************************************************************************/
41static struct physmap_flash_data rd88f5181l_ge_nor_boot_flash_data = {
42 .width = 1,
43};
44
45static struct resource rd88f5181l_ge_nor_boot_flash_resource = {
46 .flags = IORESOURCE_MEM,
47 .start = RD88F5181L_GE_NOR_BOOT_BASE,
48 .end = RD88F5181L_GE_NOR_BOOT_BASE +
49 RD88F5181L_GE_NOR_BOOT_SIZE - 1,
50};
51
52static struct platform_device rd88f5181l_ge_nor_boot_flash = {
53 .name = "physmap-flash",
54 .id = 0,
55 .dev = {
56 .platform_data = &rd88f5181l_ge_nor_boot_flash_data,
57 },
58 .num_resources = 1,
59 .resource = &rd88f5181l_ge_nor_boot_flash_resource,
60};
61
62
63/*****************************************************************************
64 * General Setup
65 ****************************************************************************/
66static struct orion5x_mpp_mode rd88f5181l_ge_mpp_modes[] __initdata = {
67 { 0, MPP_GPIO }, /* LED1 */
68 { 1, MPP_GPIO }, /* LED5 */
69 { 2, MPP_GPIO }, /* LED4 */
70 { 3, MPP_GPIO }, /* LED3 */
71 { 4, MPP_GPIO }, /* PCI_intA */
72 { 5, MPP_GPIO }, /* RTC interrupt */
73 { 6, MPP_PCI_CLK }, /* CPU PCI refclk */
74 { 7, MPP_PCI_CLK }, /* PCI/PCIe refclk */
75 { 8, MPP_GPIO }, /* 88e6131 interrupt */
76 { 9, MPP_GPIO }, /* GE_RXERR */
77 { 10, MPP_GPIO }, /* PCI_intB */
78 { 11, MPP_GPIO }, /* LED2 */
79 { 12, MPP_GIGE }, /* GE_TXD[4] */
80 { 13, MPP_GIGE }, /* GE_TXD[5] */
81 { 14, MPP_GIGE }, /* GE_TXD[6] */
82 { 15, MPP_GIGE }, /* GE_TXD[7] */
83 { 16, MPP_GIGE }, /* GE_RXD[4] */
84 { 17, MPP_GIGE }, /* GE_RXD[5] */
85 { 18, MPP_GIGE }, /* GE_RXD[6] */
86 { 19, MPP_GIGE }, /* GE_RXD[7] */
87 { -1 },
88};
89
90static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
91 .phy_addr = -1,
92};
93
94static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
95 I2C_BOARD_INFO("ds1338", 0x68),
96};
97
98static void __init rd88f5181l_ge_init(void)
99{
100 /*
101 * Setup basic Orion functions. Need to be called early.
102 */
103 orion5x_init();
104
105 orion5x_mpp_conf(rd88f5181l_ge_mpp_modes);
106
107 /*
108 * Configure peripherals.
109 */
110 orion5x_ehci0_init();
111 orion5x_eth_init(&rd88f5181l_ge_eth_data);
112 orion5x_i2c_init();
113 orion5x_uart0_init();
114
115 orion5x_setup_dev_boot_win(RD88F5181L_GE_NOR_BOOT_BASE,
116 RD88F5181L_GE_NOR_BOOT_SIZE);
117 platform_device_register(&rd88f5181l_ge_nor_boot_flash);
118
119 i2c_register_board_info(0, &rd88f5181l_ge_i2c_rtc, 1);
120}
121
122static int __init
123rd88f5181l_ge_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
124{
125 int irq;
126
127 /*
128 * Check for devices with hard-wired IRQs.
129 */
130 irq = orion5x_pci_map_irq(dev, slot, pin);
131 if (irq != -1)
132 return irq;
133
134 /*
135 * Cardbus slot.
136 */
137 if (pin == 1)
138 return gpio_to_irq(4);
139 else
140 return gpio_to_irq(10);
141}
142
143static struct hw_pci rd88f5181l_ge_pci __initdata = {
144 .nr_controllers = 2,
145 .swizzle = pci_std_swizzle,
146 .setup = orion5x_pci_sys_setup,
147 .scan = orion5x_pci_sys_scan_bus,
148 .map_irq = rd88f5181l_ge_pci_map_irq,
149};
150
151static int __init rd88f5181l_ge_pci_init(void)
152{
153 if (machine_is_rd88f5181l_ge()) {
154 orion5x_pci_set_cardbus_mode();
155 pci_common_init(&rd88f5181l_ge_pci);
156 }
157
158 return 0;
159}
160subsys_initcall(rd88f5181l_ge_pci_init);
161
162MACHINE_START(RD88F5181L_GE, "Marvell Orion-VoIP GE Reference Design")
163 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
164 .phys_io = ORION5X_REGS_PHYS_BASE,
165 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
166 .boot_params = 0x00000100,
167 .init_machine = rd88f5181l_ge_init,
168 .map_io = orion5x_map_io,
169 .init_irq = orion5x_init_irq,
170 .timer = &orion5x_timer,
171 .fixup = tag_fixup_mem32,
172MACHINE_END
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 81abc1003aae..10ae62864269 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -26,6 +26,7 @@
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h> 27#include <asm/arch/orion5x.h>
28#include "common.h" 28#include "common.h"
29#include "mpp.h"
29 30
30/***************************************************************************** 31/*****************************************************************************
31 * RD-88F5182 Info 32 * RD-88F5182 Info
@@ -125,6 +126,7 @@ static int __init rd88f5182_dbgled_init(void)
125 126
126 leds_event = rd88f5182_dbgled_event; 127 leds_event = rd88f5182_dbgled_event;
127 } 128 }
129
128 return 0; 130 return 0;
129} 131}
130 132
@@ -220,7 +222,6 @@ subsys_initcall(rd88f5182_pci_init);
220 222
221static struct mv643xx_eth_platform_data rd88f5182_eth_data = { 223static struct mv643xx_eth_platform_data rd88f5182_eth_data = {
222 .phy_addr = 8, 224 .phy_addr = 8,
223 .force_phy_addr = 1,
224}; 225};
225 226
226/***************************************************************************** 227/*****************************************************************************
@@ -234,15 +235,34 @@ static struct i2c_board_info __initdata rd88f5182_i2c_rtc = {
234 * Sata 235 * Sata
235 ****************************************************************************/ 236 ****************************************************************************/
236static struct mv_sata_platform_data rd88f5182_sata_data = { 237static struct mv_sata_platform_data rd88f5182_sata_data = {
237 .n_ports = 2, 238 .n_ports = 2,
238}; 239};
239 240
240/***************************************************************************** 241/*****************************************************************************
241 * General Setup 242 * General Setup
242 ****************************************************************************/ 243 ****************************************************************************/
243 244static struct orion5x_mpp_mode rd88f5182_mpp_modes[] __initdata = {
244static struct platform_device *rd88f5182_devices[] __initdata = { 245 { 0, MPP_GPIO }, /* Debug Led */
245 &rd88f5182_nor_flash, 246 { 1, MPP_GPIO }, /* Reset Switch */
247 { 2, MPP_UNUSED },
248 { 3, MPP_GPIO }, /* RTC Int */
249 { 4, MPP_GPIO },
250 { 5, MPP_GPIO },
251 { 6, MPP_GPIO }, /* PCI_intA */
252 { 7, MPP_GPIO }, /* PCI_intB */
253 { 8, MPP_UNUSED },
254 { 9, MPP_UNUSED },
255 { 10, MPP_UNUSED },
256 { 11, MPP_UNUSED },
257 { 12, MPP_SATA_LED }, /* SATA 0 presence */
258 { 13, MPP_SATA_LED }, /* SATA 1 presence */
259 { 14, MPP_SATA_LED }, /* SATA 0 active */
260 { 15, MPP_SATA_LED }, /* SATA 1 active */
261 { 16, MPP_UNUSED },
262 { 17, MPP_UNUSED },
263 { 18, MPP_UNUSED },
264 { 19, MPP_UNUSED },
265 { -1 },
246}; 266};
247 267
248static void __init rd88f5182_init(void) 268static void __init rd88f5182_init(void)
@@ -252,35 +272,9 @@ static void __init rd88f5182_init(void)
252 */ 272 */
253 orion5x_init(); 273 orion5x_init();
254 274
255 /* 275 orion5x_mpp_conf(rd88f5182_mpp_modes);
256 * Setup the CPU address decode windows for our devices
257 */
258 orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
259 RD88F5182_NOR_BOOT_SIZE);
260 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
261
262 /*
263 * Open a special address decode windows for the PCIe WA.
264 */
265 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
266 ORION5X_PCIE_WA_SIZE);
267 276
268 /* 277 /*
269 * Setup Multiplexing Pins --
270 * MPP[0] Debug Led (GPIO - Out)
271 * MPP[1] Debug Led (GPIO - Out)
272 * MPP[2] N/A
273 * MPP[3] RTC_Int (GPIO - In)
274 * MPP[4] GPIO
275 * MPP[5] GPIO
276 * MPP[6] PCI_intA (GPIO - In)
277 * MPP[7] PCI_intB (GPIO - In)
278 * MPP[8-11] N/A
279 * MPP[12] SATA 0 presence Indication
280 * MPP[13] SATA 1 presence Indication
281 * MPP[14] SATA 0 active Indication
282 * MPP[15] SATA 1 active indication
283 * MPP[16-19] Not used
284 * MPP[20] PCI Clock to MV88F5182 278 * MPP[20] PCI Clock to MV88F5182
285 * MPP[21] PCI Clock to mini PCI CON11 279 * MPP[21] PCI Clock to mini PCI CON11
286 * MPP[22] USB 0 over current indication 280 * MPP[22] USB 0 over current indication
@@ -289,16 +283,23 @@ static void __init rd88f5182_init(void)
289 * MPP[25] USB 0 over current enable 283 * MPP[25] USB 0 over current enable
290 */ 284 */
291 285
292 orion5x_write(MPP_0_7_CTRL, 0x00000003); 286 /*
293 orion5x_write(MPP_8_15_CTRL, 0x55550000); 287 * Configure peripherals.
294 orion5x_write(MPP_16_19_CTRL, 0x5555); 288 */
289 orion5x_ehci0_init();
290 orion5x_ehci1_init();
291 orion5x_eth_init(&rd88f5182_eth_data);
292 orion5x_i2c_init();
293 orion5x_sata_init(&rd88f5182_sata_data);
294 orion5x_uart0_init();
295 295
296 orion5x_gpio_set_valid_pins(0x000000fb); 296 orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
297 RD88F5182_NOR_BOOT_SIZE);
298
299 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
300 platform_device_register(&rd88f5182_nor_flash);
297 301
298 platform_add_devices(rd88f5182_devices, ARRAY_SIZE(rd88f5182_devices));
299 i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1); 302 i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
300 orion5x_eth_init(&rd88f5182_eth_data);
301 orion5x_sata_init(&rd88f5182_sata_data);
302} 303}
303 304
304MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design") 305MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design")
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index 9afb41ee6e07..a9cef9703d5b 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -28,6 +28,8 @@
28#include <asm/mach/pci.h> 28#include <asm/mach/pci.h>
29#include <asm/arch/orion5x.h> 29#include <asm/arch/orion5x.h>
30#include "common.h" 30#include "common.h"
31#include "mpp.h"
32#include "tsx09-common.h"
31 33
32#define QNAP_TS209_NOR_BOOT_BASE 0xf4000000 34#define QNAP_TS209_NOR_BOOT_BASE 0xf4000000
33#define QNAP_TS209_NOR_BOOT_SIZE SZ_8M 35#define QNAP_TS209_NOR_BOOT_SIZE SZ_8M
@@ -47,52 +49,54 @@
47 ***************************************************************************/ 49 ***************************************************************************/
48static struct mtd_partition qnap_ts209_partitions[] = { 50static struct mtd_partition qnap_ts209_partitions[] = {
49 { 51 {
50 .name = "U-Boot", 52 .name = "U-Boot",
51 .size = 0x00080000, 53 .size = 0x00080000,
52 .offset = 0x00780000, 54 .offset = 0x00780000,
53 .mask_flags = MTD_WRITEABLE, 55 .mask_flags = MTD_WRITEABLE,
54 }, { 56 }, {
55 .name = "Kernel", 57 .name = "Kernel",
56 .size = 0x00200000, 58 .size = 0x00200000,
57 .offset = 0, 59 .offset = 0,
58 }, { 60 }, {
59 .name = "RootFS1", 61 .name = "RootFS1",
60 .size = 0x00400000, 62 .size = 0x00400000,
61 .offset = 0x00200000, 63 .offset = 0x00200000,
62 }, { 64 }, {
63 .name = "RootFS2", 65 .name = "RootFS2",
64 .size = 0x00100000, 66 .size = 0x00100000,
65 .offset = 0x00600000, 67 .offset = 0x00600000,
66 }, { 68 }, {
67 .name = "U-Boot Config", 69 .name = "U-Boot Config",
68 .size = 0x00020000, 70 .size = 0x00020000,
69 .offset = 0x00760000, 71 .offset = 0x00760000,
70 }, { 72 }, {
71 .name = "NAS Config", 73 .name = "NAS Config",
72 .size = 0x00060000, 74 .size = 0x00060000,
73 .offset = 0x00700000, 75 .offset = 0x00700000,
74 .mask_flags = MTD_WRITEABLE, 76 .mask_flags = MTD_WRITEABLE,
75 } 77 },
76}; 78};
77 79
78static struct physmap_flash_data qnap_ts209_nor_flash_data = { 80static struct physmap_flash_data qnap_ts209_nor_flash_data = {
79 .width = 1, 81 .width = 1,
80 .parts = qnap_ts209_partitions, 82 .parts = qnap_ts209_partitions,
81 .nr_parts = ARRAY_SIZE(qnap_ts209_partitions) 83 .nr_parts = ARRAY_SIZE(qnap_ts209_partitions)
82}; 84};
83 85
84static struct resource qnap_ts209_nor_flash_resource = { 86static struct resource qnap_ts209_nor_flash_resource = {
85 .flags = IORESOURCE_MEM, 87 .flags = IORESOURCE_MEM,
86 .start = QNAP_TS209_NOR_BOOT_BASE, 88 .start = QNAP_TS209_NOR_BOOT_BASE,
87 .end = QNAP_TS209_NOR_BOOT_BASE + QNAP_TS209_NOR_BOOT_SIZE - 1, 89 .end = QNAP_TS209_NOR_BOOT_BASE + QNAP_TS209_NOR_BOOT_SIZE - 1,
88}; 90};
89 91
90static struct platform_device qnap_ts209_nor_flash = { 92static struct platform_device qnap_ts209_nor_flash = {
91 .name = "physmap-flash", 93 .name = "physmap-flash",
92 .id = 0, 94 .id = 0,
93 .dev = { .platform_data = &qnap_ts209_nor_flash_data, }, 95 .dev = {
94 .resource = &qnap_ts209_nor_flash_resource, 96 .platform_data = &qnap_ts209_nor_flash_data,
95 .num_resources = 1, 97 },
98 .resource = &qnap_ts209_nor_flash_resource,
99 .num_resources = 1,
96}; 100};
97 101
98/***************************************************************************** 102/*****************************************************************************
@@ -164,12 +168,12 @@ static int __init qnap_ts209_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
164} 168}
165 169
166static struct hw_pci qnap_ts209_pci __initdata = { 170static struct hw_pci qnap_ts209_pci __initdata = {
167 .nr_controllers = 2, 171 .nr_controllers = 2,
168 .preinit = qnap_ts209_pci_preinit, 172 .preinit = qnap_ts209_pci_preinit,
169 .swizzle = pci_std_swizzle, 173 .swizzle = pci_std_swizzle,
170 .setup = orion5x_pci_sys_setup, 174 .setup = orion5x_pci_sys_setup,
171 .scan = orion5x_pci_sys_scan_bus, 175 .scan = orion5x_pci_sys_scan_bus,
172 .map_irq = qnap_ts209_pci_map_irq, 176 .map_irq = qnap_ts209_pci_map_irq,
173}; 177};
174 178
175static int __init qnap_ts209_pci_init(void) 179static int __init qnap_ts209_pci_init(void)
@@ -183,96 +187,6 @@ static int __init qnap_ts209_pci_init(void)
183subsys_initcall(qnap_ts209_pci_init); 187subsys_initcall(qnap_ts209_pci_init);
184 188
185/***************************************************************************** 189/*****************************************************************************
186 * Ethernet
187 ****************************************************************************/
188
189static struct mv643xx_eth_platform_data qnap_ts209_eth_data = {
190 .phy_addr = 8,
191 .force_phy_addr = 1,
192};
193
194static int __init parse_hex_nibble(char n)
195{
196 if (n >= '0' && n <= '9')
197 return n - '0';
198
199 if (n >= 'A' && n <= 'F')
200 return n - 'A' + 10;
201
202 if (n >= 'a' && n <= 'f')
203 return n - 'a' + 10;
204
205 return -1;
206}
207
208static int __init parse_hex_byte(const char *b)
209{
210 int hi;
211 int lo;
212
213 hi = parse_hex_nibble(b[0]);
214 lo = parse_hex_nibble(b[1]);
215
216 if (hi < 0 || lo < 0)
217 return -1;
218
219 return (hi << 4) | lo;
220}
221
222static int __init check_mac_addr(const char *addr_str)
223{
224 u_int8_t addr[6];
225 int i;
226
227 for (i = 0; i < 6; i++) {
228 int byte;
229
230 /*
231 * Enforce "xx:xx:xx:xx:xx:xx\n" format.
232 */
233 if (addr_str[(i * 3) + 2] != ((i < 5) ? ':' : '\n'))
234 return -1;
235
236 byte = parse_hex_byte(addr_str + (i * 3));
237 if (byte < 0)
238 return -1;
239 addr[i] = byte;
240 }
241
242 printk(KERN_INFO "ts209: found ethernet mac address ");
243 for (i = 0; i < 6; i++)
244 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
245
246 memcpy(qnap_ts209_eth_data.mac_addr, addr, 6);
247
248 return 0;
249}
250
251/*
252 * The 'NAS Config' flash partition has an ext2 filesystem which
253 * contains a file that has the ethernet MAC address in plain text
254 * (format "xx:xx:xx:xx:xx:xx\n".)
255 */
256static void __init ts209_find_mac_addr(void)
257{
258 unsigned long addr;
259
260 for (addr = 0x00700000; addr < 0x00760000; addr += 1024) {
261 char *nor_page;
262 int ret = 0;
263
264 nor_page = ioremap(QNAP_TS209_NOR_BOOT_BASE + addr, 1024);
265 if (nor_page != NULL) {
266 ret = check_mac_addr(nor_page);
267 iounmap(nor_page);
268 }
269
270 if (ret == 0)
271 break;
272 }
273}
274
275/*****************************************************************************
276 * RTC S35390A on I2C bus 190 * RTC S35390A on I2C bus
277 ****************************************************************************/ 191 ****************************************************************************/
278 192
@@ -280,7 +194,7 @@ static void __init ts209_find_mac_addr(void)
280 194
281static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = { 195static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = {
282 I2C_BOARD_INFO("s35390a", 0x30), 196 I2C_BOARD_INFO("s35390a", 0x30),
283 .irq = 0, 197 .irq = 0,
284}; 198};
285 199
286/**************************************************************************** 200/****************************************************************************
@@ -297,70 +211,63 @@ static struct gpio_keys_button qnap_ts209_buttons[] = {
297 .gpio = QNAP_TS209_GPIO_KEY_MEDIA, 211 .gpio = QNAP_TS209_GPIO_KEY_MEDIA,
298 .desc = "USB Copy Button", 212 .desc = "USB Copy Button",
299 .active_low = 1, 213 .active_low = 1,
300 }, 214 }, {
301 {
302 .code = KEY_POWER, 215 .code = KEY_POWER,
303 .gpio = QNAP_TS209_GPIO_KEY_RESET, 216 .gpio = QNAP_TS209_GPIO_KEY_RESET,
304 .desc = "Reset Button", 217 .desc = "Reset Button",
305 .active_low = 1, 218 .active_low = 1,
306 } 219 },
307}; 220};
308 221
309static struct gpio_keys_platform_data qnap_ts209_button_data = { 222static struct gpio_keys_platform_data qnap_ts209_button_data = {
310 .buttons = qnap_ts209_buttons, 223 .buttons = qnap_ts209_buttons,
311 .nbuttons = ARRAY_SIZE(qnap_ts209_buttons), 224 .nbuttons = ARRAY_SIZE(qnap_ts209_buttons),
312}; 225};
313 226
314static struct platform_device qnap_ts209_button_device = { 227static struct platform_device qnap_ts209_button_device = {
315 .name = "gpio-keys", 228 .name = "gpio-keys",
316 .id = -1, 229 .id = -1,
317 .num_resources = 0, 230 .num_resources = 0,
318 .dev = { .platform_data = &qnap_ts209_button_data, }, 231 .dev = {
232 .platform_data = &qnap_ts209_button_data,
233 },
319}; 234};
320 235
321/***************************************************************************** 236/*****************************************************************************
322 * SATA 237 * SATA
323 ****************************************************************************/ 238 ****************************************************************************/
324static struct mv_sata_platform_data qnap_ts209_sata_data = { 239static struct mv_sata_platform_data qnap_ts209_sata_data = {
325 .n_ports = 2, 240 .n_ports = 2,
326}; 241};
327 242
328/***************************************************************************** 243/*****************************************************************************
329 244
330 * General Setup 245 * General Setup
331 ****************************************************************************/ 246 ****************************************************************************/
332 247static struct orion5x_mpp_mode ts209_mpp_modes[] __initdata = {
333static struct platform_device *qnap_ts209_devices[] __initdata = { 248 { 0, MPP_UNUSED },
334 &qnap_ts209_nor_flash, 249 { 1, MPP_GPIO }, /* USB copy button */
335 &qnap_ts209_button_device, 250 { 2, MPP_GPIO }, /* Load defaults button */
251 { 3, MPP_GPIO }, /* GPIO RTC */
252 { 4, MPP_UNUSED },
253 { 5, MPP_UNUSED },
254 { 6, MPP_GPIO }, /* PCI Int A */
255 { 7, MPP_GPIO }, /* PCI Int B */
256 { 8, MPP_UNUSED },
257 { 9, MPP_UNUSED },
258 { 10, MPP_UNUSED },
259 { 11, MPP_UNUSED },
260 { 12, MPP_SATA_LED }, /* SATA 0 presence */
261 { 13, MPP_SATA_LED }, /* SATA 1 presence */
262 { 14, MPP_SATA_LED }, /* SATA 0 active */
263 { 15, MPP_SATA_LED }, /* SATA 1 active */
264 { 16, MPP_UART }, /* UART1 RXD */
265 { 17, MPP_UART }, /* UART1 TXD */
266 { 18, MPP_GPIO }, /* SW_RST */
267 { 19, MPP_UNUSED },
268 { -1 },
336}; 269};
337 270
338/*
339 * QNAP TS-[12]09 specific power off method via UART1-attached PIC
340 */
341
342#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
343
344static void qnap_ts209_power_off(void)
345{
346 /* 19200 baud divisor */
347 const unsigned divisor = ((ORION5X_TCLK + (8 * 19200)) / (16 * 19200));
348
349 pr_info("%s: triggering power-off...\n", __func__);
350
351 /* hijack uart1 and reset into sane state (19200,8n1) */
352 orion5x_write(UART1_REG(LCR), 0x83);
353 orion5x_write(UART1_REG(DLL), divisor & 0xff);
354 orion5x_write(UART1_REG(DLM), (divisor >> 8) & 0xff);
355 orion5x_write(UART1_REG(LCR), 0x03);
356 orion5x_write(UART1_REG(IER), 0x00);
357 orion5x_write(UART1_REG(FCR), 0x00);
358 orion5x_write(UART1_REG(MCR), 0x00);
359
360 /* send the power-off command 'A' to PIC */
361 orion5x_write(UART1_REG(TX), 'A');
362}
363
364static void __init qnap_ts209_init(void) 271static void __init qnap_ts209_init(void)
365{ 272{
366 /* 273 /*
@@ -368,51 +275,33 @@ static void __init qnap_ts209_init(void)
368 */ 275 */
369 orion5x_init(); 276 orion5x_init();
370 277
371 /* 278 orion5x_mpp_conf(ts209_mpp_modes);
372 * Setup flash mapping
373 */
374 orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
375 QNAP_TS209_NOR_BOOT_SIZE);
376
377 /*
378 * Open a special address decode windows for the PCIe WA.
379 */
380 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
381 ORION5X_PCIE_WA_SIZE);
382 279
383 /* 280 /*
384 * Setup Multiplexing Pins --
385 * MPP[0] Reserved
386 * MPP[1] USB copy button (0 active)
387 * MPP[2] Load defaults button (0 active)
388 * MPP[3] GPIO RTC
389 * MPP[4-5] Reserved
390 * MPP[6] PCI Int A
391 * MPP[7] PCI Int B
392 * MPP[8-11] Reserved
393 * MPP[12] SATA 0 presence
394 * MPP[13] SATA 1 presence
395 * MPP[14] SATA 0 active
396 * MPP[15] SATA 1 active
397 * MPP[16] UART1 RXD
398 * MPP[17] UART1 TXD
399 * MPP[18] SW_RST (0 active)
400 * MPP[19] Reserved
401 * MPP[20] PCI clock 0 281 * MPP[20] PCI clock 0
402 * MPP[21] PCI clock 1 282 * MPP[21] PCI clock 1
403 * MPP[22] USB 0 over current 283 * MPP[22] USB 0 over current
404 * MPP[23-25] Reserved 284 * MPP[23-25] Reserved
405 */ 285 */
406 orion5x_write(MPP_0_7_CTRL, 0x3);
407 orion5x_write(MPP_8_15_CTRL, 0x55550000);
408 orion5x_write(MPP_16_19_CTRL, 0x5500);
409 orion5x_gpio_set_valid_pins(0x3cc0fff);
410 286
411 /* register ts209 specific power-off method */ 287 /*
412 pm_power_off = qnap_ts209_power_off; 288 * Configure peripherals.
289 */
290 orion5x_ehci0_init();
291 orion5x_ehci1_init();
292 qnap_tsx09_find_mac_addr(QNAP_TS209_NOR_BOOT_BASE +
293 qnap_ts209_partitions[5].offset,
294 qnap_ts209_partitions[5].size);
295 orion5x_eth_init(&qnap_tsx09_eth_data);
296 orion5x_i2c_init();
297 orion5x_sata_init(&qnap_ts209_sata_data);
298 orion5x_uart0_init();
299
300 orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
301 QNAP_TS209_NOR_BOOT_SIZE);
302 platform_device_register(&qnap_ts209_nor_flash);
413 303
414 platform_add_devices(qnap_ts209_devices, 304 platform_device_register(&qnap_ts209_button_device);
415 ARRAY_SIZE(qnap_ts209_devices));
416 305
417 /* Get RTC IRQ and register the chip */ 306 /* Get RTC IRQ and register the chip */
418 if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) { 307 if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) {
@@ -425,14 +314,12 @@ static void __init qnap_ts209_init(void)
425 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n"); 314 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n");
426 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1); 315 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
427 316
428 ts209_find_mac_addr(); 317 /* register tsx09 specific power-off method */
429 orion5x_eth_init(&qnap_ts209_eth_data); 318 pm_power_off = qnap_tsx09_power_off;
430
431 orion5x_sata_init(&qnap_ts209_sata_data);
432} 319}
433 320
434MACHINE_START(TS209, "QNAP TS-109/TS-209") 321MACHINE_START(TS209, "QNAP TS-109/TS-209")
435 /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */ 322 /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */
436 .phys_io = ORION5X_REGS_PHYS_BASE, 323 .phys_io = ORION5X_REGS_PHYS_BASE,
437 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC, 324 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
438 .boot_params = 0x00000100, 325 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
new file mode 100644
index 000000000000..32f0ff073b7e
--- /dev/null
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -0,0 +1,273 @@
1/*
2 * QNAP TS-409 Board Setup
3 *
4 * Maintainer: Sylver Bruneau <sylver.bruneau@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/pci.h>
16#include <linux/irq.h>
17#include <linux/mtd/physmap.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/gpio_keys.h>
20#include <linux/input.h>
21#include <linux/i2c.h>
22#include <linux/serial_reg.h>
23#include <asm/mach-types.h>
24#include <asm/gpio.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h>
28#include "common.h"
29#include "mpp.h"
30#include "tsx09-common.h"
31
32/*****************************************************************************
33 * QNAP TS-409 Info
34 ****************************************************************************/
35
36/*
37 * QNAP TS-409 hardware :
38 * - Marvell 88F5281-D0
39 * - Marvell 88SX7042 SATA controller (PCIe)
40 * - Marvell 88E1118 Gigabit Ethernet PHY
41 * - RTC S35390A (@0x30) on I2C bus
42 * - 8MB NOR flash
43 * - 256MB of DDR-2 RAM
44 */
45
46/*
47 * 8MB NOR flash Device bus boot chip select
48 */
49
50#define QNAP_TS409_NOR_BOOT_BASE 0xff800000
51#define QNAP_TS409_NOR_BOOT_SIZE SZ_8M
52
53/****************************************************************************
54 * 8MiB NOR flash. The struct mtd_partition is not in the same order as the
55 * partitions on the device because we want to keep compatability with
56 * existing QNAP firmware.
57 *
58 * Layout as used by QNAP:
59 * [2] 0x00000000-0x00200000 : "Kernel"
60 * [3] 0x00200000-0x00600000 : "RootFS1"
61 * [4] 0x00600000-0x00700000 : "RootFS2"
62 * [6] 0x00700000-0x00760000 : "NAS Config" (read-only)
63 * [5] 0x00760000-0x00780000 : "U-Boot Config"
64 * [1] 0x00780000-0x00800000 : "U-Boot" (read-only)
65 ***************************************************************************/
66static struct mtd_partition qnap_ts409_partitions[] = {
67 {
68 .name = "U-Boot",
69 .size = 0x00080000,
70 .offset = 0x00780000,
71 .mask_flags = MTD_WRITEABLE,
72 }, {
73 .name = "Kernel",
74 .size = 0x00200000,
75 .offset = 0,
76 }, {
77 .name = "RootFS1",
78 .size = 0x00400000,
79 .offset = 0x00200000,
80 }, {
81 .name = "RootFS2",
82 .size = 0x00100000,
83 .offset = 0x00600000,
84 }, {
85 .name = "U-Boot Config",
86 .size = 0x00020000,
87 .offset = 0x00760000,
88 }, {
89 .name = "NAS Config",
90 .size = 0x00060000,
91 .offset = 0x00700000,
92 .mask_flags = MTD_WRITEABLE,
93 },
94};
95
96static struct physmap_flash_data qnap_ts409_nor_flash_data = {
97 .width = 1,
98 .parts = qnap_ts409_partitions,
99 .nr_parts = ARRAY_SIZE(qnap_ts409_partitions)
100};
101
102static struct resource qnap_ts409_nor_flash_resource = {
103 .flags = IORESOURCE_MEM,
104 .start = QNAP_TS409_NOR_BOOT_BASE,
105 .end = QNAP_TS409_NOR_BOOT_BASE + QNAP_TS409_NOR_BOOT_SIZE - 1,
106};
107
108static struct platform_device qnap_ts409_nor_flash = {
109 .name = "physmap-flash",
110 .id = 0,
111 .dev = { .platform_data = &qnap_ts409_nor_flash_data, },
112 .num_resources = 1,
113 .resource = &qnap_ts409_nor_flash_resource,
114};
115
116/*****************************************************************************
117 * PCI
118 ****************************************************************************/
119
120static int __init qnap_ts409_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
121{
122 int irq;
123
124 /*
125 * Check for devices with hard-wired IRQs.
126 */
127 irq = orion5x_pci_map_irq(dev, slot, pin);
128 if (irq != -1)
129 return irq;
130
131 /*
132 * PCI isn't used on the TS-409
133 */
134 return -1;
135}
136
137static struct hw_pci qnap_ts409_pci __initdata = {
138 .nr_controllers = 2,
139 .swizzle = pci_std_swizzle,
140 .setup = orion5x_pci_sys_setup,
141 .scan = orion5x_pci_sys_scan_bus,
142 .map_irq = qnap_ts409_pci_map_irq,
143};
144
145static int __init qnap_ts409_pci_init(void)
146{
147 if (machine_is_ts409())
148 pci_common_init(&qnap_ts409_pci);
149
150 return 0;
151}
152
153subsys_initcall(qnap_ts409_pci_init);
154
155/*****************************************************************************
156 * RTC S35390A on I2C bus
157 ****************************************************************************/
158
159#define TS409_RTC_GPIO 10
160
161static struct i2c_board_info __initdata qnap_ts409_i2c_rtc = {
162 I2C_BOARD_INFO("s35390a", 0x30),
163};
164
165/****************************************************************************
166 * GPIO Attached Keys
167 * Power button is attached to the PIC microcontroller
168 ****************************************************************************/
169
170#define QNAP_TS409_GPIO_KEY_MEDIA 15
171
172static struct gpio_keys_button qnap_ts409_buttons[] = {
173 {
174 .code = KEY_RESTART,
175 .gpio = QNAP_TS409_GPIO_KEY_MEDIA,
176 .desc = "USB Copy Button",
177 .active_low = 1,
178 },
179};
180
181static struct gpio_keys_platform_data qnap_ts409_button_data = {
182 .buttons = qnap_ts409_buttons,
183 .nbuttons = ARRAY_SIZE(qnap_ts409_buttons),
184};
185
186static struct platform_device qnap_ts409_button_device = {
187 .name = "gpio-keys",
188 .id = -1,
189 .num_resources = 0,
190 .dev = {
191 .platform_data = &qnap_ts409_button_data,
192 },
193};
194
195/*****************************************************************************
196 * General Setup
197 ****************************************************************************/
198static struct orion5x_mpp_mode ts409_mpp_modes[] __initdata = {
199 { 0, MPP_UNUSED },
200 { 1, MPP_UNUSED },
201 { 2, MPP_UNUSED },
202 { 3, MPP_UNUSED },
203 { 4, MPP_GPIO }, /* HDD 1 status */
204 { 5, MPP_GPIO }, /* HDD 2 status */
205 { 6, MPP_GPIO }, /* HDD 3 status */
206 { 7, MPP_GPIO }, /* HDD 4 status */
207 { 8, MPP_UNUSED },
208 { 9, MPP_UNUSED },
209 { 10, MPP_GPIO }, /* RTC int */
210 { 11, MPP_UNUSED },
211 { 12, MPP_UNUSED },
212 { 13, MPP_UNUSED },
213 { 14, MPP_GPIO }, /* SW_RST */
214 { 15, MPP_GPIO }, /* USB copy button */
215 { 16, MPP_UART }, /* UART1 RXD */
216 { 17, MPP_UART }, /* UART1 TXD */
217 { 18, MPP_UNUSED },
218 { 19, MPP_UNUSED },
219 { -1 },
220};
221
222static void __init qnap_ts409_init(void)
223{
224 /*
225 * Setup basic Orion functions. Need to be called early.
226 */
227 orion5x_init();
228
229 orion5x_mpp_conf(ts409_mpp_modes);
230
231 /*
232 * Configure peripherals.
233 */
234 orion5x_ehci0_init();
235 qnap_tsx09_find_mac_addr(QNAP_TS409_NOR_BOOT_BASE +
236 qnap_ts409_partitions[5].offset,
237 qnap_ts409_partitions[5].size);
238 orion5x_eth_init(&qnap_tsx09_eth_data);
239 orion5x_i2c_init();
240 orion5x_uart0_init();
241
242 orion5x_setup_dev_boot_win(QNAP_TS409_NOR_BOOT_BASE,
243 QNAP_TS409_NOR_BOOT_SIZE);
244 platform_device_register(&qnap_ts409_nor_flash);
245
246 platform_device_register(&qnap_ts409_button_device);
247
248 /* Get RTC IRQ and register the chip */
249 if (gpio_request(TS409_RTC_GPIO, "rtc") == 0) {
250 if (gpio_direction_input(TS409_RTC_GPIO) == 0)
251 qnap_ts409_i2c_rtc.irq = gpio_to_irq(TS409_RTC_GPIO);
252 else
253 gpio_free(TS409_RTC_GPIO);
254 }
255 if (qnap_ts409_i2c_rtc.irq == 0)
256 pr_warning("qnap_ts409_init: failed to get RTC IRQ\n");
257 i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1);
258
259 /* register tsx09 specific power-off method */
260 pm_power_off = qnap_tsx09_power_off;
261}
262
263MACHINE_START(TS409, "QNAP TS-409")
264 /* Maintainer: Sylver Bruneau <sylver.bruneau@gmail.com> */
265 .phys_io = ORION5X_REGS_PHYS_BASE,
266 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
267 .boot_params = 0x00000100,
268 .init_machine = qnap_ts409_init,
269 .map_io = orion5x_map_io,
270 .init_irq = orion5x_init_irq,
271 .timer = &orion5x_timer,
272 .fixup = tag_fixup_mem32,
273MACHINE_END
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
new file mode 100644
index 000000000000..77e9f351f07a
--- /dev/null
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -0,0 +1,277 @@
1/*
2 * arch/arm/mach-orion5x/ts78xx-setup.c
3 *
4 * Maintainer: Alexander Clouter <alex@digriz.org.uk>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/mv643xx_eth.h>
16#include <linux/ata_platform.h>
17#include <linux/m48t86.h>
18#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <asm/arch/orion5x.h>
22#include "common.h"
23#include "mpp.h"
24
25/*****************************************************************************
26 * TS-78xx Info
27 ****************************************************************************/
28
29/*
30 * FPGA - lives where the PCI bus would be at ORION5X_PCI_MEM_PHYS_BASE
31 */
32#define TS78XX_FPGA_REGS_PHYS_BASE 0xe8000000
33#define TS78XX_FPGA_REGS_VIRT_BASE 0xff900000
34#define TS78XX_FPGA_REGS_SIZE SZ_1M
35
36#define TS78XX_FPGA_REGS_SYSCON_ID (TS78XX_FPGA_REGS_VIRT_BASE | 0x000)
37#define TS78XX_FPGA_REGS_SYSCON_LCDI (TS78XX_FPGA_REGS_VIRT_BASE | 0x004)
38#define TS78XX_FPGA_REGS_SYSCON_LCDO (TS78XX_FPGA_REGS_VIRT_BASE | 0x008)
39
40#define TS78XX_FPGA_REGS_RTC_CTRL (TS78XX_FPGA_REGS_VIRT_BASE | 0x808)
41#define TS78XX_FPGA_REGS_RTC_DATA (TS78XX_FPGA_REGS_VIRT_BASE | 0x80c)
42
43/*
44 * 512kB NOR flash Device
45 */
46#define TS78XX_NOR_BOOT_BASE 0xff800000
47#define TS78XX_NOR_BOOT_SIZE SZ_512K
48
49/*****************************************************************************
50 * I/O Address Mapping
51 ****************************************************************************/
52static struct map_desc ts78xx_io_desc[] __initdata = {
53 {
54 .virtual = TS78XX_FPGA_REGS_VIRT_BASE,
55 .pfn = __phys_to_pfn(TS78XX_FPGA_REGS_PHYS_BASE),
56 .length = TS78XX_FPGA_REGS_SIZE,
57 .type = MT_DEVICE,
58 },
59};
60
61void __init ts78xx_map_io(void)
62{
63 orion5x_map_io();
64 iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc));
65}
66
67/*****************************************************************************
68 * 512kB NOR Boot Flash - the chip is a M25P40
69 ****************************************************************************/
70static struct mtd_partition ts78xx_nor_boot_flash_resources[] = {
71 {
72 .name = "ts-bootrom",
73 .offset = 0,
74 /* only the first 256kB is used */
75 .size = SZ_256K,
76 .mask_flags = MTD_WRITEABLE,
77 },
78};
79
80static struct physmap_flash_data ts78xx_nor_boot_flash_data = {
81 .width = 1,
82 .parts = ts78xx_nor_boot_flash_resources,
83 .nr_parts = ARRAY_SIZE(ts78xx_nor_boot_flash_resources),
84};
85
86static struct resource ts78xx_nor_boot_flash_resource = {
87 .flags = IORESOURCE_MEM,
88 .start = TS78XX_NOR_BOOT_BASE,
89 .end = TS78XX_NOR_BOOT_BASE + TS78XX_NOR_BOOT_SIZE - 1,
90};
91
92static struct platform_device ts78xx_nor_boot_flash = {
93 .name = "physmap-flash",
94 .id = -1,
95 .dev = {
96 .platform_data = &ts78xx_nor_boot_flash_data,
97 },
98 .num_resources = 1,
99 .resource = &ts78xx_nor_boot_flash_resource,
100};
101
102/*****************************************************************************
103 * Ethernet
104 ****************************************************************************/
105static struct mv643xx_eth_platform_data ts78xx_eth_data = {
106 .phy_addr = 0,
107 .force_phy_addr = 1,
108};
109
110/*****************************************************************************
111 * RTC M48T86 - nicked^Wborrowed from arch/arm/mach-ep93xx/ts72xx.c
112 ****************************************************************************/
113#ifdef CONFIG_RTC_DRV_M48T86
114static unsigned char ts78xx_rtc_readbyte(unsigned long addr)
115{
116 writeb(addr, TS78XX_FPGA_REGS_RTC_CTRL);
117 return readb(TS78XX_FPGA_REGS_RTC_DATA);
118}
119
120static void ts78xx_rtc_writebyte(unsigned char value, unsigned long addr)
121{
122 writeb(addr, TS78XX_FPGA_REGS_RTC_CTRL);
123 writeb(value, TS78XX_FPGA_REGS_RTC_DATA);
124}
125
126static struct m48t86_ops ts78xx_rtc_ops = {
127 .readbyte = ts78xx_rtc_readbyte,
128 .writebyte = ts78xx_rtc_writebyte,
129};
130
131static struct platform_device ts78xx_rtc_device = {
132 .name = "rtc-m48t86",
133 .id = -1,
134 .dev = {
135 .platform_data = &ts78xx_rtc_ops,
136 },
137 .num_resources = 0,
138};
139
140/*
141 * TS uses some of the user storage space on the RTC chip so see if it is
142 * present; as it's an optional feature at purchase time and not all boards
143 * will have it present
144 *
145 * I've used the method TS use in their rtc7800.c example for the detection
146 *
147 * TODO: track down a guinea pig without an RTC to see if we can work out a
148 * better RTC detection routine
149 */
150static int __init ts78xx_rtc_init(void)
151{
152 unsigned char tmp_rtc0, tmp_rtc1;
153
154 tmp_rtc0 = ts78xx_rtc_readbyte(126);
155 tmp_rtc1 = ts78xx_rtc_readbyte(127);
156
157 ts78xx_rtc_writebyte(0x00, 126);
158 ts78xx_rtc_writebyte(0x55, 127);
159 if (ts78xx_rtc_readbyte(127) == 0x55) {
160 ts78xx_rtc_writebyte(0xaa, 127);
161 if (ts78xx_rtc_readbyte(127) == 0xaa
162 && ts78xx_rtc_readbyte(126) == 0x00) {
163 ts78xx_rtc_writebyte(tmp_rtc0, 126);
164 ts78xx_rtc_writebyte(tmp_rtc1, 127);
165 platform_device_register(&ts78xx_rtc_device);
166 return 1;
167 }
168 }
169
170 return 0;
171};
172#else
173static int __init ts78xx_rtc_init(void)
174{
175 return 0;
176}
177#endif
178
179/*****************************************************************************
180 * SATA
181 ****************************************************************************/
182static struct mv_sata_platform_data ts78xx_sata_data = {
183 .n_ports = 2,
184};
185
186/*****************************************************************************
187 * print some information regarding the board
188 ****************************************************************************/
189static void __init ts78xx_print_board_id(void)
190{
191 unsigned int board_info;
192
193 board_info = readl(TS78XX_FPGA_REGS_SYSCON_ID);
194 printk(KERN_INFO "TS-78xx Info: FPGA rev=%.2x, Board Magic=%.6x, ",
195 board_info & 0xff,
196 (board_info >> 8) & 0xffffff);
197 board_info = readl(TS78XX_FPGA_REGS_SYSCON_LCDI);
198 printk("JP1=%d, JP2=%d\n",
199 (board_info >> 30) & 0x1,
200 (board_info >> 31) & 0x1);
201};
202
203/*****************************************************************************
204 * General Setup
205 ****************************************************************************/
206static struct orion5x_mpp_mode ts78xx_mpp_modes[] __initdata = {
207 { 0, MPP_UNUSED },
208 { 1, MPP_GPIO }, /* JTAG Clock */
209 { 2, MPP_GPIO }, /* JTAG Data In */
210 { 3, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB2B */
211 { 4, MPP_GPIO }, /* JTAG Data Out */
212 { 5, MPP_GPIO }, /* JTAG TMS */
213 { 6, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB31A_CLK4+ */
214 { 7, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB22B */
215 { 8, MPP_UNUSED },
216 { 9, MPP_UNUSED },
217 { 10, MPP_UNUSED },
218 { 11, MPP_UNUSED },
219 { 12, MPP_UNUSED },
220 { 13, MPP_UNUSED },
221 { 14, MPP_UNUSED },
222 { 15, MPP_UNUSED },
223 { 16, MPP_UART },
224 { 17, MPP_UART },
225 { 18, MPP_UART },
226 { 19, MPP_UART },
227 { -1 },
228};
229
230static void __init ts78xx_init(void)
231{
232 /*
233 * Setup basic Orion functions. Need to be called early.
234 */
235 orion5x_init();
236
237 ts78xx_print_board_id();
238
239 orion5x_mpp_conf(ts78xx_mpp_modes);
240
241 /*
242 * MPP[20] PCI Clock Out 1
243 * MPP[21] PCI Clock Out 0
244 * MPP[22] Unused
245 * MPP[23] Unused
246 * MPP[24] Unused
247 * MPP[25] Unused
248 */
249
250 /*
251 * Configure peripherals.
252 */
253 orion5x_ehci0_init();
254 orion5x_ehci1_init();
255 orion5x_eth_init(&ts78xx_eth_data);
256 orion5x_sata_init(&ts78xx_sata_data);
257 orion5x_uart0_init();
258 orion5x_uart1_init();
259
260 orion5x_setup_dev_boot_win(TS78XX_NOR_BOOT_BASE,
261 TS78XX_NOR_BOOT_SIZE);
262 platform_device_register(&ts78xx_nor_boot_flash);
263
264 if (!ts78xx_rtc_init())
265 printk(KERN_INFO "TS-78xx RTC not detected or enabled\n");
266}
267
268MACHINE_START(TS78XX, "Technologic Systems TS-78xx SBC")
269 /* Maintainer: Alexander Clouter <alex@digriz.org.uk> */
270 .phys_io = ORION5X_REGS_PHYS_BASE,
271 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
272 .boot_params = 0x00000100,
273 .init_machine = ts78xx_init,
274 .map_io = ts78xx_map_io,
275 .init_irq = orion5x_init_irq,
276 .timer = &orion5x_timer,
277MACHINE_END
diff --git a/arch/arm/mach-orion5x/tsx09-common.c b/arch/arm/mach-orion5x/tsx09-common.c
new file mode 100644
index 000000000000..83feac3147a6
--- /dev/null
+++ b/arch/arm/mach-orion5x/tsx09-common.c
@@ -0,0 +1,133 @@
1/*
2 * QNAP TS-x09 Boards common functions
3 *
4 * Maintainers: Lennert Buytenhek <buytenh@marvell.com>
5 * Byron Bradley <byron.bbradley@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <linux/mv643xx_eth.h>
16#include <linux/timex.h>
17#include <linux/serial_reg.h>
18#include "tsx09-common.h"
19
20/*****************************************************************************
21 * QNAP TS-x09 specific power off method via UART1-attached PIC
22 ****************************************************************************/
23
24#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
25
26void qnap_tsx09_power_off(void)
27{
28 /* 19200 baud divisor */
29 const unsigned divisor = ((ORION5X_TCLK + (8 * 19200)) / (16 * 19200));
30
31 pr_info("%s: triggering power-off...\n", __func__);
32
33 /* hijack uart1 and reset into sane state (19200,8n1) */
34 writel(0x83, UART1_REG(LCR));
35 writel(divisor & 0xff, UART1_REG(DLL));
36 writel((divisor >> 8) & 0xff, UART1_REG(DLM));
37 writel(0x03, UART1_REG(LCR));
38 writel(0x00, UART1_REG(IER));
39 writel(0x00, UART1_REG(FCR));
40 writel(0x00, UART1_REG(MCR));
41
42 /* send the power-off command 'A' to PIC */
43 writel('A', UART1_REG(TX));
44}
45
46/*****************************************************************************
47 * Ethernet
48 ****************************************************************************/
49
50struct mv643xx_eth_platform_data qnap_tsx09_eth_data = {
51 .phy_addr = 8,
52};
53
54static int __init qnap_tsx09_parse_hex_nibble(char n)
55{
56 if (n >= '0' && n <= '9')
57 return n - '0';
58
59 if (n >= 'A' && n <= 'F')
60 return n - 'A' + 10;
61
62 if (n >= 'a' && n <= 'f')
63 return n - 'a' + 10;
64
65 return -1;
66}
67
68static int __init qnap_tsx09_parse_hex_byte(const char *b)
69{
70 int hi;
71 int lo;
72
73 hi = qnap_tsx09_parse_hex_nibble(b[0]);
74 lo = qnap_tsx09_parse_hex_nibble(b[1]);
75
76 if (hi < 0 || lo < 0)
77 return -1;
78
79 return (hi << 4) | lo;
80}
81
82static int __init qnap_tsx09_check_mac_addr(const char *addr_str)
83{
84 u_int8_t addr[6];
85 int i;
86
87 for (i = 0; i < 6; i++) {
88 int byte;
89
90 /*
91 * Enforce "xx:xx:xx:xx:xx:xx\n" format.
92 */
93 if (addr_str[(i * 3) + 2] != ((i < 5) ? ':' : '\n'))
94 return -1;
95
96 byte = qnap_tsx09_parse_hex_byte(addr_str + (i * 3));
97 if (byte < 0)
98 return -1;
99 addr[i] = byte;
100 }
101
102 printk(KERN_INFO "tsx09: found ethernet mac address ");
103 for (i = 0; i < 6; i++)
104 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
105
106 memcpy(qnap_tsx09_eth_data.mac_addr, addr, 6);
107
108 return 0;
109}
110
111/*
112 * The 'NAS Config' flash partition has an ext2 filesystem which
113 * contains a file that has the ethernet MAC address in plain text
114 * (format "xx:xx:xx:xx:xx:xx\n").
115 */
116void __init qnap_tsx09_find_mac_addr(u32 mem_base, u32 size)
117{
118 unsigned long addr;
119
120 for (addr = mem_base; addr < (mem_base + size); addr += 1024) {
121 char *nor_page;
122 int ret = 0;
123
124 nor_page = ioremap(addr, 1024);
125 if (nor_page != NULL) {
126 ret = qnap_tsx09_check_mac_addr(nor_page);
127 iounmap(nor_page);
128 }
129
130 if (ret == 0)
131 break;
132 }
133}
diff --git a/arch/arm/mach-orion5x/tsx09-common.h b/arch/arm/mach-orion5x/tsx09-common.h
new file mode 100644
index 000000000000..0984264616f0
--- /dev/null
+++ b/arch/arm/mach-orion5x/tsx09-common.h
@@ -0,0 +1,20 @@
1#ifndef __ARCH_ORION5X_TSX09_COMMON_H
2#define __ARCH_ORION5X_TSX09_COMMON_H
3
4/*
5 * QNAP TS-x09 Boards power-off function
6 */
7extern void qnap_tsx09_power_off(void);
8
9/*
10 * QNAP TS-x09 Boards function to find Ethernet MAC address in flash memory
11 */
12extern void __init qnap_tsx09_find_mac_addr(u32 mem_base, u32 size);
13
14/*
15 * QNAP TS-x09 Boards ethernet declaration
16 */
17extern struct mv643xx_eth_platform_data qnap_tsx09_eth_data;
18
19
20#endif
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
new file mode 100644
index 000000000000..1af093ff8cf3
--- /dev/null
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -0,0 +1,164 @@
1/*
2 * arch/arm/mach-orion5x/wnr854t-setup.c
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/pci.h>
13#include <linux/irq.h>
14#include <linux/delay.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h>
17#include <asm/mach-types.h>
18#include <asm/gpio.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/pci.h>
21#include <asm/arch/orion5x.h>
22#include "common.h"
23#include "mpp.h"
24
25static struct orion5x_mpp_mode wnr854t_mpp_modes[] __initdata = {
26 { 0, MPP_GPIO }, /* Power LED green (0=on) */
27 { 1, MPP_GPIO }, /* Reset Button (0=off) */
28 { 2, MPP_GPIO }, /* Power LED blink (0=off) */
29 { 3, MPP_GPIO }, /* WAN Status LED amber (0=off) */
30 { 4, MPP_GPIO }, /* PCI int */
31 { 5, MPP_GPIO }, /* ??? */
32 { 6, MPP_GPIO }, /* ??? */
33 { 7, MPP_GPIO }, /* ??? */
34 { 8, MPP_UNUSED }, /* ??? */
35 { 9, MPP_GIGE }, /* GE_RXERR */
36 { 10, MPP_UNUSED }, /* ??? */
37 { 11, MPP_UNUSED }, /* ??? */
38 { 12, MPP_GIGE }, /* GE_TXD[4] */
39 { 13, MPP_GIGE }, /* GE_TXD[5] */
40 { 14, MPP_GIGE }, /* GE_TXD[6] */
41 { 15, MPP_GIGE }, /* GE_TXD[7] */
42 { 16, MPP_GIGE }, /* GE_RXD[4] */
43 { 17, MPP_GIGE }, /* GE_RXD[5] */
44 { 18, MPP_GIGE }, /* GE_RXD[6] */
45 { 19, MPP_GIGE }, /* GE_RXD[7] */
46 { -1 },
47};
48
49/*
50 * 8M NOR flash Device bus boot chip select
51 */
52#define WNR854T_NOR_BOOT_BASE 0xf4000000
53#define WNR854T_NOR_BOOT_SIZE SZ_8M
54
55static struct mtd_partition wnr854t_nor_flash_partitions[] = {
56 {
57 .name = "kernel",
58 .offset = 0x00000000,
59 .size = 0x00100000,
60 }, {
61 .name = "rootfs",
62 .offset = 0x00100000,
63 .size = 0x00660000,
64 }, {
65 .name = "uboot",
66 .offset = 0x00760000,
67 .size = 0x00040000,
68 },
69};
70
71static struct physmap_flash_data wnr854t_nor_flash_data = {
72 .width = 2,
73 .parts = wnr854t_nor_flash_partitions,
74 .nr_parts = ARRAY_SIZE(wnr854t_nor_flash_partitions),
75};
76
77static struct resource wnr854t_nor_flash_resource = {
78 .flags = IORESOURCE_MEM,
79 .start = WNR854T_NOR_BOOT_BASE,
80 .end = WNR854T_NOR_BOOT_BASE + WNR854T_NOR_BOOT_SIZE - 1,
81};
82
83static struct platform_device wnr854t_nor_flash = {
84 .name = "physmap-flash",
85 .id = 0,
86 .dev = {
87 .platform_data = &wnr854t_nor_flash_data,
88 },
89 .num_resources = 1,
90 .resource = &wnr854t_nor_flash_resource,
91};
92
93static struct mv643xx_eth_platform_data wnr854t_eth_data = {
94 .phy_addr = -1,
95};
96
97static void __init wnr854t_init(void)
98{
99 /*
100 * Setup basic Orion functions. Need to be called early.
101 */
102 orion5x_init();
103
104 orion5x_mpp_conf(wnr854t_mpp_modes);
105
106 /*
107 * Configure peripherals.
108 */
109 orion5x_eth_init(&wnr854t_eth_data);
110 orion5x_uart0_init();
111
112 orion5x_setup_dev_boot_win(WNR854T_NOR_BOOT_BASE,
113 WNR854T_NOR_BOOT_SIZE);
114 platform_device_register(&wnr854t_nor_flash);
115}
116
117static int __init wnr854t_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
118{
119 int irq;
120
121 /*
122 * Check for devices with hard-wired IRQs.
123 */
124 irq = orion5x_pci_map_irq(dev, slot, pin);
125 if (irq != -1)
126 return irq;
127
128 /*
129 * Mini-PCI slot.
130 */
131 if (slot == 7)
132 return gpio_to_irq(4);
133
134 return -1;
135}
136
137static struct hw_pci wnr854t_pci __initdata = {
138 .nr_controllers = 2,
139 .swizzle = pci_std_swizzle,
140 .setup = orion5x_pci_sys_setup,
141 .scan = orion5x_pci_sys_scan_bus,
142 .map_irq = wnr854t_pci_map_irq,
143};
144
145static int __init wnr854t_pci_init(void)
146{
147 if (machine_is_wnr854t())
148 pci_common_init(&wnr854t_pci);
149
150 return 0;
151}
152subsys_initcall(wnr854t_pci_init);
153
154MACHINE_START(WNR854T, "Netgear WNR854T")
155 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
156 .phys_io = ORION5X_REGS_PHYS_BASE,
157 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
158 .boot_params = 0x00000100,
159 .init_machine = wnr854t_init,
160 .map_io = orion5x_map_io,
161 .init_irq = orion5x_init_irq,
162 .timer = &orion5x_timer,
163 .fixup = tag_fixup_mem32,
164MACHINE_END
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
new file mode 100644
index 000000000000..aeab55c6a82d
--- /dev/null
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -0,0 +1,173 @@
1/*
2 * arch/arm/mach-orion5x/wrt350n-v2-setup.c
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/pci.h>
13#include <linux/irq.h>
14#include <linux/delay.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h>
17#include <asm/mach-types.h>
18#include <asm/gpio.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/pci.h>
21#include <asm/arch/orion5x.h>
22#include "common.h"
23#include "mpp.h"
24
25static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = {
26 { 0, MPP_GPIO }, /* Power LED green (0=on) */
27 { 1, MPP_GPIO }, /* Security LED (0=on) */
28 { 2, MPP_GPIO }, /* Internal Button (0=on) */
29 { 3, MPP_GPIO }, /* Reset Button (0=on) */
30 { 4, MPP_GPIO }, /* PCI int */
31 { 5, MPP_GPIO }, /* Power LED orange (0=on) */
32 { 6, MPP_GPIO }, /* USB LED (0=on) */
33 { 7, MPP_GPIO }, /* Wireless LED (0=on) */
34 { 8, MPP_UNUSED }, /* ??? */
35 { 9, MPP_GIGE }, /* GE_RXERR */
36 { 10, MPP_UNUSED }, /* ??? */
37 { 11, MPP_UNUSED }, /* ??? */
38 { 12, MPP_GIGE }, /* GE_TXD[4] */
39 { 13, MPP_GIGE }, /* GE_TXD[5] */
40 { 14, MPP_GIGE }, /* GE_TXD[6] */
41 { 15, MPP_GIGE }, /* GE_TXD[7] */
42 { 16, MPP_GIGE }, /* GE_RXD[4] */
43 { 17, MPP_GIGE }, /* GE_RXD[5] */
44 { 18, MPP_GIGE }, /* GE_RXD[6] */
45 { 19, MPP_GIGE }, /* GE_RXD[7] */
46 { -1 },
47};
48
49/*
50 * 8M NOR flash Device bus boot chip select
51 */
52#define WRT350N_V2_NOR_BOOT_BASE 0xf4000000
53#define WRT350N_V2_NOR_BOOT_SIZE SZ_8M
54
55static struct mtd_partition wrt350n_v2_nor_flash_partitions[] = {
56 {
57 .name = "kernel",
58 .offset = 0x00000000,
59 .size = 0x00760000,
60 }, {
61 .name = "rootfs",
62 .offset = 0x001a0000,
63 .size = 0x005c0000,
64 }, {
65 .name = "lang",
66 .offset = 0x00760000,
67 .size = 0x00040000,
68 }, {
69 .name = "nvram",
70 .offset = 0x007a0000,
71 .size = 0x00020000,
72 }, {
73 .name = "u-boot",
74 .offset = 0x007c0000,
75 .size = 0x00040000,
76 },
77};
78
79static struct physmap_flash_data wrt350n_v2_nor_flash_data = {
80 .width = 1,
81 .parts = wrt350n_v2_nor_flash_partitions,
82 .nr_parts = ARRAY_SIZE(wrt350n_v2_nor_flash_partitions),
83};
84
85static struct resource wrt350n_v2_nor_flash_resource = {
86 .flags = IORESOURCE_MEM,
87 .start = WRT350N_V2_NOR_BOOT_BASE,
88 .end = WRT350N_V2_NOR_BOOT_BASE + WRT350N_V2_NOR_BOOT_SIZE - 1,
89};
90
91static struct platform_device wrt350n_v2_nor_flash = {
92 .name = "physmap-flash",
93 .id = 0,
94 .dev = {
95 .platform_data = &wrt350n_v2_nor_flash_data,
96 },
97 .num_resources = 1,
98 .resource = &wrt350n_v2_nor_flash_resource,
99};
100
101static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
102 .phy_addr = -1,
103};
104
105static void __init wrt350n_v2_init(void)
106{
107 /*
108 * Setup basic Orion functions. Need to be called early.
109 */
110 orion5x_init();
111
112 orion5x_mpp_conf(wrt350n_v2_mpp_modes);
113
114 /*
115 * Configure peripherals.
116 */
117 orion5x_ehci0_init();
118 orion5x_eth_init(&wrt350n_v2_eth_data);
119 orion5x_uart0_init();
120
121 orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
122 WRT350N_V2_NOR_BOOT_SIZE);
123 platform_device_register(&wrt350n_v2_nor_flash);
124}
125
126static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
127{
128 int irq;
129
130 /*
131 * Check for devices with hard-wired IRQs.
132 */
133 irq = orion5x_pci_map_irq(dev, slot, pin);
134 if (irq != -1)
135 return irq;
136
137 /*
138 * Mini-PCI slot.
139 */
140 if (slot == 7)
141 return gpio_to_irq(4);
142
143 return -1;
144}
145
146static struct hw_pci wrt350n_v2_pci __initdata = {
147 .nr_controllers = 2,
148 .swizzle = pci_std_swizzle,
149 .setup = orion5x_pci_sys_setup,
150 .scan = orion5x_pci_sys_scan_bus,
151 .map_irq = wrt350n_v2_pci_map_irq,
152};
153
154static int __init wrt350n_v2_pci_init(void)
155{
156 if (machine_is_wrt350n_v2())
157 pci_common_init(&wrt350n_v2_pci);
158
159 return 0;
160}
161subsys_initcall(wrt350n_v2_pci_init);
162
163MACHINE_START(WRT350N_V2, "Linksys WRT350N v2")
164 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
165 .phys_io = ORION5X_REGS_PHYS_BASE,
166 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
167 .boot_params = 0x00000100,
168 .init_machine = wrt350n_v2_init,
169 .map_io = orion5x_map_io,
170 .init_irq = orion5x_init_irq,
171 .timer = &orion5x_timer,
172 .fixup = tag_fixup_mem32,
173MACHINE_END
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 5da7a6820492..914bb33dab92 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -20,8 +20,7 @@ endmenu
20 20
21endif 21endif
22 22
23choice 23menu "Select target boards"
24 prompt "Select target board"
25 24
26config ARCH_GUMSTIX 25config ARCH_GUMSTIX
27 bool "Gumstix XScale boards" 26 bool "Gumstix XScale boards"
@@ -37,10 +36,12 @@ config ARCH_LUBBOCK
37config MACH_LOGICPD_PXA270 36config MACH_LOGICPD_PXA270
38 bool "LogicPD PXA270 Card Engine Development Platform" 37 bool "LogicPD PXA270 Card Engine Development Platform"
39 select PXA27x 38 select PXA27x
39 select HAVE_PWM
40 40
41config MACH_MAINSTONE 41config MACH_MAINSTONE
42 bool "Intel HCDDBBVA0 Development Platform" 42 bool "Intel HCDDBBVA0 Development Platform"
43 select PXA27x 43 select PXA27x
44 select HAVE_PWM
44 45
45config ARCH_PXA_IDP 46config ARCH_PXA_IDP
46 bool "Accelent Xscale IDP" 47 bool "Accelent Xscale IDP"
@@ -116,6 +117,7 @@ config MACH_COLIBRI
116config MACH_ZYLONITE 117config MACH_ZYLONITE
117 bool "PXA3xx Development Platform" 118 bool "PXA3xx Development Platform"
118 select PXA3xx 119 select PXA3xx
120 select HAVE_PWM
119 121
120config MACH_LITTLETON 122config MACH_LITTLETON
121 bool "PXA3xx Form Factor Platform (aka Littleton)" 123 bool "PXA3xx Form Factor Platform (aka Littleton)"
@@ -138,7 +140,7 @@ config MACH_PCM027
138 select PXA27x 140 select PXA27x
139 select IWMMXT 141 select IWMMXT
140 142
141endchoice 143endmenu
142 144
143choice 145choice
144 prompt "Used baseboard" 146 prompt "Used baseboard"
@@ -146,25 +148,24 @@ choice
146 148
147config MACH_PCM990_BASEBOARD 149config MACH_PCM990_BASEBOARD
148 bool "PHYTEC PCM-990 development board" 150 bool "PHYTEC PCM-990 development board"
151 select HAVE_PWM
149 152
150endchoice 153endchoice
151 154
152if PXA_SHARPSL
153
154choice 155choice
155 prompt "Select target Sharp Zaurus device range" 156 prompt "display on pcm990"
157 depends on MACH_PCM990_BASEBOARD
156 158
157config PXA_SHARPSL_25x 159config PCM990_DISPLAY_SHARP
158 bool "Sharp PXA25x models (SL-5600, SL-C7xx and SL-C6000x)" 160 bool "sharp lq084v1dg21 stn display"
159 select PXA25x
160 161
161config PXA_SHARPSL_27x 162config PCM990_DISPLAY_NEC
162 bool "Sharp PXA270 models (SL-Cxx00)" 163 bool "nec nl6448bc20_18d tft display"
163 select PXA27x
164 164
165endchoice 165config PCM990_DISPLAY_NONE
166 bool "no display"
166 167
167endif 168endchoice
168 169
169if ARCH_GUMSTIX 170if ARCH_GUMSTIX
170 171
@@ -199,28 +200,33 @@ endmenu
199 200
200config MACH_POODLE 201config MACH_POODLE
201 bool "Enable Sharp SL-5600 (Poodle) Support" 202 bool "Enable Sharp SL-5600 (Poodle) Support"
202 depends on PXA_SHARPSL_25x 203 depends on PXA_SHARPSL
204 select PXA25x
203 select SHARP_LOCOMO 205 select SHARP_LOCOMO
204 select PXA_SSP 206 select PXA_SSP
205 207
206config MACH_CORGI 208config MACH_CORGI
207 bool "Enable Sharp SL-C700 (Corgi) Support" 209 bool "Enable Sharp SL-C700 (Corgi) Support"
208 depends on PXA_SHARPSL_25x 210 depends on PXA_SHARPSL
211 select PXA25x
209 select PXA_SHARP_C7xx 212 select PXA_SHARP_C7xx
210 213
211config MACH_SHEPHERD 214config MACH_SHEPHERD
212 bool "Enable Sharp SL-C750 (Shepherd) Support" 215 bool "Enable Sharp SL-C750 (Shepherd) Support"
213 depends on PXA_SHARPSL_25x 216 depends on PXA_SHARPSL
217 select PXA25x
214 select PXA_SHARP_C7xx 218 select PXA_SHARP_C7xx
215 219
216config MACH_HUSKY 220config MACH_HUSKY
217 bool "Enable Sharp SL-C760 (Husky) Support" 221 bool "Enable Sharp SL-C760 (Husky) Support"
218 depends on PXA_SHARPSL_25x 222 depends on PXA_SHARPSL
223 select PXA25x
219 select PXA_SHARP_C7xx 224 select PXA_SHARP_C7xx
220 225
221config MACH_AKITA 226config MACH_AKITA
222 bool "Enable Sharp SL-1000 (Akita) Support" 227 bool "Enable Sharp SL-1000 (Akita) Support"
223 depends on PXA_SHARPSL_27x 228 depends on PXA_SHARPSL
229 select PXA27x
224 select PXA_SHARP_Cxx00 230 select PXA_SHARP_Cxx00
225 select MACH_SPITZ 231 select MACH_SPITZ
226 select I2C 232 select I2C
@@ -228,17 +234,20 @@ config MACH_AKITA
228 234
229config MACH_SPITZ 235config MACH_SPITZ
230 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support" 236 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
231 depends on PXA_SHARPSL_27x 237 depends on PXA_SHARPSL
238 select PXA27x
232 select PXA_SHARP_Cxx00 239 select PXA_SHARP_Cxx00
233 240
234config MACH_BORZOI 241config MACH_BORZOI
235 bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support" 242 bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support"
236 depends on PXA_SHARPSL_27x 243 depends on PXA_SHARPSL
244 select PXA27x
237 select PXA_SHARP_Cxx00 245 select PXA_SHARP_Cxx00
238 246
239config MACH_TOSA 247config MACH_TOSA
240 bool "Enable Sharp SL-6000x (Tosa) Support" 248 bool "Enable Sharp SL-6000x (Tosa) Support"
241 depends on PXA_SHARPSL_25x 249 depends on PXA_SHARPSL
250 select PXA25x
242 251
243config PXA25x 252config PXA25x
244 bool 253 bool
@@ -273,4 +282,10 @@ config PXA_SSP
273 tristate 282 tristate
274 help 283 help
275 Enable support for PXA2xx SSP ports 284 Enable support for PXA2xx SSP ports
285
286config PXA_PWM
287 tristate
288 default BACKLIGHT_PWM
289 help
290 Enable support for PXA2xx/PXA3xx PWM controllers
276endif 291endif
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 0e6d05bb81aa..c4dfbe87fc4e 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -10,10 +10,11 @@ obj-$(CONFIG_CPU_FREQ) += cpu-pxa.o
10 10
11# Generic drivers that other drivers may depend upon 11# Generic drivers that other drivers may depend upon
12obj-$(CONFIG_PXA_SSP) += ssp.o 12obj-$(CONFIG_PXA_SSP) += ssp.o
13obj-$(CONFIG_PXA_PWM) += pwm.o
13 14
14# SoC-specific code 15# SoC-specific code
15obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa25x.o 16obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa2xx.o pxa25x.o
16obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa27x.o 17obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa2xx.o pxa27x.o
17obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o 18obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o
18obj-$(CONFIG_CPU_PXA300) += pxa300.o 19obj-$(CONFIG_CPU_PXA300) += pxa300.o
19obj-$(CONFIG_CPU_PXA320) += pxa320.o 20obj-$(CONFIG_CPU_PXA320) += pxa320.o
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index e97dc59813c8..b4d04955dcb0 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -12,7 +12,7 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14 14
15#include <asm/arch/pxa-regs.h> 15#include <asm/arch/pxa2xx-regs.h>
16#include <asm/arch/pxa2xx-gpio.h> 16#include <asm/arch/pxa2xx-gpio.h>
17#include <asm/hardware.h> 17#include <asm/hardware.h>
18 18
@@ -47,6 +47,9 @@ struct clk *clk_get(struct device *dev, const char *id)
47 clk = p; 47 clk = p;
48 mutex_unlock(&clocks_mutex); 48 mutex_unlock(&clocks_mutex);
49 49
50 if (!IS_ERR(clk) && clk->ops == NULL)
51 clk = clk->other;
52
50 return clk; 53 return clk;
51} 54}
52EXPORT_SYMBOL(clk_get); 55EXPORT_SYMBOL(clk_get);
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index bc6b77e1592e..83cbfaba485d 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -15,6 +15,7 @@ struct clk {
15 unsigned int cken; 15 unsigned int cken;
16 unsigned int delay; 16 unsigned int delay;
17 unsigned int enabled; 17 unsigned int enabled;
18 struct clk *other;
18}; 19};
19 20
20#define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \ 21#define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \
@@ -35,6 +36,17 @@ struct clk {
35 .cken = CKEN_##_cken, \ 36 .cken = CKEN_##_cken, \
36 } 37 }
37 38
39/*
40 * This is a placeholder to alias one clock device+name pair
41 * to another struct clk.
42 */
43#define INIT_CKOTHER(_name, _other, _dev) \
44 { \
45 .name = _name, \
46 .dev = _dev, \
47 .other = _other, \
48 }
49
38extern const struct clkops clk_cken_ops; 50extern const struct clkops clk_cken_ops;
39 51
40void clk_cken_enable(struct clk *clk); 52void clk_cken_enable(struct clk *clk);
diff --git a/arch/arm/mach-pxa/cm-x270-pci.c b/arch/arm/mach-pxa/cm-x270-pci.c
index ac7f05f9f3eb..319c9ff3ab9a 100644
--- a/arch/arm/mach-pxa/cm-x270-pci.c
+++ b/arch/arm/mach-pxa/cm-x270-pci.c
@@ -41,18 +41,20 @@ void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size,
41{ 41{
42 unsigned int sz = SZ_64M >> PAGE_SHIFT; 42 unsigned int sz = SZ_64M >> PAGE_SHIFT;
43 43
44 pr_info("Adjusting zones for CM-x270\n"); 44 if (machine_is_armcore()) {
45 45 pr_info("Adjusting zones for CM-x270\n");
46 /* 46
47 * Only adjust if > 64M on current system 47 /*
48 */ 48 * Only adjust if > 64M on current system
49 if (node || (zone_size[0] <= sz)) 49 */
50 return; 50 if (node || (zone_size[0] <= sz))
51 51 return;
52 zone_size[1] = zone_size[0] - sz; 52
53 zone_size[0] = sz; 53 zone_size[1] = zone_size[0] - sz;
54 zhole_size[1] = zhole_size[0]; 54 zone_size[0] = sz;
55 zhole_size[0] = 0; 55 zhole_size[1] = zhole_size[0];
56 zhole_size[0] = 0;
57 }
56} 58}
57 59
58static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) 60static void cmx270_it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index f5851d1adc25..01b9964acec1 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -31,6 +31,7 @@
31#include <asm/arch/pxa-regs.h> 31#include <asm/arch/pxa-regs.h>
32#include <asm/arch/pxa2xx-regs.h> 32#include <asm/arch/pxa2xx-regs.h>
33#include <asm/arch/pxa2xx-gpio.h> 33#include <asm/arch/pxa2xx-gpio.h>
34#include <asm/arch/audio.h>
34#include <asm/arch/pxafb.h> 35#include <asm/arch/pxafb.h>
35#include <asm/arch/ohci.h> 36#include <asm/arch/ohci.h>
36#include <asm/arch/mmc.h> 37#include <asm/arch/mmc.h>
@@ -81,12 +82,6 @@ static struct platform_device cmx270_device_dm9k = {
81 } 82 }
82}; 83};
83 84
84/* audio device */
85static struct platform_device cmx270_audio_device = {
86 .name = "pxa2xx-ac97",
87 .id = -1,
88};
89
90/* touchscreen controller */ 85/* touchscreen controller */
91static struct platform_device cmx270_ts_device = { 86static struct platform_device cmx270_ts_device = {
92 .name = "ucb1400_ts", 87 .name = "ucb1400_ts",
@@ -219,7 +214,6 @@ static struct platform_device cmx270_ata = {
219/* platform devices */ 214/* platform devices */
220static struct platform_device *platform_devices[] __initdata = { 215static struct platform_device *platform_devices[] __initdata = {
221 &cmx270_device_dm9k, 216 &cmx270_device_dm9k,
222 &cmx270_audio_device,
223 &cmx270_rtc_device, 217 &cmx270_rtc_device,
224 &cmx270_2700G, 218 &cmx270_2700G,
225 &cmx270_led_device, 219 &cmx270_led_device,
@@ -594,6 +588,7 @@ static void __init cmx270_init(void)
594 588
595 /* register CM-X270 platform devices */ 589 /* register CM-X270 platform devices */
596 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 590 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
591 pxa_set_ac97_info(NULL);
597 592
598 /* set MCI and OHCI platform parameters */ 593 /* set MCI and OHCI platform parameters */
599 pxa_set_mci_info(&cmx270_mci_platform_data); 594 pxa_set_mci_info(&cmx270_mci_platform_data);
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index b757dd756655..b37671b71886 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -36,6 +36,7 @@
36#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
37 37
38#include <asm/arch/pxa-regs.h> 38#include <asm/arch/pxa-regs.h>
39#include <asm/arch/pxa2xx-regs.h>
39#include <asm/arch/pxa2xx-gpio.h> 40#include <asm/arch/pxa2xx-gpio.h>
40#include <asm/arch/irda.h> 41#include <asm/arch/irda.h>
41#include <asm/arch/mmc.h> 42#include <asm/arch/mmc.h>
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 0a85f706e887..e91c0f26c412 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -26,6 +26,7 @@
26#include <asm/arch/sharpsl.h> 26#include <asm/arch/sharpsl.h>
27#include <asm/arch/corgi.h> 27#include <asm/arch/corgi.h>
28#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h>
29#include <asm/arch/pxa2xx-gpio.h> 30#include <asm/arch/pxa2xx-gpio.h>
30#include "sharpsl.h" 31#include "sharpsl.h"
31 32
@@ -204,7 +205,9 @@ static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
204 .read_devdata = corgipm_read_devdata, 205 .read_devdata = corgipm_read_devdata,
205 .charger_wakeup = corgi_charger_wakeup, 206 .charger_wakeup = corgi_charger_wakeup,
206 .should_wakeup = corgi_should_wakeup, 207 .should_wakeup = corgi_should_wakeup,
208#ifdef CONFIG_BACKLIGHT_CORGI
207 .backlight_limit = corgibl_limit_intensity, 209 .backlight_limit = corgibl_limit_intensity,
210#endif
208 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, 211 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
209 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, 212 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP,
210 .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH, 213 .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH,
@@ -226,6 +229,10 @@ static int __devinit corgipm_init(void)
226{ 229{
227 int ret; 230 int ret;
228 231
232 if (!machine_is_corgi() && !machine_is_shepherd()
233 && !machine_is_husky())
234 return -ENODEV;
235
229 corgipm_device = platform_device_alloc("sharpsl-pm", -1); 236 corgipm_device = platform_device_alloc("sharpsl-pm", -1);
230 if (!corgipm_device) 237 if (!corgipm_device)
231 return -ENOMEM; 238 return -ENOMEM;
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index d6c05b6eab35..a6f2390ce662 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -10,11 +10,14 @@
10#include <asm/arch/mmc.h> 10#include <asm/arch/mmc.h>
11#include <asm/arch/irda.h> 11#include <asm/arch/irda.h>
12#include <asm/arch/i2c.h> 12#include <asm/arch/i2c.h>
13#include <asm/arch/mfp-pxa27x.h>
13#include <asm/arch/ohci.h> 14#include <asm/arch/ohci.h>
14#include <asm/arch/pxa27x_keypad.h> 15#include <asm/arch/pxa27x_keypad.h>
15#include <asm/arch/camera.h> 16#include <asm/arch/camera.h>
17#include <asm/arch/audio.h>
16 18
17#include "devices.h" 19#include "devices.h"
20#include "generic.h"
18 21
19void __init pxa_register_device(struct platform_device *dev, void *data) 22void __init pxa_register_device(struct platform_device *dev, void *data)
20{ 23{
@@ -91,8 +94,19 @@ static struct resource pxa2xx_udc_resources[] = {
91 94
92static u64 udc_dma_mask = ~(u32)0; 95static u64 udc_dma_mask = ~(u32)0;
93 96
94struct platform_device pxa_device_udc = { 97struct platform_device pxa25x_device_udc = {
95 .name = "pxa2xx-udc", 98 .name = "pxa25x-udc",
99 .id = -1,
100 .resource = pxa2xx_udc_resources,
101 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
102 .dev = {
103 .platform_data = &pxa_udc_info,
104 .dma_mask = &udc_dma_mask,
105 }
106};
107
108struct platform_device pxa27x_device_udc = {
109 .name = "pxa27x-udc",
96 .id = -1, 110 .id = -1,
97 .resource = pxa2xx_udc_resources, 111 .resource = pxa2xx_udc_resources,
98 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources), 112 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
@@ -233,8 +247,15 @@ struct platform_device pxa_device_i2c = {
233 .num_resources = ARRAY_SIZE(pxai2c_resources), 247 .num_resources = ARRAY_SIZE(pxai2c_resources),
234}; 248};
235 249
250static unsigned long pxa27x_i2c_mfp_cfg[] = {
251 GPIO117_I2C_SCL,
252 GPIO118_I2C_SDA,
253};
254
236void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) 255void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
237{ 256{
257 if (cpu_is_pxa27x())
258 pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
238 pxa_register_device(&pxa_device_i2c, info); 259 pxa_register_device(&pxa_device_i2c, info);
239} 260}
240 261
@@ -278,8 +299,69 @@ struct platform_device pxa_device_rtc = {
278 .id = -1, 299 .id = -1,
279}; 300};
280 301
302static struct resource pxa_ac97_resources[] = {
303 [0] = {
304 .start = 0x40500000,
305 .end = 0x40500000 + 0xfff,
306 .flags = IORESOURCE_MEM,
307 },
308 [1] = {
309 .start = IRQ_AC97,
310 .end = IRQ_AC97,
311 .flags = IORESOURCE_IRQ,
312 },
313};
314
315static u64 pxa_ac97_dmamask = 0xffffffffUL;
316
317struct platform_device pxa_device_ac97 = {
318 .name = "pxa2xx-ac97",
319 .id = -1,
320 .dev = {
321 .dma_mask = &pxa_ac97_dmamask,
322 .coherent_dma_mask = 0xffffffff,
323 },
324 .num_resources = ARRAY_SIZE(pxa_ac97_resources),
325 .resource = pxa_ac97_resources,
326};
327
328void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
329{
330 pxa_register_device(&pxa_device_ac97, ops);
331}
332
281#ifdef CONFIG_PXA25x 333#ifdef CONFIG_PXA25x
282 334
335static struct resource pxa25x_resource_pwm0[] = {
336 [0] = {
337 .start = 0x40b00000,
338 .end = 0x40b0000f,
339 .flags = IORESOURCE_MEM,
340 },
341};
342
343struct platform_device pxa25x_device_pwm0 = {
344 .name = "pxa25x-pwm",
345 .id = 0,
346 .resource = pxa25x_resource_pwm0,
347 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
348};
349
350static struct resource pxa25x_resource_pwm1[] = {
351 [0] = {
352 .start = 0x40c00000,
353 .end = 0x40c0000f,
354 .flags = IORESOURCE_MEM,
355 },
356};
357
358struct platform_device pxa25x_device_pwm1 = {
359 .name = "pxa25x-pwm",
360 .id = 1,
361 .resource = pxa25x_resource_pwm1,
362 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
363};
364
283static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32); 365static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
284 366
285static struct resource pxa25x_resource_ssp[] = { 367static struct resource pxa25x_resource_ssp[] = {
@@ -568,6 +650,36 @@ struct platform_device pxa27x_device_ssp3 = {
568 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), 650 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
569}; 651};
570 652
653static struct resource pxa27x_resource_pwm0[] = {
654 [0] = {
655 .start = 0x40b00000,
656 .end = 0x40b0001f,
657 .flags = IORESOURCE_MEM,
658 },
659};
660
661struct platform_device pxa27x_device_pwm0 = {
662 .name = "pxa27x-pwm",
663 .id = 0,
664 .resource = pxa27x_resource_pwm0,
665 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
666};
667
668static struct resource pxa27x_resource_pwm1[] = {
669 [0] = {
670 .start = 0x40c00000,
671 .end = 0x40c0001f,
672 .flags = IORESOURCE_MEM,
673 },
674};
675
676struct platform_device pxa27x_device_pwm1 = {
677 .name = "pxa27x-pwm",
678 .id = 1,
679 .resource = pxa27x_resource_pwm1,
680 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
681};
682
571static struct resource pxa27x_resource_camera[] = { 683static struct resource pxa27x_resource_camera[] = {
572 [0] = { 684 [0] = {
573 .start = 0x50000000, 685 .start = 0x50000000,
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index fcab017f27ee..b852eb18daa5 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -1,7 +1,8 @@
1extern struct platform_device pxa_device_mci; 1extern struct platform_device pxa_device_mci;
2extern struct platform_device pxa3xx_device_mci2; 2extern struct platform_device pxa3xx_device_mci2;
3extern struct platform_device pxa3xx_device_mci3; 3extern struct platform_device pxa3xx_device_mci3;
4extern struct platform_device pxa_device_udc; 4extern struct platform_device pxa25x_device_udc;
5extern struct platform_device pxa27x_device_udc;
5extern struct platform_device pxa_device_fb; 6extern struct platform_device pxa_device_fb;
6extern struct platform_device pxa_device_ffuart; 7extern struct platform_device pxa_device_ffuart;
7extern struct platform_device pxa_device_btuart; 8extern struct platform_device pxa_device_btuart;
@@ -11,6 +12,7 @@ extern struct platform_device pxa_device_i2c;
11extern struct platform_device pxa_device_i2s; 12extern struct platform_device pxa_device_i2s;
12extern struct platform_device pxa_device_ficp; 13extern struct platform_device pxa_device_ficp;
13extern struct platform_device pxa_device_rtc; 14extern struct platform_device pxa_device_rtc;
15extern struct platform_device pxa_device_ac97;
14 16
15extern struct platform_device pxa27x_device_i2c_power; 17extern struct platform_device pxa27x_device_i2c_power;
16extern struct platform_device pxa27x_device_ohci; 18extern struct platform_device pxa27x_device_ohci;
@@ -24,4 +26,9 @@ extern struct platform_device pxa27x_device_ssp2;
24extern struct platform_device pxa27x_device_ssp3; 26extern struct platform_device pxa27x_device_ssp3;
25extern struct platform_device pxa3xx_device_ssp4; 27extern struct platform_device pxa3xx_device_ssp4;
26 28
29extern struct platform_device pxa25x_device_pwm0;
30extern struct platform_device pxa25x_device_pwm1;
31extern struct platform_device pxa27x_device_pwm0;
32extern struct platform_device pxa27x_device_pwm1;
33
27void __init pxa_register_device(struct platform_device *dev, void *data); 34void __init pxa_register_device(struct platform_device *dev, void *data);
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 9c57700ee5c2..1bf680749928 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -24,6 +24,8 @@
24 24
25#include <asm/arch/pxa-regs.h> 25#include <asm/arch/pxa-regs.h>
26#include <asm/arch/pxa2xx-gpio.h> 26#include <asm/arch/pxa2xx-gpio.h>
27#include <asm/arch/pxa27x-udc.h>
28#include <asm/arch/audio.h>
27#include <asm/arch/pxafb.h> 29#include <asm/arch/pxafb.h>
28#include <asm/arch/ohci.h> 30#include <asm/arch/ohci.h>
29#include <asm/arch/mmc.h> 31#include <asm/arch/mmc.h>
@@ -72,12 +74,6 @@ static struct platform_device em_x270_dm9k = {
72 } 74 }
73}; 75};
74 76
75/* audio device */
76static struct platform_device em_x270_audio = {
77 .name = "pxa2xx-ac97",
78 .id = -1,
79};
80
81/* WM9712 touchscreen controller. Hopefully the driver will make it to 77/* WM9712 touchscreen controller. Hopefully the driver will make it to
82 * the mainstream sometime */ 78 * the mainstream sometime */
83static struct platform_device em_x270_ts = { 79static struct platform_device em_x270_ts = {
@@ -217,7 +213,6 @@ static struct platform_device em_x270_nand = {
217/* platform devices */ 213/* platform devices */
218static struct platform_device *platform_devices[] __initdata = { 214static struct platform_device *platform_devices[] __initdata = {
219 &em_x270_dm9k, 215 &em_x270_dm9k,
220 &em_x270_audio,
221 &em_x270_ts, 216 &em_x270_ts,
222 &em_x270_rtc, 217 &em_x270_rtc,
223 &em_x270_nand, 218 &em_x270_nand,
@@ -325,6 +320,7 @@ static void __init em_x270_init(void)
325 320
326 /* register EM-X270 platform devices */ 321 /* register EM-X270 platform devices */
327 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 322 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
323 pxa_set_ac97_info(NULL);
328 324
329 /* set MCI and OHCI platform parameters */ 325 /* set MCI and OHCI platform parameters */
330 pxa_set_mci_info(&em_x270_mci_platform_data); 326 pxa_set_mci_info(&em_x270_mci_platform_data);
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 44617938f3f1..ca053226fba0 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -60,23 +60,6 @@ unsigned int get_memclk_frequency_10khz(void)
60EXPORT_SYMBOL(get_memclk_frequency_10khz); 60EXPORT_SYMBOL(get_memclk_frequency_10khz);
61 61
62/* 62/*
63 * Routine to safely enable or disable a clock in the CKEN
64 */
65void __pxa_set_cken(int clock, int enable)
66{
67 unsigned long flags;
68 local_irq_save(flags);
69
70 if (enable)
71 CKEN |= (1 << clock);
72 else
73 CKEN &= ~(1 << clock);
74
75 local_irq_restore(flags);
76}
77EXPORT_SYMBOL(__pxa_set_cken);
78
79/*
80 * Intel PXA2xx internal register mapping. 63 * Intel PXA2xx internal register mapping.
81 * 64 *
82 * Note 1: not all PXA2xx variants implement all those addresses. 65 * Note 1: not all PXA2xx variants implement all those addresses.
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index a9a0c3fab159..fbff557bb225 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -21,7 +21,6 @@
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
23#include <asm/arch/pxa-regs.h> 23#include <asm/arch/pxa-regs.h>
24#include <asm/arch/pxa2xx-gpio.h>
25 24
26#include "generic.h" 25#include "generic.h"
27 26
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index a20e4b1649d6..cc1c4fa06145 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -23,6 +23,7 @@
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/pwm_backlight.h>
26 27
27#include <asm/types.h> 28#include <asm/types.h>
28#include <asm/setup.h> 29#include <asm/setup.h>
@@ -134,9 +135,12 @@ static struct sys_device lpd270_irq_device = {
134 135
135static int __init lpd270_irq_device_init(void) 136static int __init lpd270_irq_device_init(void)
136{ 137{
137 int ret = sysdev_class_register(&lpd270_irq_sysclass); 138 int ret = -ENODEV;
138 if (ret == 0) 139 if (machine_is_logicpd_pxa270()) {
139 ret = sysdev_register(&lpd270_irq_device); 140 ret = sysdev_class_register(&lpd270_irq_sysclass);
141 if (ret == 0)
142 ret = sysdev_register(&lpd270_irq_device);
143 }
140 return ret; 144 return ret;
141} 145}
142 146
@@ -164,11 +168,6 @@ static struct platform_device smc91x_device = {
164 .resource = smc91x_resources, 168 .resource = smc91x_resources,
165}; 169};
166 170
167static struct platform_device lpd270_audio_device = {
168 .name = "pxa2xx-ac97",
169 .id = -1,
170};
171
172static struct resource lpd270_flash_resources[] = { 171static struct resource lpd270_flash_resources[] = {
173 [0] = { 172 [0] = {
174 .start = PXA_CS0_PHYS, 173 .start = PXA_CS0_PHYS,
@@ -233,21 +232,20 @@ static struct platform_device lpd270_flash_device[2] = {
233 }, 232 },
234}; 233};
235 234
236static void lpd270_backlight_power(int on) 235static struct platform_pwm_backlight_data lpd270_backlight_data = {
237{ 236 .pwm_id = 0,
238 if (on) { 237 .max_brightness = 1,
239 pxa_gpio_mode(GPIO16_PWM0_MD); 238 .dft_brightness = 1,
240 pxa_set_cken(CKEN_PWM0, 1); 239 .pwm_period_ns = 78770,
241 PWM_CTRL0 = 0; 240};
242 PWM_PWDUTY0 = 0x3ff; 241
243 PWM_PERVAL0 = 0x3ff; 242static struct platform_device lpd270_backlight_device = {
244 } else { 243 .name = "pwm-backlight",
245 PWM_CTRL0 = 0; 244 .dev = {
246 PWM_PWDUTY0 = 0x0; 245 .parent = &pxa27x_device_pwm0.dev,
247 PWM_PERVAL0 = 0x3FF; 246 .platform_data = &lpd270_backlight_data,
248 pxa_set_cken(CKEN_PWM0, 0); 247 },
249 } 248};
250}
251 249
252/* 5.7" TFT QVGA (LoLo display number 1) */ 250/* 5.7" TFT QVGA (LoLo display number 1) */
253static struct pxafb_mode_info sharp_lq057q3dc02_mode = { 251static struct pxafb_mode_info sharp_lq057q3dc02_mode = {
@@ -269,7 +267,6 @@ static struct pxafb_mach_info sharp_lq057q3dc02 = {
269 .num_modes = 1, 267 .num_modes = 1,
270 .lccr0 = 0x07800080, 268 .lccr0 = 0x07800080,
271 .lccr3 = 0x00400000, 269 .lccr3 = 0x00400000,
272 .pxafb_backlight_power = lpd270_backlight_power,
273}; 270};
274 271
275/* 12.1" TFT SVGA (LoLo display number 2) */ 272/* 12.1" TFT SVGA (LoLo display number 2) */
@@ -292,7 +289,6 @@ static struct pxafb_mach_info sharp_lq121s1dg31 = {
292 .num_modes = 1, 289 .num_modes = 1,
293 .lccr0 = 0x07800080, 290 .lccr0 = 0x07800080,
294 .lccr3 = 0x00400000, 291 .lccr3 = 0x00400000,
295 .pxafb_backlight_power = lpd270_backlight_power,
296}; 292};
297 293
298/* 3.6" TFT QVGA (LoLo display number 3) */ 294/* 3.6" TFT QVGA (LoLo display number 3) */
@@ -315,7 +311,6 @@ static struct pxafb_mach_info sharp_lq036q1da01 = {
315 .num_modes = 1, 311 .num_modes = 1,
316 .lccr0 = 0x07800080, 312 .lccr0 = 0x07800080,
317 .lccr3 = 0x00400000, 313 .lccr3 = 0x00400000,
318 .pxafb_backlight_power = lpd270_backlight_power,
319}; 314};
320 315
321/* 6.4" TFT VGA (LoLo display number 5) */ 316/* 6.4" TFT VGA (LoLo display number 5) */
@@ -338,7 +333,6 @@ static struct pxafb_mach_info sharp_lq64d343 = {
338 .num_modes = 1, 333 .num_modes = 1,
339 .lccr0 = 0x07800080, 334 .lccr0 = 0x07800080,
340 .lccr3 = 0x00400000, 335 .lccr3 = 0x00400000,
341 .pxafb_backlight_power = lpd270_backlight_power,
342}; 336};
343 337
344/* 10.4" TFT VGA (LoLo display number 7) */ 338/* 10.4" TFT VGA (LoLo display number 7) */
@@ -361,7 +355,6 @@ static struct pxafb_mach_info sharp_lq10d368 = {
361 .num_modes = 1, 355 .num_modes = 1,
362 .lccr0 = 0x07800080, 356 .lccr0 = 0x07800080,
363 .lccr3 = 0x00400000, 357 .lccr3 = 0x00400000,
364 .pxafb_backlight_power = lpd270_backlight_power,
365}; 358};
366 359
367/* 3.5" TFT QVGA (LoLo display number 8) */ 360/* 3.5" TFT QVGA (LoLo display number 8) */
@@ -384,7 +377,6 @@ static struct pxafb_mach_info sharp_lq035q7db02_20 = {
384 .num_modes = 1, 377 .num_modes = 1,
385 .lccr0 = 0x07800080, 378 .lccr0 = 0x07800080,
386 .lccr3 = 0x00400000, 379 .lccr3 = 0x00400000,
387 .pxafb_backlight_power = lpd270_backlight_power,
388}; 380};
389 381
390static struct pxafb_mach_info *lpd270_lcd_to_use; 382static struct pxafb_mach_info *lpd270_lcd_to_use;
@@ -414,7 +406,7 @@ __setup("lcd=", lpd270_set_lcd);
414 406
415static struct platform_device *platform_devices[] __initdata = { 407static struct platform_device *platform_devices[] __initdata = {
416 &smc91x_device, 408 &smc91x_device,
417 &lpd270_audio_device, 409 &lpd270_backlight_device,
418 &lpd270_flash_device[0], 410 &lpd270_flash_device[0],
419 &lpd270_flash_device[1], 411 &lpd270_flash_device[1],
420}; 412};
@@ -454,9 +446,12 @@ static void __init lpd270_init(void)
454 * On LogicPD PXA270, we route AC97_SYSCLK via GPIO45. 446 * On LogicPD PXA270, we route AC97_SYSCLK via GPIO45.
455 */ 447 */
456 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD); 448 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);
449 pxa_gpio_mode(GPIO16_PWM0_MD);
457 450
458 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 451 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
459 452
453 pxa_set_ac97_info(NULL);
454
460 if (lpd270_lcd_to_use != NULL) 455 if (lpd270_lcd_to_use != NULL)
461 set_pxa_fb_info(lpd270_lcd_to_use); 456 set_pxa_fb_info(lpd270_lcd_to_use);
462 457
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 7b9bdd0c6665..a3fae4139203 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -43,6 +43,7 @@
43#include <asm/arch/pxa-regs.h> 43#include <asm/arch/pxa-regs.h>
44#include <asm/arch/pxa2xx-regs.h> 44#include <asm/arch/pxa2xx-regs.h>
45#include <asm/arch/mfp-pxa25x.h> 45#include <asm/arch/mfp-pxa25x.h>
46#include <asm/arch/audio.h>
46#include <asm/arch/lubbock.h> 47#include <asm/arch/lubbock.h>
47#include <asm/arch/udc.h> 48#include <asm/arch/udc.h>
48#include <asm/arch/irda.h> 49#include <asm/arch/irda.h>
@@ -196,11 +197,6 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
196 // no D+ pullup; lubbock can't connect/disconnect in software 197 // no D+ pullup; lubbock can't connect/disconnect in software
197}; 198};
198 199
199static struct platform_device lub_audio_device = {
200 .name = "pxa2xx-ac97",
201 .id = -1,
202};
203
204static struct resource sa1111_resources[] = { 200static struct resource sa1111_resources[] = {
205 [0] = { 201 [0] = {
206 .start = 0x10000000, 202 .start = 0x10000000,
@@ -368,7 +364,6 @@ static struct platform_device lubbock_flash_device[2] = {
368 364
369static struct platform_device *devices[] __initdata = { 365static struct platform_device *devices[] __initdata = {
370 &sa1111_device, 366 &sa1111_device,
371 &lub_audio_device,
372 &smc91x_device, 367 &smc91x_device,
373 &lubbock_flash_device[0], 368 &lubbock_flash_device[0],
374 &lubbock_flash_device[1], 369 &lubbock_flash_device[1],
@@ -494,6 +489,7 @@ static void __init lubbock_init(void)
494 set_pxa_fb_info(&sharp_lm8v31); 489 set_pxa_fb_info(&sharp_lm8v31);
495 pxa_set_mci_info(&lubbock_mci_platform_data); 490 pxa_set_mci_info(&lubbock_mci_platform_data);
496 pxa_set_ficp_info(&lubbock_ficp_platform_data); 491 pxa_set_ficp_info(&lubbock_ficp_platform_data);
492 pxa_set_ac97_info(NULL);
497 493
498 lubbock_flash_data[0].width = lubbock_flash_data[1].width = 494 lubbock_flash_data[0].width = lubbock_flash_data[1].width =
499 (BOOT_DEF & 1) ? 2 : 4; 495 (BOOT_DEF & 1) ? 2 : 4;
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index badba064dc04..01b2fa790217 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -25,6 +25,7 @@
25#include <linux/mtd/map.h> 25#include <linux/mtd/map.h>
26#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27#include <linux/pda_power.h> 27#include <linux/pda_power.h>
28#include <linux/pwm_backlight.h>
28 29
29#include <asm/gpio.h> 30#include <asm/gpio.h>
30#include <asm/hardware.h> 31#include <asm/hardware.h>
@@ -33,12 +34,14 @@
33#include <asm/arch/magician.h> 34#include <asm/arch/magician.h>
34#include <asm/arch/mfp-pxa27x.h> 35#include <asm/arch/mfp-pxa27x.h>
35#include <asm/arch/pxa-regs.h> 36#include <asm/arch/pxa-regs.h>
37#include <asm/arch/pxa2xx-regs.h>
36#include <asm/arch/pxafb.h> 38#include <asm/arch/pxafb.h>
37#include <asm/arch/i2c.h> 39#include <asm/arch/i2c.h>
38#include <asm/arch/mmc.h> 40#include <asm/arch/mmc.h>
39#include <asm/arch/irda.h> 41#include <asm/arch/irda.h>
40#include <asm/arch/ohci.h> 42#include <asm/arch/ohci.h>
41 43
44#include "devices.h"
42#include "generic.h" 45#include "generic.h"
43 46
44static unsigned long magician_pin_config[] = { 47static unsigned long magician_pin_config[] = {
@@ -348,40 +351,58 @@ static struct pxafb_mach_info samsung_info = {
348 * Backlight 351 * Backlight
349 */ 352 */
350 353
351static void magician_set_bl_intensity(int intensity) 354static int magician_backlight_init(struct device *dev)
352{ 355{
353 if (intensity) { 356 int ret;
354 PWM_CTRL0 = 1; 357
355 PWM_PERVAL0 = 0xc8; 358 ret = gpio_request(EGPIO_MAGICIAN_BL_POWER, "BL_POWER");
356 if (intensity > 0xc7) { 359 if (ret)
357 PWM_PWDUTY0 = intensity - 0x48; 360 goto err;
358 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); 361 ret = gpio_request(EGPIO_MAGICIAN_BL_POWER2, "BL_POWER2");
359 } else { 362 if (ret)
360 PWM_PWDUTY0 = intensity; 363 goto err2;
361 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); 364 return 0;
362 } 365
363 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 1); 366err2:
364 pxa_set_cken(CKEN_PWM0, 1); 367 gpio_free(EGPIO_MAGICIAN_BL_POWER);
368err:
369 return ret;
370}
371
372static int magician_backlight_notify(int brightness)
373{
374 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
375 if (brightness >= 200) {
376 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
377 return brightness - 72;
365 } else { 378 } else {
366 /* PWM_PWDUTY0 = intensity; */ 379 gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0);
367 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 0); 380 return brightness;
368 pxa_set_cken(CKEN_PWM0, 0);
369 } 381 }
370} 382}
371 383
372static struct generic_bl_info backlight_info = { 384static void magician_backlight_exit(struct device *dev)
373 .default_intensity = 0x64, 385{
374 .limit_mask = 0x0b, 386 gpio_free(EGPIO_MAGICIAN_BL_POWER);
375 .max_intensity = 0xc7+0x48, 387 gpio_free(EGPIO_MAGICIAN_BL_POWER2);
376 .set_bl_intensity = magician_set_bl_intensity, 388}
389
390static struct platform_pwm_backlight_data backlight_data = {
391 .pwm_id = 0,
392 .max_brightness = 272,
393 .dft_brightness = 100,
394 .pwm_period_ns = 30923,
395 .init = magician_backlight_init,
396 .notify = magician_backlight_notify,
397 .exit = magician_backlight_exit,
377}; 398};
378 399
379static struct platform_device backlight = { 400static struct platform_device backlight = {
380 .name = "generic-bl", 401 .name = "pwm-backlight",
381 .dev = { 402 .dev = {
382 .platform_data = &backlight_info, 403 .parent = &pxa27x_device_pwm0.dev,
404 .platform_data = &backlight_data,
383 }, 405 },
384 .id = -1,
385}; 406};
386 407
387/* 408/*
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 7399fb34da4e..f2e9e7c4da8e 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -23,9 +23,9 @@
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/backlight.h>
27#include <linux/input.h> 26#include <linux/input.h>
28#include <linux/gpio_keys.h> 27#include <linux/gpio_keys.h>
28#include <linux/pwm_backlight.h>
29 29
30#include <asm/types.h> 30#include <asm/types.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
@@ -280,12 +280,6 @@ static pxa2xx_audio_ops_t mst_audio_ops = {
280 .resume = mst_audio_resume, 280 .resume = mst_audio_resume,
281}; 281};
282 282
283static struct platform_device mst_audio_device = {
284 .name = "pxa2xx-ac97",
285 .id = -1,
286 .dev = { .platform_data = &mst_audio_ops },
287};
288
289static struct resource flash_resources[] = { 283static struct resource flash_resources[] = {
290 [0] = { 284 [0] = {
291 .start = PXA_CS0_PHYS, 285 .start = PXA_CS0_PHYS,
@@ -349,56 +343,27 @@ static struct platform_device mst_flash_device[2] = {
349 }, 343 },
350}; 344};
351 345
352#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE 346#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
353static int mainstone_backlight_update_status(struct backlight_device *bl) 347static struct platform_pwm_backlight_data mainstone_backlight_data = {
354{ 348 .pwm_id = 0,
355 int brightness = bl->props.brightness; 349 .max_brightness = 1023,
356 350 .dft_brightness = 1023,
357 if (bl->props.power != FB_BLANK_UNBLANK || 351 .pwm_period_ns = 78770,
358 bl->props.fb_blank != FB_BLANK_UNBLANK) 352};
359 brightness = 0;
360
361 if (brightness != 0)
362 pxa_set_cken(CKEN_PWM0, 1);
363
364 PWM_CTRL0 = 0;
365 PWM_PWDUTY0 = brightness;
366 PWM_PERVAL0 = bl->props.max_brightness;
367
368 if (brightness == 0)
369 pxa_set_cken(CKEN_PWM0, 0);
370 return 0; /* pointless return value */
371}
372
373static int mainstone_backlight_get_brightness(struct backlight_device *bl)
374{
375 return PWM_PWDUTY0;
376}
377 353
378static /*const*/ struct backlight_ops mainstone_backlight_ops = { 354static struct platform_device mainstone_backlight_device = {
379 .update_status = mainstone_backlight_update_status, 355 .name = "pwm-backlight",
380 .get_brightness = mainstone_backlight_get_brightness, 356 .dev = {
357 .parent = &pxa27x_device_pwm0.dev,
358 .platform_data = &mainstone_backlight_data,
359 },
381}; 360};
382 361
383static void __init mainstone_backlight_register(void) 362static void __init mainstone_backlight_register(void)
384{ 363{
385 struct backlight_device *bl; 364 int ret = platform_device_register(&mainstone_backlight_device);
386 365 if (ret)
387 bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev, 366 printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret);
388 NULL, &mainstone_backlight_ops);
389 if (IS_ERR(bl)) {
390 printk(KERN_ERR "mainstone: unable to register backlight: %ld\n",
391 PTR_ERR(bl));
392 return;
393 }
394
395 /*
396 * broken design - register-then-setup interfaces are
397 * utterly broken by definition.
398 */
399 bl->props.max_brightness = 1023;
400 bl->props.brightness = 1023;
401 backlight_update_status(bl);
402} 367}
403#else 368#else
404#define mainstone_backlight_register() do { } while (0) 369#define mainstone_backlight_register() do { } while (0)
@@ -528,7 +493,6 @@ static struct platform_device mst_gpio_keys_device = {
528 493
529static struct platform_device *platform_devices[] __initdata = { 494static struct platform_device *platform_devices[] __initdata = {
530 &smc91x_device, 495 &smc91x_device,
531 &mst_audio_device,
532 &mst_flash_device[0], 496 &mst_flash_device[0],
533 &mst_flash_device[1], 497 &mst_flash_device[1],
534 &mst_gpio_keys_device, 498 &mst_gpio_keys_device,
@@ -638,6 +602,7 @@ static void __init mainstone_init(void)
638 pxa_set_ficp_info(&mainstone_ficp_platform_data); 602 pxa_set_ficp_info(&mainstone_ficp_platform_data);
639 pxa_set_ohci_info(&mainstone_ohci_platform_data); 603 pxa_set_ohci_info(&mainstone_ohci_platform_data);
640 pxa_set_i2c_info(NULL); 604 pxa_set_i2c_info(NULL);
605 pxa_set_ac97_info(&mst_audio_ops);
641 606
642 mainstone_init_keypad(); 607 mainstone_init_keypad();
643} 608}
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 22097a1707cc..d1cdb4ecb0b8 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/arch/hardware.h> 21#include <asm/arch/hardware.h>
22#include <asm/arch/pxa-regs.h> 22#include <asm/arch/pxa-regs.h>
23#include <asm/arch/pxa2xx-regs.h>
23#include <asm/arch/mfp-pxa2xx.h> 24#include <asm/arch/mfp-pxa2xx.h>
24 25
25#include "generic.h" 26#include "generic.h"
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 49d951db0f3d..5d87c7c866e4 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -24,6 +24,7 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/ide.h> 25#include <linux/ide.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/pwm_backlight.h>
27 28
28#include <media/soc_camera.h> 29#include <media/soc_camera.h>
29 30
@@ -33,12 +34,103 @@
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
34#include <asm/arch/pxa-regs.h> 35#include <asm/arch/pxa-regs.h>
35#include <asm/arch/pxa2xx-gpio.h> 36#include <asm/arch/pxa2xx-gpio.h>
37#include <asm/arch/audio.h>
36#include <asm/arch/mmc.h> 38#include <asm/arch/mmc.h>
37#include <asm/arch/ohci.h> 39#include <asm/arch/ohci.h>
38#include <asm/arch/pcm990_baseboard.h> 40#include <asm/arch/pcm990_baseboard.h>
41#include <asm/arch/pxafb.h>
42
43#include "devices.h"
39 44
40/* 45/*
41 * The PCM-990 development baseboard uses PCM-027's hardeware in the 46 * pcm990_lcd_power - control power supply to the LCD
47 * @on: 0 = switch off, 1 = switch on
48 *
49 * Called by the pxafb driver
50 */
51#ifndef CONFIG_PCM990_DISPLAY_NONE
52static void pcm990_lcd_power(int on, struct fb_var_screeninfo *var)
53{
54 if (on) {
55 /* enable LCD-Latches
56 * power on LCD
57 */
58 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) =
59 PCM990_CTRL_LCDPWR + PCM990_CTRL_LCDON;
60 } else {
61 /* disable LCD-Latches
62 * power off LCD
63 */
64 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = 0x00;
65 }
66}
67#endif
68
69#if defined(CONFIG_PCM990_DISPLAY_SHARP)
70static struct pxafb_mode_info fb_info_sharp_lq084v1dg21 = {
71 .pixclock = 28000,
72 .xres = 640,
73 .yres = 480,
74 .bpp = 16,
75 .hsync_len = 20,
76 .left_margin = 103,
77 .right_margin = 47,
78 .vsync_len = 6,
79 .upper_margin = 28,
80 .lower_margin = 5,
81 .sync = 0,
82 .cmap_greyscale = 0,
83};
84
85static struct pxafb_mach_info pcm990_fbinfo __initdata = {
86 .modes = &fb_info_sharp_lq084v1dg21,
87 .num_modes = 1,
88 .lccr0 = LCCR0_PAS,
89 .lccr3 = LCCR3_PCP,
90 .pxafb_lcd_power = pcm990_lcd_power,
91};
92#elif defined(CONFIG_PCM990_DISPLAY_NEC)
93struct pxafb_mode_info fb_info_nec_nl6448bc20_18d = {
94 .pixclock = 39720,
95 .xres = 640,
96 .yres = 480,
97 .bpp = 16,
98 .hsync_len = 32,
99 .left_margin = 16,
100 .right_margin = 48,
101 .vsync_len = 2,
102 .upper_margin = 12,
103 .lower_margin = 17,
104 .sync = 0,
105 .cmap_greyscale = 0,
106};
107
108static struct pxafb_mach_info pcm990_fbinfo __initdata = {
109 .modes = &fb_info_nec_nl6448bc20_18d,
110 .num_modes = 1,
111 .lccr0 = LCCR0_Act,
112 .lccr3 = LCCR3_PixFlEdg,
113 .pxafb_lcd_power = pcm990_lcd_power,
114};
115#endif
116
117static struct platform_pwm_backlight_data pcm990_backlight_data = {
118 .pwm_id = 0,
119 .max_brightness = 1023,
120 .dft_brightness = 1023,
121 .pwm_period_ns = 78770,
122};
123
124static struct platform_device pcm990_backlight_device = {
125 .name = "pwm-backlight",
126 .dev = {
127 .parent = &pxa27x_device_pwm0.dev,
128 .platform_data = &pcm990_backlight_data,
129 },
130};
131
132/*
133 * The PCM-990 development baseboard uses PCM-027's hardware in the
42 * following way: 134 * following way:
43 * 135 *
44 * - LCD support is in use 136 * - LCD support is in use
@@ -333,36 +425,6 @@ static struct i2c_board_info __initdata pcm990_i2c_devices[] = {
333#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ 425#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */
334 426
335/* 427/*
336 * AC97 support
337 * Note: The connected AC97 mixer also reports interrupts at PCM990_AC97_IRQ
338 */
339static struct resource pxa27x_ac97_resources[] = {
340 [0] = {
341 .start = 0x40500000,
342 .end = 0x40500000 + 0xfff,
343 .flags = IORESOURCE_MEM,
344 },
345 [1] = {
346 .start = IRQ_AC97,
347 .end = IRQ_AC97,
348 .flags = IORESOURCE_IRQ,
349 },
350};
351
352static u64 pxa_ac97_dmamask = 0xffffffffUL;
353
354static struct platform_device pxa27x_device_ac97 = {
355 .name = "pxa2xx-ac97",
356 .id = -1,
357 .dev = {
358 .dma_mask = &pxa_ac97_dmamask,
359 .coherent_dma_mask = 0xffffffff,
360 },
361 .num_resources = ARRAY_SIZE(pxa27x_ac97_resources),
362 .resource = pxa27x_ac97_resources,
363};
364
365/*
366 * enable generic access to the base board control CPLDs U6 and U7 428 * enable generic access to the base board control CPLDs U6 and U7
367 */ 429 */
368static struct map_desc pcm990_io_desc[] __initdata = { 430static struct map_desc pcm990_io_desc[] __initdata = {
@@ -393,7 +455,11 @@ void __init pcm990_baseboard_init(void)
393 /* register CPLD's IRQ controller */ 455 /* register CPLD's IRQ controller */
394 pcm990_init_irq(); 456 pcm990_init_irq();
395 457
396 platform_device_register(&pxa27x_device_ac97); 458#ifndef CONFIG_PCM990_DISPLAY_NONE
459 set_pxa_fb_info(&pcm990_fbinfo);
460#endif
461 pxa_gpio_mode(GPIO16_PWM0_MD);
462 platform_device_register(&pcm990_backlight_device);
397 463
398 /* MMC */ 464 /* MMC */
399 pxa_set_mci_info(&pcm990_mci_platform_data); 465 pxa_set_mci_info(&pcm990_mci_platform_data);
@@ -402,6 +468,7 @@ void __init pcm990_baseboard_init(void)
402 pxa_set_ohci_info(&pcm990_ohci_platform_data); 468 pxa_set_ohci_info(&pcm990_ohci_platform_data);
403 469
404 pxa_set_i2c_info(NULL); 470 pxa_set_i2c_info(NULL);
471 pxa_set_ac97_info(NULL);
405 472
406#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) 473#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
407 pxa_set_camera_info(&pcm990_pxacamera_platform_data); 474 pxa_set_camera_info(&pcm990_pxacamera_platform_data);
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 0b30f25cff3c..f81c10cafd48 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -32,6 +32,7 @@
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33 33
34#include <asm/arch/pxa-regs.h> 34#include <asm/arch/pxa-regs.h>
35#include <asm/arch/pxa2xx-regs.h>
35#include <asm/arch/pxa2xx-gpio.h> 36#include <asm/arch/pxa2xx-gpio.h>
36#include <asm/arch/mmc.h> 37#include <asm/arch/mmc.h>
37#include <asm/arch/udc.h> 38#include <asm/arch/udc.h>
diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c
new file mode 100644
index 000000000000..ce28cd9fed16
--- /dev/null
+++ b/arch/arm/mach-pxa/pwm.c
@@ -0,0 +1,319 @@
1/*
2 * linux/arch/arm/mach-pxa/pwm.c
3 *
4 * simple driver for PWM (Pulse Width Modulator) controller
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 * 2008-02-13 initial version
11 * eric miao <eric.miao@marvell.com>
12 */
13
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/platform_device.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20#include <linux/pwm.h>
21
22#include <asm/div64.h>
23#include <asm/arch/pxa-regs.h>
24
25/* PWM registers and bits definitions */
26#define PWMCR (0x00)
27#define PWMDCR (0x04)
28#define PWMPCR (0x08)
29
30#define PWMCR_SD (1 << 6)
31#define PWMDCR_FD (1 << 10)
32
33struct pwm_device {
34 struct list_head node;
35 struct platform_device *pdev;
36
37 const char *label;
38 struct clk *clk;
39 int clk_enabled;
40 void __iomem *mmio_base;
41
42 unsigned int use_count;
43 unsigned int pwm_id;
44};
45
46/*
47 * period_ns = 10^9 * (PRESCALE + 1) * (PV + 1) / PWM_CLK_RATE
48 * duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE
49 */
50int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
51{
52 unsigned long long c;
53 unsigned long period_cycles, prescale, pv, dc;
54
55 if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
56 return -EINVAL;
57
58 c = clk_get_rate(pwm->clk);
59 c = c * period_ns;
60 do_div(c, 1000000000);
61 period_cycles = c;
62
63 if (period_cycles < 0)
64 period_cycles = 1;
65 prescale = (period_cycles - 1) / 1024;
66 pv = period_cycles / (prescale + 1) - 1;
67
68 if (prescale > 63)
69 return -EINVAL;
70
71 if (duty_ns == period_ns)
72 dc = PWMDCR_FD;
73 else
74 dc = (pv + 1) * duty_ns / period_ns;
75
76 /* NOTE: the clock to PWM has to be enabled first
77 * before writing to the registers
78 */
79 clk_enable(pwm->clk);
80 __raw_writel(prescale, pwm->mmio_base + PWMCR);
81 __raw_writel(dc, pwm->mmio_base + PWMDCR);
82 __raw_writel(pv, pwm->mmio_base + PWMPCR);
83 clk_disable(pwm->clk);
84
85 return 0;
86}
87EXPORT_SYMBOL(pwm_config);
88
89int pwm_enable(struct pwm_device *pwm)
90{
91 int rc = 0;
92
93 if (!pwm->clk_enabled) {
94 rc = clk_enable(pwm->clk);
95 if (!rc)
96 pwm->clk_enabled = 1;
97 }
98 return rc;
99}
100EXPORT_SYMBOL(pwm_enable);
101
102void pwm_disable(struct pwm_device *pwm)
103{
104 if (pwm->clk_enabled) {
105 clk_disable(pwm->clk);
106 pwm->clk_enabled = 0;
107 }
108}
109EXPORT_SYMBOL(pwm_disable);
110
111static DEFINE_MUTEX(pwm_lock);
112static LIST_HEAD(pwm_list);
113
114struct pwm_device *pwm_request(int pwm_id, const char *label)
115{
116 struct pwm_device *pwm;
117 int found = 0;
118
119 mutex_lock(&pwm_lock);
120
121 list_for_each_entry(pwm, &pwm_list, node) {
122 if (pwm->pwm_id == pwm_id) {
123 found = 1;
124 break;
125 }
126 }
127
128 if (found) {
129 if (pwm->use_count == 0) {
130 pwm->use_count++;
131 pwm->label = label;
132 } else
133 pwm = ERR_PTR(-EBUSY);
134 } else
135 pwm = ERR_PTR(-ENOENT);
136
137 mutex_unlock(&pwm_lock);
138 return pwm;
139}
140EXPORT_SYMBOL(pwm_request);
141
142void pwm_free(struct pwm_device *pwm)
143{
144 mutex_lock(&pwm_lock);
145
146 if (pwm->use_count) {
147 pwm->use_count--;
148 pwm->label = NULL;
149 } else
150 pr_warning("PWM device already freed\n");
151
152 mutex_unlock(&pwm_lock);
153}
154EXPORT_SYMBOL(pwm_free);
155
156static inline void __add_pwm(struct pwm_device *pwm)
157{
158 mutex_lock(&pwm_lock);
159 list_add_tail(&pwm->node, &pwm_list);
160 mutex_unlock(&pwm_lock);
161}
162
163static struct pwm_device *pwm_probe(struct platform_device *pdev,
164 unsigned int pwm_id, struct pwm_device *parent_pwm)
165{
166 struct pwm_device *pwm;
167 struct resource *r;
168 int ret = 0;
169
170 pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL);
171 if (pwm == NULL) {
172 dev_err(&pdev->dev, "failed to allocate memory\n");
173 return ERR_PTR(-ENOMEM);
174 }
175
176 pwm->clk = clk_get(&pdev->dev, "PWMCLK");
177 if (IS_ERR(pwm->clk)) {
178 ret = PTR_ERR(pwm->clk);
179 goto err_free;
180 }
181 pwm->clk_enabled = 0;
182
183 pwm->use_count = 0;
184 pwm->pwm_id = pwm_id;
185 pwm->pdev = pdev;
186
187 if (parent_pwm != NULL) {
188 /* registers for the second PWM has offset of 0x10 */
189 pwm->mmio_base = parent_pwm->mmio_base + 0x10;
190 __add_pwm(pwm);
191 return pwm;
192 }
193
194 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
195 if (r == NULL) {
196 dev_err(&pdev->dev, "no memory resource defined\n");
197 ret = -ENODEV;
198 goto err_free_clk;
199 }
200
201 r = request_mem_region(r->start, r->end - r->start + 1, pdev->name);
202 if (r == NULL) {
203 dev_err(&pdev->dev, "failed to request memory resource\n");
204 ret = -EBUSY;
205 goto err_free_clk;
206 }
207
208 pwm->mmio_base = ioremap(r->start, r->end - r->start + 1);
209 if (pwm->mmio_base == NULL) {
210 dev_err(&pdev->dev, "failed to ioremap() registers\n");
211 ret = -ENODEV;
212 goto err_free_mem;
213 }
214
215 __add_pwm(pwm);
216 platform_set_drvdata(pdev, pwm);
217 return pwm;
218
219err_free_mem:
220 release_mem_region(r->start, r->end - r->start + 1);
221err_free_clk:
222 clk_put(pwm->clk);
223err_free:
224 kfree(pwm);
225 return ERR_PTR(ret);
226}
227
228static int __devinit pxa25x_pwm_probe(struct platform_device *pdev)
229{
230 struct pwm_device *pwm = pwm_probe(pdev, pdev->id, NULL);
231
232 if (IS_ERR(pwm))
233 return PTR_ERR(pwm);
234
235 return 0;
236}
237
238static int __devinit pxa27x_pwm_probe(struct platform_device *pdev)
239{
240 struct pwm_device *pwm;
241
242 pwm = pwm_probe(pdev, pdev->id, NULL);
243 if (IS_ERR(pwm))
244 return PTR_ERR(pwm);
245
246 pwm = pwm_probe(pdev, pdev->id + 2, pwm);
247 if (IS_ERR(pwm))
248 return PTR_ERR(pwm);
249
250 return 0;
251}
252
253static int __devexit pwm_remove(struct platform_device *pdev)
254{
255 struct pwm_device *pwm;
256 struct resource *r;
257
258 pwm = platform_get_drvdata(pdev);
259 if (pwm == NULL)
260 return -ENODEV;
261
262 mutex_lock(&pwm_lock);
263 list_del(&pwm->node);
264 mutex_unlock(&pwm_lock);
265
266 iounmap(pwm->mmio_base);
267
268 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
269 release_mem_region(r->start, r->end - r->start + 1);
270
271 clk_put(pwm->clk);
272 kfree(pwm);
273 return 0;
274}
275
276static struct platform_driver pxa25x_pwm_driver = {
277 .driver = {
278 .name = "pxa25x-pwm",
279 },
280 .probe = pxa25x_pwm_probe,
281 .remove = __devexit_p(pwm_remove),
282};
283
284static struct platform_driver pxa27x_pwm_driver = {
285 .driver = {
286 .name = "pxa27x-pwm",
287 },
288 .probe = pxa27x_pwm_probe,
289 .remove = __devexit_p(pwm_remove),
290};
291
292static int __init pwm_init(void)
293{
294 int ret = 0;
295
296 ret = platform_driver_register(&pxa25x_pwm_driver);
297 if (ret) {
298 printk(KERN_ERR "failed to register pxa25x_pwm_driver\n");
299 return ret;
300 }
301
302 ret = platform_driver_register(&pxa27x_pwm_driver);
303 if (ret) {
304 printk(KERN_ERR "failed to register pxa27x_pwm_driver\n");
305 return ret;
306 }
307
308 return ret;
309}
310arch_initcall(pwm_init);
311
312static void __exit pwm_exit(void)
313{
314 platform_driver_unregister(&pxa25x_pwm_driver);
315 platform_driver_unregister(&pxa27x_pwm_driver);
316}
317module_exit(pwm_exit);
318
319MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index e5b417d14bb0..4cd50e3005e9 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -26,6 +26,7 @@
26#include <asm/hardware.h> 26#include <asm/hardware.h>
27#include <asm/arch/irqs.h> 27#include <asm/arch/irqs.h>
28#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h>
29#include <asm/arch/mfp-pxa25x.h> 30#include <asm/arch/mfp-pxa25x.h>
30#include <asm/arch/pm.h> 31#include <asm/arch/pm.h>
31#include <asm/arch/dma.h> 32#include <asm/arch/dma.h>
@@ -117,29 +118,35 @@ static struct clk pxa25x_hwuart_clk =
117 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev) 118 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev)
118; 119;
119 120
121/*
122 * PXA 2xx clock declarations. Order is important (see aliases below)
123 * Please be careful not to disrupt the ordering.
124 */
120static struct clk pxa25x_clks[] = { 125static struct clk pxa25x_clks[] = {
121 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev), 126 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
122 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev), 127 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
123 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev), 128 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
124 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL), 129 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
125 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev), 130 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev),
126 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev), 131 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
127 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev), 132 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
128 133
129 INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev), 134 INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev),
130 INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev), 135 INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev),
131 INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev), 136 INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev),
137 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, &pxa25x_device_pwm0.dev),
138 INIT_CKEN("PWMCLK", PWM1, 3686400, 0, &pxa25x_device_pwm1.dev),
132 139
133 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 140 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL),
134 141
135 /* 142 /*
136 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
137 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, NULL),
138 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL), 143 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL),
139 */ 144 */
140 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), 145 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
141}; 146};
142 147
148static struct clk gpio7_clk = INIT_CKOTHER("GPIO7_CK", &pxa25x_clks[4], NULL);
149
143#ifdef CONFIG_PM 150#ifdef CONFIG_PM
144 151
145#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x 152#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
@@ -260,7 +267,7 @@ void __init pxa25x_init_irq(void)
260} 267}
261 268
262static struct platform_device *pxa25x_devices[] __initdata = { 269static struct platform_device *pxa25x_devices[] __initdata = {
263 &pxa_device_udc, 270 &pxa25x_device_udc,
264 &pxa_device_ffuart, 271 &pxa_device_ffuart,
265 &pxa_device_btuart, 272 &pxa_device_btuart,
266 &pxa_device_stuart, 273 &pxa_device_stuart,
@@ -269,6 +276,8 @@ static struct platform_device *pxa25x_devices[] __initdata = {
269 &pxa25x_device_ssp, 276 &pxa25x_device_ssp,
270 &pxa25x_device_nssp, 277 &pxa25x_device_nssp,
271 &pxa25x_device_assp, 278 &pxa25x_device_assp,
279 &pxa25x_device_pwm0,
280 &pxa25x_device_pwm1,
272}; 281};
273 282
274static struct sys_device pxa25x_sysdev[] = { 283static struct sys_device pxa25x_sysdev[] = {
@@ -311,6 +320,8 @@ static int __init pxa25x_init(void)
311 if (cpu_is_pxa25x()) 320 if (cpu_is_pxa25x())
312 ret = platform_device_register(&pxa_device_hwuart); 321 ret = platform_device_register(&pxa_device_hwuart);
313 322
323 clks_register(&gpio7_clk, 1);
324
314 return ret; 325 return ret;
315} 326}
316 327
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 7e945836e129..d5d14ea33f27 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -146,7 +146,7 @@ static struct clk pxa27x_clks[] = {
146 146
147 INIT_CKEN("I2SCLK", I2S, 14682000, 0, &pxa_device_i2s.dev), 147 INIT_CKEN("I2SCLK", I2S, 14682000, 0, &pxa_device_i2s.dev),
148 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 148 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
149 INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa_device_udc.dev), 149 INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa27x_device_udc.dev),
150 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev), 150 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev),
151 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev), 151 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev),
152 152
@@ -157,12 +157,13 @@ static struct clk pxa27x_clks[] = {
157 INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), 157 INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev),
158 INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 158 INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
159 INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 159 INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev),
160 INIT_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
161 INIT_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
160 162
161 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 163 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL),
162 INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL), 164 INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL),
163 165
164 /* 166 /*
165 INIT_CKEN("PWMCLK", PWM0, 13000000, 0, NULL),
166 INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL), 167 INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL),
167 INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL), 168 INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL),
168 INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL), 169 INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL),
@@ -349,11 +350,14 @@ struct platform_device pxa27x_device_i2c_power = {
349 350
350void __init pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info) 351void __init pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info)
351{ 352{
353 local_irq_disable();
354 PCFR |= PCFR_PI2CEN;
355 local_irq_enable();
352 pxa27x_device_i2c_power.dev.platform_data = info; 356 pxa27x_device_i2c_power.dev.platform_data = info;
353} 357}
354 358
355static struct platform_device *devices[] __initdata = { 359static struct platform_device *devices[] __initdata = {
356 &pxa_device_udc, 360 &pxa27x_device_udc,
357 &pxa_device_ffuart, 361 &pxa_device_ffuart,
358 &pxa_device_btuart, 362 &pxa_device_btuart,
359 &pxa_device_stuart, 363 &pxa_device_stuart,
@@ -363,6 +367,8 @@ static struct platform_device *devices[] __initdata = {
363 &pxa27x_device_ssp1, 367 &pxa27x_device_ssp1,
364 &pxa27x_device_ssp2, 368 &pxa27x_device_ssp2,
365 &pxa27x_device_ssp3, 369 &pxa27x_device_ssp3,
370 &pxa27x_device_pwm0,
371 &pxa27x_device_pwm1,
366}; 372};
367 373
368static struct sys_device pxa27x_sysdev[] = { 374static struct sys_device pxa27x_sysdev[] = {
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
new file mode 100644
index 000000000000..d4f6415e8413
--- /dev/null
+++ b/arch/arm/mach-pxa/pxa2xx.c
@@ -0,0 +1,46 @@
1/*
2 * linux/arch/arm/mach-pxa/pxa2xx.c
3 *
4 * code specific to pxa2xx
5 *
6 * Copyright (C) 2008 Dmitry Baryshkov
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/module.h>
14#include <linux/kernel.h>
15#include <linux/device.h>
16
17#include <asm/arch/mfp-pxa2xx.h>
18#include <asm/arch/mfp-pxa25x.h>
19#include <asm/arch/irda.h>
20
21static unsigned long pxa2xx_mfp_fir[] = {
22 GPIO46_FICP_RXD,
23 GPIO47_FICP_TXD,
24};
25
26static unsigned long pxa2xx_mfp_sir[] = {
27 GPIO46_STUART_RXD,
28 GPIO47_STUART_TXD,
29};
30
31static unsigned long pxa2xx_mfp_off[] = {
32 GPIO46_GPIO | MFP_LPM_DRIVE_LOW,
33 GPIO47_GPIO | MFP_LPM_DRIVE_LOW,
34};
35
36void pxa2xx_transceiver_mode(struct device *dev, int mode)
37{
38 if (mode & IR_OFF) {
39 pxa2xx_mfp_config(pxa2xx_mfp_off, ARRAY_SIZE(pxa2xx_mfp_off));
40 } else if (mode & IR_SIRMODE) {
41 pxa2xx_mfp_config(pxa2xx_mfp_sir, ARRAY_SIZE(pxa2xx_mfp_sir));
42 } else if (mode & IR_FIRMODE) {
43 pxa2xx_mfp_config(pxa2xx_mfp_fir, ARRAY_SIZE(pxa2xx_mfp_fir));
44 } else
45 BUG();
46}
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 644550bfa330..15685d2b8f8c 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -231,7 +231,7 @@ static struct clk pxa3xx_clks[] = {
231 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL), 231 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
232 232
233 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 233 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
234 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), 234 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa27x_device_udc.dev),
235 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev), 235 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev),
236 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), 236 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
237 237
@@ -239,6 +239,8 @@ static struct clk pxa3xx_clks[] = {
239 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 239 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
240 PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 240 PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev),
241 PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev), 241 PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev),
242 PXA3xx_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
243 PXA3xx_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
242 244
243 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev), 245 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev),
244 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev), 246 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev),
@@ -520,7 +522,7 @@ void __init pxa3xx_init_irq(void)
520 */ 522 */
521 523
522static struct platform_device *devices[] __initdata = { 524static struct platform_device *devices[] __initdata = {
523 &pxa_device_udc, 525/* &pxa_device_udc, The UDC driver is PXA25x only */
524 &pxa_device_ffuart, 526 &pxa_device_ffuart,
525 &pxa_device_btuart, 527 &pxa_device_btuart,
526 &pxa_device_stuart, 528 &pxa_device_stuart,
@@ -530,6 +532,8 @@ static struct platform_device *devices[] __initdata = {
530 &pxa27x_device_ssp2, 532 &pxa27x_device_ssp2,
531 &pxa27x_device_ssp3, 533 &pxa27x_device_ssp3,
532 &pxa3xx_device_ssp4, 534 &pxa3xx_device_ssp4,
535 &pxa27x_device_pwm0,
536 &pxa27x_device_pwm1,
533}; 537};
534 538
535static struct sys_device pxa3xx_sysdev[] = { 539static struct sys_device pxa3xx_sysdev[] = {
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 23f050feb208..360354084ae4 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -26,6 +26,7 @@
26#include <asm/arch/sharpsl.h> 26#include <asm/arch/sharpsl.h>
27#include <asm/arch/spitz.h> 27#include <asm/arch/spitz.h>
28#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
29#include <asm/arch/pxa2xx-regs.h>
29#include <asm/arch/pxa2xx-gpio.h> 30#include <asm/arch/pxa2xx-gpio.h>
30#include "sharpsl.h" 31#include "sharpsl.h"
31 32
@@ -207,7 +208,9 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = {
207 .read_devdata = spitzpm_read_devdata, 208 .read_devdata = spitzpm_read_devdata,
208 .charger_wakeup = spitz_charger_wakeup, 209 .charger_wakeup = spitz_charger_wakeup,
209 .should_wakeup = spitz_should_wakeup, 210 .should_wakeup = spitz_should_wakeup,
211#ifdef CONFIG_BACKLIGHT_CORGI
210 .backlight_limit = corgibl_limit_intensity, 212 .backlight_limit = corgibl_limit_intensity,
213#endif
211 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, 214 .charge_on_volt = SHARPSL_CHARGE_ON_VOLT,
212 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, 215 .charge_on_temp = SHARPSL_CHARGE_ON_TEMP,
213 .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH, 216 .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH,
@@ -229,6 +232,10 @@ static int __devinit spitzpm_init(void)
229{ 232{
230 int ret; 233 int ret;
231 234
235 if (!machine_is_spitz() && !machine_is_akita()
236 && !machine_is_borzoi())
237 return -ENODEV;
238
232 spitzpm_device = platform_device_alloc("sharpsl-pm", -1); 239 spitzpm_device = platform_device_alloc("sharpsl-pm", -1);
233 if (!spitzpm_device) 240 if (!spitzpm_device)
234 return -ENOMEM; 241 return -ENOMEM;
diff --git a/arch/arm/mach-pxa/standby.S b/arch/arm/mach-pxa/standby.S
index 167412e6bec8..40bb70eff3fe 100644
--- a/arch/arm/mach-pxa/standby.S
+++ b/arch/arm/mach-pxa/standby.S
@@ -14,6 +14,7 @@
14#include <asm/hardware.h> 14#include <asm/hardware.h>
15 15
16#include <asm/arch/pxa-regs.h> 16#include <asm/arch/pxa-regs.h>
17#include <asm/arch/pxa2xx-regs.h>
17 18
18 .text 19 .text
19 20
@@ -35,20 +36,20 @@ ENTRY(pxa_cpu_standby)
35 36
36#ifdef CONFIG_PXA3xx 37#ifdef CONFIG_PXA3xx
37 38
38#define MDCNFG 0x0000 39#define PXA3_MDCNFG 0x0000
39#define MDCNFG_DMCEN (1 << 30) 40#define PXA3_MDCNFG_DMCEN (1 << 30)
40#define DDR_HCAL 0x0060 41#define PXA3_DDR_HCAL 0x0060
41#define DDR_HCAL_HCRNG 0x1f 42#define PXA3_DDR_HCAL_HCRNG 0x1f
42#define DDR_HCAL_HCPROG (1 << 28) 43#define PXA3_DDR_HCAL_HCPROG (1 << 28)
43#define DDR_HCAL_HCEN (1 << 31) 44#define PXA3_DDR_HCAL_HCEN (1 << 31)
44#define DMCIER 0x0070 45#define PXA3_DMCIER 0x0070
45#define DMCIER_EDLP (1 << 29) 46#define PXA3_DMCIER_EDLP (1 << 29)
46#define DMCISR 0x0078 47#define PXA3_DMCISR 0x0078
47#define RCOMP 0x0100 48#define PXA3_RCOMP 0x0100
48#define RCOMP_SWEVAL (1 << 31) 49#define PXA3_RCOMP_SWEVAL (1 << 31)
49 50
50ENTRY(pm_enter_standby_start) 51ENTRY(pm_enter_standby_start)
51 mov r1, #0xf6000000 @ DMEMC_REG_BASE (MDCNFG) 52 mov r1, #0xf6000000 @ DMEMC_REG_BASE (PXA3_MDCNFG)
52 add r1, r1, #0x00100000 53 add r1, r1, #0x00100000
53 54
54 /* 55 /*
@@ -59,54 +60,54 @@ ENTRY(pm_enter_standby_start)
59 * This also means that only the dynamic memory controller 60 * This also means that only the dynamic memory controller
60 * can be reliably accessed in the code following standby. 61 * can be reliably accessed in the code following standby.
61 */ 62 */
62 ldr r2, [r1] @ Dummy read MDCNFG 63 ldr r2, [r1] @ Dummy read PXA3_MDCNFG
63 64
64 mcr p14, 0, r0, c7, c0, 0 65 mcr p14, 0, r0, c7, c0, 0
65 .rept 8 66 .rept 8
66 nop 67 nop
67 .endr 68 .endr
68 69
69 ldr r0, [r1, #DDR_HCAL] @ Clear (and wait for) HCEN 70 ldr r0, [r1, #PXA3_DDR_HCAL] @ Clear (and wait for) HCEN
70 bic r0, r0, #DDR_HCAL_HCEN 71 bic r0, r0, #PXA3_DDR_HCAL_HCEN
71 str r0, [r1, #DDR_HCAL] 72 str r0, [r1, #PXA3_DDR_HCAL]
721: ldr r0, [r1, #DDR_HCAL] 731: ldr r0, [r1, #PXA3_DDR_HCAL]
73 tst r0, #DDR_HCAL_HCEN 74 tst r0, #PXA3_DDR_HCAL_HCEN
74 bne 1b 75 bne 1b
75 76
76 ldr r0, [r1, #RCOMP] @ Initiate RCOMP 77 ldr r0, [r1, #PXA3_RCOMP] @ Initiate RCOMP
77 orr r0, r0, #RCOMP_SWEVAL 78 orr r0, r0, #PXA3_RCOMP_SWEVAL
78 str r0, [r1, #RCOMP] 79 str r0, [r1, #PXA3_RCOMP]
79 80
80 mov r0, #~0 @ Clear interrupts 81 mov r0, #~0 @ Clear interrupts
81 str r0, [r1, #DMCISR] 82 str r0, [r1, #PXA3_DMCISR]
82 83
83 ldr r0, [r1, #DMCIER] @ set DMIER[EDLP] 84 ldr r0, [r1, #PXA3_DMCIER] @ set DMIER[EDLP]
84 orr r0, r0, #DMCIER_EDLP 85 orr r0, r0, #PXA3_DMCIER_EDLP
85 str r0, [r1, #DMCIER] 86 str r0, [r1, #PXA3_DMCIER]
86 87
87 ldr r0, [r1, #DDR_HCAL] @ clear HCRNG, set HCPROG, HCEN 88 ldr r0, [r1, #PXA3_DDR_HCAL] @ clear HCRNG, set HCPROG, HCEN
88 bic r0, r0, #DDR_HCAL_HCRNG 89 bic r0, r0, #PXA3_DDR_HCAL_HCRNG
89 orr r0, r0, #DDR_HCAL_HCEN | DDR_HCAL_HCPROG 90 orr r0, r0, #PXA3_DDR_HCAL_HCEN | PXA3_DDR_HCAL_HCPROG
90 str r0, [r1, #DDR_HCAL] 91 str r0, [r1, #PXA3_DDR_HCAL]
91 92
921: ldr r0, [r1, #DMCISR] 931: ldr r0, [r1, #PXA3_DMCISR]
93 tst r0, #DMCIER_EDLP 94 tst r0, #PXA3_DMCIER_EDLP
94 beq 1b 95 beq 1b
95 96
96 ldr r0, [r1, #MDCNFG] @ set MDCNFG[DMCEN] 97 ldr r0, [r1, #PXA3_MDCNFG] @ set PXA3_MDCNFG[DMCEN]
97 orr r0, r0, #MDCNFG_DMCEN 98 orr r0, r0, #PXA3_MDCNFG_DMCEN
98 str r0, [r1, #MDCNFG] 99 str r0, [r1, #PXA3_MDCNFG]
991: ldr r0, [r1, #MDCNFG] 1001: ldr r0, [r1, #PXA3_MDCNFG]
100 tst r0, #MDCNFG_DMCEN 101 tst r0, #PXA3_MDCNFG_DMCEN
101 beq 1b 102 beq 1b
102 103
103 ldr r0, [r1, #DDR_HCAL] @ set DDR_HCAL[HCRNG] 104 ldr r0, [r1, #PXA3_DDR_HCAL] @ set PXA3_DDR_HCAL[HCRNG]
104 orr r0, r0, #2 @ HCRNG 105 orr r0, r0, #2 @ HCRNG
105 str r0, [r1, #DDR_HCAL] 106 str r0, [r1, #PXA3_DDR_HCAL]
106 107
107 ldr r0, [r1, #DMCIER] @ Clear the interrupt 108 ldr r0, [r1, #PXA3_DMCIER] @ Clear the interrupt
108 bic r0, r0, #0x20000000 109 bic r0, r0, #0x20000000
109 str r0, [r1, #DMCIER] 110 str r0, [r1, #PXA3_DMCIER]
110 111
111 mov pc, lr 112 mov pc, lr
112ENTRY(pm_enter_standby_end) 113ENTRY(pm_enter_standby_end)
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 931885d86b91..61e244023089 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -41,6 +41,7 @@
41#include <asm/mach/flash.h> 41#include <asm/mach/flash.h>
42 42
43#include <asm/arch/pxa-regs.h> 43#include <asm/arch/pxa-regs.h>
44#include <asm/arch/pxa2xx-regs.h>
44#include <asm/arch/pxa2xx-gpio.h> 45#include <asm/arch/pxa2xx-gpio.h>
45#include <asm/arch/trizeps4.h> 46#include <asm/arch/trizeps4.h>
46#include <asm/arch/audio.h> 47#include <asm/arch/audio.h>
@@ -175,19 +176,10 @@ static struct platform_device uart_devices = {
175 .resource = NULL, 176 .resource = NULL,
176}; 177};
177 178
178/********************************************************************************************
179 * PXA270 ac97 sound codec
180 ********************************************************************************************/
181static struct platform_device ac97_audio_device = {
182 .name = "pxa2xx-ac97",
183 .id = -1,
184};
185
186static struct platform_device * trizeps4_devices[] __initdata = { 179static struct platform_device * trizeps4_devices[] __initdata = {
187 &flash_device, 180 &flash_device,
188 &uart_devices, 181 &uart_devices,
189 &dm9000_device, 182 &dm9000_device,
190 &ac97_audio_device,
191}; 183};
192 184
193#ifdef CONFIG_MACH_TRIZEPS4_CONXS 185#ifdef CONFIG_MACH_TRIZEPS4_CONXS
@@ -438,6 +430,7 @@ static void __init trizeps4_init(void)
438 pxa_set_mci_info(&trizeps4_mci_platform_data); 430 pxa_set_mci_info(&trizeps4_mci_platform_data);
439 pxa_set_ficp_info(&trizeps4_ficp_platform_data); 431 pxa_set_ficp_info(&trizeps4_ficp_platform_data);
440 pxa_set_ohci_info(&trizeps4_ohci_platform_data); 432 pxa_set_ohci_info(&trizeps4_ohci_platform_data);
433 pxa_set_ac97_info(NULL);
441} 434}
442 435
443static void __init trizeps4_map_io(void) 436static void __init trizeps4_map_io(void)
@@ -487,6 +480,7 @@ static void __init trizeps4_map_io(void)
487 ConXS_BCR = trizeps_conxs_bcr; 480 ConXS_BCR = trizeps_conxs_bcr;
488#endif 481#endif
489 482
483#warning FIXME - accessing PM registers directly is deprecated
490 PWER = 0x00000002; 484 PWER = 0x00000002;
491 PFER = 0x00000000; 485 PFER = 0x00000000;
492 PRER = 0x00000002; 486 PRER = 0x00000002;
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 4a0028087ea6..66b446ca273d 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -18,22 +18,24 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/pwm_backlight.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/hardware.h> 25#include <asm/hardware.h>
26#include <asm/arch/audio.h>
25#include <asm/arch/gpio.h> 27#include <asm/arch/gpio.h>
26#include <asm/arch/pxafb.h> 28#include <asm/arch/pxafb.h>
27#include <asm/arch/zylonite.h> 29#include <asm/arch/zylonite.h>
28#include <asm/arch/mmc.h> 30#include <asm/arch/mmc.h>
29#include <asm/arch/pxa27x_keypad.h> 31#include <asm/arch/pxa27x_keypad.h>
30 32
33#include "devices.h"
31#include "generic.h" 34#include "generic.h"
32 35
33#define MAX_SLOTS 3 36#define MAX_SLOTS 3
34struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; 37struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
35 38
36int gpio_backlight;
37int gpio_eth_irq; 39int gpio_eth_irq;
38 40
39int wm9713_irq; 41int wm9713_irq;
@@ -62,10 +64,20 @@ static struct platform_device smc91x_device = {
62}; 64};
63 65
64#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) 66#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
65static void zylonite_backlight_power(int on) 67static struct platform_pwm_backlight_data zylonite_backlight_data = {
66{ 68 .pwm_id = 3,
67 gpio_set_value(gpio_backlight, on); 69 .max_brightness = 100,
68} 70 .dft_brightness = 100,
71 .pwm_period_ns = 10000,
72};
73
74static struct platform_device zylonite_backlight_device = {
75 .name = "pwm-backlight",
76 .dev = {
77 .parent = &pxa27x_device_pwm1.dev,
78 .platform_data = &zylonite_backlight_data,
79 },
80};
69 81
70static struct pxafb_mode_info toshiba_ltm035a776c_mode = { 82static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
71 .pixclock = 110000, 83 .pixclock = 110000,
@@ -98,7 +110,6 @@ static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
98static struct pxafb_mach_info zylonite_toshiba_lcd_info = { 110static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
99 .num_modes = 1, 111 .num_modes = 1,
100 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 112 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
101 .pxafb_backlight_power = zylonite_backlight_power,
102}; 113};
103 114
104static struct pxafb_mode_info sharp_ls037_modes[] = { 115static struct pxafb_mode_info sharp_ls037_modes[] = {
@@ -134,13 +145,11 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = {
134 .modes = sharp_ls037_modes, 145 .modes = sharp_ls037_modes,
135 .num_modes = 2, 146 .num_modes = 2,
136 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, 147 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
137 .pxafb_backlight_power = zylonite_backlight_power,
138}; 148};
139 149
140static void __init zylonite_init_lcd(void) 150static void __init zylonite_init_lcd(void)
141{ 151{
142 /* backlight GPIO: output, default on */ 152 platform_device_register(&zylonite_backlight_device);
143 gpio_direction_output(gpio_backlight, 1);
144 153
145 if (lcd_id & 0x20) { 154 if (lcd_id & 0x20) {
146 set_pxa_fb_info(&zylonite_sharp_lcd_info); 155 set_pxa_fb_info(&zylonite_sharp_lcd_info);
@@ -329,6 +338,7 @@ static void __init zylonite_init(void)
329 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq); 338 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq);
330 platform_device_register(&smc91x_device); 339 platform_device_register(&smc91x_device);
331 340
341 pxa_set_ac97_info(NULL);
332 zylonite_init_lcd(); 342 zylonite_init_lcd();
333 zylonite_init_mmc(); 343 zylonite_init_mmc();
334 zylonite_init_keypad(); 344 zylonite_init_keypad();
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index 324fb9daae28..6f7ae972b8db 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -50,6 +50,7 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
50 GPIO75_LCD_BIAS, 50 GPIO75_LCD_BIAS,
51 GPIO76_LCD_VSYNC, 51 GPIO76_LCD_VSYNC,
52 GPIO127_LCD_CS_N, 52 GPIO127_LCD_CS_N,
53 GPIO20_PWM3_OUT, /* backlight */
53 54
54 /* BTUART */ 55 /* BTUART */
55 GPIO111_UART2_RTS, 56 GPIO111_UART2_RTS,
@@ -200,9 +201,6 @@ void __init zylonite_pxa300_init(void)
200 /* detect LCD panel */ 201 /* detect LCD panel */
201 zylonite_detect_lcd_panel(); 202 zylonite_detect_lcd_panel();
202 203
203 /* GPIO pin assignment */
204 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20);
205
206 /* MMC card detect & write protect for controller 0 */ 204 /* MMC card detect & write protect for controller 0 */
207 zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0); 205 zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0);
208 zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2); 206 zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2);
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 193d07903b06..2b4fc34919ac 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -49,6 +49,7 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
49 GPIO15_2_LCD_LCLK, 49 GPIO15_2_LCD_LCLK,
50 GPIO16_2_LCD_PCLK, 50 GPIO16_2_LCD_PCLK,
51 GPIO17_2_LCD_BIAS, 51 GPIO17_2_LCD_BIAS,
52 GPIO14_PWM3_OUT, /* backlight */
52 53
53 /* FFUART */ 54 /* FFUART */
54 GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL, 55 GPIO41_UART1_RXD | MFP_LPM_EDGE_FALL,
@@ -187,7 +188,6 @@ void __init zylonite_pxa320_init(void)
187 zylonite_detect_lcd_panel(); 188 zylonite_detect_lcd_panel();
188 189
189 /* GPIO pin assignment */ 190 /* GPIO pin assignment */
190 gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14);
191 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9); 191 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9);
192 192
193 /* MMC card detect & write protect for controller 0 */ 193 /* MMC card detect & write protect for controller 0 */
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index cd3dc0834b3b..99fdc736698c 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -37,6 +37,17 @@ config S3C2410_CLOCK
37 help 37 help
38 Clock code for the S3C2410, and similar processors 38 Clock code for the S3C2410, and similar processors
39 39
40config SIMTEC_NOR
41 bool
42 help
43 Internal node to specify machine has simtec NOR mapping
44
45config MACH_BAST_IDE
46 bool
47 select HAVE_PATA_PLATFORM
48 help
49 Internal node for machines with an BAST style IDE
50 interface
40 51
41menu "S3C2410 Machines" 52menu "S3C2410 Machines"
42 53
@@ -61,15 +72,18 @@ config PM_H1940
61 Internal node for H1940 and related PM 72 Internal node for H1940 and related PM
62 73
63config MACH_N30 74config MACH_N30
64 bool "Acer N30" 75 bool "Acer N30 family"
65 select CPU_S3C2410 76 select CPU_S3C2410
66 help 77 help
67 Say Y here if you are using the Acer N30 78 Say Y here if you want suppt for the Acer N30, Acer N35,
79 Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.
68 80
69config ARCH_BAST 81config ARCH_BAST
70 bool "Simtec Electronics BAST (EB2410ITX)" 82 bool "Simtec Electronics BAST (EB2410ITX)"
71 select CPU_S3C2410 83 select CPU_S3C2410
72 select PM_SIMTEC if PM 84 select PM_SIMTEC if PM
85 select SIMTEC_NOR
86 select MACH_BAST_IDE
73 select ISA 87 select ISA
74 help 88 help
75 Say Y here if you are using the Simtec Electronics EB2410ITX 89 Say Y here if you are using the Simtec Electronics EB2410ITX
@@ -107,6 +121,8 @@ config MACH_TCT_HAMMER
107config MACH_VR1000 121config MACH_VR1000
108 bool "Thorcom VR1000" 122 bool "Thorcom VR1000"
109 select PM_SIMTEC if PM 123 select PM_SIMTEC if PM
124 select SIMTEC_NOR
125 select MACH_BAST_IDE
110 select CPU_S3C2410 126 select CPU_S3C2410
111 help 127 help
112 Say Y here if you are using the Thorcom VR1000 board. 128 Say Y here if you are using the Thorcom VR1000 board.
@@ -118,4 +134,3 @@ config MACH_QT2410
118 Say Y here if you are using the Armzone QT2410 134 Say Y here if you are using the Armzone QT2410
119 135
120endmenu 136endmenu
121
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index cabc13ce09e4..00f31f8c4e78 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -30,3 +30,11 @@ obj-$(CONFIG_BAST_PC104_IRQ) += bast-irq.o
30obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o 30obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o
31obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o 31obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o
32obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o 32obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o
33
34# Common bits of machine support
35
36obj-$(CONFIG_SIMTEC_NOR) += nor-simtec.o
37
38# machine additions
39
40obj-$(CONFIG_MACH_BAST_IDE) += bast-ide.o
diff --git a/arch/arm/mach-s3c2410/bast-ide.c b/arch/arm/mach-s3c2410/bast-ide.c
new file mode 100644
index 000000000000..df95fe37cdc8
--- /dev/null
+++ b/arch/arm/mach-s3c2410/bast-ide.c
@@ -0,0 +1,112 @@
1/* linux/arch/arm/mach-s3c2410/bast-ide.c
2 *
3 * Copyright 2007 Simtec Electronics
4 * http://www.simtec.co.uk/products/EB2410ITX/
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
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/kernel.h>
14#include <linux/types.h>
15#include <linux/init.h>
16#include <linux/interrupt.h>
17
18#include <linux/platform_device.h>
19#include <linux/ata_platform.h>
20
21#include <asm/mach-types.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
26
27#include <asm/arch/map.h>
28#include <asm/arch/bast-map.h>
29#include <asm/arch/bast-irq.h>
30
31/* IDE ports */
32
33static struct pata_platform_info bast_ide_platdata = {
34 .ioport_shift = 5,
35};
36
37#define IDE_CS S3C2410_CS5
38
39static struct resource bast_ide0_resource[] = {
40 [0] = {
41 .start = IDE_CS + BAST_PA_IDEPRI,
42 .end = IDE_CS + BAST_PA_IDEPRI + (8 * 0x20) - 1,
43 .flags = IORESOURCE_MEM,
44 },
45 [1] = {
46 .start = IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20) ,
47 .end = IDE_CS + BAST_PA_IDEPRIAUX + (7 * 0x20) - 1,
48 .flags = IORESOURCE_MEM,
49 },
50 [2] = {
51 .start = IRQ_IDE0,
52 .end = IRQ_IDE0,
53 .flags = IORESOURCE_IRQ,
54 },
55};
56
57static struct platform_device bast_device_ide0 = {
58 .name = "pata_platform",
59 .id = 0,
60 .num_resources = ARRAY_SIZE(bast_ide0_resource),
61 .resource = bast_ide0_resource,
62 .dev = {
63 .platform_data = &bast_ide_platdata,
64 .coherent_dma_mask = ~0,
65 }
66
67};
68
69static struct resource bast_ide1_resource[] = {
70 [0] = {
71 .start = IDE_CS + BAST_PA_IDESEC,
72 .end = IDE_CS + BAST_PA_IDESEC + (8 * 0x20) - 1,
73 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
76 .start = IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20),
77 .end = IDE_CS + BAST_PA_IDESECAUX + (7 * 0x20) - 1,
78 .flags = IORESOURCE_MEM,
79 },
80 [2] = {
81 .start = IRQ_IDE1,
82 .end = IRQ_IDE1,
83 .flags = IORESOURCE_IRQ,
84 },
85};
86
87static struct platform_device bast_device_ide1 = {
88 .name = "pata_platform",
89 .id = 1,
90 .num_resources = ARRAY_SIZE(bast_ide1_resource),
91 .resource = bast_ide1_resource,
92 .dev = {
93 .platform_data = &bast_ide_platdata,
94 .coherent_dma_mask = ~0,
95 }
96};
97
98static struct platform_device *bast_ide_devices[] __initdata = {
99 &bast_device_ide0,
100 &bast_device_ide1,
101};
102
103static __init int bast_ide_init(void)
104{
105 if (machine_is_bast() || machine_is_vr1000())
106 return platform_add_devices(bast_ide_devices,
107 ARRAY_SIZE(bast_ide_devices));
108
109 return 0;
110}
111
112fs_initcall(bast_ide_init);
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 27f63d5d3a7b..965f27129707 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/mach-bast.c 1/* linux/arch/arm/mach-s3c2410/mach-bast.c
2 * 2 *
3 * Copyright (c) 2003-2005 Simtec Electronics 3 * Copyright (c) 2003-2005,2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/ 6 * http://www.simtec.co.uk/products/EB2410ITX/
@@ -20,6 +20,8 @@
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/dm9000.h> 22#include <linux/dm9000.h>
23#include <linux/ata_platform.h>
24#include <linux/i2c.h>
23 25
24#include <net/ax88796.h> 26#include <net/ax88796.h>
25 27
@@ -56,7 +58,9 @@
56#include <asm/plat-s3c24xx/clock.h> 58#include <asm/plat-s3c24xx/clock.h>
57#include <asm/plat-s3c24xx/devs.h> 59#include <asm/plat-s3c24xx/devs.h>
58#include <asm/plat-s3c24xx/cpu.h> 60#include <asm/plat-s3c24xx/cpu.h>
61
59#include "usb-simtec.h" 62#include "usb-simtec.h"
63#include "nor-simtec.h"
60 64
61#define COPYRIGHT ", (c) 2004-2005 Simtec Electronics" 65#define COPYRIGHT ", (c) 2004-2005 Simtec Electronics"
62 66
@@ -134,37 +138,21 @@ static struct map_desc bast_iodesc[] __initdata = {
134 { VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 138 { VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
135 { VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 139 { VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
136 { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 140 { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
137 { VA_C2(BAST_VA_IDEPRI), PA_CS3(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
138 { VA_C2(BAST_VA_IDESEC), PA_CS3(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
139 { VA_C2(BAST_VA_IDEPRIAUX), PA_CS3(BAST_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
140 { VA_C2(BAST_VA_IDESECAUX), PA_CS3(BAST_PA_IDESECAUX), SZ_1M, MT_DEVICE },
141 141
142 /* slow, word */ 142 /* slow, word */
143 { VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 143 { VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
144 { VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 144 { VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
145 { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 145 { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
146 { VA_C3(BAST_VA_IDEPRI), PA_CS3(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
147 { VA_C3(BAST_VA_IDESEC), PA_CS3(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
148 { VA_C3(BAST_VA_IDEPRIAUX), PA_CS3(BAST_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
149 { VA_C3(BAST_VA_IDESECAUX), PA_CS3(BAST_PA_IDESECAUX), SZ_1M, MT_DEVICE },
150 146
151 /* fast, byte */ 147 /* fast, byte */
152 { VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 148 { VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
153 { VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 149 { VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
154 { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 150 { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
155 { VA_C4(BAST_VA_IDEPRI), PA_CS5(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
156 { VA_C4(BAST_VA_IDESEC), PA_CS5(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
157 { VA_C4(BAST_VA_IDEPRIAUX), PA_CS5(BAST_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
158 { VA_C4(BAST_VA_IDESECAUX), PA_CS5(BAST_PA_IDESECAUX), SZ_1M, MT_DEVICE },
159 151
160 /* fast, word */ 152 /* fast, word */
161 { VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 153 { VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
162 { VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 154 { VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
163 { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 155 { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
164 { VA_C5(BAST_VA_IDEPRI), PA_CS5(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
165 { VA_C5(BAST_VA_IDESEC), PA_CS5(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
166 { VA_C5(BAST_VA_IDEPRIAUX), PA_CS5(BAST_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
167 { VA_C5(BAST_VA_IDESECAUX), PA_CS5(BAST_PA_IDESECAUX), SZ_1M, MT_DEVICE },
168}; 156};
169 157
170#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK 158#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
@@ -218,23 +206,6 @@ static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
218 } 206 }
219}; 207};
220 208
221/* NOR Flash on BAST board */
222
223static struct resource bast_nor_resource[] = {
224 [0] = {
225 .start = S3C2410_CS1 + 0x4000000,
226 .end = S3C2410_CS1 + 0x4000000 + (32*1024*1024) - 1,
227 .flags = IORESOURCE_MEM,
228 }
229};
230
231static struct platform_device bast_device_nor = {
232 .name = "bast-nor",
233 .id = -1,
234 .num_resources = ARRAY_SIZE(bast_nor_resource),
235 .resource = bast_nor_resource,
236};
237
238/* NAND Flash on BAST board */ 209/* NAND Flash on BAST board */
239 210
240#ifdef CONFIG_PM 211#ifdef CONFIG_PM
@@ -374,7 +345,7 @@ static struct resource bast_dm9k_resource[] = {
374 [2] = { 345 [2] = {
375 .start = IRQ_DM9000, 346 .start = IRQ_DM9000,
376 .end = IRQ_DM9000, 347 .end = IRQ_DM9000,
377 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, 348 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
378 } 349 }
379 350
380}; 351};
@@ -564,6 +535,18 @@ static struct s3c2410fb_mach_info __initdata bast_fb_info = {
564 .default_display = 1, 535 .default_display = 1,
565}; 536};
566 537
538/* I2C devices fitted. */
539
540static struct i2c_board_info bast_i2c_devs[] __initdata = {
541 {
542 I2C_BOARD_INFO("tlv320aic23", 0x1a),
543 }, {
544 I2C_BOARD_INFO("simtec-pmu", 0x6b),
545 }, {
546 I2C_BOARD_INFO("ch7013", 0x75),
547 },
548};
549
567/* Standard BAST devices */ 550/* Standard BAST devices */
568 551
569static struct platform_device *bast_devices[] __initdata = { 552static struct platform_device *bast_devices[] __initdata = {
@@ -573,7 +556,6 @@ static struct platform_device *bast_devices[] __initdata = {
573 &s3c_device_i2c, 556 &s3c_device_i2c,
574 &s3c_device_rtc, 557 &s3c_device_rtc,
575 &s3c_device_nand, 558 &s3c_device_nand,
576 &bast_device_nor,
577 &bast_device_dm9k, 559 &bast_device_dm9k,
578 &bast_device_asix, 560 &bast_device_asix,
579 &bast_device_axpp, 561 &bast_device_axpp,
@@ -622,6 +604,11 @@ static void __init bast_init(void)
622 604
623 s3c24xx_fb_set_platdata(&bast_fb_info); 605 s3c24xx_fb_set_platdata(&bast_fb_info);
624 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); 606 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
607
608 i2c_register_board_info(0, bast_i2c_devs,
609 ARRAY_SIZE(bast_i2c_devs));
610
611 nor_simtec_init();
625} 612}
626 613
627MACHINE_START(BAST, "Simtec-BAST") 614MACHINE_START(BAST, "Simtec-BAST")
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
index 621f548da610..43c2e915c5bf 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c2410/mach-n30.c
@@ -1,9 +1,10 @@
1/* linux/arch/arm/mach-s3c2410/mach-n30.c 1/* Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
2 * Yakumo AlphaX and Airis NC05 PDAs.
2 * 3 *
3 * Copyright (c) 2003-2005 Simtec Electronics 4 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
5 * 6 *
6 * Copyright (c) 2005 Christer Weinigel <christer@weinigel.se> 7 * Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
7 * 8 *
8 * There is a wiki with more information about the n30 port at 9 * There is a wiki with more information about the n30 port at
9 * http://handhelds.org/moin/moin.cgi/AcerN30Documentation . 10 * http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
@@ -11,36 +12,42 @@
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
14*/ 15 */
15 16
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/interrupt.h> 19
19#include <linux/list.h>
20#include <linux/timer.h>
21#include <linux/init.h>
22#include <linux/delay.h> 20#include <linux/delay.h>
23#include <linux/serial_core.h> 21#include <linux/gpio_keys.h>
22#include <linux/init.h>
23#include <linux/input.h>
24#include <linux/interrupt.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/kthread.h> 26#include <linux/serial_core.h>
26 27#include <linux/timer.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/irq.h>
30 28
31#include <asm/hardware.h> 29#include <asm/hardware.h>
32#include <asm/io.h> 30#include <asm/io.h>
33#include <asm/irq.h> 31#include <asm/irq.h>
34#include <asm/mach-types.h> 32#include <asm/mach-types.h>
35 33
36#include <asm/plat-s3c/regs-serial.h> 34#include <asm/arch/fb.h>
35#include <asm/arch/leds-gpio.h>
37#include <asm/arch/regs-gpio.h> 36#include <asm/arch/regs-gpio.h>
37#include <asm/arch/regs-lcd.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/irq.h>
41#include <asm/mach/map.h>
42
38#include <asm/plat-s3c/iic.h> 43#include <asm/plat-s3c/iic.h>
44#include <asm/plat-s3c/regs-serial.h>
39 45
40#include <asm/plat-s3c24xx/s3c2410.h>
41#include <asm/plat-s3c24xx/clock.h> 46#include <asm/plat-s3c24xx/clock.h>
42#include <asm/plat-s3c24xx/devs.h>
43#include <asm/plat-s3c24xx/cpu.h> 47#include <asm/plat-s3c24xx/cpu.h>
48#include <asm/plat-s3c24xx/devs.h>
49#include <asm/plat-s3c24xx/s3c2410.h>
50#include <asm/plat-s3c24xx/udc.h>
44 51
45static struct map_desc n30_iodesc[] __initdata = { 52static struct map_desc n30_iodesc[] __initdata = {
46 /* nothing here yet */ 53 /* nothing here yet */
@@ -64,7 +71,8 @@ static struct s3c2410_uartcfg n30_uartcfgs[] = {
64 .ulcon = 0x43, 71 .ulcon = 0x43,
65 .ufcon = 0x51, 72 .ufcon = 0x51,
66 }, 73 },
67 /* The BlueTooth controller is connected to port 2 */ 74 /* On the N30 the bluetooth controller is connected here.
75 * On the N35 and variants the GPS receiver is connected here. */
68 [2] = { 76 [2] = {
69 .hwport = 2, 77 .hwport = 2,
70 .flags = 0, 78 .flags = 0,
@@ -74,13 +82,260 @@ static struct s3c2410_uartcfg n30_uartcfgs[] = {
74 }, 82 },
75}; 83};
76 84
85static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd)
86{
87 switch (cmd) {
88 case S3C2410_UDC_P_ENABLE :
89 s3c2410_gpio_setpin(S3C2410_GPB3, 1);
90 break;
91 case S3C2410_UDC_P_DISABLE :
92 s3c2410_gpio_setpin(S3C2410_GPB3, 0);
93 break;
94 case S3C2410_UDC_P_RESET :
95 break;
96 default:
97 break;
98 }
99}
100
101static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
102 .udc_command = n30_udc_pullup,
103 .vbus_pin = S3C2410_GPG1,
104 .vbus_pin_inverted = 0,
105};
106
107static struct gpio_keys_button n30_buttons[] = {
108 {
109 .gpio = S3C2410_GPF0,
110 .code = KEY_POWER,
111 .desc = "Power",
112 .active_low = 0,
113 },
114 {
115 .gpio = S3C2410_GPG9,
116 .code = KEY_UP,
117 .desc = "Thumbwheel Up",
118 .active_low = 0,
119 },
120 {
121 .gpio = S3C2410_GPG8,
122 .code = KEY_DOWN,
123 .desc = "Thumbwheel Down",
124 .active_low = 0,
125 },
126 {
127 .gpio = S3C2410_GPG7,
128 .code = KEY_ENTER,
129 .desc = "Thumbwheel Press",
130 .active_low = 0,
131 },
132 {
133 .gpio = S3C2410_GPF7,
134 .code = KEY_HOMEPAGE,
135 .desc = "Home",
136 .active_low = 0,
137 },
138 {
139 .gpio = S3C2410_GPF6,
140 .code = KEY_CALENDAR,
141 .desc = "Calendar",
142 .active_low = 0,
143 },
144 {
145 .gpio = S3C2410_GPF5,
146 .code = KEY_ADDRESSBOOK,
147 .desc = "Contacts",
148 .active_low = 0,
149 },
150 {
151 .gpio = S3C2410_GPF4,
152 .code = KEY_MAIL,
153 .desc = "Mail",
154 .active_low = 0,
155 },
156};
157
158static struct gpio_keys_platform_data n30_button_data = {
159 .buttons = n30_buttons,
160 .nbuttons = ARRAY_SIZE(n30_buttons),
161};
162
163static struct platform_device n30_button_device = {
164 .name = "gpio-keys",
165 .id = -1,
166 .dev = {
167 .platform_data = &n30_button_data,
168 }
169};
170
171static struct gpio_keys_button n35_buttons[] = {
172 {
173 .gpio = S3C2410_GPF0,
174 .code = KEY_POWER,
175 .desc = "Power",
176 .active_low = 0,
177 },
178 {
179 .gpio = S3C2410_GPG9,
180 .code = KEY_UP,
181 .desc = "Joystick Up",
182 .active_low = 0,
183 },
184 {
185 .gpio = S3C2410_GPG8,
186 .code = KEY_DOWN,
187 .desc = "Joystick Down",
188 .active_low = 0,
189 },
190 {
191 .gpio = S3C2410_GPG6,
192 .code = KEY_DOWN,
193 .desc = "Joystick Left",
194 .active_low = 0,
195 },
196 {
197 .gpio = S3C2410_GPG5,
198 .code = KEY_DOWN,
199 .desc = "Joystick Right",
200 .active_low = 0,
201 },
202 {
203 .gpio = S3C2410_GPG7,
204 .code = KEY_ENTER,
205 .desc = "Joystick Press",
206 .active_low = 0,
207 },
208 {
209 .gpio = S3C2410_GPF7,
210 .code = KEY_HOMEPAGE,
211 .desc = "Home",
212 .active_low = 0,
213 },
214 {
215 .gpio = S3C2410_GPF6,
216 .code = KEY_CALENDAR,
217 .desc = "Calendar",
218 .active_low = 0,
219 },
220 {
221 .gpio = S3C2410_GPF5,
222 .code = KEY_ADDRESSBOOK,
223 .desc = "Contacts",
224 .active_low = 0,
225 },
226 {
227 .gpio = S3C2410_GPF4,
228 .code = KEY_MAIL,
229 .desc = "Mail",
230 .active_low = 0,
231 },
232 {
233 .gpio = S3C2410_GPF3,
234 .code = SW_RADIO,
235 .desc = "GPS Antenna",
236 .active_low = 0,
237 },
238 {
239 .gpio = S3C2410_GPG2,
240 .code = SW_HEADPHONE_INSERT,
241 .desc = "Headphone",
242 .active_low = 0,
243 },
244};
245
246static struct gpio_keys_platform_data n35_button_data = {
247 .buttons = n35_buttons,
248 .nbuttons = ARRAY_SIZE(n35_buttons),
249};
250
251static struct platform_device n35_button_device = {
252 .name = "gpio-keys",
253 .id = -1,
254 .num_resources = 0,
255 .dev = {
256 .platform_data = &n35_button_data,
257 }
258};
259
260/* This is the bluetooth LED on the device. */
261static struct s3c24xx_led_platdata n30_blue_led_pdata = {
262 .name = "blue_led",
263 .gpio = S3C2410_GPG6,
264 .def_trigger = "",
265};
266
267/* This LED is driven by the battery microcontroller, and is blinking
268 * red, blinking green or solid green when the battery is low,
269 * charging or full respectively. By driving GPD9 low, it's possible
270 * to force the LED to blink red, so call that warning LED. */
271static struct s3c24xx_led_platdata n30_warning_led_pdata = {
272 .name = "warning_led",
273 .flags = S3C24XX_LEDF_ACTLOW,
274 .gpio = S3C2410_GPD9,
275 .def_trigger = "",
276};
277
278static struct platform_device n30_blue_led = {
279 .name = "s3c24xx_led",
280 .id = 1,
281 .dev = {
282 .platform_data = &n30_blue_led_pdata,
283 },
284};
285
286static struct platform_device n30_warning_led = {
287 .name = "s3c24xx_led",
288 .id = 2,
289 .dev = {
290 .platform_data = &n30_warning_led_pdata,
291 },
292};
293
294static struct s3c2410fb_display n30_display __initdata = {
295 .type = S3C2410_LCDCON1_TFT,
296 .width = 240,
297 .height = 320,
298 .pixclock = 170000,
299
300 .xres = 240,
301 .yres = 320,
302 .bpp = 16,
303 .left_margin = 3,
304 .right_margin = 40,
305 .hsync_len = 40,
306 .upper_margin = 2,
307 .lower_margin = 3,
308 .vsync_len = 2,
309
310 .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
311};
312
313static struct s3c2410fb_mach_info n30_fb_info __initdata = {
314 .displays = &n30_display,
315 .num_displays = 1,
316 .default_display = 0,
317 .lpcsel = 0x06,
318};
319
77static struct platform_device *n30_devices[] __initdata = { 320static struct platform_device *n30_devices[] __initdata = {
321 &s3c_device_lcd,
322 &s3c_device_wdt,
323 &s3c_device_i2c,
324 &s3c_device_iis,
78 &s3c_device_usb, 325 &s3c_device_usb,
326 &s3c_device_usbgadget,
327 &n30_button_device,
328 &n30_blue_led,
329 &n30_warning_led,
330};
331
332static struct platform_device *n35_devices[] __initdata = {
79 &s3c_device_lcd, 333 &s3c_device_lcd,
80 &s3c_device_wdt, 334 &s3c_device_wdt,
81 &s3c_device_i2c, 335 &s3c_device_i2c,
82 &s3c_device_iis, 336 &s3c_device_iis,
83 &s3c_device_usbgadget, 337 &s3c_device_usbgadget,
338 &n35_button_device,
84}; 339};
85 340
86static struct s3c2410_platform_i2c n30_i2ccfg = { 341static struct s3c2410_platform_i2c n30_i2ccfg = {
@@ -90,9 +345,148 @@ static struct s3c2410_platform_i2c n30_i2ccfg = {
90 .max_freq = 10*1000, 345 .max_freq = 10*1000,
91}; 346};
92 347
348/* Lots of hardcoded stuff, but it sets up the hardware in a useful
349 * state so that we can boot Linux directly from flash. */
350static void __init n30_hwinit(void)
351{
352 /* GPA0-11 special functions -- unknown what they do
353 * GPA12 N30 special function -- unknown what it does
354 * N35/PiN output -- unknown what it does
355 *
356 * A12 is nGCS1 on the N30 and an output on the N35/PiN. I
357 * don't think it does anything useful on the N30, so I ought
358 * to make it an output there too since it always driven to 0
359 * as far as I can tell. */
360 if (machine_is_n30())
361 __raw_writel(0x007fffff, S3C2410_GPACON);
362 if (machine_is_n35())
363 __raw_writel(0x007fefff, S3C2410_GPACON);
364 __raw_writel(0x00000000, S3C2410_GPADAT);
365
366 /* GPB0 TOUT0 backlight level
367 * GPB1 output 1=backlight on
368 * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled
369 * GPB3 output USB D+ pull up 0=disabled, 1=enabled
370 * GPB4 N30 output -- unknown function
371 * N30/PiN GPS control 0=GPS enabled, 1=GPS disabled
372 * GPB5 output -- unknown function
373 * GPB6 input -- unknown function
374 * GPB7 output -- unknown function
375 * GPB8 output -- probably LCD driver enable
376 * GPB9 output -- probably LCD VSYNC driver enable
377 * GPB10 output -- probably LCD HSYNC driver enable
378 */
379 __raw_writel(0x00154556, S3C2410_GPBCON);
380 __raw_writel(0x00000750, S3C2410_GPBDAT);
381 __raw_writel(0x00000073, S3C2410_GPBUP);
382
383 /* GPC0 input RS232 DCD/DSR/RI
384 * GPC1 LCD
385 * GPC2 output RS232 DTR?
386 * GPC3 input RS232 DCD/DSR/RI
387 * GPC4 LCD
388 * GPC5 output 0=NAND write enabled, 1=NAND write protect
389 * GPC6 input -- unknown function
390 * GPC7 input charger status 0=charger connected
391 * this input can be triggered by power on the USB device
392 * port too, but will go back to disconnected soon after.
393 * GPC8 N30/N35 output -- unknown function, always driven to 1
394 * PiN input -- unknown function, always read as 1
395 * Make it an input with a pull up for all models.
396 * GPC9-15 LCD
397 */
398 __raw_writel(0xaaa80618, S3C2410_GPCCON);
399 __raw_writel(0x0000014c, S3C2410_GPCDAT);
400 __raw_writel(0x0000fef2, S3C2410_GPCUP);
401
402 /* GPD0 input -- unknown function
403 * GPD1-D7 LCD
404 * GPD8 N30 output -- unknown function
405 * N35/PiN output 1=GPS LED on
406 * GPD9 output 0=power led blinks red, 1=normal power led function
407 * GPD10 output -- unknown function
408 * GPD11-15 LCD drivers
409 */
410 __raw_writel(0xaa95aaa4, S3C2410_GPDCON);
411 __raw_writel(0x00000601, S3C2410_GPDDAT);
412 __raw_writel(0x0000fbfe, S3C2410_GPDUP);
413
414 /* GPE0-4 I2S audio bus
415 * GPE5-10 SD/MMC bus
416 * E11-13 outputs -- unknown function, probably power management
417 * E14-15 I2C bus connected to the battery controller
418 */
419 __raw_writel(0xa56aaaaa, S3C2410_GPECON);
420 __raw_writel(0x0000efc5, S3C2410_GPEDAT);
421 __raw_writel(0x0000f81f, S3C2410_GPEUP);
422
423 /* GPF0 input 0=power button pressed
424 * GPF1 input SD/MMC switch 0=card present
425 * GPF2 N30 1=reset button pressed (inverted compared to the rest)
426 * N35/PiN 0=reset button pressed
427 * GPF3 N30/PiN input -- unknown function
428 * N35 input GPS antenna position, 0=antenna closed, 1=open
429 * GPF4 input 0=button 4 pressed
430 * GPF5 input 0=button 3 pressed
431 * GPF6 input 0=button 2 pressed
432 * GPF7 input 0=button 1 pressed
433 */
434 __raw_writel(0x0000aaaa, S3C2410_GPFCON);
435 __raw_writel(0x00000000, S3C2410_GPFDAT);
436 __raw_writel(0x000000ff, S3C2410_GPFUP);
437
438 /* GPG0 input RS232 DCD/DSR/RI
439 * GPG1 input 1=USB gadget port has power from a host
440 * GPG2 N30 input -- unknown function
441 * N35/PiN input 0=headphones plugged in, 1=not plugged in
442 * GPG3 N30 output -- unknown function
443 * N35/PiN input with unknown function
444 * GPG4 N30 output 0=MMC enabled, 1=MMC disabled
445 * GPG5 N30 output 0=BlueTooth chip disabled, 1=enabled
446 * N35/PiN input joystick right
447 * GPG6 N30 output 0=blue led on, 1=off
448 * N35/PiN input joystick left
449 * GPG7 input 0=thumbwheel pressed
450 * GPG8 input 0=thumbwheel down
451 * GPG9 input 0=thumbwheel up
452 * GPG10 input SD/MMC write protect switch
453 * GPG11 N30 input -- unknown function
454 * N35 output 0=GPS antenna powered, 1=not powered
455 * PiN output -- unknown function
456 * GPG12-15 touch screen functions
457 *
458 * The pullups differ between the models, so enable all
459 * pullups that are enabled on any of the models.
460 */
461 if (machine_is_n30())
462 __raw_writel(0xff0a956a, S3C2410_GPGCON);
463 if (machine_is_n35())
464 __raw_writel(0xff4aa92a, S3C2410_GPGCON);
465 __raw_writel(0x0000e800, S3C2410_GPGDAT);
466 __raw_writel(0x0000f86f, S3C2410_GPGUP);
467
468 /* GPH0/1/2/3 RS232 serial port
469 * GPH4/5 IrDA serial port
470 * GPH6/7 N30 BlueTooth serial port
471 * N35/PiN GPS receiver
472 * GPH8 input -- unknown function
473 * GPH9 CLKOUT0 HCLK -- unknown use
474 * GPH10 CLKOUT1 FCLK -- unknown use
475 *
476 * The pull ups for H6/H7 are enabled on N30 but not on the
477 * N35/PiN. I suppose is useful for a budget model of the N30
478 * with no bluetooh. It doesn't hurt to have the pull ups
479 * enabled on the N35, so leave them enabled for all models.
480 */
481 __raw_writel(0x0028aaaa, S3C2410_GPHCON);
482 __raw_writel(0x000005ef, S3C2410_GPHDAT);
483 __raw_writel(0x0000063f, S3C2410_GPHUP);
484}
485
93static void __init n30_map_io(void) 486static void __init n30_map_io(void)
94{ 487{
95 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc)); 488 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
489 n30_hwinit();
96 s3c24xx_init_clocks(0); 490 s3c24xx_init_clocks(0);
97 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); 491 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
98} 492}
@@ -106,7 +500,9 @@ static void __init n30_init_irq(void)
106 500
107static void __init n30_init(void) 501static void __init n30_init(void)
108{ 502{
503 s3c24xx_fb_set_platdata(&n30_fb_info);
109 s3c_device_i2c.dev.platform_data = &n30_i2ccfg; 504 s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
505 s3c24xx_udc_set_platdata(&n30_udc_cfg);
110 506
111 /* Turn off suspend on both USB ports, and switch the 507 /* Turn off suspend on both USB ports, and switch the
112 * selectable USB port to USB device mode. */ 508 * selectable USB port to USB device mode. */
@@ -115,7 +511,32 @@ static void __init n30_init(void)
115 S3C2410_MISCCR_USBSUSPND0 | 511 S3C2410_MISCCR_USBSUSPND0 |
116 S3C2410_MISCCR_USBSUSPND1, 0x0); 512 S3C2410_MISCCR_USBSUSPND1, 0x0);
117 513
118 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices)); 514 if (machine_is_n30()) {
515 /* Turn off suspend on both USB ports, and switch the
516 * selectable USB port to USB device mode. */
517 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
518 S3C2410_MISCCR_USBSUSPND0 |
519 S3C2410_MISCCR_USBSUSPND1, 0x0);
520
521 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
522 }
523
524 if (machine_is_n35()) {
525 /* Turn off suspend and switch the selectable USB port
526 * to USB device mode. Turn on suspend for the host
527 * port since it is not connected on the N35.
528 *
529 * Actually, the host port is available at some pads
530 * on the back of the device, so it would actually be
531 * possible to add a USB device inside the N35 if you
532 * are willing to do some hardware modifications. */
533 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
534 S3C2410_MISCCR_USBSUSPND0 |
535 S3C2410_MISCCR_USBSUSPND1,
536 S3C2410_MISCCR_USBSUSPND1);
537
538 platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
539 }
119} 540}
120 541
121MACHINE_START(N30, "Acer-N30") 542MACHINE_START(N30, "Acer-N30")
@@ -131,9 +552,14 @@ MACHINE_START(N30, "Acer-N30")
131 .map_io = n30_map_io, 552 .map_io = n30_map_io,
132MACHINE_END 553MACHINE_END
133 554
134/* 555MACHINE_START(N35, "Acer-N35")
135 Local variables: 556 /* Maintainer: Christer Weinigel <christer@weinigel.se>
136 compile-command: "make ARCH=arm CROSS_COMPILE=/usr/local/arm/3.3.2/bin/arm-linux- -k -C ../../.." 557 */
137 c-basic-offset: 8 558 .phys_io = S3C2410_PA_UART,
138 End: 559 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
139*/ 560 .boot_params = S3C2410_SDRAM_PA + 0x100,
561 .timer = &s3c24xx_timer,
562 .init_machine = n30_init,
563 .init_irq = n30_init_irq,
564 .map_io = n30_map_io,
565MACHINE_END
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 4c4b5c4207c4..9a0965ac5e11 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/mach-vr1000.c 1/* linux/arch/arm/mach-s3c2410/mach-vr1000.c
2 * 2 *
3 * Copyright (c) 2003-2005 Simtec Electronics 3 * Copyright (c) 2003-2005,2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * Machine support for Thorcom VR1000 board. Designed for Thorcom by 6 * Machine support for Thorcom VR1000 board. Designed for Thorcom by
@@ -19,6 +19,7 @@
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/dm9000.h> 21#include <linux/dm9000.h>
22#include <linux/i2c.h>
22 23
23#include <linux/serial.h> 24#include <linux/serial.h>
24#include <linux/tty.h> 25#include <linux/tty.h>
@@ -46,7 +47,9 @@
46#include <asm/plat-s3c24xx/clock.h> 47#include <asm/plat-s3c24xx/clock.h>
47#include <asm/plat-s3c24xx/devs.h> 48#include <asm/plat-s3c24xx/devs.h>
48#include <asm/plat-s3c24xx/cpu.h> 49#include <asm/plat-s3c24xx/cpu.h>
50
49#include "usb-simtec.h" 51#include "usb-simtec.h"
52#include "nor-simtec.h"
50 53
51/* macros for virtual address mods for the io space entries */ 54/* macros for virtual address mods for the io space entries */
52#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5) 55#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
@@ -97,34 +100,6 @@ static struct map_desc vr1000_iodesc[] __initdata = {
97 .length = SZ_1M, 100 .length = SZ_1M,
98 .type = MT_DEVICE, 101 .type = MT_DEVICE,
99 }, 102 },
100
101 /* peripheral space... one for each of fast/slow/byte/16bit */
102 /* note, ide is only decoded in word space, even though some registers
103 * are only 8bit */
104
105 /* slow, byte */
106 { VA_C2(VR1000_VA_IDEPRI), PA_CS3(VR1000_PA_IDEPRI), SZ_1M, MT_DEVICE },
107 { VA_C2(VR1000_VA_IDESEC), PA_CS3(VR1000_PA_IDESEC), SZ_1M, MT_DEVICE },
108 { VA_C2(VR1000_VA_IDEPRIAUX), PA_CS3(VR1000_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
109 { VA_C2(VR1000_VA_IDESECAUX), PA_CS3(VR1000_PA_IDESECAUX), SZ_1M, MT_DEVICE },
110
111 /* slow, word */
112 { VA_C3(VR1000_VA_IDEPRI), PA_CS3(VR1000_PA_IDEPRI), SZ_1M, MT_DEVICE },
113 { VA_C3(VR1000_VA_IDESEC), PA_CS3(VR1000_PA_IDESEC), SZ_1M, MT_DEVICE },
114 { VA_C3(VR1000_VA_IDEPRIAUX), PA_CS3(VR1000_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
115 { VA_C3(VR1000_VA_IDESECAUX), PA_CS3(VR1000_PA_IDESECAUX), SZ_1M, MT_DEVICE },
116
117 /* fast, byte */
118 { VA_C4(VR1000_VA_IDEPRI), PA_CS5(VR1000_PA_IDEPRI), SZ_1M, MT_DEVICE },
119 { VA_C4(VR1000_VA_IDESEC), PA_CS5(VR1000_PA_IDESEC), SZ_1M, MT_DEVICE },
120 { VA_C4(VR1000_VA_IDEPRIAUX), PA_CS5(VR1000_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
121 { VA_C4(VR1000_VA_IDESECAUX), PA_CS5(VR1000_PA_IDESECAUX), SZ_1M, MT_DEVICE },
122
123 /* fast, word */
124 { VA_C5(VR1000_VA_IDEPRI), PA_CS5(VR1000_PA_IDEPRI), SZ_1M, MT_DEVICE },
125 { VA_C5(VR1000_VA_IDESEC), PA_CS5(VR1000_PA_IDESEC), SZ_1M, MT_DEVICE },
126 { VA_C5(VR1000_VA_IDEPRIAUX), PA_CS5(VR1000_PA_IDEPRIAUX), SZ_1M, MT_DEVICE },
127 { VA_C5(VR1000_VA_IDESECAUX), PA_CS5(VR1000_PA_IDESECAUX), SZ_1M, MT_DEVICE },
128}; 103};
129 104
130#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK 105#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
@@ -230,23 +205,6 @@ static struct platform_device serial_device = {
230 }, 205 },
231}; 206};
232 207
233/* MTD NOR Flash */
234
235static struct resource vr1000_nor_resource[] = {
236 [0] = {
237 .start = S3C2410_CS1 + 0x4000000,
238 .end = S3C2410_CS1 + 0x4000000 + SZ_16M - 1,
239 .flags = IORESOURCE_MEM,
240 }
241};
242
243static struct platform_device vr1000_nor = {
244 .name = "bast-nor",
245 .id = -1,
246 .num_resources = ARRAY_SIZE(vr1000_nor_resource),
247 .resource = vr1000_nor_resource,
248};
249
250/* DM9000 ethernet devices */ 208/* DM9000 ethernet devices */
251 209
252static struct resource vr1000_dm9k0_resource[] = { 210static struct resource vr1000_dm9k0_resource[] = {
@@ -263,7 +221,7 @@ static struct resource vr1000_dm9k0_resource[] = {
263 [2] = { 221 [2] = {
264 .start = IRQ_VR1000_DM9000A, 222 .start = IRQ_VR1000_DM9000A,
265 .end = IRQ_VR1000_DM9000A, 223 .end = IRQ_VR1000_DM9000A,
266 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, 224 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
267 } 225 }
268 226
269}; 227};
@@ -282,7 +240,7 @@ static struct resource vr1000_dm9k1_resource[] = {
282 [2] = { 240 [2] = {
283 .start = IRQ_VR1000_DM9000N, 241 .start = IRQ_VR1000_DM9000N,
284 .end = IRQ_VR1000_DM9000N, 242 .end = IRQ_VR1000_DM9000N,
285 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, 243 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
286 } 244 }
287}; 245};
288 246
@@ -358,6 +316,18 @@ static struct platform_device vr1000_led3 = {
358 }, 316 },
359}; 317};
360 318
319/* I2C devices. */
320
321static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
322 {
323 I2C_BOARD_INFO("tlv320aic23", 0x1a),
324 }, {
325 I2C_BOARD_INFO("tmp101", 0x48),
326 }, {
327 I2C_BOARD_INFO("m41st87", 0x68),
328 },
329};
330
361/* devices for this board */ 331/* devices for this board */
362 332
363static struct platform_device *vr1000_devices[] __initdata = { 333static struct platform_device *vr1000_devices[] __initdata = {
@@ -367,7 +337,6 @@ static struct platform_device *vr1000_devices[] __initdata = {
367 &s3c_device_i2c, 337 &s3c_device_i2c,
368 &s3c_device_adc, 338 &s3c_device_adc,
369 &serial_device, 339 &serial_device,
370 &vr1000_nor,
371 &vr1000_dm9k0, 340 &vr1000_dm9k0,
372 &vr1000_dm9k1, 341 &vr1000_dm9k1,
373 &vr1000_led1, 342 &vr1000_led1,
@@ -416,6 +385,11 @@ static void __init vr1000_map_io(void)
416static void __init vr1000_init(void) 385static void __init vr1000_init(void)
417{ 386{
418 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices)); 387 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
388
389 i2c_register_board_info(0, vr1000_i2c_devs,
390 ARRAY_SIZE(vr1000_i2c_devs));
391
392 nor_simtec_init();
419} 393}
420 394
421MACHINE_START(VR1000, "Thorcom-VR1000") 395MACHINE_START(VR1000, "Thorcom-VR1000")
diff --git a/arch/arm/mach-s3c2410/nor-simtec.c b/arch/arm/mach-s3c2410/nor-simtec.c
new file mode 100644
index 000000000000..f44e21b9c3ba
--- /dev/null
+++ b/arch/arm/mach-s3c2410/nor-simtec.c
@@ -0,0 +1,86 @@
1/* linux/arch/arm/mach-s3c2410/nor-simtec.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Simtec NOR mapping
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 version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/module.h>
15#include <linux/types.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/platform_device.h>
19
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h>
22#include <linux/mtd/physmap.h>
23#include <linux/mtd/partitions.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
29#include <asm/arch/map.h>
30#include <asm/arch/bast-map.h>
31#include <asm/arch/bast-cpld.h>
32
33
34static void simtec_nor_vpp(struct map_info *map, int vpp)
35{
36 unsigned int val;
37 unsigned long flags;
38
39 local_irq_save(flags);
40 val = __raw_readb(BAST_VA_CTRL3);
41
42 printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
43
44 if (vpp)
45 val |= BAST_CPLD_CTRL3_ROMWEN;
46 else
47 val &= ~BAST_CPLD_CTRL3_ROMWEN;
48
49 __raw_writeb(val, BAST_VA_CTRL3);
50 local_irq_restore(flags);
51}
52
53struct physmap_flash_data simtec_nor_pdata = {
54 .width = 2,
55 .set_vpp = simtec_nor_vpp,
56 .nr_parts = 0,
57};
58
59static struct resource simtec_nor_resource[] = {
60 [0] = {
61 .start = S3C2410_CS1 + 0x4000000,
62 .end = S3C2410_CS1 + 0x4000000 + SZ_8M - 1,
63 .flags = IORESOURCE_MEM,
64 }
65};
66
67static struct platform_device simtec_device_nor = {
68 .name = "physmap-flash",
69 .id = -1,
70 .num_resources = ARRAY_SIZE(simtec_nor_resource),
71 .resource = simtec_nor_resource,
72 .dev = {
73 .platform_data = &simtec_nor_pdata,
74 },
75};
76
77void __init nor_simtec_init(void)
78{
79 int ret;
80
81 ret = platform_device_register(&simtec_device_nor);
82 if (ret < 0)
83 printk(KERN_ERR "failed to register physmap-flash device\n");
84 else
85 simtec_nor_vpp(NULL, 1);
86}
diff --git a/arch/arm/mach-s3c2410/nor-simtec.h b/arch/arm/mach-s3c2410/nor-simtec.h
new file mode 100644
index 000000000000..f619c1e0d0c8
--- /dev/null
+++ b/arch/arm/mach-s3c2410/nor-simtec.h
@@ -0,0 +1,14 @@
1/* linux/arch/arm/mach-s3c2410/nor-simtec.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Simtec NOR mapping
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 version 2 as
11 * published by the Free Software Foundation.
12*/
13
14extern void nor_simtec_init(void);
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig
index 0b43431d4b75..c59a9d2ee9a6 100644
--- a/arch/arm/mach-s3c2412/Kconfig
+++ b/arch/arm/mach-s3c2412/Kconfig
@@ -34,6 +34,16 @@ config S3C2412_PM
34 34
35menu "S3C2412 Machines" 35menu "S3C2412 Machines"
36 36
37config MACH_JIVE
38 bool "Logitech Jive"
39 select CPU_S3C2412
40 help
41 Say Y here if you are using the Logitech Jive.
42
43config MACH_JIVE_SHOW_BOOTLOADER
44 bool "Allow access to bootloader partitions in MTD"
45 depends on MACH_JIVE && EXPERIMENTAL
46
37config MACH_SMDK2413 47config MACH_SMDK2413
38 bool "SMDK2413" 48 bool "SMDK2413"
39 select CPU_S3C2412 49 select CPU_S3C2412
diff --git a/arch/arm/mach-s3c2412/Makefile b/arch/arm/mach-s3c2412/Makefile
index 267f3348301e..20918d5dc6a9 100644
--- a/arch/arm/mach-s3c2412/Makefile
+++ b/arch/arm/mach-s3c2412/Makefile
@@ -18,5 +18,6 @@ obj-$(CONFIG_S3C2412_PM) += pm.o sleep.o
18 18
19# Machine support 19# Machine support
20 20
21obj-$(CONFIG_MACH_JIVE) += mach-jive.o
21obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o 22obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o
22obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o 23obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 2697a65ba727..1157b5a16263 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -631,6 +631,17 @@ static struct clk_init clks_src[] __initdata = {
631 .bit = S3C2412_CLKSRC_USBCLK_HCLK, 631 .bit = S3C2412_CLKSRC_USBCLK_HCLK,
632 .src_0 = &clk_usysclk, 632 .src_0 = &clk_usysclk,
633 .src_1 = &clk_h, 633 .src_1 = &clk_h,
634 /* here we assume OM[4] select xtal */
635 }, {
636 .clk = &clk_erefclk,
637 .bit = S3C2412_CLKSRC_EREFCLK_EXTCLK,
638 .src_0 = &clk_xtal,
639 .src_1 = &clk_ext,
640 }, {
641 .clk = &clk_urefclk,
642 .bit = S3C2412_CLKSRC_UREFCLK_EXTCLK,
643 .src_0 = &clk_xtal,
644 .src_1 = &clk_ext,
634 }, 645 },
635}; 646};
636 647
@@ -666,8 +677,6 @@ static void __init s3c2412_clk_initparents(void)
666static struct clk *clks[] __initdata = { 677static struct clk *clks[] __initdata = {
667 &clk_ext, 678 &clk_ext,
668 &clk_usb_bus, 679 &clk_usb_bus,
669 &clk_erefclk,
670 &clk_urefclk,
671 &clk_mrefclk, 680 &clk_mrefclk,
672 &clk_armclk, 681 &clk_armclk,
673}; 682};
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
new file mode 100644
index 000000000000..7f5924713485
--- /dev/null
+++ b/arch/arm/mach-s3c2412/mach-jive.c
@@ -0,0 +1,687 @@
1/* linux/arch/arm/mach-s3c2410/mach-jive.c
2 *
3 * Copyright 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * http://armlinux.simtec.co.uk/
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/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/list.h>
17#include <linux/timer.h>
18#include <linux/init.h>
19#include <linux/sysdev.h>
20#include <linux/delay.h>
21#include <linux/serial_core.h>
22#include <linux/platform_device.h>
23#include <linux/i2c.h>
24
25#include <video/ili9320.h>
26
27#include <linux/spi/spi.h>
28
29#include <linux/mtd/mtd.h>
30#include <linux/mtd/partitions.h>
31
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34#include <asm/mach/irq.h>
35
36#include <asm/plat-s3c/regs-serial.h>
37#include <asm/plat-s3c/nand.h>
38#include <asm/plat-s3c/iic.h>
39
40#include <asm/arch/regs-power.h>
41#include <asm/arch/regs-gpio.h>
42#include <asm/arch/regs-mem.h>
43#include <asm/arch/regs-lcd.h>
44#include <asm/arch/spi-gpio.h>
45#include <asm/arch/fb.h>
46
47#include <asm/mach-types.h>
48
49#include <linux/mtd/mtd.h>
50#include <linux/mtd/nand.h>
51#include <linux/mtd/nand_ecc.h>
52#include <linux/mtd/partitions.h>
53
54#include <asm/plat-s3c24xx/clock.h>
55#include <asm/plat-s3c24xx/devs.h>
56#include <asm/plat-s3c24xx/cpu.h>
57#include <asm/plat-s3c24xx/pm.h>
58#include <asm/plat-s3c24xx/udc.h>
59
60static struct map_desc jive_iodesc[] __initdata = {
61};
62
63#define UCON S3C2410_UCON_DEFAULT
64#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
65#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
66
67static struct s3c2410_uartcfg jive_uartcfgs[] = {
68 [0] = {
69 .hwport = 0,
70 .flags = 0,
71 .ucon = UCON,
72 .ulcon = ULCON,
73 .ufcon = UFCON,
74 },
75 [1] = {
76 .hwport = 1,
77 .flags = 0,
78 .ucon = UCON,
79 .ulcon = ULCON,
80 .ufcon = UFCON,
81 },
82 [2] = {
83 .hwport = 2,
84 .flags = 0,
85 .ucon = UCON,
86 .ulcon = ULCON,
87 .ufcon = UFCON,
88 }
89};
90
91/* Jive flash assignment
92 *
93 * 0x00000000-0x00028000 : uboot
94 * 0x00028000-0x0002c000 : uboot env
95 * 0x0002c000-0x00030000 : spare
96 * 0x00030000-0x00200000 : zimage A
97 * 0x00200000-0x01600000 : cramfs A
98 * 0x01600000-0x017d0000 : zimage B
99 * 0x017d0000-0x02bd0000 : cramfs B
100 * 0x02bd0000-0x03fd0000 : yaffs
101 */
102static struct mtd_partition jive_imageA_nand_part[] = {
103
104#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
105 /* Don't allow access to the bootloader from linux */
106 {
107 .name = "uboot",
108 .offset = 0,
109 .size = (160 * SZ_1K),
110 .mask_flags = MTD_WRITEABLE, /* force read-only */
111 },
112
113 /* spare */
114 {
115 .name = "spare",
116 .offset = (176 * SZ_1K),
117 .size = (16 * SZ_1K),
118 },
119#endif
120
121 /* booted images */
122 {
123 .name = "kernel (ro)",
124 .offset = (192 * SZ_1K),
125 .size = (SZ_2M) - (192 * SZ_1K),
126 .mask_flags = MTD_WRITEABLE, /* force read-only */
127 }, {
128 .name = "root (ro)",
129 .offset = (SZ_2M),
130 .size = (20 * SZ_1M),
131 .mask_flags = MTD_WRITEABLE, /* force read-only */
132 },
133
134 /* yaffs */
135 {
136 .name = "yaffs",
137 .offset = (44 * SZ_1M),
138 .size = (20 * SZ_1M),
139 },
140
141 /* bootloader environment */
142 {
143 .name = "env",
144 .offset = (160 * SZ_1K),
145 .size = (16 * SZ_1K),
146 },
147
148 /* upgrade images */
149 {
150 .name = "zimage",
151 .offset = (22 * SZ_1M),
152 .size = (2 * SZ_1M) - (192 * SZ_1K),
153 }, {
154 .name = "cramfs",
155 .offset = (24 * SZ_1M) - (192*SZ_1K),
156 .size = (20 * SZ_1M),
157 },
158};
159
160static struct mtd_partition jive_imageB_nand_part[] = {
161
162#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
163 /* Don't allow access to the bootloader from linux */
164 {
165 .name = "uboot",
166 .offset = 0,
167 .size = (160 * SZ_1K),
168 .mask_flags = MTD_WRITEABLE, /* force read-only */
169 },
170
171 /* spare */
172 {
173 .name = "spare",
174 .offset = (176 * SZ_1K),
175 .size = (16 * SZ_1K),
176 },
177#endif
178
179 /* booted images */
180 {
181 .name = "kernel (ro)",
182 .offset = (22 * SZ_1M),
183 .size = (2 * SZ_1M) - (192 * SZ_1K),
184 .mask_flags = MTD_WRITEABLE, /* force read-only */
185 },
186 {
187 .name = "root (ro)",
188 .offset = (24 * SZ_1M) - (192 * SZ_1K),
189 .size = (20 * SZ_1M),
190 .mask_flags = MTD_WRITEABLE, /* force read-only */
191 },
192
193 /* yaffs */
194 {
195 .name = "yaffs",
196 .offset = (44 * SZ_1M),
197 .size = (20 * SZ_1M),
198 },
199
200 /* bootloader environment */
201 {
202 .name = "env",
203 .offset = (160 * SZ_1K),
204 .size = (16 * SZ_1K),
205 },
206
207 /* upgrade images */
208 {
209 .name = "zimage",
210 .offset = (192 * SZ_1K),
211 .size = (2 * SZ_1M) - (192 * SZ_1K),
212 }, {
213 .name = "cramfs",
214 .offset = (2 * SZ_1M),
215 .size = (20 * SZ_1M),
216 },
217};
218
219static struct s3c2410_nand_set jive_nand_sets[] = {
220 [0] = {
221 .name = "flash",
222 .nr_chips = 1,
223 .nr_partitions = ARRAY_SIZE(jive_imageA_nand_part),
224 .partitions = jive_imageA_nand_part,
225 },
226};
227
228static struct s3c2410_platform_nand jive_nand_info = {
229 /* set taken from osiris nand timings, possibly still conservative */
230 .tacls = 30,
231 .twrph0 = 55,
232 .twrph1 = 40,
233 .sets = jive_nand_sets,
234 .nr_sets = ARRAY_SIZE(jive_nand_sets),
235};
236
237static int __init jive_mtdset(char *options)
238{
239 struct s3c2410_nand_set *nand = &jive_nand_sets[0];
240 unsigned long set;
241
242 if (options == NULL || options[0] == '\0')
243 return 0;
244
245 if (strict_strtoul(options, 10, &set)) {
246 printk(KERN_ERR "failed to parse mtdset=%s\n", options);
247 return 0;
248 }
249
250 switch (set) {
251 case 1:
252 nand->nr_partitions = ARRAY_SIZE(jive_imageB_nand_part);
253 nand->partitions = jive_imageB_nand_part;
254 case 0:
255 /* this is already setup in the nand info */
256 break;
257 default:
258 printk(KERN_ERR "Unknown mtd set %ld specified,"
259 "using default.", set);
260 }
261
262 return 0;
263}
264
265/* parse the mtdset= option given to the kernel command line */
266__setup("mtdset=", jive_mtdset);
267
268/* LCD timing and setup */
269
270#define LCD_XRES (240)
271#define LCD_YRES (320)
272#define LCD_LEFT_MARGIN (12)
273#define LCD_RIGHT_MARGIN (12)
274#define LCD_LOWER_MARGIN (12)
275#define LCD_UPPER_MARGIN (12)
276#define LCD_VSYNC (2)
277#define LCD_HSYNC (2)
278
279#define LCD_REFRESH (60)
280
281#define LCD_HTOT (LCD_HSYNC + LCD_LEFT_MARGIN + LCD_XRES + LCD_RIGHT_MARGIN)
282#define LCD_VTOT (LCD_VSYNC + LCD_LOWER_MARGIN + LCD_YRES + LCD_UPPER_MARGIN)
283
284struct s3c2410fb_display jive_vgg2432a4_display[] = {
285 [0] = {
286 .width = LCD_XRES,
287 .height = LCD_YRES,
288 .xres = LCD_XRES,
289 .yres = LCD_YRES,
290 .left_margin = LCD_LEFT_MARGIN,
291 .right_margin = LCD_RIGHT_MARGIN,
292 .upper_margin = LCD_UPPER_MARGIN,
293 .lower_margin = LCD_LOWER_MARGIN,
294 .hsync_len = LCD_HSYNC,
295 .vsync_len = LCD_VSYNC,
296
297 .pixclock = (1000000000000LL /
298 (LCD_REFRESH * LCD_HTOT * LCD_VTOT)),
299
300 .bpp = 16,
301 .type = (S3C2410_LCDCON1_TFT16BPP |
302 S3C2410_LCDCON1_TFT),
303
304 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
305 S3C2410_LCDCON5_INVVLINE |
306 S3C2410_LCDCON5_INVVFRAME |
307 S3C2410_LCDCON5_INVVDEN |
308 S3C2410_LCDCON5_PWREN),
309 },
310};
311
312/* todo - put into gpio header */
313
314#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
315#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
316
317struct s3c2410fb_mach_info jive_lcd_config = {
318 .displays = jive_vgg2432a4_display,
319 .num_displays = ARRAY_SIZE(jive_vgg2432a4_display),
320 .default_display = 0,
321
322 /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
323 * and disable the pull down resistors on pins we are using for LCD
324 * data. */
325
326 .gpcup = (0xf << 1) | (0x3f << 10),
327
328 .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE |
329 S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
330 S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 |
331 S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 |
332 S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7),
333
334 .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) |
335 S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) |
336 S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
337 S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
338 S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
339
340 .gpdup = (0x3f << 2) | (0x3f << 10),
341
342 .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 |
343 S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 |
344 S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 |
345 S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
346 S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
347 S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
348
349 .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) |
350 S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) |
351 S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) |
352 S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
353 S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
354 S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
355};
356
357/* ILI9320 support. */
358
359static void jive_lcm_reset(unsigned int set)
360{
361 printk(KERN_DEBUG "%s(%d)\n", __func__, set);
362
363 s3c2410_gpio_setpin(S3C2410_GPG13, set);
364 s3c2410_gpio_cfgpin(S3C2410_GPG13, S3C2410_GPIO_OUTPUT);
365}
366
367#undef LCD_UPPER_MARGIN
368#define LCD_UPPER_MARGIN 2
369
370static struct ili9320_platdata jive_lcm_config = {
371 .hsize = LCD_XRES,
372 .vsize = LCD_YRES,
373
374 .reset = jive_lcm_reset,
375 .suspend = ILI9320_SUSPEND_DEEP,
376
377 .entry_mode = ILI9320_ENTRYMODE_ID(3) | ILI9320_ENTRYMODE_BGR,
378 .display2 = (ILI9320_DISPLAY2_FP(LCD_UPPER_MARGIN) |
379 ILI9320_DISPLAY2_BP(LCD_LOWER_MARGIN)),
380 .display3 = 0x0,
381 .display4 = 0x0,
382 .rgb_if1 = (ILI9320_RGBIF1_RIM_RGB18 |
383 ILI9320_RGBIF1_RM | ILI9320_RGBIF1_CLK_RGBIF),
384 .rgb_if2 = ILI9320_RGBIF2_DPL,
385 .interface2 = 0x0,
386 .interface3 = 0x3,
387 .interface4 = (ILI9320_INTERFACE4_RTNE(16) |
388 ILI9320_INTERFACE4_DIVE(1)),
389 .interface5 = 0x0,
390 .interface6 = 0x0,
391};
392
393/* LCD SPI support */
394
395static void jive_lcd_spi_chipselect(struct s3c2410_spigpio_info *spi, int cs)
396{
397 s3c2410_gpio_setpin(S3C2410_GPB7, cs ? 0 : 1);
398}
399
400static struct s3c2410_spigpio_info jive_lcd_spi = {
401 .bus_num = 0,
402 .pin_clk = S3C2410_GPG8,
403 .pin_mosi = S3C2410_GPB8,
404 .chip_select = jive_lcd_spi_chipselect,
405};
406
407static struct platform_device jive_device_lcdspi = {
408 .name = "s3c24xx-spi-gpio",
409 .id = 1,
410 .num_resources = 0,
411 .dev.platform_data = &jive_lcd_spi,
412};
413
414/* WM8750 audio code SPI definition */
415
416static void jive_wm8750_chipselect(struct s3c2410_spigpio_info *spi, int cs)
417{
418 s3c2410_gpio_setpin(S3C2410_GPH10, cs ? 0 : 1);
419}
420
421static struct s3c2410_spigpio_info jive_wm8750_spi = {
422 .bus_num = 2,
423 .pin_clk = S3C2410_GPB4,
424 .pin_mosi = S3C2410_GPB9,
425 .chip_select = jive_wm8750_chipselect,
426};
427
428static struct platform_device jive_device_wm8750 = {
429 .name = "s3c24xx-spi-gpio",
430 .id = 2,
431 .num_resources = 0,
432 .dev.platform_data = &jive_wm8750_spi,
433};
434
435/* JIVE SPI devices. */
436
437static struct spi_board_info __initdata jive_spi_devs[] = {
438 [0] = {
439 .modalias = "VGG2432A4",
440 .bus_num = 1,
441 .chip_select = 0,
442 .mode = SPI_MODE_3, /* CPOL=1, CPHA=1 */
443 .max_speed_hz = 100000,
444 .platform_data = &jive_lcm_config,
445 }, {
446 .modalias = "WM8750",
447 .bus_num = 2,
448 .chip_select = 0,
449 .mode = SPI_MODE_0, /* CPOL=0, CPHA=0 */
450 .max_speed_hz = 100000,
451 },
452};
453
454/* I2C bus and device configuration. */
455
456static struct s3c2410_platform_i2c jive_i2c_cfg = {
457 .max_freq = 80 * 1000,
458 .bus_freq = 50 * 1000,
459 .flags = S3C_IICFLG_FILTER,
460 .sda_delay = 2,
461};
462
463static struct i2c_board_info jive_i2c_devs[] = {
464 [0] = {
465 I2C_BOARD_INFO("lis302dl", 0x1c),
466 .irq = IRQ_EINT14,
467 },
468};
469
470/* The platform devices being used. */
471
472static struct platform_device *jive_devices[] __initdata = {
473 &s3c_device_usb,
474 &s3c_device_rtc,
475 &s3c_device_wdt,
476 &s3c_device_i2c,
477 &s3c_device_lcd,
478 &jive_device_lcdspi,
479 &jive_device_wm8750,
480 &s3c_device_nand,
481 &s3c_device_usbgadget,
482};
483
484static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
485 .vbus_pin = S3C2410_GPG1, /* detect is on GPG1 */
486};
487
488/* Jive power management device */
489
490#ifdef CONFIG_PM
491static int jive_pm_suspend(struct sys_device *sd, pm_message_t state)
492{
493 /* Write the magic value u-boot uses to check for resume into
494 * the INFORM0 register, and ensure INFORM1 is set to the
495 * correct address to resume from. */
496
497 __raw_writel(0x2BED, S3C2412_INFORM0);
498 __raw_writel(virt_to_phys(s3c2410_cpu_resume), S3C2412_INFORM1);
499
500 return 0;
501}
502
503static int jive_pm_resume(struct sys_device *sd)
504{
505 __raw_writel(0x0, S3C2412_INFORM0);
506 return 0;
507}
508
509#else
510#define jive_pm_suspend NULL
511#define jive_pm_resume NULL
512#endif
513
514static struct sysdev_class jive_pm_sysclass = {
515 .name = "jive-pm",
516 .suspend = jive_pm_suspend,
517 .resume = jive_pm_resume,
518};
519
520static struct sys_device jive_pm_sysdev = {
521 .cls = &jive_pm_sysclass,
522};
523
524static void __init jive_map_io(void)
525{
526 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
527 s3c24xx_init_clocks(12000000);
528 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
529}
530
531static void jive_power_off(void)
532{
533 printk(KERN_INFO "powering system down...\n");
534
535 s3c2410_gpio_setpin(S3C2410_GPC5, 1);
536 s3c2410_gpio_cfgpin(S3C2410_GPC5, S3C2410_GPIO_OUTPUT);
537}
538
539static void __init jive_machine_init(void)
540{
541 /* register system devices for managing low level suspend */
542
543 sysdev_class_register(&jive_pm_sysclass);
544 sysdev_register(&jive_pm_sysdev);
545
546 /* write our sleep configurations for the IO. Pull down all unused
547 * IO, ensure that we have turned off all peripherals we do not
548 * need, and configure the ones we do need. */
549
550 /* Port B sleep */
551
552 __raw_writel(S3C2412_SLPCON_IN(0) |
553 S3C2412_SLPCON_PULL(1) |
554 S3C2412_SLPCON_HIGH(2) |
555 S3C2412_SLPCON_PULL(3) |
556 S3C2412_SLPCON_PULL(4) |
557 S3C2412_SLPCON_PULL(5) |
558 S3C2412_SLPCON_PULL(6) |
559 S3C2412_SLPCON_HIGH(7) |
560 S3C2412_SLPCON_PULL(8) |
561 S3C2412_SLPCON_PULL(9) |
562 S3C2412_SLPCON_PULL(10), S3C2412_GPBSLPCON);
563
564 /* Port C sleep */
565
566 __raw_writel(S3C2412_SLPCON_PULL(0) |
567 S3C2412_SLPCON_PULL(1) |
568 S3C2412_SLPCON_PULL(2) |
569 S3C2412_SLPCON_PULL(3) |
570 S3C2412_SLPCON_PULL(4) |
571 S3C2412_SLPCON_PULL(5) |
572 S3C2412_SLPCON_LOW(6) |
573 S3C2412_SLPCON_PULL(6) |
574 S3C2412_SLPCON_PULL(7) |
575 S3C2412_SLPCON_PULL(8) |
576 S3C2412_SLPCON_PULL(9) |
577 S3C2412_SLPCON_PULL(10) |
578 S3C2412_SLPCON_PULL(11) |
579 S3C2412_SLPCON_PULL(12) |
580 S3C2412_SLPCON_PULL(13) |
581 S3C2412_SLPCON_PULL(14) |
582 S3C2412_SLPCON_PULL(15), S3C2412_GPCSLPCON);
583
584 /* Port D sleep */
585
586 __raw_writel(S3C2412_SLPCON_ALL_PULL, S3C2412_GPDSLPCON);
587
588 /* Port F sleep */
589
590 __raw_writel(S3C2412_SLPCON_LOW(0) |
591 S3C2412_SLPCON_LOW(1) |
592 S3C2412_SLPCON_LOW(2) |
593 S3C2412_SLPCON_EINT(3) |
594 S3C2412_SLPCON_EINT(4) |
595 S3C2412_SLPCON_EINT(5) |
596 S3C2412_SLPCON_EINT(6) |
597 S3C2412_SLPCON_EINT(7), S3C2412_GPFSLPCON);
598
599 /* Port G sleep */
600
601 __raw_writel(S3C2412_SLPCON_IN(0) |
602 S3C2412_SLPCON_IN(1) |
603 S3C2412_SLPCON_IN(2) |
604 S3C2412_SLPCON_IN(3) |
605 S3C2412_SLPCON_IN(4) |
606 S3C2412_SLPCON_IN(5) |
607 S3C2412_SLPCON_IN(6) |
608 S3C2412_SLPCON_IN(7) |
609 S3C2412_SLPCON_PULL(8) |
610 S3C2412_SLPCON_PULL(9) |
611 S3C2412_SLPCON_IN(10) |
612 S3C2412_SLPCON_PULL(11) |
613 S3C2412_SLPCON_PULL(12) |
614 S3C2412_SLPCON_PULL(13) |
615 S3C2412_SLPCON_IN(14) |
616 S3C2412_SLPCON_PULL(15), S3C2412_GPGSLPCON);
617
618 /* Port H sleep */
619
620 __raw_writel(S3C2412_SLPCON_PULL(0) |
621 S3C2412_SLPCON_PULL(1) |
622 S3C2412_SLPCON_PULL(2) |
623 S3C2412_SLPCON_PULL(3) |
624 S3C2412_SLPCON_PULL(4) |
625 S3C2412_SLPCON_PULL(5) |
626 S3C2412_SLPCON_PULL(6) |
627 S3C2412_SLPCON_IN(7) |
628 S3C2412_SLPCON_IN(8) |
629 S3C2412_SLPCON_PULL(9) |
630 S3C2412_SLPCON_IN(10), S3C2412_GPHSLPCON);
631
632 /* initialise the power management now we've setup everything. */
633
634 s3c2410_pm_init();
635
636 s3c_device_nand.dev.platform_data = &jive_nand_info;
637
638 /* initialise the spi */
639
640 s3c2410_gpio_setpin(S3C2410_GPG13, 0);
641 s3c2410_gpio_cfgpin(S3C2410_GPG13, S3C2410_GPIO_OUTPUT);
642
643 s3c2410_gpio_setpin(S3C2410_GPB7, 1);
644 s3c2410_gpio_cfgpin(S3C2410_GPB7, S3C2410_GPIO_OUTPUT);
645
646 s3c2410_gpio_setpin(S3C2410_GPB6, 0);
647 s3c2410_gpio_cfgpin(S3C2410_GPB6, S3C2410_GPIO_OUTPUT);
648
649 s3c2410_gpio_setpin(S3C2410_GPG8, 1);
650 s3c2410_gpio_cfgpin(S3C2410_GPG8, S3C2410_GPIO_OUTPUT);
651
652 /* initialise the WM8750 spi */
653
654 s3c2410_gpio_setpin(S3C2410_GPH10, 1);
655 s3c2410_gpio_cfgpin(S3C2410_GPH10, S3C2410_GPIO_OUTPUT);
656
657 /* Turn off suspend on both USB ports, and switch the
658 * selectable USB port to USB device mode. */
659
660 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
661 S3C2410_MISCCR_USBSUSPND0 |
662 S3C2410_MISCCR_USBSUSPND1, 0x0);
663
664 s3c24xx_udc_set_platdata(&jive_udc_cfg);
665 s3c24xx_fb_set_platdata(&jive_lcd_config);
666
667 spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs));
668
669 s3c_device_i2c.dev.platform_data = &jive_i2c_cfg;
670 i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
671
672 pm_power_off = jive_power_off;
673
674 platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
675}
676
677MACHINE_START(JIVE, "JIVE")
678 /* Maintainer: Ben Dooks <ben@fluff.org> */
679 .phys_io = S3C2410_PA_UART,
680 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
681 .boot_params = S3C2410_SDRAM_PA + 0x100,
682
683 .init_irq = s3c24xx_init_irq,
684 .map_io = jive_map_io,
685 .init_machine = jive_machine_init,
686 .timer = &s3c24xx_timer,
687MACHINE_END
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index f1915bd61d15..25de042ab996 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -29,6 +29,7 @@ config MACH_ANUBIS
29 bool "Simtec Electronics ANUBIS" 29 bool "Simtec Electronics ANUBIS"
30 select CPU_S3C2440 30 select CPU_S3C2440
31 select PM_SIMTEC if PM 31 select PM_SIMTEC if PM
32 select HAVE_PATA_PLATFORM
32 help 33 help
33 Say Y here if you are using the Simtec Electronics ANUBIS 34 Say Y here if you are using the Simtec Electronics ANUBIS
34 development system 35 development system
@@ -67,6 +68,11 @@ config SMDK2440_CPU2440
67 default y if ARCH_S3C2440 68 default y if ARCH_S3C2440
68 select CPU_S3C2440 69 select CPU_S3C2440
69 70
71config MACH_AT2440EVB
72 bool "Avantech AT2440EVB development board"
73 select CPU_S3C2440
74 help
75 Say Y here if you are using the AT2440EVB development board
70 76
71endmenu 77endmenu
72 78
diff --git a/arch/arm/mach-s3c2440/Makefile b/arch/arm/mach-s3c2440/Makefile
index c81ed6248dcb..0b4440e79b90 100644
--- a/arch/arm/mach-s3c2440/Makefile
+++ b/arch/arm/mach-s3c2440/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_MACH_OSIRIS) += mach-osiris.o
21obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o 21obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o
22obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o 22obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
23obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o 23obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
24obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c2440/mach-anubis.c
index 47258915a2f9..09af8b23500b 100644
--- a/arch/arm/mach-s3c2440/mach-anubis.c
+++ b/arch/arm/mach-s3c2440/mach-anubis.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/mach-anubis.c 1/* linux/arch/arm/mach-s3c2440/mach-anubis.c
2 * 2 *
3 * Copyright (c) 2003-2005 Simtec Electronics 3 * Copyright (c) 2003-2005,2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
@@ -17,6 +17,8 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/ata_platform.h>
21#include <linux/i2c.h>
20 22
21#include <linux/sm501.h> 23#include <linux/sm501.h>
22#include <linux/sm501-regs.h> 24#include <linux/sm501-regs.h>
@@ -241,14 +243,18 @@ static struct s3c2410_platform_nand anubis_nand_info = {
241 243
242/* IDE channels */ 244/* IDE channels */
243 245
246struct pata_platform_info anubis_ide_platdata = {
247 .ioport_shift = 5,
248};
249
244static struct resource anubis_ide0_resource[] = { 250static struct resource anubis_ide0_resource[] = {
245 { 251 {
246 .start = S3C2410_CS3, 252 .start = S3C2410_CS3,
247 .end = S3C2410_CS3 + (8*32) - 1, 253 .end = S3C2410_CS3 + (8*32) - 1,
248 .flags = IORESOURCE_MEM, 254 .flags = IORESOURCE_MEM,
249 }, { 255 }, {
250 .start = S3C2410_CS3 + (1<<26), 256 .start = S3C2410_CS3 + (1<<26) + (6*32),
251 .end = S3C2410_CS3 + (1<<26) + (8*32) - 1, 257 .end = S3C2410_CS3 + (1<<26) + (7*32) - 1,
252 .flags = IORESOURCE_MEM, 258 .flags = IORESOURCE_MEM,
253 }, { 259 }, {
254 .start = IRQ_IDE0, 260 .start = IRQ_IDE0,
@@ -258,10 +264,14 @@ static struct resource anubis_ide0_resource[] = {
258}; 264};
259 265
260static struct platform_device anubis_device_ide0 = { 266static struct platform_device anubis_device_ide0 = {
261 .name = "simtec-ide", 267 .name = "pata_platform",
262 .id = 0, 268 .id = 0,
263 .num_resources = ARRAY_SIZE(anubis_ide0_resource), 269 .num_resources = ARRAY_SIZE(anubis_ide0_resource),
264 .resource = anubis_ide0_resource, 270 .resource = anubis_ide0_resource,
271 .dev = {
272 .platform_data = &anubis_ide_platdata,
273 .coherent_dma_mask = ~0,
274 },
265}; 275};
266 276
267static struct resource anubis_ide1_resource[] = { 277static struct resource anubis_ide1_resource[] = {
@@ -270,8 +280,8 @@ static struct resource anubis_ide1_resource[] = {
270 .end = S3C2410_CS4 + (8*32) - 1, 280 .end = S3C2410_CS4 + (8*32) - 1,
271 .flags = IORESOURCE_MEM, 281 .flags = IORESOURCE_MEM,
272 }, { 282 }, {
273 .start = S3C2410_CS4 + (1<<26), 283 .start = S3C2410_CS4 + (1<<26) + (6*32),
274 .end = S3C2410_CS4 + (1<<26) + (8*32) - 1, 284 .end = S3C2410_CS4 + (1<<26) + (7*32) - 1,
275 .flags = IORESOURCE_MEM, 285 .flags = IORESOURCE_MEM,
276 }, { 286 }, {
277 .start = IRQ_IDE0, 287 .start = IRQ_IDE0,
@@ -280,12 +290,15 @@ static struct resource anubis_ide1_resource[] = {
280 }, 290 },
281}; 291};
282 292
283
284static struct platform_device anubis_device_ide1 = { 293static struct platform_device anubis_device_ide1 = {
285 .name = "simtec-ide", 294 .name = "pata_platform",
286 .id = 1, 295 .id = 1,
287 .num_resources = ARRAY_SIZE(anubis_ide1_resource), 296 .num_resources = ARRAY_SIZE(anubis_ide1_resource),
288 .resource = anubis_ide1_resource, 297 .resource = anubis_ide1_resource,
298 .dev = {
299 .platform_data = &anubis_ide_platdata,
300 .coherent_dma_mask = ~0,
301 },
289}; 302};
290 303
291/* Asix AX88796 10/100 ethernet controller */ 304/* Asix AX88796 10/100 ethernet controller */
@@ -409,6 +422,15 @@ static struct clk *anubis_clocks[] = {
409 &s3c24xx_uclk, 422 &s3c24xx_uclk,
410}; 423};
411 424
425/* I2C devices. */
426
427static struct i2c_board_info anubis_i2c_devs[] __initdata = {
428 {
429 I2C_BOARD_INFO("tps65011", 0x48),
430 .irq = IRQ_EINT20,
431 }
432};
433
412static void __init anubis_map_io(void) 434static void __init anubis_map_io(void)
413{ 435{
414 /* initialise the clocks */ 436 /* initialise the clocks */
@@ -448,6 +470,9 @@ static void __init anubis_map_io(void)
448static void __init anubis_init(void) 470static void __init anubis_init(void)
449{ 471{
450 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); 472 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
473
474 i2c_register_board_info(0, anubis_i2c_devs,
475 ARRAY_SIZE(anubis_i2c_devs));
451} 476}
452 477
453 478
diff --git a/arch/arm/mach-s3c2440/mach-at2440evb.c b/arch/arm/mach-s3c2440/mach-at2440evb.c
new file mode 100644
index 000000000000..f5e3c7f27639
--- /dev/null
+++ b/arch/arm/mach-s3c2440/mach-at2440evb.c
@@ -0,0 +1,198 @@
1/* linux/arch/arm/mach-s3c2440/mach-at2440evb.c
2 *
3 * Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
4 * Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
5 * and modifications by SBZ <sbz@spgui.org> and
6 * Weibing <http://weibing.blogbus.com>
7 *
8 * For product information, visit http://www.arm9e.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 version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/list.h>
19#include <linux/timer.h>
20#include <linux/init.h>
21#include <linux/io.h>
22#include <linux/serial_core.h>
23#include <linux/dm9000.h>
24#include <linux/platform_device.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28#include <asm/mach/irq.h>
29
30#include <asm/hardware.h>
31#include <asm/irq.h>
32#include <asm/mach-types.h>
33
34#include <asm/plat-s3c/regs-serial.h>
35#include <asm/arch/regs-gpio.h>
36#include <asm/arch/regs-mem.h>
37#include <asm/arch/regs-lcd.h>
38#include <asm/plat-s3c/nand.h>
39
40#include <linux/mtd/mtd.h>
41#include <linux/mtd/nand.h>
42#include <linux/mtd/nand_ecc.h>
43#include <linux/mtd/partitions.h>
44
45#include <asm/plat-s3c24xx/clock.h>
46#include <asm/plat-s3c24xx/devs.h>
47#include <asm/plat-s3c24xx/cpu.h>
48
49static struct map_desc at2440evb_iodesc[] __initdata = {
50 /* Nothing here */
51};
52
53#define UCON S3C2410_UCON_DEFAULT
54#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
55#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
56
57static struct s3c24xx_uart_clksrc at2440evb_serial_clocks[] = {
58 [0] = {
59 .name = "uclk",
60 .divisor = 1,
61 .min_baud = 0,
62 .max_baud = 0,
63 },
64 [1] = {
65 .name = "pclk",
66 .divisor = 1,
67 .min_baud = 0,
68 .max_baud = 0,
69 }
70};
71
72
73static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = {
74 [0] = {
75 .hwport = 0,
76 .flags = 0,
77 .ucon = UCON,
78 .ulcon = ULCON,
79 .ufcon = UFCON,
80 .clocks = at2440evb_serial_clocks,
81 .clocks_size = ARRAY_SIZE(at2440evb_serial_clocks),
82 },
83 [1] = {
84 .hwport = 1,
85 .flags = 0,
86 .ucon = UCON,
87 .ulcon = ULCON,
88 .ufcon = UFCON,
89 .clocks = at2440evb_serial_clocks,
90 .clocks_size = ARRAY_SIZE(at2440evb_serial_clocks),
91 },
92};
93
94/* NAND Flash on AT2440EVB board */
95
96static struct mtd_partition at2440evb_default_nand_part[] = {
97 [0] = {
98 .name = "Boot Agent",
99 .size = SZ_256K,
100 .offset = 0,
101 },
102 [1] = {
103 .name = "Kernel",
104 .size = SZ_2M,
105 .offset = SZ_256K,
106 },
107 [2] = {
108 .name = "Root",
109 .offset = SZ_256K + SZ_2M,
110 .size = MTDPART_SIZ_FULL,
111 },
112};
113
114static struct s3c2410_nand_set at2440evb_nand_sets[] = {
115 [0] = {
116 .name = "nand",
117 .nr_chips = 1,
118 .nr_partitions = ARRAY_SIZE(at2440evb_default_nand_part),
119 .partitions = at2440evb_default_nand_part,
120 },
121};
122
123static struct s3c2410_platform_nand at2440evb_nand_info = {
124 .tacls = 25,
125 .twrph0 = 55,
126 .twrph1 = 40,
127 .nr_sets = ARRAY_SIZE(at2440evb_nand_sets),
128 .sets = at2440evb_nand_sets,
129};
130
131/* DM9000AEP 10/100 ethernet controller */
132
133static struct resource at2440evb_dm9k_resource[] = {
134 [0] = {
135 .start = S3C2410_CS3,
136 .end = S3C2410_CS3 + 3,
137 .flags = IORESOURCE_MEM
138 },
139 [1] = {
140 .start = S3C2410_CS3 + 4,
141 .end = S3C2410_CS3 + 7,
142 .flags = IORESOURCE_MEM
143 },
144 [2] = {
145 .start = IRQ_EINT7,
146 .end = IRQ_EINT7,
147 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
148 }
149};
150
151static struct dm9000_plat_data at2440evb_dm9k_pdata = {
152 .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
153};
154
155static struct platform_device at2440evb_device_eth = {
156 .name = "dm9000",
157 .id = -1,
158 .num_resources = ARRAY_SIZE(at2440evb_dm9k_resource),
159 .resource = at2440evb_dm9k_resource,
160 .dev = {
161 .platform_data = &at2440evb_dm9k_pdata,
162 },
163};
164
165static struct platform_device *at2440evb_devices[] __initdata = {
166 &s3c_device_usb,
167 &s3c_device_wdt,
168 &s3c_device_adc,
169 &s3c_device_i2c,
170 &s3c_device_rtc,
171 &s3c_device_nand,
172 &at2440evb_device_eth,
173};
174
175static void __init at2440evb_map_io(void)
176{
177 s3c_device_nand.dev.platform_data = &at2440evb_nand_info;
178
179 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
180 s3c24xx_init_clocks(16934400);
181 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
182}
183
184static void __init at2440evb_init(void)
185{
186 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
187}
188
189
190MACHINE_START(AT2440EVB, "AT2440EVB")
191 .phys_io = S3C2410_PA_UART,
192 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
193 .boot_params = S3C2410_SDRAM_PA + 0x100,
194 .map_io = at2440evb_map_io,
195 .init_machine = at2440evb_init,
196 .init_irq = s3c24xx_init_irq,
197 .timer = &s3c24xx_timer,
198MACHINE_END
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index 8a8acdbd072d..af996b0e91e8 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2440/mach-osiris.c 1/* linux/arch/arm/mach-s3c2440/mach-osiris.c
2 * 2 *
3 * Copyright (c) 2005 Simtec Electronics 3 * Copyright (c) 2005,2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
@@ -19,6 +19,7 @@
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/i2c.h>
22 23
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
@@ -322,6 +323,15 @@ static struct sys_device osiris_pm_sysdev = {
322 .cls = &osiris_pm_sysclass, 323 .cls = &osiris_pm_sysclass,
323}; 324};
324 325
326/* I2C devices fitted. */
327
328static struct i2c_board_info osiris_i2c_devs[] __initdata = {
329 {
330 I2C_BOARD_INFO("tps65011", 0x48),
331 .irq = IRQ_EINT20,
332 },
333};
334
325/* Standard Osiris devices */ 335/* Standard Osiris devices */
326 336
327static struct platform_device *osiris_devices[] __initdata = { 337static struct platform_device *osiris_devices[] __initdata = {
@@ -388,6 +398,9 @@ static void __init osiris_init(void)
388 sysdev_class_register(&osiris_pm_sysclass); 398 sysdev_class_register(&osiris_pm_sysclass);
389 sysdev_register(&osiris_pm_sysdev); 399 sysdev_register(&osiris_pm_sysdev);
390 400
401 i2c_register_board_info(0, osiris_i2c_devs,
402 ARRAY_SIZE(osiris_i2c_devs));
403
391 platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices)); 404 platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices));
392}; 405};
393 406
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index b42f956738d0..17f064fabdaf 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -81,7 +81,7 @@ static int s3c2443_clkcon_enable_p(struct clk *clk, int enable)
81 else 81 else
82 clkcon &= ~clocks; 82 clkcon &= ~clocks;
83 83
84 __raw_writel(clkcon, S3C2443_HCLKCON); 84 __raw_writel(clkcon, S3C2443_PCLKCON);
85 85
86 return 0; 86 return 0;
87} 87}
@@ -221,7 +221,6 @@ static struct clk clk_mdivclk = {
221 .get_rate = s3c2443_getrate_mdivclk, 221 .get_rate = s3c2443_getrate_mdivclk,
222}; 222};
223 223
224
225static int s3c2443_setparent_msysclk(struct clk *clk, struct clk *parent) 224static int s3c2443_setparent_msysclk(struct clk *clk, struct clk *parent)
226{ 225{
227 unsigned long clksrc = __raw_readl(S3C2443_CLKSRC); 226 unsigned long clksrc = __raw_readl(S3C2443_CLKSRC);
@@ -249,6 +248,46 @@ static struct clk clk_msysclk = {
249 .set_parent = s3c2443_setparent_msysclk, 248 .set_parent = s3c2443_setparent_msysclk,
250}; 249};
251 250
251/* armdiv
252 *
253 * this clock is sourced from msysclk and can have a number of
254 * divider values applied to it to then be fed into armclk.
255*/
256
257static struct clk clk_armdiv = {
258 .name = "armdiv",
259 .id = -1,
260 .parent = &clk_msysclk,
261};
262
263/* armclk
264 *
265 * this is the clock fed into the ARM core itself, either from
266 * armdiv or from hclk.
267 */
268
269static int s3c2443_setparent_armclk(struct clk *clk, struct clk *parent)
270{
271 unsigned long clkdiv0;
272
273 clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
274
275 if (parent == &clk_armdiv)
276 clkdiv0 &= ~S3C2443_CLKDIV0_DVS;
277 else if (parent == &clk_h)
278 clkdiv0 |= S3C2443_CLKDIV0_DVS;
279 else
280 return -EINVAL;
281
282 __raw_writel(clkdiv0, S3C2443_CLKDIV0);
283 return 0;
284}
285
286static struct clk clk_arm = {
287 .name = "armclk",
288 .id = -1,
289 .set_parent = s3c2443_setparent_armclk,
290};
252 291
253/* esysclk 292/* esysclk
254 * 293 *
@@ -639,6 +678,29 @@ static struct clk clk_display = {
639 .round_rate = s3c2443_roundrate_clksrc256, 678 .round_rate = s3c2443_roundrate_clksrc256,
640}; 679};
641 680
681/* prediv
682 *
683 * this divides the msysclk down to pass to h/p/etc.
684 */
685
686static unsigned long s3c2443_prediv_getrate(struct clk *clk)
687{
688 unsigned long rate = clk_get_rate(clk->parent);
689 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
690
691 clkdiv0 &= S3C2443_CLKDIV0_PREDIV_MASK;
692 clkdiv0 >>= S3C2443_CLKDIV0_PREDIV_SHIFT;
693
694 return rate / (clkdiv0 + 1);
695}
696
697static struct clk clk_prediv = {
698 .name = "prediv",
699 .id = -1,
700 .parent = &clk_msysclk,
701 .get_rate = s3c2443_prediv_getrate,
702};
703
642/* standard clock definitions */ 704/* standard clock definitions */
643 705
644static struct clk init_clocks_disable[] = { 706static struct clk init_clocks_disable[] = {
@@ -887,6 +949,15 @@ static void __init s3c2443_clk_initparents(void)
887 } 949 }
888 950
889 clk_init_set_parent(&clk_msysclk, parent); 951 clk_init_set_parent(&clk_msysclk, parent);
952
953 /* arm */
954
955 if (__raw_readl(S3C2443_CLKDIV0) & S3C2443_CLKDIV0_DVS)
956 parent = &clk_h;
957 else
958 parent = &clk_armdiv;
959
960 clk_init_set_parent(&clk_arm, parent);
890} 961}
891 962
892/* armdiv divisor table */ 963/* armdiv divisor table */
@@ -909,10 +980,9 @@ static inline unsigned int s3c2443_fclk_div(unsigned long clkcon0)
909 return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT]; 980 return armdiv[clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT];
910} 981}
911 982
912static inline unsigned long s3c2443_get_prediv(unsigned long clkcon0) 983static inline unsigned long s3c2443_get_hdiv(unsigned long clkcon0)
913{ 984{
914 clkcon0 &= S3C2443_CLKDIV0_PREDIV_MASK; 985 clkcon0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;
915 clkcon0 >>= S3C2443_CLKDIV0_PREDIV_SHIFT;
916 986
917 return clkcon0 + 1; 987 return clkcon0 + 1;
918} 988}
@@ -936,6 +1006,9 @@ static struct clk *clks[] __initdata = {
936 &clk_hsspi, 1006 &clk_hsspi,
937 &clk_hsmmc_div, 1007 &clk_hsmmc_div,
938 &clk_hsmmc, 1008 &clk_hsmmc,
1009 &clk_armdiv,
1010 &clk_arm,
1011 &clk_prediv,
939}; 1012};
940 1013
941void __init s3c2443_init_clocks(int xtal) 1014void __init s3c2443_init_clocks(int xtal)
@@ -951,10 +1024,16 @@ void __init s3c2443_init_clocks(int xtal)
951 int ret; 1024 int ret;
952 int ptr; 1025 int ptr;
953 1026
1027 /* s3c2443 parents h and p clocks from prediv */
1028 clk_h.parent = &clk_prediv;
1029 clk_p.parent = &clk_prediv;
1030
954 pll = s3c2443_get_mpll(mpllcon, xtal); 1031 pll = s3c2443_get_mpll(mpllcon, xtal);
1032 clk_msysclk.rate = pll;
955 1033
956 fclk = pll / s3c2443_fclk_div(clkdiv0); 1034 fclk = pll / s3c2443_fclk_div(clkdiv0);
957 hclk = fclk / s3c2443_get_prediv(clkdiv0); 1035 hclk = s3c2443_prediv_getrate(&clk_prediv);
1036 hclk = hclk / s3c2443_get_hdiv(clkdiv0);
958 hclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_HCLK) ? 2 : 1); 1037 hclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_HCLK) ? 2 : 1);
959 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); 1038 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);
960 1039
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 33ed048502a3..3a6c8ec34cd9 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -180,8 +180,21 @@ config CPU_ARM925T
180# ARM926T 180# ARM926T
181config CPU_ARM926T 181config CPU_ARM926T
182 bool "Support ARM926T processor" 182 bool "Support ARM926T processor"
183 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9 || ARCH_NS9XXX || ARCH_DAVINCI 183 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || \
184 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9 || ARCH_NS9XXX || ARCH_DAVINCI 184 MACH_VERSATILE_AB || ARCH_OMAP730 || \
185 ARCH_OMAP16XX || MACH_REALVIEW_EB || \
186 ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \
187 ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \
188 ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \
189 ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \
190 ARCH_NS9XXX || ARCH_DAVINCI
191 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || \
192 ARCH_OMAP730 || ARCH_OMAP16XX || \
193 ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \
194 ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \
195 ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \
196 ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \
197 ARCH_NS9XXX || ARCH_DAVINCI || ARCH_MX2
185 select CPU_32v5 198 select CPU_32v5
186 select CPU_ABRT_EV5TJ 199 select CPU_ABRT_EV5TJ
187 select CPU_PABRT_NOIFAR 200 select CPU_PABRT_NOIFAR
@@ -365,7 +378,7 @@ config CPU_XSC3
365# Feroceon 378# Feroceon
366config CPU_FEROCEON 379config CPU_FEROCEON
367 bool 380 bool
368 depends on ARCH_ORION5X 381 depends on ARCH_ORION5X || ARCH_LOKI || ARCH_KIRKWOOD || ARCH_MV78XX0
369 default y 382 default y
370 select CPU_32v5 383 select CPU_32v5
371 select CPU_ABRT_EV5T 384 select CPU_ABRT_EV5T
@@ -373,7 +386,7 @@ config CPU_FEROCEON
373 select CPU_CACHE_VIVT 386 select CPU_CACHE_VIVT
374 select CPU_CP15_MMU 387 select CPU_CP15_MMU
375 select CPU_COPY_FEROCEON if MMU 388 select CPU_COPY_FEROCEON if MMU
376 select CPU_TLB_V4WBI if MMU 389 select CPU_TLB_FEROCEON if MMU
377 390
378config CPU_FEROCEON_OLD_ID 391config CPU_FEROCEON_OLD_ID
379 bool "Accept early Feroceon cores with an ARM926 ID" 392 bool "Accept early Feroceon cores with an ARM926 ID"
@@ -551,6 +564,11 @@ config CPU_TLB_V4WBI
551 ARM Architecture Version 4 TLB with writeback cache and invalidate 564 ARM Architecture Version 4 TLB with writeback cache and invalidate
552 instruction cache entry. 565 instruction cache entry.
553 566
567config CPU_TLB_FEROCEON
568 bool
569 help
570 Feroceon TLB (v4wbi with non-outer-cachable page table walks).
571
554config CPU_TLB_V6 572config CPU_TLB_V6
555 bool 573 bool
556 574
@@ -709,6 +727,14 @@ config OUTER_CACHE
709 bool 727 bool
710 default n 728 default n
711 729
730config CACHE_FEROCEON_L2
731 bool "Enable the Feroceon L2 cache controller"
732 depends on ARCH_KIRKWOOD || ARCH_MV78XX0
733 default y
734 select OUTER_CACHE
735 help
736 This option enables the Feroceon L2 cache controller.
737
712config CACHE_L2X0 738config CACHE_L2X0
713 bool "Enable the L2x0 outer cache controller" 739 bool "Enable the L2x0 outer cache controller"
714 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 740 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 32b2d2d213a6..f64b92557b11 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_CPU_TLB_V3) += tlb-v3.o
46obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o 46obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o
47obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o 47obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o
48obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o 48obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o
49obj-$(CONFIG_CPU_TLB_FEROCEON) += tlb-v4wbi.o # reuse v4wbi TLB functions
49obj-$(CONFIG_CPU_TLB_V6) += tlb-v6.o 50obj-$(CONFIG_CPU_TLB_V6) += tlb-v6.o
50obj-$(CONFIG_CPU_TLB_V7) += tlb-v7.o 51obj-$(CONFIG_CPU_TLB_V7) += tlb-v7.o
51 52
@@ -73,4 +74,5 @@ obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o
73obj-$(CONFIG_CPU_V6) += proc-v6.o 74obj-$(CONFIG_CPU_V6) += proc-v6.o
74obj-$(CONFIG_CPU_V7) += proc-v7.o 75obj-$(CONFIG_CPU_V7) += proc-v7.o
75 76
77obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o
76obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 78obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
new file mode 100644
index 000000000000..20eec4ba173f
--- /dev/null
+++ b/arch/arm/mm/cache-feroceon-l2.c
@@ -0,0 +1,318 @@
1/*
2 * arch/arm/mm/cache-feroceon-l2.c - Feroceon L2 cache controller support
3 *
4 * Copyright (C) 2008 Marvell Semiconductor
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 *
10 * References:
11 * - Unified Layer 2 Cache for Feroceon CPU Cores,
12 * Document ID MV-S104858-00, Rev. A, October 23 2007.
13 */
14
15#include <linux/init.h>
16#include <asm/cacheflush.h>
17#include <asm/plat-orion/cache-feroceon-l2.h>
18
19
20/*
21 * Low-level cache maintenance operations.
22 *
23 * As well as the regular 'clean/invalidate/flush L2 cache line by
24 * MVA' instructions, the Feroceon L2 cache controller also features
25 * 'clean/invalidate L2 range by MVA' operations.
26 *
27 * Cache range operations are initiated by writing the start and
28 * end addresses to successive cp15 registers, and process every
29 * cache line whose first byte address lies in the inclusive range
30 * [start:end].
31 *
32 * The cache range operations stall the CPU pipeline until completion.
33 *
34 * The range operations require two successive cp15 writes, in
35 * between which we don't want to be preempted.
36 */
37static inline void l2_clean_pa(unsigned long addr)
38{
39 __asm__("mcr p15, 1, %0, c15, c9, 3" : : "r" (addr));
40}
41
42static inline void l2_clean_mva_range(unsigned long start, unsigned long end)
43{
44 unsigned long flags;
45
46 /*
47 * Make sure 'start' and 'end' reference the same page, as
48 * L2 is PIPT and range operations only do a TLB lookup on
49 * the start address.
50 */
51 BUG_ON((start ^ end) & ~(PAGE_SIZE - 1));
52
53 raw_local_irq_save(flags);
54 __asm__("mcr p15, 1, %0, c15, c9, 4" : : "r" (start));
55 __asm__("mcr p15, 1, %0, c15, c9, 5" : : "r" (end));
56 raw_local_irq_restore(flags);
57}
58
59static inline void l2_clean_pa_range(unsigned long start, unsigned long end)
60{
61 l2_clean_mva_range(__phys_to_virt(start), __phys_to_virt(end));
62}
63
64static inline void l2_clean_inv_pa(unsigned long addr)
65{
66 __asm__("mcr p15, 1, %0, c15, c10, 3" : : "r" (addr));
67}
68
69static inline void l2_inv_pa(unsigned long addr)
70{
71 __asm__("mcr p15, 1, %0, c15, c11, 3" : : "r" (addr));
72}
73
74static inline void l2_inv_mva_range(unsigned long start, unsigned long end)
75{
76 unsigned long flags;
77
78 /*
79 * Make sure 'start' and 'end' reference the same page, as
80 * L2 is PIPT and range operations only do a TLB lookup on
81 * the start address.
82 */
83 BUG_ON((start ^ end) & ~(PAGE_SIZE - 1));
84
85 raw_local_irq_save(flags);
86 __asm__("mcr p15, 1, %0, c15, c11, 4" : : "r" (start));
87 __asm__("mcr p15, 1, %0, c15, c11, 5" : : "r" (end));
88 raw_local_irq_restore(flags);
89}
90
91static inline void l2_inv_pa_range(unsigned long start, unsigned long end)
92{
93 l2_inv_mva_range(__phys_to_virt(start), __phys_to_virt(end));
94}
95
96
97/*
98 * Linux primitives.
99 *
100 * Note that the end addresses passed to Linux primitives are
101 * noninclusive, while the hardware cache range operations use
102 * inclusive start and end addresses.
103 */
104#define CACHE_LINE_SIZE 32
105#define MAX_RANGE_SIZE 1024
106
107static int l2_wt_override;
108
109static unsigned long calc_range_end(unsigned long start, unsigned long end)
110{
111 unsigned long range_end;
112
113 BUG_ON(start & (CACHE_LINE_SIZE - 1));
114 BUG_ON(end & (CACHE_LINE_SIZE - 1));
115
116 /*
117 * Try to process all cache lines between 'start' and 'end'.
118 */
119 range_end = end;
120
121 /*
122 * Limit the number of cache lines processed at once,
123 * since cache range operations stall the CPU pipeline
124 * until completion.
125 */
126 if (range_end > start + MAX_RANGE_SIZE)
127 range_end = start + MAX_RANGE_SIZE;
128
129 /*
130 * Cache range operations can't straddle a page boundary.
131 */
132 if (range_end > (start | (PAGE_SIZE - 1)) + 1)
133 range_end = (start | (PAGE_SIZE - 1)) + 1;
134
135 return range_end;
136}
137
138static void feroceon_l2_inv_range(unsigned long start, unsigned long end)
139{
140 /*
141 * Clean and invalidate partial first cache line.
142 */
143 if (start & (CACHE_LINE_SIZE - 1)) {
144 l2_clean_inv_pa(start & ~(CACHE_LINE_SIZE - 1));
145 start = (start | (CACHE_LINE_SIZE - 1)) + 1;
146 }
147
148 /*
149 * Clean and invalidate partial last cache line.
150 */
151 if (end & (CACHE_LINE_SIZE - 1)) {
152 l2_clean_inv_pa(end & ~(CACHE_LINE_SIZE - 1));
153 end &= ~(CACHE_LINE_SIZE - 1);
154 }
155
156 /*
157 * Invalidate all full cache lines between 'start' and 'end'.
158 */
159 while (start != end) {
160 unsigned long range_end = calc_range_end(start, end);
161 l2_inv_pa_range(start, range_end - CACHE_LINE_SIZE);
162 start = range_end;
163 }
164
165 dsb();
166}
167
168static void feroceon_l2_clean_range(unsigned long start, unsigned long end)
169{
170 /*
171 * If L2 is forced to WT, the L2 will always be clean and we
172 * don't need to do anything here.
173 */
174 if (!l2_wt_override) {
175 start &= ~(CACHE_LINE_SIZE - 1);
176 end = (end + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1);
177 while (start != end) {
178 unsigned long range_end = calc_range_end(start, end);
179 l2_clean_pa_range(start, range_end - CACHE_LINE_SIZE);
180 start = range_end;
181 }
182 }
183
184 dsb();
185}
186
187static void feroceon_l2_flush_range(unsigned long start, unsigned long end)
188{
189 start &= ~(CACHE_LINE_SIZE - 1);
190 end = (end + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1);
191 while (start != end) {
192 unsigned long range_end = calc_range_end(start, end);
193 if (!l2_wt_override)
194 l2_clean_pa_range(start, range_end - CACHE_LINE_SIZE);
195 l2_inv_pa_range(start, range_end - CACHE_LINE_SIZE);
196 start = range_end;
197 }
198
199 dsb();
200}
201
202
203/*
204 * Routines to disable and re-enable the D-cache and I-cache at run
205 * time. These are necessary because the L2 cache can only be enabled
206 * or disabled while the L1 Dcache and Icache are both disabled.
207 */
208static void __init invalidate_and_disable_dcache(void)
209{
210 u32 cr;
211
212 cr = get_cr();
213 if (cr & CR_C) {
214 unsigned long flags;
215
216 raw_local_irq_save(flags);
217 flush_cache_all();
218 set_cr(cr & ~CR_C);
219 raw_local_irq_restore(flags);
220 }
221}
222
223static void __init enable_dcache(void)
224{
225 u32 cr;
226
227 cr = get_cr();
228 if (!(cr & CR_C))
229 set_cr(cr | CR_C);
230}
231
232static void __init __invalidate_icache(void)
233{
234 int dummy;
235
236 __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0\n" : "=r" (dummy));
237}
238
239static void __init invalidate_and_disable_icache(void)
240{
241 u32 cr;
242
243 cr = get_cr();
244 if (cr & CR_I) {
245 set_cr(cr & ~CR_I);
246 __invalidate_icache();
247 }
248}
249
250static void __init enable_icache(void)
251{
252 u32 cr;
253
254 cr = get_cr();
255 if (!(cr & CR_I))
256 set_cr(cr | CR_I);
257}
258
259static inline u32 read_extra_features(void)
260{
261 u32 u;
262
263 __asm__("mrc p15, 1, %0, c15, c1, 0" : "=r" (u));
264
265 return u;
266}
267
268static inline void write_extra_features(u32 u)
269{
270 __asm__("mcr p15, 1, %0, c15, c1, 0" : : "r" (u));
271}
272
273static void __init disable_l2_prefetch(void)
274{
275 u32 u;
276
277 /*
278 * Read the CPU Extra Features register and verify that the
279 * Disable L2 Prefetch bit is set.
280 */
281 u = read_extra_features();
282 if (!(u & 0x01000000)) {
283 printk(KERN_INFO "Feroceon L2: Disabling L2 prefetch.\n");
284 write_extra_features(u | 0x01000000);
285 }
286}
287
288static void __init enable_l2(void)
289{
290 u32 u;
291
292 u = read_extra_features();
293 if (!(u & 0x00400000)) {
294 printk(KERN_INFO "Feroceon L2: Enabling L2\n");
295
296 invalidate_and_disable_dcache();
297 invalidate_and_disable_icache();
298 write_extra_features(u | 0x00400000);
299 enable_icache();
300 enable_dcache();
301 }
302}
303
304void __init feroceon_l2_init(int __l2_wt_override)
305{
306 l2_wt_override = __l2_wt_override;
307
308 disable_l2_prefetch();
309
310 outer_cache.inv_range = feroceon_l2_inv_range;
311 outer_cache.clean_range = feroceon_l2_clean_range;
312 outer_cache.flush_range = feroceon_l2_flush_range;
313
314 enable_l2();
315
316 printk(KERN_INFO "Feroceon L2: Cache support initialised%s.\n",
317 l2_wt_override ? ", in WT override mode" : "");
318}
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index 44558d5f9313..fbfa26058442 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -144,13 +144,17 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
144 page = pfn_to_page(pfn); 144 page = pfn_to_page(pfn);
145 mapping = page_mapping(page); 145 mapping = page_mapping(page);
146 if (mapping) { 146 if (mapping) {
147#ifndef CONFIG_SMP
147 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); 148 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
148 149
149 if (dirty) 150 if (dirty)
150 __flush_dcache_page(mapping, page); 151 __flush_dcache_page(mapping, page);
152#endif
151 153
152 if (cache_is_vivt()) 154 if (cache_is_vivt())
153 make_coherent(mapping, vma, addr, pfn); 155 make_coherent(mapping, vma, addr, pfn);
156 else if (vma->vm_flags & VM_EXEC)
157 __flush_icache_all();
154 } 158 }
155} 159}
156 160
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 9df507d36e0b..029ee65fda2b 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -199,6 +199,8 @@ void flush_dcache_page(struct page *page)
199 __flush_dcache_page(mapping, page); 199 __flush_dcache_page(mapping, page);
200 if (mapping && cache_is_vivt()) 200 if (mapping && cache_is_vivt())
201 __flush_dcache_aliases(mapping, page); 201 __flush_dcache_aliases(mapping, page);
202 else if (mapping)
203 __flush_icache_all();
202 } 204 }
203} 205}
204EXPORT_SYMBOL(flush_dcache_page); 206EXPORT_SYMBOL(flush_dcache_page);
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index a02c1712b52d..f2e5884c513a 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -44,11 +44,31 @@
44 */ 44 */
45#define CACHE_DLINESIZE 32 45#define CACHE_DLINESIZE 32
46 46
47 .bss
48 .align 3
49__cache_params_loc:
50 .space 8
51
47 .text 52 .text
53__cache_params:
54 .word __cache_params_loc
55
48/* 56/*
49 * cpu_feroceon_proc_init() 57 * cpu_feroceon_proc_init()
50 */ 58 */
51ENTRY(cpu_feroceon_proc_init) 59ENTRY(cpu_feroceon_proc_init)
60 mrc p15, 0, r0, c0, c0, 1 @ read cache type register
61 ldr r1, __cache_params
62 mov r2, #(16 << 5)
63 tst r0, #(1 << 16) @ get way
64 mov r0, r0, lsr #18 @ get cache size order
65 movne r3, #((4 - 1) << 30) @ 4-way
66 and r0, r0, #0xf
67 moveq r3, #0 @ 1-way
68 mov r2, r2, lsl r0 @ actual cache size
69 movne r2, r2, lsr #2 @ turned into # of sets
70 sub r2, r2, #(1 << 5)
71 stmia r1, {r2, r3}
52 mov pc, lr 72 mov pc, lr
53 73
54/* 74/*
@@ -59,6 +79,13 @@ ENTRY(cpu_feroceon_proc_fin)
59 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE 79 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
60 msr cpsr_c, ip 80 msr cpsr_c, ip
61 bl feroceon_flush_kern_cache_all 81 bl feroceon_flush_kern_cache_all
82
83#if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH)
84 mov r0, #0
85 mcr p15, 1, r0, c15, c9, 0 @ clean L2
86 mcr p15, 0, r0, c7, c10, 4 @ drain WB
87#endif
88
62 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 89 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
63 bic r0, r0, #0x1000 @ ...i............ 90 bic r0, r0, #0x1000 @ ...i............
64 bic r0, r0, #0x000e @ ............wca. 91 bic r0, r0, #0x000e @ ............wca.
@@ -117,11 +144,19 @@ ENTRY(feroceon_flush_user_cache_all)
117 */ 144 */
118ENTRY(feroceon_flush_kern_cache_all) 145ENTRY(feroceon_flush_kern_cache_all)
119 mov r2, #VM_EXEC 146 mov r2, #VM_EXEC
120 mov ip, #0 147
121__flush_whole_cache: 148__flush_whole_cache:
1221: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate 149 ldr r1, __cache_params
123 bne 1b 150 ldmia r1, {r1, r3}
1511: orr ip, r1, r3
1522: mcr p15, 0, ip, c7, c14, 2 @ clean + invalidate D set/way
153 subs ip, ip, #(1 << 30) @ next way
154 bcs 2b
155 subs r1, r1, #(1 << 5) @ next set
156 bcs 1b
157
124 tst r2, #VM_EXEC 158 tst r2, #VM_EXEC
159 mov ip, #0
125 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache 160 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
126 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 161 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
127 mov pc, lr 162 mov pc, lr
@@ -138,7 +173,6 @@ __flush_whole_cache:
138 */ 173 */
139 .align 5 174 .align 5
140ENTRY(feroceon_flush_user_cache_range) 175ENTRY(feroceon_flush_user_cache_range)
141 mov ip, #0
142 sub r3, r1, r0 @ calculate total size 176 sub r3, r1, r0 @ calculate total size
143 cmp r3, #CACHE_DLIMIT 177 cmp r3, #CACHE_DLIMIT
144 bgt __flush_whole_cache 178 bgt __flush_whole_cache
@@ -152,6 +186,7 @@ ENTRY(feroceon_flush_user_cache_range)
152 cmp r0, r1 186 cmp r0, r1
153 blo 1b 187 blo 1b
154 tst r2, #VM_EXEC 188 tst r2, #VM_EXEC
189 mov ip, #0
155 mcrne p15, 0, ip, c7, c10, 4 @ drain WB 190 mcrne p15, 0, ip, c7, c10, 4 @ drain WB
156 mov pc, lr 191 mov pc, lr
157 192
@@ -209,6 +244,20 @@ ENTRY(feroceon_flush_kern_dcache_page)
209 mcr p15, 0, r0, c7, c10, 4 @ drain WB 244 mcr p15, 0, r0, c7, c10, 4 @ drain WB
210 mov pc, lr 245 mov pc, lr
211 246
247 .align 5
248ENTRY(feroceon_range_flush_kern_dcache_page)
249 mrs r2, cpsr
250 add r1, r0, #PAGE_SZ - CACHE_DLINESIZE @ top addr is inclusive
251 orr r3, r2, #PSR_I_BIT
252 msr cpsr_c, r3 @ disable interrupts
253 mcr p15, 5, r0, c15, c15, 0 @ D clean/inv range start
254 mcr p15, 5, r1, c15, c15, 1 @ D clean/inv range top
255 msr cpsr_c, r2 @ restore interrupts
256 mov r0, #0
257 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
258 mcr p15, 0, r0, c7, c10, 4 @ drain WB
259 mov pc, lr
260
212/* 261/*
213 * dma_inv_range(start, end) 262 * dma_inv_range(start, end)
214 * 263 *
@@ -225,10 +274,10 @@ ENTRY(feroceon_flush_kern_dcache_page)
225 .align 5 274 .align 5
226ENTRY(feroceon_dma_inv_range) 275ENTRY(feroceon_dma_inv_range)
227 tst r0, #CACHE_DLINESIZE - 1 276 tst r0, #CACHE_DLINESIZE - 1
277 bic r0, r0, #CACHE_DLINESIZE - 1
228 mcrne p15, 0, r0, c7, c10, 1 @ clean D entry 278 mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
229 tst r1, #CACHE_DLINESIZE - 1 279 tst r1, #CACHE_DLINESIZE - 1
230 mcrne p15, 0, r1, c7, c10, 1 @ clean D entry 280 mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
231 bic r0, r0, #CACHE_DLINESIZE - 1
2321: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry 2811: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
233 add r0, r0, #CACHE_DLINESIZE 282 add r0, r0, #CACHE_DLINESIZE
234 cmp r0, r1 283 cmp r0, r1
@@ -236,6 +285,22 @@ ENTRY(feroceon_dma_inv_range)
236 mcr p15, 0, r0, c7, c10, 4 @ drain WB 285 mcr p15, 0, r0, c7, c10, 4 @ drain WB
237 mov pc, lr 286 mov pc, lr
238 287
288 .align 5
289ENTRY(feroceon_range_dma_inv_range)
290 mrs r2, cpsr
291 tst r0, #CACHE_DLINESIZE - 1
292 mcrne p15, 0, r0, c7, c10, 1 @ clean D entry
293 tst r1, #CACHE_DLINESIZE - 1
294 mcrne p15, 0, r1, c7, c10, 1 @ clean D entry
295 cmp r1, r0
296 subne r1, r1, #1 @ top address is inclusive
297 orr r3, r2, #PSR_I_BIT
298 msr cpsr_c, r3 @ disable interrupts
299 mcr p15, 5, r0, c15, c14, 0 @ D inv range start
300 mcr p15, 5, r1, c15, c14, 1 @ D inv range top
301 msr cpsr_c, r2 @ restore interrupts
302 mov pc, lr
303
239/* 304/*
240 * dma_clean_range(start, end) 305 * dma_clean_range(start, end)
241 * 306 *
@@ -256,6 +321,19 @@ ENTRY(feroceon_dma_clean_range)
256 mcr p15, 0, r0, c7, c10, 4 @ drain WB 321 mcr p15, 0, r0, c7, c10, 4 @ drain WB
257 mov pc, lr 322 mov pc, lr
258 323
324 .align 5
325ENTRY(feroceon_range_dma_clean_range)
326 mrs r2, cpsr
327 cmp r1, r0
328 subne r1, r1, #1 @ top address is inclusive
329 orr r3, r2, #PSR_I_BIT
330 msr cpsr_c, r3 @ disable interrupts
331 mcr p15, 5, r0, c15, c13, 0 @ D clean range start
332 mcr p15, 5, r1, c15, c13, 1 @ D clean range top
333 msr cpsr_c, r2 @ restore interrupts
334 mcr p15, 0, r0, c7, c10, 4 @ drain WB
335 mov pc, lr
336
259/* 337/*
260 * dma_flush_range(start, end) 338 * dma_flush_range(start, end)
261 * 339 *
@@ -274,6 +352,19 @@ ENTRY(feroceon_dma_flush_range)
274 mcr p15, 0, r0, c7, c10, 4 @ drain WB 352 mcr p15, 0, r0, c7, c10, 4 @ drain WB
275 mov pc, lr 353 mov pc, lr
276 354
355 .align 5
356ENTRY(feroceon_range_dma_flush_range)
357 mrs r2, cpsr
358 cmp r1, r0
359 subne r1, r1, #1 @ top address is inclusive
360 orr r3, r2, #PSR_I_BIT
361 msr cpsr_c, r3 @ disable interrupts
362 mcr p15, 5, r0, c15, c15, 0 @ D clean/inv range start
363 mcr p15, 5, r1, c15, c15, 1 @ D clean/inv range top
364 msr cpsr_c, r2 @ restore interrupts
365 mcr p15, 0, r0, c7, c10, 4 @ drain WB
366 mov pc, lr
367
277ENTRY(feroceon_cache_fns) 368ENTRY(feroceon_cache_fns)
278 .long feroceon_flush_kern_cache_all 369 .long feroceon_flush_kern_cache_all
279 .long feroceon_flush_user_cache_all 370 .long feroceon_flush_user_cache_all
@@ -285,12 +376,33 @@ ENTRY(feroceon_cache_fns)
285 .long feroceon_dma_clean_range 376 .long feroceon_dma_clean_range
286 .long feroceon_dma_flush_range 377 .long feroceon_dma_flush_range
287 378
379ENTRY(feroceon_range_cache_fns)
380 .long feroceon_flush_kern_cache_all
381 .long feroceon_flush_user_cache_all
382 .long feroceon_flush_user_cache_range
383 .long feroceon_coherent_kern_range
384 .long feroceon_coherent_user_range
385 .long feroceon_range_flush_kern_dcache_page
386 .long feroceon_range_dma_inv_range
387 .long feroceon_range_dma_clean_range
388 .long feroceon_range_dma_flush_range
389
288 .align 5 390 .align 5
289ENTRY(cpu_feroceon_dcache_clean_area) 391ENTRY(cpu_feroceon_dcache_clean_area)
392#if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH)
393 mov r2, r0
394 mov r3, r1
395#endif
2901: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 3961: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
291 add r0, r0, #CACHE_DLINESIZE 397 add r0, r0, #CACHE_DLINESIZE
292 subs r1, r1, #CACHE_DLINESIZE 398 subs r1, r1, #CACHE_DLINESIZE
293 bhi 1b 399 bhi 1b
400#if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH)
4011: mcr p15, 1, r2, c15, c9, 1 @ clean L2 entry
402 add r2, r2, #CACHE_DLINESIZE
403 subs r3, r3, #CACHE_DLINESIZE
404 bhi 1b
405#endif
294 mcr p15, 0, r0, c7, c10, 4 @ drain WB 406 mcr p15, 0, r0, c7, c10, 4 @ drain WB
295 mov pc, lr 407 mov pc, lr
296 408
@@ -306,16 +418,25 @@ ENTRY(cpu_feroceon_dcache_clean_area)
306 .align 5 418 .align 5
307ENTRY(cpu_feroceon_switch_mm) 419ENTRY(cpu_feroceon_switch_mm)
308#ifdef CONFIG_MMU 420#ifdef CONFIG_MMU
309 mov ip, #0 421 /*
310@ && 'Clean & Invalidate whole DCache' 422 * Note: we wish to call __flush_whole_cache but we need to preserve
3111: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate 423 * lr to do so. The only way without touching main memory is to
312 bne 1b 424 * use r2 which is normally used to test the VM_EXEC flag, and
313 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 425 * compensate locally for the skipped ops if it is not set.
314 mcr p15, 0, ip, c7, c10, 4 @ drain WB 426 */
427 mov r2, lr @ abuse r2 to preserve lr
428 bl __flush_whole_cache
429 @ if r2 contains the VM_EXEC bit then the next 2 ops are done already
430 tst r2, #VM_EXEC
431 mcreq p15, 0, ip, c7, c5, 0 @ invalidate I cache
432 mcreq p15, 0, ip, c7, c10, 4 @ drain WB
433
315 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 434 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
316 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 435 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
317#endif 436 mov pc, r2
437#else
318 mov pc, lr 438 mov pc, lr
439#endif
319 440
320/* 441/*
321 * cpu_feroceon_set_pte_ext(ptep, pte, ext) 442 * cpu_feroceon_set_pte_ext(ptep, pte, ext)
@@ -345,6 +466,9 @@ ENTRY(cpu_feroceon_set_pte_ext)
345 str r2, [r0] @ hardware version 466 str r2, [r0] @ hardware version
346 mov r0, r0 467 mov r0, r0
347 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 468 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
469#if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH)
470 mcr p15, 1, r0, c15, c9, 1 @ clean L2 entry
471#endif
348 mcr p15, 0, r0, c7, c10, 4 @ drain WB 472 mcr p15, 0, r0, c7, c10, 4 @ drain WB
349#endif 473#endif
350 mov pc, lr 474 mov pc, lr
@@ -369,14 +493,15 @@ __feroceon_setup:
369 .size __feroceon_setup, . - __feroceon_setup 493 .size __feroceon_setup, . - __feroceon_setup
370 494
371 /* 495 /*
372 * R 496 * B
373 * .RVI ZFRS BLDP WCAM 497 * R P
374 * .011 0001 ..11 0101 498 * .RVI UFRS BLDP WCAM
499 * .011 .001 ..11 0101
375 * 500 *
376 */ 501 */
377 .type feroceon_crval, #object 502 .type feroceon_crval, #object
378feroceon_crval: 503feroceon_crval:
379 crval clear=0x00007f3f, mmuset=0x00003135, ucset=0x00001134 504 crval clear=0x0000773f, mmuset=0x00003135, ucset=0x00001134
380 505
381 __INITDATA 506 __INITDATA
382 507
@@ -414,6 +539,21 @@ cpu_feroceon_name:
414 .asciz "Feroceon" 539 .asciz "Feroceon"
415 .size cpu_feroceon_name, . - cpu_feroceon_name 540 .size cpu_feroceon_name, . - cpu_feroceon_name
416 541
542 .type cpu_88fr531_name, #object
543cpu_88fr531_name:
544 .asciz "Feroceon 88FR531-vd"
545 .size cpu_88fr531_name, . - cpu_88fr531_name
546
547 .type cpu_88fr571_name, #object
548cpu_88fr571_name:
549 .asciz "Feroceon 88FR571-vd"
550 .size cpu_88fr571_name, . - cpu_88fr571_name
551
552 .type cpu_88fr131_name, #object
553cpu_88fr131_name:
554 .asciz "Feroceon 88FR131"
555 .size cpu_88fr131_name, . - cpu_88fr131_name
556
417 .align 557 .align
418 558
419 .section ".proc.info.init", #alloc, #execinstr 559 .section ".proc.info.init", #alloc, #execinstr
@@ -421,15 +561,15 @@ cpu_feroceon_name:
421#ifdef CONFIG_CPU_FEROCEON_OLD_ID 561#ifdef CONFIG_CPU_FEROCEON_OLD_ID
422 .type __feroceon_old_id_proc_info,#object 562 .type __feroceon_old_id_proc_info,#object
423__feroceon_old_id_proc_info: 563__feroceon_old_id_proc_info:
424 .long 0x41069260 564 .long 0x41009260
425 .long 0xfffffff0 565 .long 0xff00fff0
426 .long PMD_TYPE_SECT | \ 566 .long PMD_TYPE_SECT | \
427 PMD_SECT_BUFFERABLE | \ 567 PMD_SECT_BUFFERABLE | \
428 PMD_SECT_CACHEABLE | \ 568 PMD_SECT_CACHEABLE | \
429 PMD_BIT4 | \ 569 PMD_BIT4 | \
430 PMD_SECT_AP_WRITE | \ 570 PMD_SECT_AP_WRITE | \
431 PMD_SECT_AP_READ 571 PMD_SECT_AP_READ
432 .long PMD_TYPE_SECT | \ 572 .long PMD_TYPE_SECT | \
433 PMD_BIT4 | \ 573 PMD_BIT4 | \
434 PMD_SECT_AP_WRITE | \ 574 PMD_SECT_AP_WRITE | \
435 PMD_SECT_AP_READ 575 PMD_SECT_AP_READ
@@ -445,17 +585,17 @@ __feroceon_old_id_proc_info:
445 .size __feroceon_old_id_proc_info, . - __feroceon_old_id_proc_info 585 .size __feroceon_old_id_proc_info, . - __feroceon_old_id_proc_info
446#endif 586#endif
447 587
448 .type __feroceon_proc_info,#object 588 .type __88fr531_proc_info,#object
449__feroceon_proc_info: 589__88fr531_proc_info:
450 .long 0x56055310 590 .long 0x56055310
451 .long 0xfffffff0 591 .long 0xfffffff0
452 .long PMD_TYPE_SECT | \ 592 .long PMD_TYPE_SECT | \
453 PMD_SECT_BUFFERABLE | \ 593 PMD_SECT_BUFFERABLE | \
454 PMD_SECT_CACHEABLE | \ 594 PMD_SECT_CACHEABLE | \
455 PMD_BIT4 | \ 595 PMD_BIT4 | \
456 PMD_SECT_AP_WRITE | \ 596 PMD_SECT_AP_WRITE | \
457 PMD_SECT_AP_READ 597 PMD_SECT_AP_READ
458 .long PMD_TYPE_SECT | \ 598 .long PMD_TYPE_SECT | \
459 PMD_BIT4 | \ 599 PMD_BIT4 | \
460 PMD_SECT_AP_WRITE | \ 600 PMD_SECT_AP_WRITE | \
461 PMD_SECT_AP_READ 601 PMD_SECT_AP_READ
@@ -463,9 +603,59 @@ __feroceon_proc_info:
463 .long cpu_arch_name 603 .long cpu_arch_name
464 .long cpu_elf_name 604 .long cpu_elf_name
465 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP 605 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
466 .long cpu_feroceon_name 606 .long cpu_88fr531_name
467 .long feroceon_processor_functions 607 .long feroceon_processor_functions
468 .long v4wbi_tlb_fns 608 .long v4wbi_tlb_fns
469 .long feroceon_user_fns 609 .long feroceon_user_fns
470 .long feroceon_cache_fns 610 .long feroceon_cache_fns
471 .size __feroceon_proc_info, . - __feroceon_proc_info 611 .size __88fr531_proc_info, . - __88fr531_proc_info
612
613 .type __88fr571_proc_info,#object
614__88fr571_proc_info:
615 .long 0x56155710
616 .long 0xfffffff0
617 .long PMD_TYPE_SECT | \
618 PMD_SECT_BUFFERABLE | \
619 PMD_SECT_CACHEABLE | \
620 PMD_BIT4 | \
621 PMD_SECT_AP_WRITE | \
622 PMD_SECT_AP_READ
623 .long PMD_TYPE_SECT | \
624 PMD_BIT4 | \
625 PMD_SECT_AP_WRITE | \
626 PMD_SECT_AP_READ
627 b __feroceon_setup
628 .long cpu_arch_name
629 .long cpu_elf_name
630 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
631 .long cpu_88fr571_name
632 .long feroceon_processor_functions
633 .long v4wbi_tlb_fns
634 .long feroceon_user_fns
635 .long feroceon_range_cache_fns
636 .size __88fr571_proc_info, . - __88fr571_proc_info
637
638 .type __88fr131_proc_info,#object
639__88fr131_proc_info:
640 .long 0x56251310
641 .long 0xfffffff0
642 .long PMD_TYPE_SECT | \
643 PMD_SECT_BUFFERABLE | \
644 PMD_SECT_CACHEABLE | \
645 PMD_BIT4 | \
646 PMD_SECT_AP_WRITE | \
647 PMD_SECT_AP_READ
648 .long PMD_TYPE_SECT | \
649 PMD_BIT4 | \
650 PMD_SECT_AP_WRITE | \
651 PMD_SECT_AP_READ
652 b __feroceon_setup
653 .long cpu_arch_name
654 .long cpu_elf_name
655 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
656 .long cpu_88fr131_name
657 .long feroceon_processor_functions
658 .long v4wbi_tlb_fns
659 .long feroceon_user_fns
660 .long feroceon_range_cache_fns
661 .size __88fr131_proc_info, . - __88fr131_proc_info
diff --git a/arch/arm/plat-iop/gpio.c b/arch/arm/plat-iop/gpio.c
index eda436083417..640e498c12ef 100644
--- a/arch/arm/plat-iop/gpio.c
+++ b/arch/arm/plat-iop/gpio.c
@@ -11,6 +11,10 @@
11 */ 11 */
12 12
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/init.h>
15#include <linux/types.h>
16#include <linux/errno.h>
17#include <linux/gpio.h>
14#include <asm/hardware/iop3xx.h> 18#include <asm/hardware/iop3xx.h>
15 19
16void gpio_line_config(int line, int direction) 20void gpio_line_config(int line, int direction)
@@ -46,3 +50,42 @@ void gpio_line_set(int line, int value)
46 local_irq_restore(flags); 50 local_irq_restore(flags);
47} 51}
48EXPORT_SYMBOL(gpio_line_set); 52EXPORT_SYMBOL(gpio_line_set);
53
54static int iop3xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
55{
56 gpio_line_config(gpio, GPIO_IN);
57 return 0;
58}
59
60static int iop3xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level)
61{
62 gpio_line_set(gpio, level);
63 gpio_line_config(gpio, GPIO_OUT);
64 return 0;
65}
66
67static int iop3xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
68{
69 return gpio_line_get(gpio);
70}
71
72static void iop3xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
73{
74 gpio_line_set(gpio, value);
75}
76
77static struct gpio_chip iop3xx_chip = {
78 .label = "iop3xx",
79 .direction_input = iop3xx_gpio_direction_input,
80 .get = iop3xx_gpio_get_value,
81 .direction_output = iop3xx_gpio_direction_output,
82 .set = iop3xx_gpio_set_value,
83 .base = 0,
84 .ngpio = IOP3XX_N_GPIOS,
85};
86
87static int __init iop3xx_gpio_setup(void)
88{
89 return gpiochip_add(&iop3xx_chip);
90}
91arch_initcall(iop3xx_gpio_setup);
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index bb6e12738fb3..e14eaad11dd5 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -3,9 +3,14 @@ if ARCH_MXC
3menu "Freescale MXC Implementations" 3menu "Freescale MXC Implementations"
4 4
5choice 5choice
6 prompt "MXC/iMX System Type" 6 prompt "MXC/iMX Base Type"
7 default ARCH_MX3 7 default ARCH_MX3
8 8
9config ARCH_MX2
10 bool "MX2-based"
11 help
12 This enables support for systems based on the Freescale i.MX2 family
13
9config ARCH_MX3 14config ARCH_MX3
10 bool "MX3-based" 15 bool "MX3-based"
11 help 16 help
@@ -13,6 +18,7 @@ config ARCH_MX3
13 18
14endchoice 19endchoice
15 20
21source "arch/arm/mach-mx2/Kconfig"
16source "arch/arm/mach-mx3/Kconfig" 22source "arch/arm/mach-mx3/Kconfig"
17 23
18endmenu 24endmenu
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index f96dc0362068..db66e9ae8414 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -3,4 +3,6 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := irq.o 6obj-y := irq.o clock.o gpio.o time.o
7
8obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o
diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
new file mode 100644
index 000000000000..1aa86fd60d71
--- /dev/null
+++ b/arch/arm/plat-mxc/clock.c
@@ -0,0 +1,331 @@
1/*
2 * Based on arch/arm/plat-omap/clock.c
3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
7 * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
8 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301, USA.
23 */
24
25/* #define DEBUG */
26
27#include <linux/clk.h>
28#include <linux/err.h>
29#include <linux/errno.h>
30#include <linux/init.h>
31#include <linux/io.h>
32#include <linux/kernel.h>
33#include <linux/list.h>
34#include <linux/module.h>
35#include <linux/mutex.h>
36#include <linux/platform_device.h>
37#include <linux/proc_fs.h>
38#include <linux/semaphore.h>
39#include <linux/string.h>
40#include <linux/version.h>
41
42#include <asm/arch/clock.h>
43
44static LIST_HEAD(clocks);
45static DEFINE_MUTEX(clocks_mutex);
46
47/*-------------------------------------------------------------------------
48 * Standard clock functions defined in include/linux/clk.h
49 *-------------------------------------------------------------------------*/
50
51/*
52 * Retrieve a clock by name.
53 *
54 * Note that we first try to use device id on the bus
55 * and clock name. If this fails, we try to use "<name>.<id>". If this fails,
56 * we try to use clock name only.
57 * The reference count to the clock's module owner ref count is incremented.
58 */
59struct clk *clk_get(struct device *dev, const char *id)
60{
61 struct clk *p, *clk = ERR_PTR(-ENOENT);
62 int idno;
63 const char *str;
64
65 if (id == NULL)
66 return clk;
67
68 if (dev == NULL || dev->bus != &platform_bus_type)
69 idno = -1;
70 else
71 idno = to_platform_device(dev)->id;
72
73 mutex_lock(&clocks_mutex);
74
75 list_for_each_entry(p, &clocks, node) {
76 if (p->id == idno &&
77 strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
78 clk = p;
79 goto found;
80 }
81 }
82
83 str = strrchr(id, '.');
84 if (str) {
85 int cnt = str - id;
86 str++;
87 idno = simple_strtol(str, NULL, 10);
88 list_for_each_entry(p, &clocks, node) {
89 if (p->id == idno &&
90 strlen(p->name) == cnt &&
91 strncmp(id, p->name, cnt) == 0 &&
92 try_module_get(p->owner)) {
93 clk = p;
94 goto found;
95 }
96 }
97 }
98
99 list_for_each_entry(p, &clocks, node) {
100 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
101 clk = p;
102 goto found;
103 }
104 }
105
106 printk(KERN_WARNING "clk: Unable to get requested clock: %s\n", id);
107
108found:
109 mutex_unlock(&clocks_mutex);
110
111 return clk;
112}
113EXPORT_SYMBOL(clk_get);
114
115static void __clk_disable(struct clk *clk)
116{
117 if (clk == NULL || IS_ERR(clk))
118 return;
119
120 __clk_disable(clk->parent);
121 __clk_disable(clk->secondary);
122
123 if (!(--clk->usecount) && clk->disable)
124 clk->disable(clk);
125}
126
127static int __clk_enable(struct clk *clk)
128{
129 if (clk == NULL || IS_ERR(clk))
130 return -EINVAL;
131
132 __clk_enable(clk->parent);
133 __clk_enable(clk->secondary);
134
135 if (clk->usecount++ == 0 && clk->enable)
136 clk->enable(clk);
137
138 return 0;
139}
140
141/* This function increments the reference count on the clock and enables the
142 * clock if not already enabled. The parent clock tree is recursively enabled
143 */
144int clk_enable(struct clk *clk)
145{
146 int ret = 0;
147
148 if (clk == NULL || IS_ERR(clk))
149 return -EINVAL;
150
151 mutex_lock(&clocks_mutex);
152 ret = __clk_enable(clk);
153 mutex_unlock(&clocks_mutex);
154
155 return ret;
156}
157EXPORT_SYMBOL(clk_enable);
158
159/* This function decrements the reference count on the clock and disables
160 * the clock when reference count is 0. The parent clock tree is
161 * recursively disabled
162 */
163void clk_disable(struct clk *clk)
164{
165 if (clk == NULL || IS_ERR(clk))
166 return;
167
168 mutex_lock(&clocks_mutex);
169 __clk_disable(clk);
170 mutex_unlock(&clocks_mutex);
171}
172EXPORT_SYMBOL(clk_disable);
173
174/* Retrieve the *current* clock rate. If the clock itself
175 * does not provide a special calculation routine, ask
176 * its parent and so on, until one is able to return
177 * a valid clock rate
178 */
179unsigned long clk_get_rate(struct clk *clk)
180{
181 if (clk == NULL || IS_ERR(clk))
182 return 0UL;
183
184 if (clk->get_rate)
185 return clk->get_rate(clk);
186
187 return clk_get_rate(clk->parent);
188}
189EXPORT_SYMBOL(clk_get_rate);
190
191/* Decrement the clock's module reference count */
192void clk_put(struct clk *clk)
193{
194 if (clk && !IS_ERR(clk))
195 module_put(clk->owner);
196}
197EXPORT_SYMBOL(clk_put);
198
199/* Round the requested clock rate to the nearest supported
200 * rate that is less than or equal to the requested rate.
201 * This is dependent on the clock's current parent.
202 */
203long clk_round_rate(struct clk *clk, unsigned long rate)
204{
205 if (clk == NULL || IS_ERR(clk) || !clk->round_rate)
206 return 0;
207
208 return clk->round_rate(clk, rate);
209}
210EXPORT_SYMBOL(clk_round_rate);
211
212/* Set the clock to the requested clock rate. The rate must
213 * match a supported rate exactly based on what clk_round_rate returns
214 */
215int clk_set_rate(struct clk *clk, unsigned long rate)
216{
217 int ret = -EINVAL;
218
219 if (clk == NULL || IS_ERR(clk) || clk->set_rate == NULL || rate == 0)
220 return ret;
221
222 mutex_lock(&clocks_mutex);
223 ret = clk->set_rate(clk, rate);
224 mutex_unlock(&clocks_mutex);
225
226 return ret;
227}
228EXPORT_SYMBOL(clk_set_rate);
229
230/* Set the clock's parent to another clock source */
231int clk_set_parent(struct clk *clk, struct clk *parent)
232{
233 int ret = -EINVAL;
234
235 if (clk == NULL || IS_ERR(clk) || parent == NULL ||
236 IS_ERR(parent) || clk->set_parent == NULL)
237 return ret;
238
239 mutex_lock(&clocks_mutex);
240 ret = clk->set_parent(clk, parent);
241 if (ret == 0)
242 clk->parent = parent;
243 mutex_unlock(&clocks_mutex);
244
245 return ret;
246}
247EXPORT_SYMBOL(clk_set_parent);
248
249/* Retrieve the clock's parent clock source */
250struct clk *clk_get_parent(struct clk *clk)
251{
252 struct clk *ret = NULL;
253
254 if (clk == NULL || IS_ERR(clk))
255 return ret;
256
257 return clk->parent;
258}
259EXPORT_SYMBOL(clk_get_parent);
260
261/*
262 * Add a new clock to the clock tree.
263 */
264int clk_register(struct clk *clk)
265{
266 if (clk == NULL || IS_ERR(clk))
267 return -EINVAL;
268
269 mutex_lock(&clocks_mutex);
270 list_add(&clk->node, &clocks);
271 mutex_unlock(&clocks_mutex);
272
273 return 0;
274}
275EXPORT_SYMBOL(clk_register);
276
277/* Remove a clock from the clock tree */
278void clk_unregister(struct clk *clk)
279{
280 if (clk == NULL || IS_ERR(clk))
281 return;
282
283 mutex_lock(&clocks_mutex);
284 list_del(&clk->node);
285 mutex_unlock(&clocks_mutex);
286}
287EXPORT_SYMBOL(clk_unregister);
288
289#ifdef CONFIG_PROC_FS
290static int mxc_clock_read_proc(char *page, char **start, off_t off,
291 int count, int *eof, void *data)
292{
293 struct clk *clkp;
294 char *p = page;
295 int len;
296
297 list_for_each_entry(clkp, &clocks, node) {
298 p += sprintf(p, "%s-%d:\t\t%lu, %d", clkp->name, clkp->id,
299 clk_get_rate(clkp), clkp->usecount);
300 if (clkp->parent)
301 p += sprintf(p, ", %s-%d\n", clkp->parent->name,
302 clkp->parent->id);
303 else
304 p += sprintf(p, "\n");
305 }
306
307 len = (p - page) - off;
308 if (len < 0)
309 len = 0;
310
311 *eof = (len <= count) ? 1 : 0;
312 *start = page + off;
313
314 return len;
315}
316
317static int __init mxc_setup_proc_entry(void)
318{
319 struct proc_dir_entry *res;
320
321 res = create_proc_read_entry("cpu/clocks", 0, NULL,
322 mxc_clock_read_proc, NULL);
323 if (!res) {
324 printk(KERN_ERR "Failed to create proc/cpu/clocks\n");
325 return -ENOMEM;
326 }
327 return 0;
328}
329
330late_initcall(mxc_setup_proc_entry);
331#endif
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
new file mode 100644
index 000000000000..4a7736717d86
--- /dev/null
+++ b/arch/arm/plat-mxc/gpio.c
@@ -0,0 +1,253 @@
1/*
2 * MXC GPIO support. (c) 2008 Daniel Mack <daniel@caiaq.de>
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * Based on code from Freescale,
6 * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22#include <linux/init.h>
23#include <linux/io.h>
24#include <linux/irq.h>
25#include <linux/gpio.h>
26#include <asm/hardware.h>
27#include <asm-generic/bug.h>
28
29static struct mxc_gpio_port *mxc_gpio_ports;
30static int gpio_table_size;
31
32/* Note: This driver assumes 32 GPIOs are handled in one register */
33
34static void _clear_gpio_irqstatus(struct mxc_gpio_port *port, u32 index)
35{
36 __raw_writel(1 << index, port->base + GPIO_ISR);
37}
38
39static void _set_gpio_irqenable(struct mxc_gpio_port *port, u32 index,
40 int enable)
41{
42 u32 l;
43
44 l = __raw_readl(port->base + GPIO_IMR);
45 l = (l & (~(1 << index))) | (!!enable << index);
46 __raw_writel(l, port->base + GPIO_IMR);
47}
48
49static void gpio_ack_irq(u32 irq)
50{
51 u32 gpio = irq_to_gpio(irq);
52 _clear_gpio_irqstatus(&mxc_gpio_ports[gpio / 32], gpio & 0x1f);
53}
54
55static void gpio_mask_irq(u32 irq)
56{
57 u32 gpio = irq_to_gpio(irq);
58 _set_gpio_irqenable(&mxc_gpio_ports[gpio / 32], gpio & 0x1f, 0);
59}
60
61static void gpio_unmask_irq(u32 irq)
62{
63 u32 gpio = irq_to_gpio(irq);
64 _set_gpio_irqenable(&mxc_gpio_ports[gpio / 32], gpio & 0x1f, 1);
65}
66
67static int gpio_set_irq_type(u32 irq, u32 type)
68{
69 u32 gpio = irq_to_gpio(irq);
70 struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32];
71 u32 bit, val;
72 int edge;
73 void __iomem *reg = port->base;
74
75 switch (type) {
76 case IRQT_RISING:
77 edge = GPIO_INT_RISE_EDGE;
78 break;
79 case IRQT_FALLING:
80 edge = GPIO_INT_FALL_EDGE;
81 break;
82 case IRQT_LOW:
83 edge = GPIO_INT_LOW_LEV;
84 break;
85 case IRQT_HIGH:
86 edge = GPIO_INT_HIGH_LEV;
87 break;
88 default: /* this includes IRQT_BOTHEDGE */
89 return -EINVAL;
90 }
91
92 reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */
93 bit = gpio & 0xf;
94 val = __raw_readl(reg) & ~(0x3 << (bit << 1));
95 __raw_writel(val | (edge << (bit << 1)), reg);
96 _clear_gpio_irqstatus(port, gpio & 0x1f);
97
98 return 0;
99}
100
101/* handle n interrupts in one status register */
102static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat)
103{
104 u32 gpio_irq_no;
105
106 gpio_irq_no = port->virtual_irq_start;
107 for (; irq_stat != 0; irq_stat >>= 1, gpio_irq_no++) {
108
109 if ((irq_stat & 1) == 0)
110 continue;
111
112 BUG_ON(!(irq_desc[gpio_irq_no].handle_irq));
113 irq_desc[gpio_irq_no].handle_irq(gpio_irq_no,
114 &irq_desc[gpio_irq_no]);
115 }
116}
117
118#ifdef CONFIG_ARCH_MX3
119/* MX3 has one interrupt *per* gpio port */
120static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc)
121{
122 u32 irq_stat;
123 struct mxc_gpio_port *port = (struct mxc_gpio_port *)get_irq_data(irq);
124
125 irq_stat = __raw_readl(port->base + GPIO_ISR) &
126 __raw_readl(port->base + GPIO_IMR);
127 BUG_ON(!irq_stat);
128 mxc_gpio_irq_handler(port, irq_stat);
129}
130#endif
131
132#ifdef CONFIG_ARCH_MX2
133/* MX2 has one interrupt *for all* gpio ports */
134static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc)
135{
136 int i;
137 u32 irq_msk, irq_stat;
138 struct mxc_gpio_port *port = (struct mxc_gpio_port *)get_irq_data(irq);
139
140 /* walk through all interrupt status registers */
141 for (i = 0; i < gpio_table_size; i++) {
142 irq_msk = __raw_readl(port[i].base + GPIO_IMR);
143 if (!irq_msk)
144 continue;
145
146 irq_stat = __raw_readl(port[i].base + GPIO_ISR) & irq_msk;
147 if (irq_stat)
148 mxc_gpio_irq_handler(&port[i], irq_stat);
149 }
150}
151#endif
152
153static struct irq_chip gpio_irq_chip = {
154 .ack = gpio_ack_irq,
155 .mask = gpio_mask_irq,
156 .unmask = gpio_unmask_irq,
157 .set_type = gpio_set_irq_type,
158};
159
160static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
161 int dir)
162{
163 struct mxc_gpio_port *port =
164 container_of(chip, struct mxc_gpio_port, chip);
165 u32 l;
166
167 l = __raw_readl(port->base + GPIO_GDIR);
168 if (dir)
169 l |= 1 << offset;
170 else
171 l &= ~(1 << offset);
172 __raw_writel(l, port->base + GPIO_GDIR);
173}
174
175static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
176{
177 struct mxc_gpio_port *port =
178 container_of(chip, struct mxc_gpio_port, chip);
179 void __iomem *reg = port->base + GPIO_DR;
180 u32 l;
181
182 l = (__raw_readl(reg) & (~(1 << offset))) | (value << offset);
183 __raw_writel(l, reg);
184}
185
186static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset)
187{
188 struct mxc_gpio_port *port =
189 container_of(chip, struct mxc_gpio_port, chip);
190
191 return (__raw_readl(port->base + GPIO_DR) >> offset) & 1;
192}
193
194static int mxc_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
195{
196 _set_gpio_direction(chip, offset, 0);
197 return 0;
198}
199
200static int mxc_gpio_direction_output(struct gpio_chip *chip,
201 unsigned offset, int value)
202{
203 _set_gpio_direction(chip, offset, 1);
204 mxc_gpio_set(chip, offset, value);
205 return 0;
206}
207
208int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
209{
210 int i, j;
211
212 /* save for local usage */
213 mxc_gpio_ports = port;
214 gpio_table_size = cnt;
215
216 printk(KERN_INFO "MXC GPIO hardware\n");
217
218 for (i = 0; i < cnt; i++) {
219 /* disable the interrupt and clear the status */
220 __raw_writel(0, port[i].base + GPIO_IMR);
221 __raw_writel(~0, port[i].base + GPIO_ISR);
222 for (j = port[i].virtual_irq_start;
223 j < port[i].virtual_irq_start + 32; j++) {
224 set_irq_chip(j, &gpio_irq_chip);
225 set_irq_handler(j, handle_edge_irq);
226 set_irq_flags(j, IRQF_VALID);
227 }
228
229 /* register gpio chip */
230 port[i].chip.direction_input = mxc_gpio_direction_input;
231 port[i].chip.direction_output = mxc_gpio_direction_output;
232 port[i].chip.get = mxc_gpio_get;
233 port[i].chip.set = mxc_gpio_set;
234 port[i].chip.base = i * 32;
235 port[i].chip.ngpio = 32;
236
237 /* its a serious configuration bug when it fails */
238 BUG_ON( gpiochip_add(&port[i].chip) < 0 );
239
240#ifdef CONFIG_ARCH_MX3
241 /* setup one handler for each entry */
242 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler);
243 set_irq_data(port[i].irq, &port[i]);
244#endif
245 }
246
247#ifdef CONFIG_ARCH_MX2
248 /* setup one handler for all GPIO interrupts */
249 set_irq_chained_handler(port[0].irq, mx2_gpio_irq_handler);
250 set_irq_data(port[0].irq, port);
251#endif
252 return 0;
253}
diff --git a/arch/arm/plat-mxc/iomux-mx1-mx2.c b/arch/arm/plat-mxc/iomux-mx1-mx2.c
new file mode 100644
index 000000000000..1985571eb40c
--- /dev/null
+++ b/arch/arm/plat-mxc/iomux-mx1-mx2.c
@@ -0,0 +1,156 @@
1/*
2 * arch/arm/mach-mxc/generic.c
3 *
4 * author: Sascha Hauer
5 * Created: april 20th, 2004
6 * Copyright: Synertronixx GmbH
7 *
8 * Common code for i.MX machines
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
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#include <linux/errno.h>
27#include <linux/init.h>
28#include <linux/kernel.h>
29#include <linux/module.h>
30#include <linux/string.h>
31#include <linux/gpio.h>
32
33#include <asm/hardware.h>
34#include <asm/mach/map.h>
35#include <asm/arch/iomux-mx1-mx2.h>
36
37void mxc_gpio_mode(int gpio_mode)
38{
39 unsigned int pin = gpio_mode & GPIO_PIN_MASK;
40 unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
41 unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
42 unsigned int tmp;
43
44 /* Pullup enable */
45 tmp = __raw_readl(VA_GPIO_BASE + MXC_PUEN(port));
46 if (gpio_mode & GPIO_PUEN)
47 tmp |= (1 << pin);
48 else
49 tmp &= ~(1 << pin);
50 __raw_writel(tmp, VA_GPIO_BASE + MXC_PUEN(port));
51
52 /* Data direction */
53 tmp = __raw_readl(VA_GPIO_BASE + MXC_DDIR(port));
54 if (gpio_mode & GPIO_OUT)
55 tmp |= 1 << pin;
56 else
57 tmp &= ~(1 << pin);
58 __raw_writel(tmp, VA_GPIO_BASE + MXC_DDIR(port));
59
60 /* Primary / alternate function */
61 tmp = __raw_readl(VA_GPIO_BASE + MXC_GPR(port));
62 if (gpio_mode & GPIO_AF)
63 tmp |= (1 << pin);
64 else
65 tmp &= ~(1 << pin);
66 __raw_writel(tmp, VA_GPIO_BASE + MXC_GPR(port));
67
68 /* use as gpio? */
69 tmp = __raw_readl(VA_GPIO_BASE + MXC_GIUS(port));
70 if (gpio_mode & (GPIO_PF | GPIO_AF))
71 tmp &= ~(1 << pin);
72 else
73 tmp |= (1 << pin);
74 __raw_writel(tmp, VA_GPIO_BASE + MXC_GIUS(port));
75
76 if (pin < 16) {
77 tmp = __raw_readl(VA_GPIO_BASE + MXC_OCR1(port));
78 tmp &= ~(3 << (pin * 2));
79 tmp |= (ocr << (pin * 2));
80 __raw_writel(tmp, VA_GPIO_BASE + MXC_OCR1(port));
81
82 tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFA1(port));
83 tmp &= ~(3 << (pin * 2));
84 tmp |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << (pin * 2);
85 __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFA1(port));
86
87 tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFB1(port));
88 tmp &= ~(3 << (pin * 2));
89 tmp |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2);
90 __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFB1(port));
91 } else {
92 pin -= 16;
93
94 tmp = __raw_readl(VA_GPIO_BASE + MXC_OCR2(port));
95 tmp &= ~(3 << (pin * 2));
96 tmp |= (ocr << (pin * 2));
97 __raw_writel(tmp, VA_GPIO_BASE + MXC_OCR2(port));
98
99 tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFA2(port));
100 tmp &= ~(3 << (pin * 2));
101 tmp |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << (pin * 2);
102 __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFA2(port));
103
104 tmp = __raw_readl(VA_GPIO_BASE + MXC_ICONFB2(port));
105 tmp &= ~(3 << (pin * 2));
106 tmp |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2);
107 __raw_writel(tmp, VA_GPIO_BASE + MXC_ICONFB2(port));
108 }
109}
110EXPORT_SYMBOL(mxc_gpio_mode);
111
112int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
113 int alloc_mode, const char *label)
114{
115 const int *p = pin_list;
116 int i;
117 unsigned gpio;
118 unsigned mode;
119
120 for (i = 0; i < count; i++) {
121 gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
122 mode = *p & ~(GPIO_PIN_MASK | GPIO_PORT_MASK);
123
124 if (gpio >= (GPIO_PORT_MAX + 1) * 32)
125 goto setup_error;
126
127 if (alloc_mode & MXC_GPIO_ALLOC_MODE_RELEASE)
128 gpio_free(gpio);
129 else if (!(alloc_mode & MXC_GPIO_ALLOC_MODE_NO_ALLOC))
130 if (gpio_request(gpio, label)
131 && !(alloc_mode & MXC_GPIO_ALLOC_MODE_TRY_ALLOC))
132 goto setup_error;
133
134 if (!(alloc_mode & (MXC_GPIO_ALLOC_MODE_ALLOC_ONLY |
135 MXC_GPIO_ALLOC_MODE_RELEASE)))
136 mxc_gpio_mode(gpio | mode);
137
138 p++;
139 }
140 return 0;
141
142setup_error:
143 if (alloc_mode & (MXC_GPIO_ALLOC_MODE_NO_ALLOC |
144 MXC_GPIO_ALLOC_MODE_TRY_ALLOC))
145 return -EINVAL;
146
147 while (p != pin_list) {
148 p--;
149 gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
150 gpio_free(gpio);
151 }
152
153 return -EINVAL;
154}
155EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins);
156
diff --git a/arch/arm/plat-mxc/irq.c b/arch/arm/plat-mxc/irq.c
index 2ad5a6917b3f..1fbe01da6925 100644
--- a/arch/arm/plat-mxc/irq.c
+++ b/arch/arm/plat-mxc/irq.c
@@ -1,24 +1,59 @@
1/* 1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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 Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
3 */ 18 */
4 19
5/* 20#include <linux/irq.h>
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/module.h>
12#include <linux/moduleparam.h>
13#include <linux/init.h>
14#include <linux/device.h>
15#include <linux/errno.h>
16#include <asm/hardware.h>
17#include <asm/io.h> 21#include <asm/io.h>
18#include <asm/irq.h>
19#include <asm/mach/irq.h>
20#include <asm/arch/common.h> 22#include <asm/arch/common.h>
21 23
24#define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR)
25#define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */
26#define AVIC_NIMASK (AVIC_BASE + 0x04) /* int mask reg */
27#define AVIC_INTENNUM (AVIC_BASE + 0x08) /* int enable number reg */
28#define AVIC_INTDISNUM (AVIC_BASE + 0x0C) /* int disable number reg */
29#define AVIC_INTENABLEH (AVIC_BASE + 0x10) /* int enable reg high */
30#define AVIC_INTENABLEL (AVIC_BASE + 0x14) /* int enable reg low */
31#define AVIC_INTTYPEH (AVIC_BASE + 0x18) /* int type reg high */
32#define AVIC_INTTYPEL (AVIC_BASE + 0x1C) /* int type reg low */
33#define AVIC_NIPRIORITY7 (AVIC_BASE + 0x20) /* norm int priority lvl7 */
34#define AVIC_NIPRIORITY6 (AVIC_BASE + 0x24) /* norm int priority lvl6 */
35#define AVIC_NIPRIORITY5 (AVIC_BASE + 0x28) /* norm int priority lvl5 */
36#define AVIC_NIPRIORITY4 (AVIC_BASE + 0x2C) /* norm int priority lvl4 */
37#define AVIC_NIPRIORITY3 (AVIC_BASE + 0x30) /* norm int priority lvl3 */
38#define AVIC_NIPRIORITY2 (AVIC_BASE + 0x34) /* norm int priority lvl2 */
39#define AVIC_NIPRIORITY1 (AVIC_BASE + 0x38) /* norm int priority lvl1 */
40#define AVIC_NIPRIORITY0 (AVIC_BASE + 0x3C) /* norm int priority lvl0 */
41#define AVIC_NIVECSR (AVIC_BASE + 0x40) /* norm int vector/status */
42#define AVIC_FIVECSR (AVIC_BASE + 0x44) /* fast int vector/status */
43#define AVIC_INTSRCH (AVIC_BASE + 0x48) /* int source reg high */
44#define AVIC_INTSRCL (AVIC_BASE + 0x4C) /* int source reg low */
45#define AVIC_INTFRCH (AVIC_BASE + 0x50) /* int force reg high */
46#define AVIC_INTFRCL (AVIC_BASE + 0x54) /* int force reg low */
47#define AVIC_NIPNDH (AVIC_BASE + 0x58) /* norm int pending high */
48#define AVIC_NIPNDL (AVIC_BASE + 0x5C) /* norm int pending low */
49#define AVIC_FIPNDH (AVIC_BASE + 0x60) /* fast int pending high */
50#define AVIC_FIPNDL (AVIC_BASE + 0x64) /* fast int pending low */
51
52#define SYSTEM_PREV_REG IO_ADDRESS(IIM_BASE_ADDR + 0x20)
53#define SYSTEM_SREV_REG IO_ADDRESS(IIM_BASE_ADDR + 0x24)
54#define IIM_PROD_REV_SH 3
55#define IIM_PROD_REV_LEN 5
56
22/* Disable interrupt number "irq" in the AVIC */ 57/* Disable interrupt number "irq" in the AVIC */
23static void mxc_mask_irq(unsigned int irq) 58static void mxc_mask_irq(unsigned int irq)
24{ 59{
@@ -32,7 +67,7 @@ static void mxc_unmask_irq(unsigned int irq)
32} 67}
33 68
34static struct irq_chip mxc_avic_chip = { 69static struct irq_chip mxc_avic_chip = {
35 .mask_ack = mxc_mask_irq, 70 .ack = mxc_mask_irq,
36 .mask = mxc_mask_irq, 71 .mask = mxc_mask_irq,
37 .unmask = mxc_unmask_irq, 72 .unmask = mxc_unmask_irq,
38}; 73};
@@ -71,5 +106,8 @@ void __init mxc_init_irq(void)
71 reg |= (0xF << 28); 106 reg |= (0xF << 28);
72 __raw_writel(reg, AVIC_NIPRIORITY6); 107 __raw_writel(reg, AVIC_NIPRIORITY6);
73 108
109 /* init architectures chained interrupt handler */
110 mxc_register_gpios();
111
74 printk(KERN_INFO "MXC IRQ initialized\n"); 112 printk(KERN_INFO "MXC IRQ initialized\n");
75} 113}
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
new file mode 100644
index 000000000000..3bf86343fdf4
--- /dev/null
+++ b/arch/arm/plat-mxc/time.c
@@ -0,0 +1,228 @@
1/*
2 * linux/arch/arm/plat-mxc/time.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions
5 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
6 * Copyright (C) 2006-2007 Pavel Pisa (ppisa@pikron.com)
7 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
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,
21 * MA 02110-1301, USA.
22 */
23
24#include <linux/interrupt.h>
25#include <linux/irq.h>
26#include <linux/clockchips.h>
27#include <linux/clk.h>
28
29#include <asm/hardware.h>
30#include <asm/mach/time.h>
31#include <asm/arch/common.h>
32#include <asm/arch/mxc_timer.h>
33
34static struct clock_event_device clockevent_mxc;
35static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
36
37/* clock source for the timer */
38static struct clk *timer_clk;
39
40/* clock source */
41
42static cycle_t mxc_get_cycles(void)
43{
44 return __raw_readl(TIMER_BASE + MXC_TCN);
45}
46
47static struct clocksource clocksource_mxc = {
48 .name = "mxc_timer1",
49 .rating = 200,
50 .read = mxc_get_cycles,
51 .mask = CLOCKSOURCE_MASK(32),
52 .shift = 20,
53 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
54};
55
56static int __init mxc_clocksource_init(void)
57{
58 unsigned int clock;
59
60 clock = clk_get_rate(timer_clk);
61
62 clocksource_mxc.mult = clocksource_hz2mult(clock,
63 clocksource_mxc.shift);
64 clocksource_register(&clocksource_mxc);
65
66 return 0;
67}
68
69/* clock event */
70
71static int mxc_set_next_event(unsigned long evt,
72 struct clock_event_device *unused)
73{
74 unsigned long tcmp;
75
76 tcmp = __raw_readl(TIMER_BASE + MXC_TCN) + evt;
77 __raw_writel(tcmp, TIMER_BASE + MXC_TCMP);
78
79 return (int)(tcmp - __raw_readl(TIMER_BASE + MXC_TCN)) < 0 ?
80 -ETIME : 0;
81}
82
83#ifdef DEBUG
84static const char *clock_event_mode_label[] = {
85 [CLOCK_EVT_MODE_PERIODIC] = "CLOCK_EVT_MODE_PERIODIC",
86 [CLOCK_EVT_MODE_ONESHOT] = "CLOCK_EVT_MODE_ONESHOT",
87 [CLOCK_EVT_MODE_SHUTDOWN] = "CLOCK_EVT_MODE_SHUTDOWN",
88 [CLOCK_EVT_MODE_UNUSED] = "CLOCK_EVT_MODE_UNUSED"
89};
90#endif /* DEBUG */
91
92static void mxc_set_mode(enum clock_event_mode mode,
93 struct clock_event_device *evt)
94{
95 unsigned long flags;
96
97 /*
98 * The timer interrupt generation is disabled at least
99 * for enough time to call mxc_set_next_event()
100 */
101 local_irq_save(flags);
102
103 /* Disable interrupt in GPT module */
104 gpt_irq_disable();
105
106 if (mode != clockevent_mode) {
107 /* Set event time into far-far future */
108 __raw_writel(__raw_readl(TIMER_BASE + MXC_TCN) - 3,
109 TIMER_BASE + MXC_TCMP);
110 /* Clear pending interrupt */
111 gpt_irq_acknowledge();
112 }
113
114#ifdef DEBUG
115 printk(KERN_INFO "mxc_set_mode: changing mode from %s to %s\n",
116 clock_event_mode_label[clockevent_mode],
117 clock_event_mode_label[mode]);
118#endif /* DEBUG */
119
120 /* Remember timer mode */
121 clockevent_mode = mode;
122 local_irq_restore(flags);
123
124 switch (mode) {
125 case CLOCK_EVT_MODE_PERIODIC:
126 printk(KERN_ERR"mxc_set_mode: Periodic mode is not "
127 "supported for i.MX\n");
128 break;
129 case CLOCK_EVT_MODE_ONESHOT:
130 /*
131 * Do not put overhead of interrupt enable/disable into
132 * mxc_set_next_event(), the core has about 4 minutes
133 * to call mxc_set_next_event() or shutdown clock after
134 * mode switching
135 */
136 local_irq_save(flags);
137 gpt_irq_enable();
138 local_irq_restore(flags);
139 break;
140 case CLOCK_EVT_MODE_SHUTDOWN:
141 case CLOCK_EVT_MODE_UNUSED:
142 case CLOCK_EVT_MODE_RESUME:
143 /* Left event sources disabled, no more interrupts appear */
144 break;
145 }
146}
147
148/*
149 * IRQ handler for the timer
150 */
151static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
152{
153 struct clock_event_device *evt = &clockevent_mxc;
154 uint32_t tstat;
155
156 tstat = __raw_readl(TIMER_BASE + MXC_TSTAT);
157
158 gpt_irq_acknowledge();
159
160 evt->event_handler(evt);
161
162 return IRQ_HANDLED;
163}
164
165static struct irqaction mxc_timer_irq = {
166 .name = "i.MX Timer Tick",
167 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
168 .handler = mxc_timer_interrupt,
169};
170
171static struct clock_event_device clockevent_mxc = {
172 .name = "mxc_timer1",
173 .features = CLOCK_EVT_FEAT_ONESHOT,
174 .shift = 32,
175 .set_mode = mxc_set_mode,
176 .set_next_event = mxc_set_next_event,
177 .rating = 200,
178};
179
180static int __init mxc_clockevent_init(void)
181{
182 unsigned int clock;
183
184 clock = clk_get_rate(timer_clk);
185
186 clockevent_mxc.mult = div_sc(clock, NSEC_PER_SEC,
187 clockevent_mxc.shift);
188 clockevent_mxc.max_delta_ns =
189 clockevent_delta2ns(0xfffffffe, &clockevent_mxc);
190 clockevent_mxc.min_delta_ns =
191 clockevent_delta2ns(0xff, &clockevent_mxc);
192
193 clockevent_mxc.cpumask = cpumask_of_cpu(0);
194
195 clockevents_register_device(&clockevent_mxc);
196
197 return 0;
198}
199
200void __init mxc_timer_init(const char *clk_timer)
201{
202 timer_clk = clk_get(NULL, clk_timer);
203 if (!timer_clk) {
204 printk(KERN_ERR"Cannot determine timer clock. Giving up.\n");
205 return;
206 }
207
208 clk_enable(timer_clk);
209
210 /*
211 * Initialise to a known state (all timers off, and timing reset)
212 */
213 __raw_writel(0, TIMER_BASE + MXC_TCTL);
214 __raw_writel(0, TIMER_BASE + MXC_TPRER); /* see datasheet note */
215
216 __raw_writel(TCTL_FRR | /* free running */
217 TCTL_VAL | /* set clocksource and arch specific bits */
218 TCTL_TEN, /* start the timer */
219 TIMER_BASE + MXC_TCTL);
220
221 /* init and register the timer to the framework */
222 mxc_clocksource_init();
223 mxc_clockevent_init();
224
225 /* Make irqs happen */
226 setup_irq(TIMER_INTERRUPT, &mxc_timer_irq);
227}
228
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index bc639a30d6d1..2c4051cc79a1 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := common.o sram.o sram-fn.o clock.o devices.o dma.o mux.o gpio.o \ 6obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
7 usb.o fb.o 7 usb.o fb.o
8obj-m := 8obj-m :=
9obj-n := 9obj-n :=
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 2db5580048d8..c2e741de0203 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/plat-omap/clock.c 2 * linux/arch/arm/plat-omap/clock.c
3 * 3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation 4 * Copyright (C) 2004 - 2008 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * 6 *
7 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com> 7 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
@@ -22,6 +22,7 @@
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/cpufreq.h> 24#include <linux/cpufreq.h>
25#include <linux/debugfs.h>
25 26
26#include <asm/io.h> 27#include <asm/io.h>
27 28
@@ -33,41 +34,6 @@ static DEFINE_SPINLOCK(clockfw_lock);
33 34
34static struct clk_functions *arch_clock; 35static struct clk_functions *arch_clock;
35 36
36#ifdef CONFIG_PM_DEBUG
37
38static void print_parents(struct clk *clk)
39{
40 struct clk *p;
41 int printed = 0;
42
43 list_for_each_entry(p, &clocks, node) {
44 if (p->parent == clk && p->usecount) {
45 if (!clk->usecount && !printed) {
46 printk("MISMATCH: %s\n", clk->name);
47 printed = 1;
48 }
49 printk("\t%-15s\n", p->name);
50 }
51 }
52}
53
54void clk_print_usecounts(void)
55{
56 unsigned long flags;
57 struct clk *p;
58
59 spin_lock_irqsave(&clockfw_lock, flags);
60 list_for_each_entry(p, &clocks, node) {
61 if (p->usecount)
62 printk("%-15s: %d\n", p->name, p->usecount);
63 print_parents(p);
64
65 }
66 spin_unlock_irqrestore(&clockfw_lock, flags);
67}
68
69#endif
70
71/*------------------------------------------------------------------------- 37/*-------------------------------------------------------------------------
72 * Standard clock functions defined in include/linux/clk.h 38 * Standard clock functions defined in include/linux/clk.h
73 *-------------------------------------------------------------------------*/ 39 *-------------------------------------------------------------------------*/
@@ -446,3 +412,93 @@ int __init clk_init(struct clk_functions * custom_clocks)
446 return 0; 412 return 0;
447} 413}
448 414
415#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
416/*
417 * debugfs support to trace clock tree hierarchy and attributes
418 */
419static struct dentry *clk_debugfs_root;
420
421static int clk_debugfs_register_one(struct clk *c)
422{
423 int err;
424 struct dentry *d, *child;
425 struct clk *pa = c->parent;
426 char s[255];
427 char *p = s;
428
429 p += sprintf(p, "%s", c->name);
430 if (c->id != 0)
431 sprintf(p, ":%d", c->id);
432 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
433 if (IS_ERR(d))
434 return PTR_ERR(d);
435 c->dent = d;
436
437 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
438 if (IS_ERR(d)) {
439 err = PTR_ERR(d);
440 goto err_out;
441 }
442 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
443 if (IS_ERR(d)) {
444 err = PTR_ERR(d);
445 goto err_out;
446 }
447 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
448 if (IS_ERR(d)) {
449 err = PTR_ERR(d);
450 goto err_out;
451 }
452 return 0;
453
454err_out:
455 d = c->dent;
456 list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
457 debugfs_remove(child);
458 debugfs_remove(c->dent);
459 return err;
460}
461
462static int clk_debugfs_register(struct clk *c)
463{
464 int err;
465 struct clk *pa = c->parent;
466
467 if (pa && !pa->dent) {
468 err = clk_debugfs_register(pa);
469 if (err)
470 return err;
471 }
472
473 if (!c->dent) {
474 err = clk_debugfs_register_one(c);
475 if (err)
476 return err;
477 }
478 return 0;
479}
480
481static int __init clk_debugfs_init(void)
482{
483 struct clk *c;
484 struct dentry *d;
485 int err;
486
487 d = debugfs_create_dir("clock", NULL);
488 if (IS_ERR(d))
489 return PTR_ERR(d);
490 clk_debugfs_root = d;
491
492 list_for_each_entry(c, &clocks, node) {
493 err = clk_debugfs_register(c);
494 if (err)
495 goto err_out;
496 }
497 return 0;
498err_out:
499 debugfs_remove(clk_debugfs_root); /* REVISIT: Cleanup correctly */
500 return err;
501}
502late_initcall(clk_debugfs_init);
503
504#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index bd1cef2c3c14..8d04929a3c75 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -26,6 +26,7 @@
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/setup.h> 27#include <asm/setup.h>
28 28
29#include <asm/arch/common.h>
29#include <asm/arch/board.h> 30#include <asm/arch/board.h>
30#include <asm/arch/control.h> 31#include <asm/arch/control.h>
31#include <asm/arch/mux.h> 32#include <asm/arch/mux.h>
@@ -241,30 +242,70 @@ arch_initcall(omap_init_clocksource_32k);
241 242
242/* Global address base setup code */ 243/* Global address base setup code */
243 244
245#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
246
247static struct omap_globals *omap2_globals;
248
249static void __init __omap2_set_globals(void)
250{
251 omap2_set_globals_memory(omap2_globals);
252 omap2_set_globals_control(omap2_globals);
253 omap2_set_globals_prcm(omap2_globals);
254}
255
256#endif
257
244#if defined(CONFIG_ARCH_OMAP2420) 258#if defined(CONFIG_ARCH_OMAP2420)
259
260static struct omap_globals omap242x_globals = {
261 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x48014000),
262 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE),
263 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE),
264 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_CTRL_BASE),
265 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_PRM_BASE),
266 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_CM_BASE),
267};
268
245void __init omap2_set_globals_242x(void) 269void __init omap2_set_globals_242x(void)
246{ 270{
247 omap2_sdrc_base = OMAP2420_SDRC_BASE; 271 omap2_globals = &omap242x_globals;
248 omap2_sms_base = OMAP2420_SMS_BASE; 272 __omap2_set_globals();
249 omap_ctrl_base_set(OMAP2420_CTRL_BASE);
250} 273}
251#endif 274#endif
252 275
253#if defined(CONFIG_ARCH_OMAP2430) 276#if defined(CONFIG_ARCH_OMAP2430)
277
278static struct omap_globals omap243x_globals = {
279 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x4900a000),
280 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE),
281 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE),
282 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_CTRL_BASE),
283 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2430_PRM_BASE),
284 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP2430_CM_BASE),
285};
286
254void __init omap2_set_globals_243x(void) 287void __init omap2_set_globals_243x(void)
255{ 288{
256 omap2_sdrc_base = OMAP243X_SDRC_BASE; 289 omap2_globals = &omap243x_globals;
257 omap2_sms_base = OMAP243X_SMS_BASE; 290 __omap2_set_globals();
258 omap_ctrl_base_set(OMAP243X_CTRL_BASE);
259} 291}
260#endif 292#endif
261 293
262#if defined(CONFIG_ARCH_OMAP3430) 294#if defined(CONFIG_ARCH_OMAP3430)
295
296static struct omap_globals omap343x_globals = {
297 .tap = (__force void __iomem *)OMAP2_IO_ADDRESS(0x4830A000),
298 .sdrc = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE),
299 .sms = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE),
300 .ctrl = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_CTRL_BASE),
301 .prm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP3430_PRM_BASE),
302 .cm = (__force void __iomem *)OMAP2_IO_ADDRESS(OMAP3430_CM_BASE),
303};
304
263void __init omap2_set_globals_343x(void) 305void __init omap2_set_globals_343x(void)
264{ 306{
265 omap2_sdrc_base = OMAP343X_SDRC_BASE; 307 omap2_globals = &omap343x_globals;
266 omap2_sms_base = OMAP343X_SMS_BASE; 308 __omap2_set_globals();
267 omap_ctrl_base_set(OMAP343X_CTRL_BASE);
268} 309}
269#endif 310#endif
270 311
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 4a53f9ba6c43..81002b722da1 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -24,6 +24,7 @@
24#include <asm/arch/mux.h> 24#include <asm/arch/mux.h>
25#include <asm/arch/gpio.h> 25#include <asm/arch/gpio.h>
26#include <asm/arch/menelaus.h> 26#include <asm/arch/menelaus.h>
27#include <asm/arch/mcbsp.h>
27 28
28#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) 29#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
29 30
@@ -145,6 +146,53 @@ static inline void omap_init_kp(void) {}
145#endif 146#endif
146 147
147/*-------------------------------------------------------------------------*/ 148/*-------------------------------------------------------------------------*/
149#if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE)
150
151static struct platform_device **omap_mcbsp_devices;
152
153void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
154 int size)
155{
156 int i;
157
158 if (size > OMAP_MAX_MCBSP_COUNT) {
159 printk(KERN_WARNING "Registered too many McBSPs platform_data."
160 " Using maximum (%d) available.\n",
161 OMAP_MAX_MCBSP_COUNT);
162 size = OMAP_MAX_MCBSP_COUNT;
163 }
164
165 omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *),
166 GFP_KERNEL);
167 if (!omap_mcbsp_devices) {
168 printk(KERN_ERR "Could not register McBSP devices\n");
169 return;
170 }
171
172 for (i = 0; i < size; i++) {
173 struct platform_device *new_mcbsp;
174 int ret;
175
176 new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1);
177 if (!new_mcbsp)
178 continue;
179 new_mcbsp->dev.platform_data = &config[i];
180 ret = platform_device_add(new_mcbsp);
181 if (ret) {
182 platform_device_put(new_mcbsp);
183 continue;
184 }
185 omap_mcbsp_devices[i] = new_mcbsp;
186 }
187}
188
189#else
190void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
191 int size)
192{ }
193#endif
194
195/*-------------------------------------------------------------------------*/
148 196
149#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 197#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
150 198
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 39c637b0ffea..fac8e994f588 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/plat-omap/dma.c 2 * linux/arch/arm/plat-omap/dma.c
3 * 3 *
4 * Copyright (C) 2003 Nokia Corporation 4 * Copyright (C) 2003 - 2008 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com> 5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com> 6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
7 * Graphics DMA and LCD DMA graphics tranformations 7 * Graphics DMA and LCD DMA graphics tranformations
@@ -25,11 +25,11 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/io.h>
28 29
29#include <asm/system.h> 30#include <asm/system.h>
30#include <asm/hardware.h> 31#include <asm/hardware.h>
31#include <asm/dma.h> 32#include <asm/dma.h>
32#include <asm/io.h>
33 33
34#include <asm/arch/tc.h> 34#include <asm/arch/tc.h>
35 35
@@ -43,13 +43,13 @@ enum { DMA_CH_ALLOC_DONE, DMA_CH_PARAMS_SET_DONE, DMA_CH_STARTED,
43enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED }; 43enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED };
44#endif 44#endif
45 45
46#define OMAP_DMA_ACTIVE 0x01 46#define OMAP_DMA_ACTIVE 0x01
47#define OMAP_DMA_CCR_EN (1 << 7) 47#define OMAP_DMA_CCR_EN (1 << 7)
48#define OMAP2_DMA_CSR_CLEAR_MASK 0xffe 48#define OMAP2_DMA_CSR_CLEAR_MASK 0xffe
49 49
50#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec) 50#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec)
51 51
52static int enable_1510_mode = 0; 52static int enable_1510_mode;
53 53
54struct omap_dma_lch { 54struct omap_dma_lch {
55 int next_lch; 55 int next_lch;
@@ -57,7 +57,7 @@ struct omap_dma_lch {
57 u16 saved_csr; 57 u16 saved_csr;
58 u16 enabled_irqs; 58 u16 enabled_irqs;
59 const char *dev_name; 59 const char *dev_name;
60 void (* callback)(int lch, u16 ch_status, void *data); 60 void (*callback)(int lch, u16 ch_status, void *data);
61 void *data; 61 void *data;
62 62
63#ifndef CONFIG_ARCH_OMAP1 63#ifndef CONFIG_ARCH_OMAP1
@@ -72,7 +72,6 @@ struct omap_dma_lch {
72 long flags; 72 long flags;
73}; 73};
74 74
75#ifndef CONFIG_ARCH_OMAP1
76struct dma_link_info { 75struct dma_link_info {
77 int *linked_dmach_q; 76 int *linked_dmach_q;
78 int no_of_lchs_linked; 77 int no_of_lchs_linked;
@@ -86,7 +85,9 @@ struct dma_link_info {
86 85
87}; 86};
88 87
89static struct dma_link_info dma_linked_lch[OMAP_LOGICAL_DMA_CH_COUNT]; 88static struct dma_link_info *dma_linked_lch;
89
90#ifndef CONFIG_ARCH_OMAP1
90 91
91/* Chain handling macros */ 92/* Chain handling macros */
92#define OMAP_DMA_CHAIN_QINIT(chain_id) \ 93#define OMAP_DMA_CHAIN_QINIT(chain_id) \
@@ -119,12 +120,15 @@ static struct dma_link_info dma_linked_lch[OMAP_LOGICAL_DMA_CH_COUNT];
119 dma_linked_lch[chain_id].q_count++; \ 120 dma_linked_lch[chain_id].q_count++; \
120 } while (0) 121 } while (0)
121#endif 122#endif
123
124static int dma_lch_count;
122static int dma_chan_count; 125static int dma_chan_count;
123 126
124static spinlock_t dma_chan_lock; 127static spinlock_t dma_chan_lock;
125static struct omap_dma_lch dma_chan[OMAP_LOGICAL_DMA_CH_COUNT]; 128static struct omap_dma_lch *dma_chan;
129static void __iomem *omap_dma_base;
126 130
127static const u8 omap1_dma_irq[OMAP_LOGICAL_DMA_CH_COUNT] = { 131static const u8 omap1_dma_irq[OMAP1_LOGICAL_DMA_CH_COUNT] = {
128 INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3, 132 INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3,
129 INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7, 133 INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7,
130 INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10, 134 INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10,
@@ -139,6 +143,24 @@ static inline void omap_enable_channel_irq(int lch);
139#define REVISIT_24XX() printk(KERN_ERR "FIXME: no %s on 24xx\n", \ 143#define REVISIT_24XX() printk(KERN_ERR "FIXME: no %s on 24xx\n", \
140 __func__); 144 __func__);
141 145
146#define dma_read(reg) \
147({ \
148 u32 __val; \
149 if (cpu_class_is_omap1()) \
150 __val = __raw_readw(omap_dma_base + OMAP1_DMA_##reg); \
151 else \
152 __val = __raw_readl(omap_dma_base + OMAP_DMA4_##reg); \
153 __val; \
154})
155
156#define dma_write(val, reg) \
157({ \
158 if (cpu_class_is_omap1()) \
159 __raw_writew((u16)(val), omap_dma_base + OMAP1_DMA_##reg); \
160 else \
161 __raw_writel((val), omap_dma_base + OMAP_DMA4_##reg); \
162})
163
142#ifdef CONFIG_ARCH_OMAP15XX 164#ifdef CONFIG_ARCH_OMAP15XX
143/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */ 165/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */
144int omap_dma_in_1510_mode(void) 166int omap_dma_in_1510_mode(void)
@@ -173,13 +195,14 @@ static inline void set_gdma_dev(int req, int dev)
173#define set_gdma_dev(req, dev) do {} while (0) 195#define set_gdma_dev(req, dev) do {} while (0)
174#endif 196#endif
175 197
198/* Omap1 only */
176static void clear_lch_regs(int lch) 199static void clear_lch_regs(int lch)
177{ 200{
178 int i; 201 int i;
179 u32 lch_base = OMAP_DMA_BASE + lch * 0x40; 202 void __iomem *lch_base = omap_dma_base + OMAP1_DMA_CH_BASE(lch);
180 203
181 for (i = 0; i < 0x2c; i += 2) 204 for (i = 0; i < 0x2c; i += 2)
182 omap_writew(0, lch_base + i); 205 __raw_writew(0, lch_base + i);
183} 206}
184 207
185void omap_set_dma_priority(int lch, int dst_port, int priority) 208void omap_set_dma_priority(int lch, int dst_port, int priority)
@@ -212,33 +235,49 @@ void omap_set_dma_priority(int lch, int dst_port, int priority)
212 } 235 }
213 236
214 if (cpu_class_is_omap2()) { 237 if (cpu_class_is_omap2()) {
238 u32 ccr;
239
240 ccr = dma_read(CCR(lch));
215 if (priority) 241 if (priority)
216 OMAP_DMA_CCR_REG(lch) |= (1 << 6); 242 ccr |= (1 << 6);
217 else 243 else
218 OMAP_DMA_CCR_REG(lch) &= ~(1 << 6); 244 ccr &= ~(1 << 6);
245 dma_write(ccr, CCR(lch));
219 } 246 }
220} 247}
248EXPORT_SYMBOL(omap_set_dma_priority);
221 249
222void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, 250void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
223 int frame_count, int sync_mode, 251 int frame_count, int sync_mode,
224 int dma_trigger, int src_or_dst_synch) 252 int dma_trigger, int src_or_dst_synch)
225{ 253{
226 OMAP_DMA_CSDP_REG(lch) &= ~0x03; 254 u32 l;
227 OMAP_DMA_CSDP_REG(lch) |= data_type; 255
256 l = dma_read(CSDP(lch));
257 l &= ~0x03;
258 l |= data_type;
259 dma_write(l, CSDP(lch));
228 260
229 if (cpu_class_is_omap1()) { 261 if (cpu_class_is_omap1()) {
230 OMAP_DMA_CCR_REG(lch) &= ~(1 << 5); 262 u16 ccr;
263
264 ccr = dma_read(CCR(lch));
265 ccr &= ~(1 << 5);
231 if (sync_mode == OMAP_DMA_SYNC_FRAME) 266 if (sync_mode == OMAP_DMA_SYNC_FRAME)
232 OMAP_DMA_CCR_REG(lch) |= 1 << 5; 267 ccr |= 1 << 5;
268 dma_write(ccr, CCR(lch));
233 269
234 OMAP1_DMA_CCR2_REG(lch) &= ~(1 << 2); 270 ccr = dma_read(CCR2(lch));
271 ccr &= ~(1 << 2);
235 if (sync_mode == OMAP_DMA_SYNC_BLOCK) 272 if (sync_mode == OMAP_DMA_SYNC_BLOCK)
236 OMAP1_DMA_CCR2_REG(lch) |= 1 << 2; 273 ccr |= 1 << 2;
274 dma_write(ccr, CCR2(lch));
237 } 275 }
238 276
239 if (cpu_class_is_omap2() && dma_trigger) { 277 if (cpu_class_is_omap2() && dma_trigger) {
240 u32 val = OMAP_DMA_CCR_REG(lch); 278 u32 val;
241 279
280 val = dma_read(CCR(lch));
242 val &= ~(3 << 19); 281 val &= ~(3 << 19);
243 if (dma_trigger > 63) 282 if (dma_trigger > 63)
244 val |= 1 << 20; 283 val |= 1 << 20;
@@ -263,12 +302,13 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
263 else 302 else
264 val &= ~(1 << 24); /* dest synch */ 303 val &= ~(1 << 24); /* dest synch */
265 304
266 OMAP_DMA_CCR_REG(lch) = val; 305 dma_write(val, CCR(lch));
267 } 306 }
268 307
269 OMAP_DMA_CEN_REG(lch) = elem_count; 308 dma_write(elem_count, CEN(lch));
270 OMAP_DMA_CFN_REG(lch) = frame_count; 309 dma_write(frame_count, CFN(lch));
271} 310}
311EXPORT_SYMBOL(omap_set_dma_transfer_params);
272 312
273void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color) 313void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
274{ 314{
@@ -281,7 +321,9 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
281 return; 321 return;
282 } 322 }
283 323
284 w = OMAP1_DMA_CCR2_REG(lch) & ~0x03; 324 w = dma_read(CCR2(lch));
325 w &= ~0x03;
326
285 switch (mode) { 327 switch (mode) {
286 case OMAP_DMA_CONSTANT_FILL: 328 case OMAP_DMA_CONSTANT_FILL:
287 w |= 0x01; 329 w |= 0x01;
@@ -294,52 +336,81 @@ void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
294 default: 336 default:
295 BUG(); 337 BUG();
296 } 338 }
297 OMAP1_DMA_CCR2_REG(lch) = w; 339 dma_write(w, CCR2(lch));
298 340
299 w = OMAP1_DMA_LCH_CTRL_REG(lch) & ~0x0f; 341 w = dma_read(LCH_CTRL(lch));
342 w &= ~0x0f;
300 /* Default is channel type 2D */ 343 /* Default is channel type 2D */
301 if (mode) { 344 if (mode) {
302 OMAP1_DMA_COLOR_L_REG(lch) = (u16)color; 345 dma_write((u16)color, COLOR_L(lch));
303 OMAP1_DMA_COLOR_U_REG(lch) = (u16)(color >> 16); 346 dma_write((u16)(color >> 16), COLOR_U(lch));
304 w |= 1; /* Channel type G */ 347 w |= 1; /* Channel type G */
305 } 348 }
306 OMAP1_DMA_LCH_CTRL_REG(lch) = w; 349 dma_write(w, LCH_CTRL(lch));
307} 350}
351EXPORT_SYMBOL(omap_set_dma_color_mode);
308 352
309void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode) 353void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode)
310{ 354{
311 if (cpu_class_is_omap2()) { 355 if (cpu_class_is_omap2()) {
312 OMAP_DMA_CSDP_REG(lch) &= ~(0x3 << 16); 356 u32 csdp;
313 OMAP_DMA_CSDP_REG(lch) |= (mode << 16); 357
358 csdp = dma_read(CSDP(lch));
359 csdp &= ~(0x3 << 16);
360 csdp |= (mode << 16);
361 dma_write(csdp, CSDP(lch));
362 }
363}
364EXPORT_SYMBOL(omap_set_dma_write_mode);
365
366void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode)
367{
368 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) {
369 u32 l;
370
371 l = dma_read(LCH_CTRL(lch));
372 l &= ~0x7;
373 l |= mode;
374 dma_write(l, LCH_CTRL(lch));
314 } 375 }
315} 376}
377EXPORT_SYMBOL(omap_set_dma_channel_mode);
316 378
317/* Note that src_port is only for omap1 */ 379/* Note that src_port is only for omap1 */
318void omap_set_dma_src_params(int lch, int src_port, int src_amode, 380void omap_set_dma_src_params(int lch, int src_port, int src_amode,
319 unsigned long src_start, 381 unsigned long src_start,
320 int src_ei, int src_fi) 382 int src_ei, int src_fi)
321{ 383{
384 u32 l;
385
322 if (cpu_class_is_omap1()) { 386 if (cpu_class_is_omap1()) {
323 OMAP_DMA_CSDP_REG(lch) &= ~(0x1f << 2); 387 u16 w;
324 OMAP_DMA_CSDP_REG(lch) |= src_port << 2; 388
389 w = dma_read(CSDP(lch));
390 w &= ~(0x1f << 2);
391 w |= src_port << 2;
392 dma_write(w, CSDP(lch));
325 } 393 }
326 394
327 OMAP_DMA_CCR_REG(lch) &= ~(0x03 << 12); 395 l = dma_read(CCR(lch));
328 OMAP_DMA_CCR_REG(lch) |= src_amode << 12; 396 l &= ~(0x03 << 12);
397 l |= src_amode << 12;
398 dma_write(l, CCR(lch));
329 399
330 if (cpu_class_is_omap1()) { 400 if (cpu_class_is_omap1()) {
331 OMAP1_DMA_CSSA_U_REG(lch) = src_start >> 16; 401 dma_write(src_start >> 16, CSSA_U(lch));
332 OMAP1_DMA_CSSA_L_REG(lch) = src_start; 402 dma_write((u16)src_start, CSSA_L(lch));
333 } 403 }
334 404
335 if (cpu_class_is_omap2()) 405 if (cpu_class_is_omap2())
336 OMAP2_DMA_CSSA_REG(lch) = src_start; 406 dma_write(src_start, CSSA(lch));
337 407
338 OMAP_DMA_CSEI_REG(lch) = src_ei; 408 dma_write(src_ei, CSEI(lch));
339 OMAP_DMA_CSFI_REG(lch) = src_fi; 409 dma_write(src_fi, CSFI(lch));
340} 410}
411EXPORT_SYMBOL(omap_set_dma_src_params);
341 412
342void omap_set_dma_params(int lch, struct omap_dma_channel_params * params) 413void omap_set_dma_params(int lch, struct omap_dma_channel_params *params)
343{ 414{
344 omap_set_dma_transfer_params(lch, params->data_type, 415 omap_set_dma_transfer_params(lch, params->data_type,
345 params->elem_count, params->frame_count, 416 params->elem_count, params->frame_count,
@@ -356,28 +427,37 @@ void omap_set_dma_params(int lch, struct omap_dma_channel_params * params)
356 omap_dma_set_prio_lch(lch, params->read_prio, 427 omap_dma_set_prio_lch(lch, params->read_prio,
357 params->write_prio); 428 params->write_prio);
358} 429}
430EXPORT_SYMBOL(omap_set_dma_params);
359 431
360void omap_set_dma_src_index(int lch, int eidx, int fidx) 432void omap_set_dma_src_index(int lch, int eidx, int fidx)
361{ 433{
362 if (cpu_class_is_omap2()) { 434 if (cpu_class_is_omap2())
363 REVISIT_24XX();
364 return; 435 return;
365 } 436
366 OMAP_DMA_CSEI_REG(lch) = eidx; 437 dma_write(eidx, CSEI(lch));
367 OMAP_DMA_CSFI_REG(lch) = fidx; 438 dma_write(fidx, CSFI(lch));
368} 439}
440EXPORT_SYMBOL(omap_set_dma_src_index);
369 441
370void omap_set_dma_src_data_pack(int lch, int enable) 442void omap_set_dma_src_data_pack(int lch, int enable)
371{ 443{
372 OMAP_DMA_CSDP_REG(lch) &= ~(1 << 6); 444 u32 l;
445
446 l = dma_read(CSDP(lch));
447 l &= ~(1 << 6);
373 if (enable) 448 if (enable)
374 OMAP_DMA_CSDP_REG(lch) |= (1 << 6); 449 l |= (1 << 6);
450 dma_write(l, CSDP(lch));
375} 451}
452EXPORT_SYMBOL(omap_set_dma_src_data_pack);
376 453
377void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) 454void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
378{ 455{
379 unsigned int burst = 0; 456 unsigned int burst = 0;
380 OMAP_DMA_CSDP_REG(lch) &= ~(0x03 << 7); 457 u32 l;
458
459 l = dma_read(CSDP(lch));
460 l &= ~(0x03 << 7);
381 461
382 switch (burst_mode) { 462 switch (burst_mode) {
383 case OMAP_DMA_DATA_BURST_DIS: 463 case OMAP_DMA_DATA_BURST_DIS:
@@ -408,55 +488,73 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
408 default: 488 default:
409 BUG(); 489 BUG();
410 } 490 }
411 OMAP_DMA_CSDP_REG(lch) |= (burst << 7); 491
492 l |= (burst << 7);
493 dma_write(l, CSDP(lch));
412} 494}
495EXPORT_SYMBOL(omap_set_dma_src_burst_mode);
413 496
414/* Note that dest_port is only for OMAP1 */ 497/* Note that dest_port is only for OMAP1 */
415void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, 498void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
416 unsigned long dest_start, 499 unsigned long dest_start,
417 int dst_ei, int dst_fi) 500 int dst_ei, int dst_fi)
418{ 501{
502 u32 l;
503
419 if (cpu_class_is_omap1()) { 504 if (cpu_class_is_omap1()) {
420 OMAP_DMA_CSDP_REG(lch) &= ~(0x1f << 9); 505 l = dma_read(CSDP(lch));
421 OMAP_DMA_CSDP_REG(lch) |= dest_port << 9; 506 l &= ~(0x1f << 9);
507 l |= dest_port << 9;
508 dma_write(l, CSDP(lch));
422 } 509 }
423 510
424 OMAP_DMA_CCR_REG(lch) &= ~(0x03 << 14); 511 l = dma_read(CCR(lch));
425 OMAP_DMA_CCR_REG(lch) |= dest_amode << 14; 512 l &= ~(0x03 << 14);
513 l |= dest_amode << 14;
514 dma_write(l, CCR(lch));
426 515
427 if (cpu_class_is_omap1()) { 516 if (cpu_class_is_omap1()) {
428 OMAP1_DMA_CDSA_U_REG(lch) = dest_start >> 16; 517 dma_write(dest_start >> 16, CDSA_U(lch));
429 OMAP1_DMA_CDSA_L_REG(lch) = dest_start; 518 dma_write(dest_start, CDSA_L(lch));
430 } 519 }
431 520
432 if (cpu_class_is_omap2()) 521 if (cpu_class_is_omap2())
433 OMAP2_DMA_CDSA_REG(lch) = dest_start; 522 dma_write(dest_start, CDSA(lch));
434 523
435 OMAP_DMA_CDEI_REG(lch) = dst_ei; 524 dma_write(dst_ei, CDEI(lch));
436 OMAP_DMA_CDFI_REG(lch) = dst_fi; 525 dma_write(dst_fi, CDFI(lch));
437} 526}
527EXPORT_SYMBOL(omap_set_dma_dest_params);
438 528
439void omap_set_dma_dest_index(int lch, int eidx, int fidx) 529void omap_set_dma_dest_index(int lch, int eidx, int fidx)
440{ 530{
441 if (cpu_class_is_omap2()) { 531 if (cpu_class_is_omap2())
442 REVISIT_24XX();
443 return; 532 return;
444 } 533
445 OMAP_DMA_CDEI_REG(lch) = eidx; 534 dma_write(eidx, CDEI(lch));
446 OMAP_DMA_CDFI_REG(lch) = fidx; 535 dma_write(fidx, CDFI(lch));
447} 536}
537EXPORT_SYMBOL(omap_set_dma_dest_index);
448 538
449void omap_set_dma_dest_data_pack(int lch, int enable) 539void omap_set_dma_dest_data_pack(int lch, int enable)
450{ 540{
451 OMAP_DMA_CSDP_REG(lch) &= ~(1 << 13); 541 u32 l;
542
543 l = dma_read(CSDP(lch));
544 l &= ~(1 << 13);
452 if (enable) 545 if (enable)
453 OMAP_DMA_CSDP_REG(lch) |= 1 << 13; 546 l |= 1 << 13;
547 dma_write(l, CSDP(lch));
454} 548}
549EXPORT_SYMBOL(omap_set_dma_dest_data_pack);
455 550
456void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode) 551void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
457{ 552{
458 unsigned int burst = 0; 553 unsigned int burst = 0;
459 OMAP_DMA_CSDP_REG(lch) &= ~(0x03 << 14); 554 u32 l;
555
556 l = dma_read(CSDP(lch));
557 l &= ~(0x03 << 14);
460 558
461 switch (burst_mode) { 559 switch (burst_mode) {
462 case OMAP_DMA_DATA_BURST_DIS: 560 case OMAP_DMA_DATA_BURST_DIS:
@@ -486,8 +584,10 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
486 BUG(); 584 BUG();
487 return; 585 return;
488 } 586 }
489 OMAP_DMA_CSDP_REG(lch) |= (burst << 14); 587 l |= (burst << 14);
588 dma_write(l, CSDP(lch));
490} 589}
590EXPORT_SYMBOL(omap_set_dma_dest_burst_mode);
491 591
492static inline void omap_enable_channel_irq(int lch) 592static inline void omap_enable_channel_irq(int lch)
493{ 593{
@@ -495,62 +595,74 @@ static inline void omap_enable_channel_irq(int lch)
495 595
496 /* Clear CSR */ 596 /* Clear CSR */
497 if (cpu_class_is_omap1()) 597 if (cpu_class_is_omap1())
498 status = OMAP_DMA_CSR_REG(lch); 598 status = dma_read(CSR(lch));
499 else if (cpu_class_is_omap2()) 599 else if (cpu_class_is_omap2())
500 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK; 600 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
501 601
502 /* Enable some nice interrupts. */ 602 /* Enable some nice interrupts. */
503 OMAP_DMA_CICR_REG(lch) = dma_chan[lch].enabled_irqs; 603 dma_write(dma_chan[lch].enabled_irqs, CICR(lch));
504} 604}
505 605
506static void omap_disable_channel_irq(int lch) 606static void omap_disable_channel_irq(int lch)
507{ 607{
508 if (cpu_class_is_omap2()) 608 if (cpu_class_is_omap2())
509 OMAP_DMA_CICR_REG(lch) = 0; 609 dma_write(0, CICR(lch));
510} 610}
511 611
512void omap_enable_dma_irq(int lch, u16 bits) 612void omap_enable_dma_irq(int lch, u16 bits)
513{ 613{
514 dma_chan[lch].enabled_irqs |= bits; 614 dma_chan[lch].enabled_irqs |= bits;
515} 615}
616EXPORT_SYMBOL(omap_enable_dma_irq);
516 617
517void omap_disable_dma_irq(int lch, u16 bits) 618void omap_disable_dma_irq(int lch, u16 bits)
518{ 619{
519 dma_chan[lch].enabled_irqs &= ~bits; 620 dma_chan[lch].enabled_irqs &= ~bits;
520} 621}
622EXPORT_SYMBOL(omap_disable_dma_irq);
521 623
522static inline void enable_lnk(int lch) 624static inline void enable_lnk(int lch)
523{ 625{
626 u32 l;
627
628 l = dma_read(CLNK_CTRL(lch));
629
524 if (cpu_class_is_omap1()) 630 if (cpu_class_is_omap1())
525 OMAP_DMA_CLNK_CTRL_REG(lch) &= ~(1 << 14); 631 l &= ~(1 << 14);
526 632
527 /* Set the ENABLE_LNK bits */ 633 /* Set the ENABLE_LNK bits */
528 if (dma_chan[lch].next_lch != -1) 634 if (dma_chan[lch].next_lch != -1)
529 OMAP_DMA_CLNK_CTRL_REG(lch) = 635 l = dma_chan[lch].next_lch | (1 << 15);
530 dma_chan[lch].next_lch | (1 << 15);
531 636
532#ifndef CONFIG_ARCH_OMAP1 637#ifndef CONFIG_ARCH_OMAP1
533 if (dma_chan[lch].next_linked_ch != -1) 638 if (cpu_class_is_omap2())
534 OMAP_DMA_CLNK_CTRL_REG(lch) = 639 if (dma_chan[lch].next_linked_ch != -1)
535 dma_chan[lch].next_linked_ch | (1 << 15); 640 l = dma_chan[lch].next_linked_ch | (1 << 15);
536#endif 641#endif
642
643 dma_write(l, CLNK_CTRL(lch));
537} 644}
538 645
539static inline void disable_lnk(int lch) 646static inline void disable_lnk(int lch)
540{ 647{
648 u32 l;
649
650 l = dma_read(CLNK_CTRL(lch));
651
541 /* Disable interrupts */ 652 /* Disable interrupts */
542 if (cpu_class_is_omap1()) { 653 if (cpu_class_is_omap1()) {
543 OMAP_DMA_CICR_REG(lch) = 0; 654 dma_write(0, CICR(lch));
544 /* Set the STOP_LNK bit */ 655 /* Set the STOP_LNK bit */
545 OMAP_DMA_CLNK_CTRL_REG(lch) |= 1 << 14; 656 l |= 1 << 14;
546 } 657 }
547 658
548 if (cpu_class_is_omap2()) { 659 if (cpu_class_is_omap2()) {
549 omap_disable_channel_irq(lch); 660 omap_disable_channel_irq(lch);
550 /* Clear the ENABLE_LNK bit */ 661 /* Clear the ENABLE_LNK bit */
551 OMAP_DMA_CLNK_CTRL_REG(lch) &= ~(1 << 15); 662 l &= ~(1 << 15);
552 } 663 }
553 664
665 dma_write(l, CLNK_CTRL(lch));
554 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; 666 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
555} 667}
556 668
@@ -561,13 +673,13 @@ static inline void omap2_enable_irq_lch(int lch)
561 if (!cpu_class_is_omap2()) 673 if (!cpu_class_is_omap2())
562 return; 674 return;
563 675
564 val = omap_readl(OMAP_DMA4_IRQENABLE_L0); 676 val = dma_read(IRQENABLE_L0);
565 val |= 1 << lch; 677 val |= 1 << lch;
566 omap_writel(val, OMAP_DMA4_IRQENABLE_L0); 678 dma_write(val, IRQENABLE_L0);
567} 679}
568 680
569int omap_request_dma(int dev_id, const char *dev_name, 681int omap_request_dma(int dev_id, const char *dev_name,
570 void (* callback)(int lch, u16 ch_status, void *data), 682 void (*callback)(int lch, u16 ch_status, void *data),
571 void *data, int *dma_ch_out) 683 void *data, int *dma_ch_out)
572{ 684{
573 int ch, free_ch = -1; 685 int ch, free_ch = -1;
@@ -600,10 +712,14 @@ int omap_request_dma(int dev_id, const char *dev_name,
600 chan->dev_name = dev_name; 712 chan->dev_name = dev_name;
601 chan->callback = callback; 713 chan->callback = callback;
602 chan->data = data; 714 chan->data = data;
715
603#ifndef CONFIG_ARCH_OMAP1 716#ifndef CONFIG_ARCH_OMAP1
604 chan->chain_id = -1; 717 if (cpu_class_is_omap2()) {
605 chan->next_linked_ch = -1; 718 chan->chain_id = -1;
719 chan->next_linked_ch = -1;
720 }
606#endif 721#endif
722
607 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ; 723 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
608 724
609 if (cpu_class_is_omap1()) 725 if (cpu_class_is_omap1())
@@ -618,26 +734,28 @@ int omap_request_dma(int dev_id, const char *dev_name,
618 set_gdma_dev(free_ch + 1, dev_id); 734 set_gdma_dev(free_ch + 1, dev_id);
619 dev_id = free_ch + 1; 735 dev_id = free_ch + 1;
620 } 736 }
621 /* Disable the 1510 compatibility mode and set the sync device 737 /*
622 * id. */ 738 * Disable the 1510 compatibility mode and set the sync device
623 OMAP_DMA_CCR_REG(free_ch) = dev_id | (1 << 10); 739 * id.
740 */
741 dma_write(dev_id | (1 << 10), CCR(free_ch));
624 } else if (cpu_is_omap730() || cpu_is_omap15xx()) { 742 } else if (cpu_is_omap730() || cpu_is_omap15xx()) {
625 OMAP_DMA_CCR_REG(free_ch) = dev_id; 743 dma_write(dev_id, CCR(free_ch));
626 } 744 }
627 745
628 if (cpu_class_is_omap2()) { 746 if (cpu_class_is_omap2()) {
629 omap2_enable_irq_lch(free_ch); 747 omap2_enable_irq_lch(free_ch);
630
631 omap_enable_channel_irq(free_ch); 748 omap_enable_channel_irq(free_ch);
632 /* Clear the CSR register and IRQ status register */ 749 /* Clear the CSR register and IRQ status register */
633 OMAP_DMA_CSR_REG(free_ch) = OMAP2_DMA_CSR_CLEAR_MASK; 750 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(free_ch));
634 omap_writel(1 << free_ch, OMAP_DMA4_IRQSTATUS_L0); 751 dma_write(1 << free_ch, IRQSTATUS_L0);
635 } 752 }
636 753
637 *dma_ch_out = free_ch; 754 *dma_ch_out = free_ch;
638 755
639 return 0; 756 return 0;
640} 757}
758EXPORT_SYMBOL(omap_request_dma);
641 759
642void omap_free_dma(int lch) 760void omap_free_dma(int lch)
643{ 761{
@@ -645,11 +763,12 @@ void omap_free_dma(int lch)
645 763
646 spin_lock_irqsave(&dma_chan_lock, flags); 764 spin_lock_irqsave(&dma_chan_lock, flags);
647 if (dma_chan[lch].dev_id == -1) { 765 if (dma_chan[lch].dev_id == -1) {
648 printk("omap_dma: trying to free nonallocated DMA channel %d\n", 766 pr_err("omap_dma: trying to free unallocated DMA channel %d\n",
649 lch); 767 lch);
650 spin_unlock_irqrestore(&dma_chan_lock, flags); 768 spin_unlock_irqrestore(&dma_chan_lock, flags);
651 return; 769 return;
652 } 770 }
771
653 dma_chan[lch].dev_id = -1; 772 dma_chan[lch].dev_id = -1;
654 dma_chan[lch].next_lch = -1; 773 dma_chan[lch].next_lch = -1;
655 dma_chan[lch].callback = NULL; 774 dma_chan[lch].callback = NULL;
@@ -657,30 +776,31 @@ void omap_free_dma(int lch)
657 776
658 if (cpu_class_is_omap1()) { 777 if (cpu_class_is_omap1()) {
659 /* Disable all DMA interrupts for the channel. */ 778 /* Disable all DMA interrupts for the channel. */
660 OMAP_DMA_CICR_REG(lch) = 0; 779 dma_write(0, CICR(lch));
661 /* Make sure the DMA transfer is stopped. */ 780 /* Make sure the DMA transfer is stopped. */
662 OMAP_DMA_CCR_REG(lch) = 0; 781 dma_write(0, CCR(lch));
663 } 782 }
664 783
665 if (cpu_class_is_omap2()) { 784 if (cpu_class_is_omap2()) {
666 u32 val; 785 u32 val;
667 /* Disable interrupts */ 786 /* Disable interrupts */
668 val = omap_readl(OMAP_DMA4_IRQENABLE_L0); 787 val = dma_read(IRQENABLE_L0);
669 val &= ~(1 << lch); 788 val &= ~(1 << lch);
670 omap_writel(val, OMAP_DMA4_IRQENABLE_L0); 789 dma_write(val, IRQENABLE_L0);
671 790
672 /* Clear the CSR register and IRQ status register */ 791 /* Clear the CSR register and IRQ status register */
673 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK; 792 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
674 omap_writel(1 << lch, OMAP_DMA4_IRQSTATUS_L0); 793 dma_write(1 << lch, IRQSTATUS_L0);
675 794
676 /* Disable all DMA interrupts for the channel. */ 795 /* Disable all DMA interrupts for the channel. */
677 OMAP_DMA_CICR_REG(lch) = 0; 796 dma_write(0, CICR(lch));
678 797
679 /* Make sure the DMA transfer is stopped. */ 798 /* Make sure the DMA transfer is stopped. */
680 OMAP_DMA_CCR_REG(lch) = 0; 799 dma_write(0, CCR(lch));
681 omap_clear_dma(lch); 800 omap_clear_dma(lch);
682 } 801 }
683} 802}
803EXPORT_SYMBOL(omap_free_dma);
684 804
685/** 805/**
686 * @brief omap_dma_set_global_params : Set global priority settings for dma 806 * @brief omap_dma_set_global_params : Set global priority settings for dma
@@ -708,7 +828,7 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
708 reg = (arb_rate & 0xff) << 16; 828 reg = (arb_rate & 0xff) << 16;
709 reg |= (0xff & max_fifo_depth); 829 reg |= (0xff & max_fifo_depth);
710 830
711 omap_writel(reg, OMAP_DMA4_GCR_REG); 831 dma_write(reg, GCR);
712} 832}
713EXPORT_SYMBOL(omap_dma_set_global_params); 833EXPORT_SYMBOL(omap_dma_set_global_params);
714 834
@@ -725,20 +845,21 @@ int
725omap_dma_set_prio_lch(int lch, unsigned char read_prio, 845omap_dma_set_prio_lch(int lch, unsigned char read_prio,
726 unsigned char write_prio) 846 unsigned char write_prio)
727{ 847{
728 u32 w; 848 u32 l;
729 849
730 if (unlikely((lch < 0 || lch >= OMAP_LOGICAL_DMA_CH_COUNT))) { 850 if (unlikely((lch < 0 || lch >= dma_lch_count))) {
731 printk(KERN_ERR "Invalid channel id\n"); 851 printk(KERN_ERR "Invalid channel id\n");
732 return -EINVAL; 852 return -EINVAL;
733 } 853 }
734 w = OMAP_DMA_CCR_REG(lch); 854 l = dma_read(CCR(lch));
735 w &= ~((1 << 6) | (1 << 26)); 855 l &= ~((1 << 6) | (1 << 26));
736 if (cpu_is_omap2430() || cpu_is_omap34xx()) 856 if (cpu_is_omap2430() || cpu_is_omap34xx())
737 w |= ((read_prio & 0x1) << 6) | ((write_prio & 0x1) << 26); 857 l |= ((read_prio & 0x1) << 6) | ((write_prio & 0x1) << 26);
738 else 858 else
739 w |= ((read_prio & 0x1) << 6); 859 l |= ((read_prio & 0x1) << 6);
860
861 dma_write(l, CCR(lch));
740 862
741 OMAP_DMA_CCR_REG(lch) = w;
742 return 0; 863 return 0;
743} 864}
744EXPORT_SYMBOL(omap_dma_set_prio_lch); 865EXPORT_SYMBOL(omap_dma_set_prio_lch);
@@ -754,28 +875,34 @@ void omap_clear_dma(int lch)
754 local_irq_save(flags); 875 local_irq_save(flags);
755 876
756 if (cpu_class_is_omap1()) { 877 if (cpu_class_is_omap1()) {
757 int status; 878 u32 l;
758 OMAP_DMA_CCR_REG(lch) &= ~OMAP_DMA_CCR_EN; 879
880 l = dma_read(CCR(lch));
881 l &= ~OMAP_DMA_CCR_EN;
882 dma_write(l, CCR(lch));
759 883
760 /* Clear pending interrupts */ 884 /* Clear pending interrupts */
761 status = OMAP_DMA_CSR_REG(lch); 885 l = dma_read(CSR(lch));
762 } 886 }
763 887
764 if (cpu_class_is_omap2()) { 888 if (cpu_class_is_omap2()) {
765 int i; 889 int i;
766 u32 lch_base = OMAP_DMA4_BASE + lch * 0x60 + 0x80; 890 void __iomem *lch_base = omap_dma_base + OMAP_DMA4_CH_BASE(lch);
767 for (i = 0; i < 0x44; i += 4) 891 for (i = 0; i < 0x44; i += 4)
768 omap_writel(0, lch_base + i); 892 __raw_writel(0, lch_base + i);
769 } 893 }
770 894
771 local_irq_restore(flags); 895 local_irq_restore(flags);
772} 896}
897EXPORT_SYMBOL(omap_clear_dma);
773 898
774void omap_start_dma(int lch) 899void omap_start_dma(int lch)
775{ 900{
901 u32 l;
902
776 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { 903 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
777 int next_lch, cur_lch; 904 int next_lch, cur_lch;
778 char dma_chan_link_map[OMAP_LOGICAL_DMA_CH_COUNT]; 905 char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT];
779 906
780 dma_chan_link_map[lch] = 1; 907 dma_chan_link_map[lch] = 1;
781 /* Set the link register of the first channel */ 908 /* Set the link register of the first channel */
@@ -799,27 +926,34 @@ void omap_start_dma(int lch)
799 } while (next_lch != -1); 926 } while (next_lch != -1);
800 } else if (cpu_class_is_omap2()) { 927 } else if (cpu_class_is_omap2()) {
801 /* Errata: Need to write lch even if not using chaining */ 928 /* Errata: Need to write lch even if not using chaining */
802 OMAP_DMA_CLNK_CTRL_REG(lch) = lch; 929 dma_write(lch, CLNK_CTRL(lch));
803 } 930 }
804 931
805 omap_enable_channel_irq(lch); 932 omap_enable_channel_irq(lch);
806 933
807 /* Errata: On ES2.0 BUFFERING disable must be set. 934 l = dma_read(CCR(lch));
808 * This will always fail on ES1.0 */ 935
809 if (cpu_is_omap24xx()) { 936 /*
810 OMAP_DMA_CCR_REG(lch) |= OMAP_DMA_CCR_EN; 937 * Errata: On ES2.0 BUFFERING disable must be set.
811 } 938 * This will always fail on ES1.0
939 */
940 if (cpu_is_omap24xx())
941 l |= OMAP_DMA_CCR_EN;
812 942
813 OMAP_DMA_CCR_REG(lch) |= OMAP_DMA_CCR_EN; 943 l |= OMAP_DMA_CCR_EN;
944 dma_write(l, CCR(lch));
814 945
815 dma_chan[lch].flags |= OMAP_DMA_ACTIVE; 946 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
816} 947}
948EXPORT_SYMBOL(omap_start_dma);
817 949
818void omap_stop_dma(int lch) 950void omap_stop_dma(int lch)
819{ 951{
952 u32 l;
953
820 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { 954 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
821 int next_lch, cur_lch = lch; 955 int next_lch, cur_lch = lch;
822 char dma_chan_link_map[OMAP_LOGICAL_DMA_CH_COUNT]; 956 char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT];
823 957
824 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map)); 958 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map));
825 do { 959 do {
@@ -840,18 +974,22 @@ void omap_stop_dma(int lch)
840 974
841 /* Disable all interrupts on the channel */ 975 /* Disable all interrupts on the channel */
842 if (cpu_class_is_omap1()) 976 if (cpu_class_is_omap1())
843 OMAP_DMA_CICR_REG(lch) = 0; 977 dma_write(0, CICR(lch));
978
979 l = dma_read(CCR(lch));
980 l &= ~OMAP_DMA_CCR_EN;
981 dma_write(l, CCR(lch));
844 982
845 OMAP_DMA_CCR_REG(lch) &= ~OMAP_DMA_CCR_EN;
846 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; 983 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
847} 984}
985EXPORT_SYMBOL(omap_stop_dma);
848 986
849/* 987/*
850 * Allows changing the DMA callback function or data. This may be needed if 988 * Allows changing the DMA callback function or data. This may be needed if
851 * the driver shares a single DMA channel for multiple dma triggers. 989 * the driver shares a single DMA channel for multiple dma triggers.
852 */ 990 */
853int omap_set_dma_callback(int lch, 991int omap_set_dma_callback(int lch,
854 void (* callback)(int lch, u16 ch_status, void *data), 992 void (*callback)(int lch, u16 ch_status, void *data),
855 void *data) 993 void *data)
856{ 994{
857 unsigned long flags; 995 unsigned long flags;
@@ -871,6 +1009,7 @@ int omap_set_dma_callback(int lch,
871 1009
872 return 0; 1010 return 0;
873} 1011}
1012EXPORT_SYMBOL(omap_set_dma_callback);
874 1013
875/* 1014/*
876 * Returns current physical source address for the given DMA channel. 1015 * Returns current physical source address for the given DMA channel.
@@ -884,15 +1023,24 @@ dma_addr_t omap_get_dma_src_pos(int lch)
884{ 1023{
885 dma_addr_t offset = 0; 1024 dma_addr_t offset = 0;
886 1025
887 if (cpu_class_is_omap1()) 1026 if (cpu_is_omap15xx())
888 offset = (dma_addr_t) (OMAP1_DMA_CSSA_L_REG(lch) | 1027 offset = dma_read(CPC(lch));
889 (OMAP1_DMA_CSSA_U_REG(lch) << 16)); 1028 else
1029 offset = dma_read(CSAC(lch));
890 1030
891 if (cpu_class_is_omap2()) 1031 /*
892 offset = OMAP_DMA_CSAC_REG(lch); 1032 * omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
1033 * read before the DMA controller finished disabling the channel.
1034 */
1035 if (!cpu_is_omap15xx() && offset == 0)
1036 offset = dma_read(CSAC(lch));
1037
1038 if (cpu_class_is_omap1())
1039 offset |= (dma_read(CSSA_U(lch)) << 16);
893 1040
894 return offset; 1041 return offset;
895} 1042}
1043EXPORT_SYMBOL(omap_get_dma_src_pos);
896 1044
897/* 1045/*
898 * Returns current physical destination address for the given DMA channel. 1046 * Returns current physical destination address for the given DMA channel.
@@ -906,25 +1054,30 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
906{ 1054{
907 dma_addr_t offset = 0; 1055 dma_addr_t offset = 0;
908 1056
909 if (cpu_class_is_omap1()) 1057 if (cpu_is_omap15xx())
910 offset = (dma_addr_t) (OMAP1_DMA_CDSA_L_REG(lch) | 1058 offset = dma_read(CPC(lch));
911 (OMAP1_DMA_CDSA_U_REG(lch) << 16)); 1059 else
1060 offset = dma_read(CDAC(lch));
912 1061
913 if (cpu_class_is_omap2()) 1062 /*
914 offset = OMAP_DMA_CDAC_REG(lch); 1063 * omap 3.2/3.3 erratum: sometimes 0 is returned if CSAC/CDAC is
1064 * read before the DMA controller finished disabling the channel.
1065 */
1066 if (!cpu_is_omap15xx() && offset == 0)
1067 offset = dma_read(CDAC(lch));
1068
1069 if (cpu_class_is_omap1())
1070 offset |= (dma_read(CDSA_U(lch)) << 16);
915 1071
916 return offset; 1072 return offset;
917} 1073}
1074EXPORT_SYMBOL(omap_get_dma_dst_pos);
918 1075
919/* 1076int omap_get_dma_active_status(int lch)
920 * Returns current source transfer counting for the given DMA channel.
921 * Can be used to monitor the progress of a transfer inside a block.
922 * It must be called with disabled interrupts.
923 */
924int omap_get_dma_src_addr_counter(int lch)
925{ 1077{
926 return (dma_addr_t) OMAP_DMA_CSAC_REG(lch); 1078 return (dma_read(CCR(lch)) & OMAP_DMA_CCR_EN) != 0;
927} 1079}
1080EXPORT_SYMBOL(omap_get_dma_active_status);
928 1081
929int omap_dma_running(void) 1082int omap_dma_running(void)
930{ 1083{
@@ -936,7 +1089,7 @@ int omap_dma_running(void)
936 return 1; 1089 return 1;
937 1090
938 for (lch = 0; lch < dma_chan_count; lch++) 1091 for (lch = 0; lch < dma_chan_count; lch++)
939 if (OMAP_DMA_CCR_REG(lch) & OMAP_DMA_CCR_EN) 1092 if (dma_read(CCR(lch)) & OMAP_DMA_CCR_EN)
940 return 1; 1093 return 1;
941 1094
942 return 0; 1095 return 0;
@@ -947,7 +1100,7 @@ int omap_dma_running(void)
947 * For this DMA link to start, you still need to start (see omap_start_dma) 1100 * For this DMA link to start, you still need to start (see omap_start_dma)
948 * the first one. That will fire up the entire queue. 1101 * the first one. That will fire up the entire queue.
949 */ 1102 */
950void omap_dma_link_lch (int lch_head, int lch_queue) 1103void omap_dma_link_lch(int lch_head, int lch_queue)
951{ 1104{
952 if (omap_dma_in_1510_mode()) { 1105 if (omap_dma_in_1510_mode()) {
953 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n"); 1106 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
@@ -964,11 +1117,12 @@ void omap_dma_link_lch (int lch_head, int lch_queue)
964 1117
965 dma_chan[lch_head].next_lch = lch_queue; 1118 dma_chan[lch_head].next_lch = lch_queue;
966} 1119}
1120EXPORT_SYMBOL(omap_dma_link_lch);
967 1121
968/* 1122/*
969 * Once the DMA queue is stopped, we can destroy it. 1123 * Once the DMA queue is stopped, we can destroy it.
970 */ 1124 */
971void omap_dma_unlink_lch (int lch_head, int lch_queue) 1125void omap_dma_unlink_lch(int lch_head, int lch_queue)
972{ 1126{
973 if (omap_dma_in_1510_mode()) { 1127 if (omap_dma_in_1510_mode()) {
974 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n"); 1128 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
@@ -983,7 +1137,6 @@ void omap_dma_unlink_lch (int lch_head, int lch_queue)
983 dump_stack(); 1137 dump_stack();
984 } 1138 }
985 1139
986
987 if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) || 1140 if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) ||
988 (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) { 1141 (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) {
989 printk(KERN_ERR "omap_dma: You need to stop the DMA channels " 1142 printk(KERN_ERR "omap_dma: You need to stop the DMA channels "
@@ -993,12 +1146,15 @@ void omap_dma_unlink_lch (int lch_head, int lch_queue)
993 1146
994 dma_chan[lch_head].next_lch = -1; 1147 dma_chan[lch_head].next_lch = -1;
995} 1148}
1149EXPORT_SYMBOL(omap_dma_unlink_lch);
1150
1151/*----------------------------------------------------------------------------*/
996 1152
997#ifndef CONFIG_ARCH_OMAP1 1153#ifndef CONFIG_ARCH_OMAP1
998/* Create chain of DMA channesls */ 1154/* Create chain of DMA channesls */
999static void create_dma_lch_chain(int lch_head, int lch_queue) 1155static void create_dma_lch_chain(int lch_head, int lch_queue)
1000{ 1156{
1001 u32 w; 1157 u32 l;
1002 1158
1003 /* Check if this is the first link in chain */ 1159 /* Check if this is the first link in chain */
1004 if (dma_chan[lch_head].next_linked_ch == -1) { 1160 if (dma_chan[lch_head].next_linked_ch == -1) {
@@ -1018,15 +1174,15 @@ static void create_dma_lch_chain(int lch_head, int lch_queue)
1018 lch_queue; 1174 lch_queue;
1019 } 1175 }
1020 1176
1021 w = OMAP_DMA_CLNK_CTRL_REG(lch_head); 1177 l = dma_read(CLNK_CTRL(lch_head));
1022 w &= ~(0x1f); 1178 l &= ~(0x1f);
1023 w |= lch_queue; 1179 l |= lch_queue;
1024 OMAP_DMA_CLNK_CTRL_REG(lch_head) = w; 1180 dma_write(l, CLNK_CTRL(lch_head));
1025 1181
1026 w = OMAP_DMA_CLNK_CTRL_REG(lch_queue); 1182 l = dma_read(CLNK_CTRL(lch_queue));
1027 w &= ~(0x1f); 1183 l &= ~(0x1f);
1028 w |= (dma_chan[lch_queue].next_linked_ch); 1184 l |= (dma_chan[lch_queue].next_linked_ch);
1029 OMAP_DMA_CLNK_CTRL_REG(lch_queue) = w; 1185 dma_write(l, CLNK_CTRL(lch_queue));
1030} 1186}
1031 1187
1032/** 1188/**
@@ -1061,7 +1217,7 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
1061 } 1217 }
1062 1218
1063 if (unlikely((no_of_chans < 1 1219 if (unlikely((no_of_chans < 1
1064 || no_of_chans > OMAP_LOGICAL_DMA_CH_COUNT))) { 1220 || no_of_chans > dma_lch_count))) {
1065 printk(KERN_ERR "Invalid Number of channels requested\n"); 1221 printk(KERN_ERR "Invalid Number of channels requested\n");
1066 return -EINVAL; 1222 return -EINVAL;
1067 } 1223 }
@@ -1116,6 +1272,7 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
1116 for (i = 0; i < (no_of_chans - 1); i++) 1272 for (i = 0; i < (no_of_chans - 1); i++)
1117 create_dma_lch_chain(channels[i], channels[i + 1]); 1273 create_dma_lch_chain(channels[i], channels[i + 1]);
1118 } 1274 }
1275
1119 return 0; 1276 return 0;
1120} 1277}
1121EXPORT_SYMBOL(omap_request_dma_chain); 1278EXPORT_SYMBOL(omap_request_dma_chain);
@@ -1138,7 +1295,7 @@ int omap_modify_dma_chain_params(int chain_id,
1138 1295
1139 /* Check for input params */ 1296 /* Check for input params */
1140 if (unlikely((chain_id < 0 1297 if (unlikely((chain_id < 0
1141 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1298 || chain_id >= dma_lch_count))) {
1142 printk(KERN_ERR "Invalid chain id\n"); 1299 printk(KERN_ERR "Invalid chain id\n");
1143 return -EINVAL; 1300 return -EINVAL;
1144 } 1301 }
@@ -1158,6 +1315,7 @@ int omap_modify_dma_chain_params(int chain_id,
1158 */ 1315 */
1159 omap_set_dma_params(channels[i], &params); 1316 omap_set_dma_params(channels[i], &params);
1160 } 1317 }
1318
1161 return 0; 1319 return 0;
1162} 1320}
1163EXPORT_SYMBOL(omap_modify_dma_chain_params); 1321EXPORT_SYMBOL(omap_modify_dma_chain_params);
@@ -1176,7 +1334,7 @@ int omap_free_dma_chain(int chain_id)
1176 u32 i; 1334 u32 i;
1177 1335
1178 /* Check for input params */ 1336 /* Check for input params */
1179 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1337 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1180 printk(KERN_ERR "Invalid chain id\n"); 1338 printk(KERN_ERR "Invalid chain id\n");
1181 return -EINVAL; 1339 return -EINVAL;
1182 } 1340 }
@@ -1201,6 +1359,7 @@ int omap_free_dma_chain(int chain_id)
1201 dma_linked_lch[chain_id].linked_dmach_q = NULL; 1359 dma_linked_lch[chain_id].linked_dmach_q = NULL;
1202 dma_linked_lch[chain_id].chain_mode = -1; 1360 dma_linked_lch[chain_id].chain_mode = -1;
1203 dma_linked_lch[chain_id].chain_state = -1; 1361 dma_linked_lch[chain_id].chain_state = -1;
1362
1204 return (0); 1363 return (0);
1205} 1364}
1206EXPORT_SYMBOL(omap_free_dma_chain); 1365EXPORT_SYMBOL(omap_free_dma_chain);
@@ -1216,7 +1375,7 @@ EXPORT_SYMBOL(omap_free_dma_chain);
1216int omap_dma_chain_status(int chain_id) 1375int omap_dma_chain_status(int chain_id)
1217{ 1376{
1218 /* Check for input params */ 1377 /* Check for input params */
1219 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1378 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1220 printk(KERN_ERR "Invalid chain id\n"); 1379 printk(KERN_ERR "Invalid chain id\n");
1221 return -EINVAL; 1380 return -EINVAL;
1222 } 1381 }
@@ -1231,6 +1390,7 @@ int omap_dma_chain_status(int chain_id)
1231 1390
1232 if (OMAP_DMA_CHAIN_QEMPTY(chain_id)) 1391 if (OMAP_DMA_CHAIN_QEMPTY(chain_id))
1233 return OMAP_DMA_CHAIN_INACTIVE; 1392 return OMAP_DMA_CHAIN_INACTIVE;
1393
1234 return OMAP_DMA_CHAIN_ACTIVE; 1394 return OMAP_DMA_CHAIN_ACTIVE;
1235} 1395}
1236EXPORT_SYMBOL(omap_dma_chain_status); 1396EXPORT_SYMBOL(omap_dma_chain_status);
@@ -1253,11 +1413,13 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1253 int elem_count, int frame_count, void *callbk_data) 1413 int elem_count, int frame_count, void *callbk_data)
1254{ 1414{
1255 int *channels; 1415 int *channels;
1256 u32 w, lch; 1416 u32 l, lch;
1257 int start_dma = 0; 1417 int start_dma = 0;
1258 1418
1259 /* if buffer size is less than 1 then there is 1419 /*
1260 * no use of starting the chain */ 1420 * if buffer size is less than 1 then there is
1421 * no use of starting the chain
1422 */
1261 if (elem_count < 1) { 1423 if (elem_count < 1) {
1262 printk(KERN_ERR "Invalid buffer size\n"); 1424 printk(KERN_ERR "Invalid buffer size\n");
1263 return -EINVAL; 1425 return -EINVAL;
@@ -1265,7 +1427,7 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1265 1427
1266 /* Check for input params */ 1428 /* Check for input params */
1267 if (unlikely((chain_id < 0 1429 if (unlikely((chain_id < 0
1268 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1430 || chain_id >= dma_lch_count))) {
1269 printk(KERN_ERR "Invalid chain id\n"); 1431 printk(KERN_ERR "Invalid chain id\n");
1270 return -EINVAL; 1432 return -EINVAL;
1271 } 1433 }
@@ -1294,20 +1456,24 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1294 1456
1295 /* Set the params to the free channel */ 1457 /* Set the params to the free channel */
1296 if (src_start != 0) 1458 if (src_start != 0)
1297 OMAP2_DMA_CSSA_REG(lch) = src_start; 1459 dma_write(src_start, CSSA(lch));
1298 if (dest_start != 0) 1460 if (dest_start != 0)
1299 OMAP2_DMA_CDSA_REG(lch) = dest_start; 1461 dma_write(dest_start, CDSA(lch));
1300 1462
1301 /* Write the buffer size */ 1463 /* Write the buffer size */
1302 OMAP_DMA_CEN_REG(lch) = elem_count; 1464 dma_write(elem_count, CEN(lch));
1303 OMAP_DMA_CFN_REG(lch) = frame_count; 1465 dma_write(frame_count, CFN(lch));
1304 1466
1305 /* If the chain is dynamically linked, 1467 /*
1306 * then we may have to start the chain if its not active */ 1468 * If the chain is dynamically linked,
1469 * then we may have to start the chain if its not active
1470 */
1307 if (dma_linked_lch[chain_id].chain_mode == OMAP_DMA_DYNAMIC_CHAIN) { 1471 if (dma_linked_lch[chain_id].chain_mode == OMAP_DMA_DYNAMIC_CHAIN) {
1308 1472
1309 /* In Dynamic chain, if the chain is not started, 1473 /*
1310 * queue the channel */ 1474 * In Dynamic chain, if the chain is not started,
1475 * queue the channel
1476 */
1311 if (dma_linked_lch[chain_id].chain_state == 1477 if (dma_linked_lch[chain_id].chain_state ==
1312 DMA_CHAIN_NOTSTARTED) { 1478 DMA_CHAIN_NOTSTARTED) {
1313 /* Enable the link in previous channel */ 1479 /* Enable the link in previous channel */
@@ -1317,8 +1483,10 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1317 dma_chan[lch].state = DMA_CH_QUEUED; 1483 dma_chan[lch].state = DMA_CH_QUEUED;
1318 } 1484 }
1319 1485
1320 /* Chain is already started, make sure its active, 1486 /*
1321 * if not then start the chain */ 1487 * Chain is already started, make sure its active,
1488 * if not then start the chain
1489 */
1322 else { 1490 else {
1323 start_dma = 1; 1491 start_dma = 1;
1324 1492
@@ -1327,8 +1495,8 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1327 enable_lnk(dma_chan[lch].prev_linked_ch); 1495 enable_lnk(dma_chan[lch].prev_linked_ch);
1328 dma_chan[lch].state = DMA_CH_QUEUED; 1496 dma_chan[lch].state = DMA_CH_QUEUED;
1329 start_dma = 0; 1497 start_dma = 0;
1330 if (0 == ((1 << 7) & (OMAP_DMA_CCR_REG 1498 if (0 == ((1 << 7) & dma_read(
1331 (dma_chan[lch].prev_linked_ch)))) { 1499 CCR(dma_chan[lch].prev_linked_ch)))) {
1332 disable_lnk(dma_chan[lch]. 1500 disable_lnk(dma_chan[lch].
1333 prev_linked_ch); 1501 prev_linked_ch);
1334 pr_debug("\n prev ch is stopped\n"); 1502 pr_debug("\n prev ch is stopped\n");
@@ -1344,27 +1512,28 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
1344 } 1512 }
1345 omap_enable_channel_irq(lch); 1513 omap_enable_channel_irq(lch);
1346 1514
1347 w = OMAP_DMA_CCR_REG(lch); 1515 l = dma_read(CCR(lch));
1348 1516
1349 if ((0 == (w & (1 << 24)))) 1517 if ((0 == (l & (1 << 24))))
1350 w &= ~(1 << 25); 1518 l &= ~(1 << 25);
1351 else 1519 else
1352 w |= (1 << 25); 1520 l |= (1 << 25);
1353 if (start_dma == 1) { 1521 if (start_dma == 1) {
1354 if (0 == (w & (1 << 7))) { 1522 if (0 == (l & (1 << 7))) {
1355 w |= (1 << 7); 1523 l |= (1 << 7);
1356 dma_chan[lch].state = DMA_CH_STARTED; 1524 dma_chan[lch].state = DMA_CH_STARTED;
1357 pr_debug("starting %d\n", lch); 1525 pr_debug("starting %d\n", lch);
1358 OMAP_DMA_CCR_REG(lch) = w; 1526 dma_write(l, CCR(lch));
1359 } else 1527 } else
1360 start_dma = 0; 1528 start_dma = 0;
1361 } else { 1529 } else {
1362 if (0 == (w & (1 << 7))) 1530 if (0 == (l & (1 << 7)))
1363 OMAP_DMA_CCR_REG(lch) = w; 1531 dma_write(l, CCR(lch));
1364 } 1532 }
1365 dma_chan[lch].flags |= OMAP_DMA_ACTIVE; 1533 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
1366 } 1534 }
1367 } 1535 }
1536
1368 return 0; 1537 return 0;
1369} 1538}
1370EXPORT_SYMBOL(omap_dma_chain_a_transfer); 1539EXPORT_SYMBOL(omap_dma_chain_a_transfer);
@@ -1380,9 +1549,9 @@ EXPORT_SYMBOL(omap_dma_chain_a_transfer);
1380int omap_start_dma_chain_transfers(int chain_id) 1549int omap_start_dma_chain_transfers(int chain_id)
1381{ 1550{
1382 int *channels; 1551 int *channels;
1383 u32 w, i; 1552 u32 l, i;
1384 1553
1385 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1554 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1386 printk(KERN_ERR "Invalid chain id\n"); 1555 printk(KERN_ERR "Invalid chain id\n");
1387 return -EINVAL; 1556 return -EINVAL;
1388 } 1557 }
@@ -1404,18 +1573,19 @@ int omap_start_dma_chain_transfers(int chain_id)
1404 omap_enable_channel_irq(channels[0]); 1573 omap_enable_channel_irq(channels[0]);
1405 } 1574 }
1406 1575
1407 w = OMAP_DMA_CCR_REG(channels[0]); 1576 l = dma_read(CCR(channels[0]));
1408 w |= (1 << 7); 1577 l |= (1 << 7);
1409 dma_linked_lch[chain_id].chain_state = DMA_CHAIN_STARTED; 1578 dma_linked_lch[chain_id].chain_state = DMA_CHAIN_STARTED;
1410 dma_chan[channels[0]].state = DMA_CH_STARTED; 1579 dma_chan[channels[0]].state = DMA_CH_STARTED;
1411 1580
1412 if ((0 == (w & (1 << 24)))) 1581 if ((0 == (l & (1 << 24))))
1413 w &= ~(1 << 25); 1582 l &= ~(1 << 25);
1414 else 1583 else
1415 w |= (1 << 25); 1584 l |= (1 << 25);
1416 OMAP_DMA_CCR_REG(channels[0]) = w; 1585 dma_write(l, CCR(channels[0]));
1417 1586
1418 dma_chan[channels[0]].flags |= OMAP_DMA_ACTIVE; 1587 dma_chan[channels[0]].flags |= OMAP_DMA_ACTIVE;
1588
1419 return 0; 1589 return 0;
1420} 1590}
1421EXPORT_SYMBOL(omap_start_dma_chain_transfers); 1591EXPORT_SYMBOL(omap_start_dma_chain_transfers);
@@ -1431,11 +1601,11 @@ EXPORT_SYMBOL(omap_start_dma_chain_transfers);
1431int omap_stop_dma_chain_transfers(int chain_id) 1601int omap_stop_dma_chain_transfers(int chain_id)
1432{ 1602{
1433 int *channels; 1603 int *channels;
1434 u32 w, i; 1604 u32 l, i;
1435 u32 sys_cf; 1605 u32 sys_cf;
1436 1606
1437 /* Check for input params */ 1607 /* Check for input params */
1438 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1608 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1439 printk(KERN_ERR "Invalid chain id\n"); 1609 printk(KERN_ERR "Invalid chain id\n");
1440 return -EINVAL; 1610 return -EINVAL;
1441 } 1611 }
@@ -1447,21 +1617,22 @@ int omap_stop_dma_chain_transfers(int chain_id)
1447 } 1617 }
1448 channels = dma_linked_lch[chain_id].linked_dmach_q; 1618 channels = dma_linked_lch[chain_id].linked_dmach_q;
1449 1619
1450 /* DMA Errata: 1620 /*
1621 * DMA Errata:
1451 * Special programming model needed to disable DMA before end of block 1622 * Special programming model needed to disable DMA before end of block
1452 */ 1623 */
1453 sys_cf = omap_readl(OMAP_DMA4_OCP_SYSCONFIG); 1624 sys_cf = dma_read(OCP_SYSCONFIG);
1454 w = sys_cf; 1625 l = sys_cf;
1455 /* Middle mode reg set no Standby */ 1626 /* Middle mode reg set no Standby */
1456 w &= ~((1 << 12)|(1 << 13)); 1627 l &= ~((1 << 12)|(1 << 13));
1457 omap_writel(w, OMAP_DMA4_OCP_SYSCONFIG); 1628 dma_write(l, OCP_SYSCONFIG);
1458 1629
1459 for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked; i++) { 1630 for (i = 0; i < dma_linked_lch[chain_id].no_of_lchs_linked; i++) {
1460 1631
1461 /* Stop the Channel transmission */ 1632 /* Stop the Channel transmission */
1462 w = OMAP_DMA_CCR_REG(channels[i]); 1633 l = dma_read(CCR(channels[i]));
1463 w &= ~(1 << 7); 1634 l &= ~(1 << 7);
1464 OMAP_DMA_CCR_REG(channels[i]) = w; 1635 dma_write(l, CCR(channels[i]));
1465 1636
1466 /* Disable the link in all the channels */ 1637 /* Disable the link in all the channels */
1467 disable_lnk(channels[i]); 1638 disable_lnk(channels[i]);
@@ -1474,7 +1645,8 @@ int omap_stop_dma_chain_transfers(int chain_id)
1474 OMAP_DMA_CHAIN_QINIT(chain_id); 1645 OMAP_DMA_CHAIN_QINIT(chain_id);
1475 1646
1476 /* Errata - put in the old value */ 1647 /* Errata - put in the old value */
1477 omap_writel(sys_cf, OMAP_DMA4_OCP_SYSCONFIG); 1648 dma_write(sys_cf, OCP_SYSCONFIG);
1649
1478 return 0; 1650 return 0;
1479} 1651}
1480EXPORT_SYMBOL(omap_stop_dma_chain_transfers); 1652EXPORT_SYMBOL(omap_stop_dma_chain_transfers);
@@ -1497,7 +1669,7 @@ int omap_get_dma_chain_index(int chain_id, int *ei, int *fi)
1497 int *channels; 1669 int *channels;
1498 1670
1499 /* Check for input params */ 1671 /* Check for input params */
1500 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1672 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1501 printk(KERN_ERR "Invalid chain id\n"); 1673 printk(KERN_ERR "Invalid chain id\n");
1502 return -EINVAL; 1674 return -EINVAL;
1503 } 1675 }
@@ -1515,8 +1687,8 @@ int omap_get_dma_chain_index(int chain_id, int *ei, int *fi)
1515 /* Get the current channel */ 1687 /* Get the current channel */
1516 lch = channels[dma_linked_lch[chain_id].q_head]; 1688 lch = channels[dma_linked_lch[chain_id].q_head];
1517 1689
1518 *ei = OMAP2_DMA_CCEN_REG(lch); 1690 *ei = dma_read(CCEN(lch));
1519 *fi = OMAP2_DMA_CCFN_REG(lch); 1691 *fi = dma_read(CCFN(lch));
1520 1692
1521 return 0; 1693 return 0;
1522} 1694}
@@ -1537,7 +1709,7 @@ int omap_get_dma_chain_dst_pos(int chain_id)
1537 int *channels; 1709 int *channels;
1538 1710
1539 /* Check for input params */ 1711 /* Check for input params */
1540 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1712 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1541 printk(KERN_ERR "Invalid chain id\n"); 1713 printk(KERN_ERR "Invalid chain id\n");
1542 return -EINVAL; 1714 return -EINVAL;
1543 } 1715 }
@@ -1553,7 +1725,7 @@ int omap_get_dma_chain_dst_pos(int chain_id)
1553 /* Get the current channel */ 1725 /* Get the current channel */
1554 lch = channels[dma_linked_lch[chain_id].q_head]; 1726 lch = channels[dma_linked_lch[chain_id].q_head];
1555 1727
1556 return (OMAP_DMA_CDAC_REG(lch)); 1728 return dma_read(CDAC(lch));
1557} 1729}
1558EXPORT_SYMBOL(omap_get_dma_chain_dst_pos); 1730EXPORT_SYMBOL(omap_get_dma_chain_dst_pos);
1559 1731
@@ -1571,7 +1743,7 @@ int omap_get_dma_chain_src_pos(int chain_id)
1571 int *channels; 1743 int *channels;
1572 1744
1573 /* Check for input params */ 1745 /* Check for input params */
1574 if (unlikely((chain_id < 0 || chain_id >= OMAP_LOGICAL_DMA_CH_COUNT))) { 1746 if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
1575 printk(KERN_ERR "Invalid chain id\n"); 1747 printk(KERN_ERR "Invalid chain id\n");
1576 return -EINVAL; 1748 return -EINVAL;
1577 } 1749 }
@@ -1587,10 +1759,10 @@ int omap_get_dma_chain_src_pos(int chain_id)
1587 /* Get the current channel */ 1759 /* Get the current channel */
1588 lch = channels[dma_linked_lch[chain_id].q_head]; 1760 lch = channels[dma_linked_lch[chain_id].q_head];
1589 1761
1590 return (OMAP_DMA_CSAC_REG(lch)); 1762 return dma_read(CSAC(lch));
1591} 1763}
1592EXPORT_SYMBOL(omap_get_dma_chain_src_pos); 1764EXPORT_SYMBOL(omap_get_dma_chain_src_pos);
1593#endif 1765#endif /* ifndef CONFIG_ARCH_OMAP1 */
1594 1766
1595/*----------------------------------------------------------------------------*/ 1767/*----------------------------------------------------------------------------*/
1596 1768
@@ -1598,13 +1770,13 @@ EXPORT_SYMBOL(omap_get_dma_chain_src_pos);
1598 1770
1599static int omap1_dma_handle_ch(int ch) 1771static int omap1_dma_handle_ch(int ch)
1600{ 1772{
1601 u16 csr; 1773 u32 csr;
1602 1774
1603 if (enable_1510_mode && ch >= 6) { 1775 if (enable_1510_mode && ch >= 6) {
1604 csr = dma_chan[ch].saved_csr; 1776 csr = dma_chan[ch].saved_csr;
1605 dma_chan[ch].saved_csr = 0; 1777 dma_chan[ch].saved_csr = 0;
1606 } else 1778 } else
1607 csr = OMAP_DMA_CSR_REG(ch); 1779 csr = dma_read(CSR(ch));
1608 if (enable_1510_mode && ch <= 2 && (csr >> 7) != 0) { 1780 if (enable_1510_mode && ch <= 2 && (csr >> 7) != 0) {
1609 dma_chan[ch + 6].saved_csr = csr >> 7; 1781 dma_chan[ch + 6].saved_csr = csr >> 7;
1610 csr &= 0x7f; 1782 csr &= 0x7f;
@@ -1626,6 +1798,7 @@ static int omap1_dma_handle_ch(int ch)
1626 dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE; 1798 dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE;
1627 if (likely(dma_chan[ch].callback != NULL)) 1799 if (likely(dma_chan[ch].callback != NULL))
1628 dma_chan[ch].callback(ch, csr, dma_chan[ch].data); 1800 dma_chan[ch].callback(ch, csr, dma_chan[ch].data);
1801
1629 return 1; 1802 return 1;
1630} 1803}
1631 1804
@@ -1656,12 +1829,13 @@ static irqreturn_t omap1_dma_irq_handler(int irq, void *dev_id)
1656 1829
1657static int omap2_dma_handle_ch(int ch) 1830static int omap2_dma_handle_ch(int ch)
1658{ 1831{
1659 u32 status = OMAP_DMA_CSR_REG(ch); 1832 u32 status = dma_read(CSR(ch));
1660 1833
1661 if (!status) { 1834 if (!status) {
1662 if (printk_ratelimit()) 1835 if (printk_ratelimit())
1663 printk(KERN_WARNING "Spurious DMA IRQ for lch %d\n", ch); 1836 printk(KERN_WARNING "Spurious DMA IRQ for lch %d\n",
1664 omap_writel(1 << ch, OMAP_DMA4_IRQSTATUS_L0); 1837 ch);
1838 dma_write(1 << ch, IRQSTATUS_L0);
1665 return 0; 1839 return 0;
1666 } 1840 }
1667 if (unlikely(dma_chan[ch].dev_id == -1)) { 1841 if (unlikely(dma_chan[ch].dev_id == -1)) {
@@ -1684,14 +1858,14 @@ static int omap2_dma_handle_ch(int ch)
1684 printk(KERN_INFO "DMA misaligned error with device %d\n", 1858 printk(KERN_INFO "DMA misaligned error with device %d\n",
1685 dma_chan[ch].dev_id); 1859 dma_chan[ch].dev_id);
1686 1860
1687 OMAP_DMA_CSR_REG(ch) = OMAP2_DMA_CSR_CLEAR_MASK; 1861 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(ch));
1688 omap_writel(1 << ch, OMAP_DMA4_IRQSTATUS_L0); 1862 dma_write(1 << ch, IRQSTATUS_L0);
1689 1863
1690 /* If the ch is not chained then chain_id will be -1 */ 1864 /* If the ch is not chained then chain_id will be -1 */
1691 if (dma_chan[ch].chain_id != -1) { 1865 if (dma_chan[ch].chain_id != -1) {
1692 int chain_id = dma_chan[ch].chain_id; 1866 int chain_id = dma_chan[ch].chain_id;
1693 dma_chan[ch].state = DMA_CH_NOTSTARTED; 1867 dma_chan[ch].state = DMA_CH_NOTSTARTED;
1694 if (OMAP_DMA_CLNK_CTRL_REG(ch) & (1 << 15)) 1868 if (dma_read(CLNK_CTRL(ch)) & (1 << 15))
1695 dma_chan[dma_chan[ch].next_linked_ch].state = 1869 dma_chan[dma_chan[ch].next_linked_ch].state =
1696 DMA_CH_STARTED; 1870 DMA_CH_STARTED;
1697 if (dma_linked_lch[chain_id].chain_mode == 1871 if (dma_linked_lch[chain_id].chain_mode ==
@@ -1701,13 +1875,13 @@ static int omap2_dma_handle_ch(int ch)
1701 if (!OMAP_DMA_CHAIN_QEMPTY(chain_id)) 1875 if (!OMAP_DMA_CHAIN_QEMPTY(chain_id))
1702 OMAP_DMA_CHAIN_INCQHEAD(chain_id); 1876 OMAP_DMA_CHAIN_INCQHEAD(chain_id);
1703 1877
1704 status = OMAP_DMA_CSR_REG(ch); 1878 status = dma_read(CSR(ch));
1705 } 1879 }
1706 1880
1707 if (likely(dma_chan[ch].callback != NULL)) 1881 if (likely(dma_chan[ch].callback != NULL))
1708 dma_chan[ch].callback(ch, status, dma_chan[ch].data); 1882 dma_chan[ch].callback(ch, status, dma_chan[ch].data);
1709 1883
1710 OMAP_DMA_CSR_REG(ch) = status; 1884 dma_write(status, CSR(ch));
1711 1885
1712 return 0; 1886 return 0;
1713} 1887}
@@ -1718,13 +1892,13 @@ static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id)
1718 u32 val; 1892 u32 val;
1719 int i; 1893 int i;
1720 1894
1721 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0); 1895 val = dma_read(IRQSTATUS_L0);
1722 if (val == 0) { 1896 if (val == 0) {
1723 if (printk_ratelimit()) 1897 if (printk_ratelimit())
1724 printk(KERN_WARNING "Spurious DMA IRQ\n"); 1898 printk(KERN_WARNING "Spurious DMA IRQ\n");
1725 return IRQ_HANDLED; 1899 return IRQ_HANDLED;
1726 } 1900 }
1727 for (i = 0; i < OMAP_LOGICAL_DMA_CH_COUNT && val != 0; i++) { 1901 for (i = 0; i < dma_lch_count && val != 0; i++) {
1728 if (val & 1) 1902 if (val & 1)
1729 omap2_dma_handle_ch(i); 1903 omap2_dma_handle_ch(i);
1730 val >>= 1; 1904 val >>= 1;
@@ -1748,7 +1922,7 @@ static struct irqaction omap24xx_dma_irq;
1748static struct lcd_dma_info { 1922static struct lcd_dma_info {
1749 spinlock_t lock; 1923 spinlock_t lock;
1750 int reserved; 1924 int reserved;
1751 void (* callback)(u16 status, void *data); 1925 void (*callback)(u16 status, void *data);
1752 void *cb_data; 1926 void *cb_data;
1753 1927
1754 int active; 1928 int active;
@@ -1770,6 +1944,7 @@ void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
1770 lcd_dma.xres = fb_xres; 1944 lcd_dma.xres = fb_xres;
1771 lcd_dma.yres = fb_yres; 1945 lcd_dma.yres = fb_yres;
1772} 1946}
1947EXPORT_SYMBOL(omap_set_lcd_dma_b1);
1773 1948
1774void omap_set_lcd_dma_src_port(int port) 1949void omap_set_lcd_dma_src_port(int port)
1775{ 1950{
@@ -1780,12 +1955,13 @@ void omap_set_lcd_dma_ext_controller(int external)
1780{ 1955{
1781 lcd_dma.ext_ctrl = external; 1956 lcd_dma.ext_ctrl = external;
1782} 1957}
1958EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
1783 1959
1784void omap_set_lcd_dma_single_transfer(int single) 1960void omap_set_lcd_dma_single_transfer(int single)
1785{ 1961{
1786 lcd_dma.single_transfer = single; 1962 lcd_dma.single_transfer = single;
1787} 1963}
1788 1964EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
1789 1965
1790void omap_set_lcd_dma_b1_rotation(int rotate) 1966void omap_set_lcd_dma_b1_rotation(int rotate)
1791{ 1967{
@@ -1796,6 +1972,7 @@ void omap_set_lcd_dma_b1_rotation(int rotate)
1796 } 1972 }
1797 lcd_dma.rotate = rotate; 1973 lcd_dma.rotate = rotate;
1798} 1974}
1975EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
1799 1976
1800void omap_set_lcd_dma_b1_mirror(int mirror) 1977void omap_set_lcd_dma_b1_mirror(int mirror)
1801{ 1978{
@@ -1805,6 +1982,7 @@ void omap_set_lcd_dma_b1_mirror(int mirror)
1805 } 1982 }
1806 lcd_dma.mirror = mirror; 1983 lcd_dma.mirror = mirror;
1807} 1984}
1985EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
1808 1986
1809void omap_set_lcd_dma_b1_vxres(unsigned long vxres) 1987void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
1810{ 1988{
@@ -1815,6 +1993,7 @@ void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
1815 } 1993 }
1816 lcd_dma.vxres = vxres; 1994 lcd_dma.vxres = vxres;
1817} 1995}
1996EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
1818 1997
1819void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) 1998void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
1820{ 1999{
@@ -1825,6 +2004,7 @@ void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
1825 lcd_dma.xscale = xscale; 2004 lcd_dma.xscale = xscale;
1826 lcd_dma.yscale = yscale; 2005 lcd_dma.yscale = yscale;
1827} 2006}
2007EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
1828 2008
1829static void set_b1_regs(void) 2009static void set_b1_regs(void)
1830{ 2010{
@@ -1855,8 +2035,11 @@ static void set_b1_regs(void)
1855 xscale = lcd_dma.xscale ? lcd_dma.xscale : 1; 2035 xscale = lcd_dma.xscale ? lcd_dma.xscale : 1;
1856 yscale = lcd_dma.yscale ? lcd_dma.yscale : 1; 2036 yscale = lcd_dma.yscale ? lcd_dma.yscale : 1;
1857 BUG_ON(vxres < lcd_dma.xres); 2037 BUG_ON(vxres < lcd_dma.xres);
1858#define PIXADDR(x,y) (lcd_dma.addr + ((y) * vxres * yscale + (x) * xscale) * es) 2038
2039#define PIXADDR(x, y) (lcd_dma.addr + \
2040 ((y) * vxres * yscale + (x) * xscale) * es)
1859#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1) 2041#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1)
2042
1860 switch (lcd_dma.rotate) { 2043 switch (lcd_dma.rotate) {
1861 case 0: 2044 case 0:
1862 if (!lcd_dma.mirror) { 2045 if (!lcd_dma.mirror) {
@@ -1865,8 +2048,8 @@ static void set_b1_regs(void)
1865 /* 1510 DMA requires the bottom address to be 2 more 2048 /* 1510 DMA requires the bottom address to be 2 more
1866 * than the actual last memory access location. */ 2049 * than the actual last memory access location. */
1867 if (omap_dma_in_1510_mode() && 2050 if (omap_dma_in_1510_mode() &&
1868 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) 2051 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32)
1869 bottom += 2; 2052 bottom += 2;
1870 ei = PIXSTEP(0, 0, 1, 0); 2053 ei = PIXSTEP(0, 0, 1, 0);
1871 fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1); 2054 fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1);
1872 } else { 2055 } else {
@@ -1993,7 +2176,7 @@ static irqreturn_t lcd_dma_irq_handler(int irq, void *dev_id)
1993 return IRQ_HANDLED; 2176 return IRQ_HANDLED;
1994} 2177}
1995 2178
1996int omap_request_lcd_dma(void (* callback)(u16 status, void *data), 2179int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
1997 void *data) 2180 void *data)
1998{ 2181{
1999 spin_lock_irq(&lcd_dma.lock); 2182 spin_lock_irq(&lcd_dma.lock);
@@ -2019,6 +2202,7 @@ int omap_request_lcd_dma(void (* callback)(u16 status, void *data),
2019 2202
2020 return 0; 2203 return 0;
2021} 2204}
2205EXPORT_SYMBOL(omap_request_lcd_dma);
2022 2206
2023void omap_free_lcd_dma(void) 2207void omap_free_lcd_dma(void)
2024{ 2208{
@@ -2035,12 +2219,14 @@ void omap_free_lcd_dma(void)
2035 lcd_dma.reserved = 0; 2219 lcd_dma.reserved = 0;
2036 spin_unlock(&lcd_dma.lock); 2220 spin_unlock(&lcd_dma.lock);
2037} 2221}
2222EXPORT_SYMBOL(omap_free_lcd_dma);
2038 2223
2039void omap_enable_lcd_dma(void) 2224void omap_enable_lcd_dma(void)
2040{ 2225{
2041 u16 w; 2226 u16 w;
2042 2227
2043 /* Set the Enable bit only if an external controller is 2228 /*
2229 * Set the Enable bit only if an external controller is
2044 * connected. Otherwise the OMAP internal controller will 2230 * connected. Otherwise the OMAP internal controller will
2045 * start the transfer when it gets enabled. 2231 * start the transfer when it gets enabled.
2046 */ 2232 */
@@ -2057,6 +2243,7 @@ void omap_enable_lcd_dma(void)
2057 w |= 1 << 7; 2243 w |= 1 << 7;
2058 omap_writew(w, OMAP1610_DMA_LCD_CCR); 2244 omap_writew(w, OMAP1610_DMA_LCD_CCR);
2059} 2245}
2246EXPORT_SYMBOL(omap_enable_lcd_dma);
2060 2247
2061void omap_setup_lcd_dma(void) 2248void omap_setup_lcd_dma(void)
2062{ 2249{
@@ -2072,16 +2259,18 @@ void omap_setup_lcd_dma(void)
2072 u16 w; 2259 u16 w;
2073 2260
2074 w = omap_readw(OMAP1610_DMA_LCD_CCR); 2261 w = omap_readw(OMAP1610_DMA_LCD_CCR);
2075 /* If DMA was already active set the end_prog bit to have 2262 /*
2263 * If DMA was already active set the end_prog bit to have
2076 * the programmed register set loaded into the active 2264 * the programmed register set loaded into the active
2077 * register set. 2265 * register set.
2078 */ 2266 */
2079 w |= 1 << 11; /* End_prog */ 2267 w |= 1 << 11; /* End_prog */
2080 if (!lcd_dma.single_transfer) 2268 if (!lcd_dma.single_transfer)
2081 w |= (3 << 8); /* Auto_init, repeat */ 2269 w |= (3 << 8); /* Auto_init, repeat */
2082 omap_writew(w, OMAP1610_DMA_LCD_CCR); 2270 omap_writew(w, OMAP1610_DMA_LCD_CCR);
2083 } 2271 }
2084} 2272}
2273EXPORT_SYMBOL(omap_setup_lcd_dma);
2085 2274
2086void omap_stop_lcd_dma(void) 2275void omap_stop_lcd_dma(void)
2087{ 2276{
@@ -2099,6 +2288,7 @@ void omap_stop_lcd_dma(void)
2099 w &= ~(1 << 8); 2288 w &= ~(1 << 8);
2100 omap_writew(w, OMAP1610_DMA_LCD_CTRL); 2289 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2101} 2290}
2291EXPORT_SYMBOL(omap_stop_lcd_dma);
2102 2292
2103/*----------------------------------------------------------------------------*/ 2293/*----------------------------------------------------------------------------*/
2104 2294
@@ -2106,27 +2296,55 @@ static int __init omap_init_dma(void)
2106{ 2296{
2107 int ch, r; 2297 int ch, r;
2108 2298
2299 if (cpu_class_is_omap1()) {
2300 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP1_DMA_BASE);
2301 dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT;
2302 } else if (cpu_is_omap24xx()) {
2303 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP24XX_DMA4_BASE);
2304 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2305 } else if (cpu_is_omap34xx()) {
2306 omap_dma_base = (void __iomem *)IO_ADDRESS(OMAP34XX_DMA4_BASE);
2307 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2308 } else {
2309 pr_err("DMA init failed for unsupported omap\n");
2310 return -ENODEV;
2311 }
2312
2313 dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count,
2314 GFP_KERNEL);
2315 if (!dma_chan)
2316 return -ENOMEM;
2317
2318 if (cpu_class_is_omap2()) {
2319 dma_linked_lch = kzalloc(sizeof(struct dma_link_info) *
2320 dma_lch_count, GFP_KERNEL);
2321 if (!dma_linked_lch) {
2322 kfree(dma_chan);
2323 return -ENOMEM;
2324 }
2325 }
2326
2109 if (cpu_is_omap15xx()) { 2327 if (cpu_is_omap15xx()) {
2110 printk(KERN_INFO "DMA support for OMAP15xx initialized\n"); 2328 printk(KERN_INFO "DMA support for OMAP15xx initialized\n");
2111 dma_chan_count = 9; 2329 dma_chan_count = 9;
2112 enable_1510_mode = 1; 2330 enable_1510_mode = 1;
2113 } else if (cpu_is_omap16xx() || cpu_is_omap730()) { 2331 } else if (cpu_is_omap16xx() || cpu_is_omap730()) {
2114 printk(KERN_INFO "OMAP DMA hardware version %d\n", 2332 printk(KERN_INFO "OMAP DMA hardware version %d\n",
2115 omap_readw(OMAP_DMA_HW_ID)); 2333 dma_read(HW_ID));
2116 printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n", 2334 printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n",
2117 (omap_readw(OMAP_DMA_CAPS_0_U) << 16) | 2335 (dma_read(CAPS_0_U) << 16) |
2118 omap_readw(OMAP_DMA_CAPS_0_L), 2336 dma_read(CAPS_0_L),
2119 (omap_readw(OMAP_DMA_CAPS_1_U) << 16) | 2337 (dma_read(CAPS_1_U) << 16) |
2120 omap_readw(OMAP_DMA_CAPS_1_L), 2338 dma_read(CAPS_1_L),
2121 omap_readw(OMAP_DMA_CAPS_2), omap_readw(OMAP_DMA_CAPS_3), 2339 dma_read(CAPS_2), dma_read(CAPS_3),
2122 omap_readw(OMAP_DMA_CAPS_4)); 2340 dma_read(CAPS_4));
2123 if (!enable_1510_mode) { 2341 if (!enable_1510_mode) {
2124 u16 w; 2342 u16 w;
2125 2343
2126 /* Disable OMAP 3.0/3.1 compatibility mode. */ 2344 /* Disable OMAP 3.0/3.1 compatibility mode. */
2127 w = omap_readw(OMAP_DMA_GSCR); 2345 w = dma_read(GSCR);
2128 w |= 1 << 3; 2346 w |= 1 << 3;
2129 omap_writew(w, OMAP_DMA_GSCR); 2347 dma_write(w, GSCR);
2130 dma_chan_count = 16; 2348 dma_chan_count = 16;
2131 } else 2349 } else
2132 dma_chan_count = 9; 2350 dma_chan_count = 9;
@@ -2139,19 +2357,17 @@ static int __init omap_init_dma(void)
2139 omap_writew(w, OMAP1610_DMA_LCD_CTRL); 2357 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2140 } 2358 }
2141 } else if (cpu_class_is_omap2()) { 2359 } else if (cpu_class_is_omap2()) {
2142 u8 revision = omap_readb(OMAP_DMA4_REVISION); 2360 u8 revision = dma_read(REVISION) & 0xff;
2143 printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", 2361 printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n",
2144 revision >> 4, revision & 0xf); 2362 revision >> 4, revision & 0xf);
2145 dma_chan_count = OMAP_LOGICAL_DMA_CH_COUNT; 2363 dma_chan_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2146 } else { 2364 } else {
2147 dma_chan_count = 0; 2365 dma_chan_count = 0;
2148 return 0; 2366 return 0;
2149 } 2367 }
2150 2368
2151 memset(&lcd_dma, 0, sizeof(lcd_dma));
2152 spin_lock_init(&lcd_dma.lock); 2369 spin_lock_init(&lcd_dma.lock);
2153 spin_lock_init(&dma_chan_lock); 2370 spin_lock_init(&dma_chan_lock);
2154 memset(&dma_chan, 0, sizeof(dma_chan));
2155 2371
2156 for (ch = 0; ch < dma_chan_count; ch++) { 2372 for (ch = 0; ch < dma_chan_count; ch++) {
2157 omap_clear_dma(ch); 2373 omap_clear_dma(ch);
@@ -2162,8 +2378,10 @@ static int __init omap_init_dma(void)
2162 continue; 2378 continue;
2163 2379
2164 if (cpu_class_is_omap1()) { 2380 if (cpu_class_is_omap1()) {
2165 /* request_irq() doesn't like dev_id (ie. ch) being 2381 /*
2166 * zero, so we have to kludge around this. */ 2382 * request_irq() doesn't like dev_id (ie. ch) being
2383 * zero, so we have to kludge around this.
2384 */
2167 r = request_irq(omap1_dma_irq[ch], 2385 r = request_irq(omap1_dma_irq[ch],
2168 omap1_dma_irq_handler, 0, "DMA", 2386 omap1_dma_irq_handler, 0, "DMA",
2169 (void *) (ch + 1)); 2387 (void *) (ch + 1));
@@ -2208,48 +2426,4 @@ static int __init omap_init_dma(void)
2208 2426
2209arch_initcall(omap_init_dma); 2427arch_initcall(omap_init_dma);
2210 2428
2211EXPORT_SYMBOL(omap_get_dma_src_pos);
2212EXPORT_SYMBOL(omap_get_dma_dst_pos);
2213EXPORT_SYMBOL(omap_get_dma_src_addr_counter);
2214EXPORT_SYMBOL(omap_clear_dma);
2215EXPORT_SYMBOL(omap_set_dma_priority);
2216EXPORT_SYMBOL(omap_request_dma);
2217EXPORT_SYMBOL(omap_free_dma);
2218EXPORT_SYMBOL(omap_start_dma);
2219EXPORT_SYMBOL(omap_stop_dma);
2220EXPORT_SYMBOL(omap_set_dma_callback);
2221EXPORT_SYMBOL(omap_enable_dma_irq);
2222EXPORT_SYMBOL(omap_disable_dma_irq);
2223
2224EXPORT_SYMBOL(omap_set_dma_transfer_params);
2225EXPORT_SYMBOL(omap_set_dma_color_mode);
2226EXPORT_SYMBOL(omap_set_dma_write_mode);
2227
2228EXPORT_SYMBOL(omap_set_dma_src_params);
2229EXPORT_SYMBOL(omap_set_dma_src_index);
2230EXPORT_SYMBOL(omap_set_dma_src_data_pack);
2231EXPORT_SYMBOL(omap_set_dma_src_burst_mode);
2232
2233EXPORT_SYMBOL(omap_set_dma_dest_params);
2234EXPORT_SYMBOL(omap_set_dma_dest_index);
2235EXPORT_SYMBOL(omap_set_dma_dest_data_pack);
2236EXPORT_SYMBOL(omap_set_dma_dest_burst_mode);
2237
2238EXPORT_SYMBOL(omap_set_dma_params);
2239
2240EXPORT_SYMBOL(omap_dma_link_lch);
2241EXPORT_SYMBOL(omap_dma_unlink_lch);
2242
2243EXPORT_SYMBOL(omap_request_lcd_dma);
2244EXPORT_SYMBOL(omap_free_lcd_dma);
2245EXPORT_SYMBOL(omap_enable_lcd_dma);
2246EXPORT_SYMBOL(omap_setup_lcd_dma);
2247EXPORT_SYMBOL(omap_stop_lcd_dma);
2248EXPORT_SYMBOL(omap_set_lcd_dma_b1);
2249EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
2250EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
2251EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
2252EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
2253EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
2254EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
2255 2429
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 302ad8dff2cb..f22506af0e67 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -38,34 +38,113 @@
38#include <asm/arch/irqs.h> 38#include <asm/arch/irqs.h>
39 39
40/* register offsets */ 40/* register offsets */
41#define OMAP_TIMER_ID_REG 0x00 41#define _OMAP_TIMER_ID_OFFSET 0x00
42#define OMAP_TIMER_OCP_CFG_REG 0x10 42#define _OMAP_TIMER_OCP_CFG_OFFSET 0x10
43#define OMAP_TIMER_SYS_STAT_REG 0x14 43#define _OMAP_TIMER_SYS_STAT_OFFSET 0x14
44#define OMAP_TIMER_STAT_REG 0x18 44#define _OMAP_TIMER_STAT_OFFSET 0x18
45#define OMAP_TIMER_INT_EN_REG 0x1c 45#define _OMAP_TIMER_INT_EN_OFFSET 0x1c
46#define OMAP_TIMER_WAKEUP_EN_REG 0x20 46#define _OMAP_TIMER_WAKEUP_EN_OFFSET 0x20
47#define OMAP_TIMER_CTRL_REG 0x24 47#define _OMAP_TIMER_CTRL_OFFSET 0x24
48#define OMAP_TIMER_COUNTER_REG 0x28 48#define OMAP_TIMER_CTRL_GPOCFG (1 << 14)
49#define OMAP_TIMER_LOAD_REG 0x2c 49#define OMAP_TIMER_CTRL_CAPTMODE (1 << 13)
50#define OMAP_TIMER_TRIGGER_REG 0x30 50#define OMAP_TIMER_CTRL_PT (1 << 12)
51#define OMAP_TIMER_WRITE_PEND_REG 0x34 51#define OMAP_TIMER_CTRL_TCM_LOWTOHIGH (0x1 << 8)
52#define OMAP_TIMER_MATCH_REG 0x38 52#define OMAP_TIMER_CTRL_TCM_HIGHTOLOW (0x2 << 8)
53#define OMAP_TIMER_CAPTURE_REG 0x3c 53#define OMAP_TIMER_CTRL_TCM_BOTHEDGES (0x3 << 8)
54#define OMAP_TIMER_IF_CTRL_REG 0x40 54#define OMAP_TIMER_CTRL_SCPWM (1 << 7)
55 55#define OMAP_TIMER_CTRL_CE (1 << 6) /* compare enable */
56/* timer control reg bits */ 56#define OMAP_TIMER_CTRL_PRE (1 << 5) /* prescaler enable */
57#define OMAP_TIMER_CTRL_GPOCFG (1 << 14) 57#define OMAP_TIMER_CTRL_PTV_SHIFT 2 /* prescaler value shift */
58#define OMAP_TIMER_CTRL_CAPTMODE (1 << 13) 58#define OMAP_TIMER_CTRL_POSTED (1 << 2)
59#define OMAP_TIMER_CTRL_PT (1 << 12) 59#define OMAP_TIMER_CTRL_AR (1 << 1) /* auto-reload enable */
60#define OMAP_TIMER_CTRL_TCM_LOWTOHIGH (0x1 << 8) 60#define OMAP_TIMER_CTRL_ST (1 << 0) /* start timer */
61#define OMAP_TIMER_CTRL_TCM_HIGHTOLOW (0x2 << 8) 61#define _OMAP_TIMER_COUNTER_OFFSET 0x28
62#define OMAP_TIMER_CTRL_TCM_BOTHEDGES (0x3 << 8) 62#define _OMAP_TIMER_LOAD_OFFSET 0x2c
63#define OMAP_TIMER_CTRL_SCPWM (1 << 7) 63#define _OMAP_TIMER_TRIGGER_OFFSET 0x30
64#define OMAP_TIMER_CTRL_CE (1 << 6) /* compare enable */ 64#define _OMAP_TIMER_WRITE_PEND_OFFSET 0x34
65#define OMAP_TIMER_CTRL_PRE (1 << 5) /* prescaler enable */ 65#define WP_NONE 0 /* no write pending bit */
66#define OMAP_TIMER_CTRL_PTV_SHIFT 2 /* how much to shift the prescaler value */ 66#define WP_TCLR (1 << 0)
67#define OMAP_TIMER_CTRL_AR (1 << 1) /* auto-reload enable */ 67#define WP_TCRR (1 << 1)
68#define OMAP_TIMER_CTRL_ST (1 << 0) /* start timer */ 68#define WP_TLDR (1 << 2)
69#define WP_TTGR (1 << 3)
70#define WP_TMAR (1 << 4)
71#define WP_TPIR (1 << 5)
72#define WP_TNIR (1 << 6)
73#define WP_TCVR (1 << 7)
74#define WP_TOCR (1 << 8)
75#define WP_TOWR (1 << 9)
76#define _OMAP_TIMER_MATCH_OFFSET 0x38
77#define _OMAP_TIMER_CAPTURE_OFFSET 0x3c
78#define _OMAP_TIMER_IF_CTRL_OFFSET 0x40
79#define _OMAP_TIMER_CAPTURE2_OFFSET 0x44 /* TCAR2, 34xx only */
80#define _OMAP_TIMER_TICK_POS_OFFSET 0x48 /* TPIR, 34xx only */
81#define _OMAP_TIMER_TICK_NEG_OFFSET 0x4c /* TNIR, 34xx only */
82#define _OMAP_TIMER_TICK_COUNT_OFFSET 0x50 /* TCVR, 34xx only */
83#define _OMAP_TIMER_TICK_INT_MASK_SET_OFFSET 0x54 /* TOCR, 34xx only */
84#define _OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET 0x58 /* TOWR, 34xx only */
85
86/* register offsets with the write pending bit encoded */
87#define WPSHIFT 16
88
89#define OMAP_TIMER_ID_REG (_OMAP_TIMER_ID_OFFSET \
90 | (WP_NONE << WPSHIFT))
91
92#define OMAP_TIMER_OCP_CFG_REG (_OMAP_TIMER_OCP_CFG_OFFSET \
93 | (WP_NONE << WPSHIFT))
94
95#define OMAP_TIMER_SYS_STAT_REG (_OMAP_TIMER_SYS_STAT_OFFSET \
96 | (WP_NONE << WPSHIFT))
97
98#define OMAP_TIMER_STAT_REG (_OMAP_TIMER_STAT_OFFSET \
99 | (WP_NONE << WPSHIFT))
100
101#define OMAP_TIMER_INT_EN_REG (_OMAP_TIMER_INT_EN_OFFSET \
102 | (WP_NONE << WPSHIFT))
103
104#define OMAP_TIMER_WAKEUP_EN_REG (_OMAP_TIMER_WAKEUP_EN_OFFSET \
105 | (WP_NONE << WPSHIFT))
106
107#define OMAP_TIMER_CTRL_REG (_OMAP_TIMER_CTRL_OFFSET \
108 | (WP_TCLR << WPSHIFT))
109
110#define OMAP_TIMER_COUNTER_REG (_OMAP_TIMER_COUNTER_OFFSET \
111 | (WP_TCRR << WPSHIFT))
112
113#define OMAP_TIMER_LOAD_REG (_OMAP_TIMER_LOAD_OFFSET \
114 | (WP_TLDR << WPSHIFT))
115
116#define OMAP_TIMER_TRIGGER_REG (_OMAP_TIMER_TRIGGER_OFFSET \
117 | (WP_TTGR << WPSHIFT))
118
119#define OMAP_TIMER_WRITE_PEND_REG (_OMAP_TIMER_WRITE_PEND_OFFSET \
120 | (WP_NONE << WPSHIFT))
121
122#define OMAP_TIMER_MATCH_REG (_OMAP_TIMER_MATCH_OFFSET \
123 | (WP_TMAR << WPSHIFT))
124
125#define OMAP_TIMER_CAPTURE_REG (_OMAP_TIMER_CAPTURE_OFFSET \
126 | (WP_NONE << WPSHIFT))
127
128#define OMAP_TIMER_IF_CTRL_REG (_OMAP_TIMER_IF_CTRL_OFFSET \
129 | (WP_NONE << WPSHIFT))
130
131#define OMAP_TIMER_CAPTURE2_REG (_OMAP_TIMER_CAPTURE2_OFFSET \
132 | (WP_NONE << WPSHIFT))
133
134#define OMAP_TIMER_TICK_POS_REG (_OMAP_TIMER_TICK_POS_OFFSET \
135 | (WP_TPIR << WPSHIFT))
136
137#define OMAP_TIMER_TICK_NEG_REG (_OMAP_TIMER_TICK_NEG_OFFSET \
138 | (WP_TNIR << WPSHIFT))
139
140#define OMAP_TIMER_TICK_COUNT_REG (_OMAP_TIMER_TICK_COUNT_OFFSET \
141 | (WP_TCVR << WPSHIFT))
142
143#define OMAP_TIMER_TICK_INT_MASK_SET_REG \
144 (_OMAP_TIMER_TICK_INT_MASK_SET_OFFSET | (WP_TOCR << WPSHIFT))
145
146#define OMAP_TIMER_TICK_INT_MASK_COUNT_REG \
147 (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT))
69 148
70struct omap_dm_timer { 149struct omap_dm_timer {
71 unsigned long phys_base; 150 unsigned long phys_base;
@@ -76,6 +155,7 @@ struct omap_dm_timer {
76 void __iomem *io_base; 155 void __iomem *io_base;
77 unsigned reserved:1; 156 unsigned reserved:1;
78 unsigned enabled:1; 157 unsigned enabled:1;
158 unsigned posted:1;
79}; 159};
80 160
81#ifdef CONFIG_ARCH_OMAP1 161#ifdef CONFIG_ARCH_OMAP1
@@ -181,16 +261,34 @@ static struct clk **dm_source_clocks;
181 261
182static spinlock_t dm_timer_lock; 262static spinlock_t dm_timer_lock;
183 263
184static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, int reg) 264/*
265 * Reads timer registers in posted and non-posted mode. The posted mode bit
266 * is encoded in reg. Note that in posted mode write pending bit must be
267 * checked. Otherwise a read of a non completed write will produce an error.
268 */
269static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
185{ 270{
186 return readl(timer->io_base + reg); 271 if (timer->posted)
272 while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))
273 & (reg >> WPSHIFT))
274 cpu_relax();
275 return readl(timer->io_base + (reg & 0xff));
187} 276}
188 277
189static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, int reg, u32 value) 278/*
279 * Writes timer registers in posted and non-posted mode. The posted mode bit
280 * is encoded in reg. Note that in posted mode the write pending bit must be
281 * checked. Otherwise a write on a register which has a pending write will be
282 * lost.
283 */
284static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg,
285 u32 value)
190{ 286{
191 writel(value, timer->io_base + reg); 287 if (timer->posted)
192 while (omap_dm_timer_read_reg(timer, OMAP_TIMER_WRITE_PEND_REG)) 288 while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))
193 ; 289 & (reg >> WPSHIFT))
290 cpu_relax();
291 writel(value, timer->io_base + (reg & 0xff));
194} 292}
195 293
196static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer) 294static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer)
@@ -217,17 +315,23 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer)
217 } 315 }
218 omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ); 316 omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
219 317
220 /* Set to smart-idle mode */
221 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_OCP_CFG_REG); 318 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_OCP_CFG_REG);
222 l |= 0x02 << 3; 319 l |= 0x02 << 3; /* Set to smart-idle mode */
223 320 l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */
224 if (cpu_class_is_omap2() && timer == &dm_timers[0]) { 321
225 /* Enable wake-up only for GPT1 on OMAP2 CPUs*/ 322 /*
323 * Enable wake-up only for GPT1 on OMAP2 CPUs.
324 * FIXME: All timers should have wake-up enabled and clear
325 * PRCM status.
326 */
327 if (cpu_class_is_omap2() && (timer == &dm_timers[0]))
226 l |= 1 << 2; 328 l |= 1 << 2;
227 /* Non-posted mode */
228 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0);
229 }
230 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l); 329 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l);
330
331 /* Match hardware reset default of posted mode */
332 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG,
333 OMAP_TIMER_CTRL_POSTED);
334 timer->posted = 1;
231} 335}
232 336
233static void omap_dm_timer_prepare(struct omap_dm_timer *timer) 337static void omap_dm_timer_prepare(struct omap_dm_timer *timer)
@@ -434,9 +538,32 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
434 l &= ~OMAP_TIMER_CTRL_AR; 538 l &= ~OMAP_TIMER_CTRL_AR;
435 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); 539 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
436 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); 540 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
541
542 /* REVISIT: hw feature, ttgr overtaking tldr? */
543 while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)))
544 cpu_relax();
545
437 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); 546 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
438} 547}
439 548
549/* Optimized set_load which removes costly spin wait in timer_start */
550void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
551 unsigned int load)
552{
553 u32 l;
554
555 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
556 if (autoreload)
557 l |= OMAP_TIMER_CTRL_AR;
558 else
559 l &= ~OMAP_TIMER_CTRL_AR;
560 l |= OMAP_TIMER_CTRL_ST;
561
562 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
563 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
564 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
565}
566
440void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, 567void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
441 unsigned int match) 568 unsigned int match)
442{ 569{
@@ -451,7 +578,6 @@ void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
451 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match); 578 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match);
452} 579}
453 580
454
455void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, 581void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
456 int toggle, int trigger) 582 int toggle, int trigger)
457{ 583{
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 9cf83c4da9fa..c7f74064696c 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -15,95 +15,66 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/platform_device.h>
18#include <linux/wait.h> 19#include <linux/wait.h>
19#include <linux/completion.h> 20#include <linux/completion.h>
20#include <linux/interrupt.h> 21#include <linux/interrupt.h>
21#include <linux/err.h> 22#include <linux/err.h>
22#include <linux/clk.h> 23#include <linux/clk.h>
23#include <linux/delay.h> 24#include <linux/delay.h>
24 25#include <linux/io.h>
25#include <asm/io.h>
26#include <asm/irq.h>
27 26
28#include <asm/arch/dma.h> 27#include <asm/arch/dma.h>
29#include <asm/arch/mux.h>
30#include <asm/arch/irqs.h>
31#include <asm/arch/dsp_common.h>
32#include <asm/arch/mcbsp.h> 28#include <asm/arch/mcbsp.h>
33 29
34#ifdef CONFIG_MCBSP_DEBUG
35#define DBG(x...) printk(x)
36#else
37#define DBG(x...) do { } while (0)
38#endif
39
40struct omap_mcbsp {
41 u32 io_base;
42 u8 id;
43 u8 free;
44 omap_mcbsp_word_length rx_word_length;
45 omap_mcbsp_word_length tx_word_length;
46
47 omap_mcbsp_io_type_t io_type; /* IRQ or poll */
48 /* IRQ based TX/RX */
49 int rx_irq;
50 int tx_irq;
51
52 /* DMA stuff */
53 u8 dma_rx_sync;
54 short dma_rx_lch;
55 u8 dma_tx_sync;
56 short dma_tx_lch;
57
58 /* Completion queues */
59 struct completion tx_irq_completion;
60 struct completion rx_irq_completion;
61 struct completion tx_dma_completion;
62 struct completion rx_dma_completion;
63
64 spinlock_t lock;
65};
66
67static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT]; 30static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT];
68#ifdef CONFIG_ARCH_OMAP1 31
69static struct clk *mcbsp_dsp_ck = 0; 32#define omap_mcbsp_check_valid_id(id) (mcbsp[id].pdata && \
70static struct clk *mcbsp_api_ck = 0; 33 mcbsp[id].pdata->ops && \
71static struct clk *mcbsp_dspxor_ck = 0; 34 mcbsp[id].pdata->ops->check && \
72#endif 35 (mcbsp[id].pdata->ops->check(id) == 0))
73#ifdef CONFIG_ARCH_OMAP2
74static struct clk *mcbsp1_ick = 0;
75static struct clk *mcbsp1_fck = 0;
76static struct clk *mcbsp2_ick = 0;
77static struct clk *mcbsp2_fck = 0;
78#endif
79 36
80static void omap_mcbsp_dump_reg(u8 id) 37static void omap_mcbsp_dump_reg(u8 id)
81{ 38{
82 DBG("**** MCBSP%d regs ****\n", mcbsp[id].id); 39 dev_dbg(mcbsp[id].dev, "**** McBSP%d regs ****\n", mcbsp[id].id);
83 DBG("DRR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, DRR2)); 40 dev_dbg(mcbsp[id].dev, "DRR2: 0x%04x\n",
84 DBG("DRR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, DRR1)); 41 OMAP_MCBSP_READ(mcbsp[id].io_base, DRR2));
85 DBG("DXR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, DXR2)); 42 dev_dbg(mcbsp[id].dev, "DRR1: 0x%04x\n",
86 DBG("DXR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, DXR1)); 43 OMAP_MCBSP_READ(mcbsp[id].io_base, DRR1));
87 DBG("SPCR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, SPCR2)); 44 dev_dbg(mcbsp[id].dev, "DXR2: 0x%04x\n",
88 DBG("SPCR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, SPCR1)); 45 OMAP_MCBSP_READ(mcbsp[id].io_base, DXR2));
89 DBG("RCR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, RCR2)); 46 dev_dbg(mcbsp[id].dev, "DXR1: 0x%04x\n",
90 DBG("RCR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, RCR1)); 47 OMAP_MCBSP_READ(mcbsp[id].io_base, DXR1));
91 DBG("XCR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, XCR2)); 48 dev_dbg(mcbsp[id].dev, "SPCR2: 0x%04x\n",
92 DBG("XCR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, XCR1)); 49 OMAP_MCBSP_READ(mcbsp[id].io_base, SPCR2));
93 DBG("SRGR2: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, SRGR2)); 50 dev_dbg(mcbsp[id].dev, "SPCR1: 0x%04x\n",
94 DBG("SRGR1: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, SRGR1)); 51 OMAP_MCBSP_READ(mcbsp[id].io_base, SPCR1));
95 DBG("PCR0: 0x%04x\n", OMAP_MCBSP_READ(mcbsp[id].io_base, PCR0)); 52 dev_dbg(mcbsp[id].dev, "RCR2: 0x%04x\n",
96 DBG("***********************\n"); 53 OMAP_MCBSP_READ(mcbsp[id].io_base, RCR2));
54 dev_dbg(mcbsp[id].dev, "RCR1: 0x%04x\n",
55 OMAP_MCBSP_READ(mcbsp[id].io_base, RCR1));
56 dev_dbg(mcbsp[id].dev, "XCR2: 0x%04x\n",
57 OMAP_MCBSP_READ(mcbsp[id].io_base, XCR2));
58 dev_dbg(mcbsp[id].dev, "XCR1: 0x%04x\n",
59 OMAP_MCBSP_READ(mcbsp[id].io_base, XCR1));
60 dev_dbg(mcbsp[id].dev, "SRGR2: 0x%04x\n",
61 OMAP_MCBSP_READ(mcbsp[id].io_base, SRGR2));
62 dev_dbg(mcbsp[id].dev, "SRGR1: 0x%04x\n",
63 OMAP_MCBSP_READ(mcbsp[id].io_base, SRGR1));
64 dev_dbg(mcbsp[id].dev, "PCR0: 0x%04x\n",
65 OMAP_MCBSP_READ(mcbsp[id].io_base, PCR0));
66 dev_dbg(mcbsp[id].dev, "***********************\n");
97} 67}
98 68
99static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id) 69static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id)
100{ 70{
101 struct omap_mcbsp *mcbsp_tx = dev_id; 71 struct omap_mcbsp *mcbsp_tx = dev_id;
102 72
103 DBG("TX IRQ callback : 0x%x\n", 73 dev_dbg(mcbsp_tx->dev, "TX IRQ callback : 0x%x\n",
104 OMAP_MCBSP_READ(mcbsp_tx->io_base, SPCR2)); 74 OMAP_MCBSP_READ(mcbsp_tx->io_base, SPCR2));
105 75
106 complete(&mcbsp_tx->tx_irq_completion); 76 complete(&mcbsp_tx->tx_irq_completion);
77
107 return IRQ_HANDLED; 78 return IRQ_HANDLED;
108} 79}
109 80
@@ -111,10 +82,11 @@ static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id)
111{ 82{
112 struct omap_mcbsp *mcbsp_rx = dev_id; 83 struct omap_mcbsp *mcbsp_rx = dev_id;
113 84
114 DBG("RX IRQ callback : 0x%x\n", 85 dev_dbg(mcbsp_rx->dev, "RX IRQ callback : 0x%x\n",
115 OMAP_MCBSP_READ(mcbsp_rx->io_base, SPCR2)); 86 OMAP_MCBSP_READ(mcbsp_rx->io_base, SPCR2));
116 87
117 complete(&mcbsp_rx->rx_irq_completion); 88 complete(&mcbsp_rx->rx_irq_completion);
89
118 return IRQ_HANDLED; 90 return IRQ_HANDLED;
119} 91}
120 92
@@ -122,8 +94,8 @@ static void omap_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data)
122{ 94{
123 struct omap_mcbsp *mcbsp_dma_tx = data; 95 struct omap_mcbsp *mcbsp_dma_tx = data;
124 96
125 DBG("TX DMA callback : 0x%x\n", 97 dev_dbg(mcbsp_dma_tx->dev, "TX DMA callback : 0x%x\n",
126 OMAP_MCBSP_READ(mcbsp_dma_tx->io_base, SPCR2)); 98 OMAP_MCBSP_READ(mcbsp_dma_tx->io_base, SPCR2));
127 99
128 /* We can free the channels */ 100 /* We can free the channels */
129 omap_free_dma(mcbsp_dma_tx->dma_tx_lch); 101 omap_free_dma(mcbsp_dma_tx->dma_tx_lch);
@@ -136,8 +108,8 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
136{ 108{
137 struct omap_mcbsp *mcbsp_dma_rx = data; 109 struct omap_mcbsp *mcbsp_dma_rx = data;
138 110
139 DBG("RX DMA callback : 0x%x\n", 111 dev_dbg(mcbsp_dma_rx->dev, "RX DMA callback : 0x%x\n",
140 OMAP_MCBSP_READ(mcbsp_dma_rx->io_base, SPCR2)); 112 OMAP_MCBSP_READ(mcbsp_dma_rx->io_base, SPCR2));
141 113
142 /* We can free the channels */ 114 /* We can free the channels */
143 omap_free_dma(mcbsp_dma_rx->dma_rx_lch); 115 omap_free_dma(mcbsp_dma_rx->dma_rx_lch);
@@ -146,19 +118,24 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
146 complete(&mcbsp_dma_rx->rx_dma_completion); 118 complete(&mcbsp_dma_rx->rx_dma_completion);
147} 119}
148 120
149
150/* 121/*
151 * omap_mcbsp_config simply write a config to the 122 * omap_mcbsp_config simply write a config to the
152 * appropriate McBSP. 123 * appropriate McBSP.
153 * You either call this function or set the McBSP registers 124 * You either call this function or set the McBSP registers
154 * by yourself before calling omap_mcbsp_start(). 125 * by yourself before calling omap_mcbsp_start().
155 */ 126 */
156 127void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
157void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config)
158{ 128{
159 u32 io_base = mcbsp[id].io_base; 129 u32 io_base;
130
131 if (!omap_mcbsp_check_valid_id(id)) {
132 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
133 return;
134 }
160 135
161 DBG("OMAP-McBSP: McBSP%d io_base: 0x%8x\n", id+1, io_base); 136 io_base = mcbsp[id].io_base;
137 dev_dbg(mcbsp[id].dev, "Configuring McBSP%d io_base: 0x%8x\n",
138 mcbsp[id].id, io_base);
162 139
163 /* We write the given config */ 140 /* We write the given config */
164 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2); 141 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2);
@@ -173,83 +150,7 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config
173 OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1); 150 OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1);
174 OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0); 151 OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0);
175} 152}
176 153EXPORT_SYMBOL(omap_mcbsp_config);
177
178
179static int omap_mcbsp_check(unsigned int id)
180{
181 if (cpu_is_omap730()) {
182 if (id > OMAP_MAX_MCBSP_COUNT - 1) {
183 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1);
184 return -1;
185 }
186 return 0;
187 }
188
189 if (cpu_is_omap15xx() || cpu_is_omap16xx() || cpu_is_omap24xx()) {
190 if (id > OMAP_MAX_MCBSP_COUNT) {
191 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1);
192 return -1;
193 }
194 return 0;
195 }
196
197 return -1;
198}
199
200#ifdef CONFIG_ARCH_OMAP1
201static void omap_mcbsp_dsp_request(void)
202{
203 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
204 int ret;
205
206 ret = omap_dsp_request_mem();
207 if (ret < 0) {
208 printk(KERN_ERR "Could not get dsp memory: %i\n", ret);
209 return;
210 }
211
212 clk_enable(mcbsp_dsp_ck);
213 clk_enable(mcbsp_api_ck);
214
215 /* enable 12MHz clock to mcbsp 1 & 3 */
216 clk_enable(mcbsp_dspxor_ck);
217
218 /*
219 * DSP external peripheral reset
220 * FIXME: This should be moved to dsp code
221 */
222 __raw_writew(__raw_readw(DSP_RSTCT2) | 1 | 1 << 1,
223 DSP_RSTCT2);
224 }
225}
226
227static void omap_mcbsp_dsp_free(void)
228{
229 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
230 omap_dsp_release_mem();
231 clk_disable(mcbsp_dspxor_ck);
232 clk_disable(mcbsp_dsp_ck);
233 clk_disable(mcbsp_api_ck);
234 }
235}
236#endif
237
238#ifdef CONFIG_ARCH_OMAP2
239static void omap2_mcbsp2_mux_setup(void)
240{
241 if (cpu_is_omap2420()) {
242 omap_cfg_reg(Y15_24XX_MCBSP2_CLKX);
243 omap_cfg_reg(R14_24XX_MCBSP2_FSX);
244 omap_cfg_reg(W15_24XX_MCBSP2_DR);
245 omap_cfg_reg(V15_24XX_MCBSP2_DX);
246 omap_cfg_reg(V14_24XX_GPIO117);
247 }
248 /*
249 * Need to add MUX settings for OMAP 2430 SDP
250 */
251}
252#endif
253 154
254/* 155/*
255 * We can choose between IRQ based or polled IO. 156 * We can choose between IRQ based or polled IO.
@@ -257,13 +158,16 @@ static void omap2_mcbsp2_mux_setup(void)
257 */ 158 */
258int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type) 159int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type)
259{ 160{
260 if (omap_mcbsp_check(id) < 0) 161 if (!omap_mcbsp_check_valid_id(id)) {
261 return -EINVAL; 162 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
163 return -ENODEV;
164 }
262 165
263 spin_lock(&mcbsp[id].lock); 166 spin_lock(&mcbsp[id].lock);
264 167
265 if (!mcbsp[id].free) { 168 if (!mcbsp[id].free) {
266 printk (KERN_ERR "OMAP-McBSP: McBSP%d is currently in use\n", id + 1); 169 dev_err(mcbsp[id].dev, "McBSP%d is currently in use\n",
170 mcbsp[id].id);
267 spin_unlock(&mcbsp[id].lock); 171 spin_unlock(&mcbsp[id].lock);
268 return -EINVAL; 172 return -EINVAL;
269 } 173 }
@@ -274,38 +178,26 @@ int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type)
274 178
275 return 0; 179 return 0;
276} 180}
181EXPORT_SYMBOL(omap_mcbsp_set_io_type);
277 182
278int omap_mcbsp_request(unsigned int id) 183int omap_mcbsp_request(unsigned int id)
279{ 184{
280 int err; 185 int err;
281 186
282 if (omap_mcbsp_check(id) < 0) 187 if (!omap_mcbsp_check_valid_id(id)) {
283 return -EINVAL; 188 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
284 189 return -ENODEV;
285#ifdef CONFIG_ARCH_OMAP1
286 /*
287 * On 1510, 1610 and 1710, McBSP1 and McBSP3
288 * are DSP public peripherals.
289 */
290 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3)
291 omap_mcbsp_dsp_request();
292#endif
293
294#ifdef CONFIG_ARCH_OMAP2
295 if (cpu_is_omap24xx()) {
296 if (id == OMAP_MCBSP1) {
297 clk_enable(mcbsp1_ick);
298 clk_enable(mcbsp1_fck);
299 } else {
300 clk_enable(mcbsp2_ick);
301 clk_enable(mcbsp2_fck);
302 }
303 } 190 }
304#endif 191
192 if (mcbsp[id].pdata->ops->request)
193 mcbsp[id].pdata->ops->request(id);
194
195 clk_enable(mcbsp[id].clk);
305 196
306 spin_lock(&mcbsp[id].lock); 197 spin_lock(&mcbsp[id].lock);
307 if (!mcbsp[id].free) { 198 if (!mcbsp[id].free) {
308 printk (KERN_ERR "OMAP-McBSP: McBSP%d is currently in use\n", id + 1); 199 dev_err(mcbsp[id].dev, "McBSP%d is currently in use\n",
200 mcbsp[id].id);
309 spin_unlock(&mcbsp[id].lock); 201 spin_unlock(&mcbsp[id].lock);
310 return -1; 202 return -1;
311 } 203 }
@@ -315,24 +207,23 @@ int omap_mcbsp_request(unsigned int id)
315 207
316 if (mcbsp[id].io_type == OMAP_MCBSP_IRQ_IO) { 208 if (mcbsp[id].io_type == OMAP_MCBSP_IRQ_IO) {
317 /* We need to get IRQs here */ 209 /* We need to get IRQs here */
318 err = request_irq(mcbsp[id].tx_irq, omap_mcbsp_tx_irq_handler, 0, 210 err = request_irq(mcbsp[id].tx_irq, omap_mcbsp_tx_irq_handler,
319 "McBSP", 211 0, "McBSP", (void *) (&mcbsp[id]));
320 (void *) (&mcbsp[id]));
321 if (err != 0) { 212 if (err != 0) {
322 printk(KERN_ERR "OMAP-McBSP: Unable to request TX IRQ %d for McBSP%d\n", 213 dev_err(mcbsp[id].dev, "Unable to request TX IRQ %d "
323 mcbsp[id].tx_irq, mcbsp[id].id); 214 "for McBSP%d\n", mcbsp[id].tx_irq,
215 mcbsp[id].id);
324 return err; 216 return err;
325 } 217 }
326 218
327 init_completion(&(mcbsp[id].tx_irq_completion)); 219 init_completion(&(mcbsp[id].tx_irq_completion));
328 220
329 221 err = request_irq(mcbsp[id].rx_irq, omap_mcbsp_rx_irq_handler,
330 err = request_irq(mcbsp[id].rx_irq, omap_mcbsp_rx_irq_handler, 0, 222 0, "McBSP", (void *) (&mcbsp[id]));
331 "McBSP",
332 (void *) (&mcbsp[id]));
333 if (err != 0) { 223 if (err != 0) {
334 printk(KERN_ERR "OMAP-McBSP: Unable to request RX IRQ %d for McBSP%d\n", 224 dev_err(mcbsp[id].dev, "Unable to request RX IRQ %d "
335 mcbsp[id].rx_irq, mcbsp[id].id); 225 "for McBSP%d\n", mcbsp[id].rx_irq,
226 mcbsp[id].id);
336 free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id])); 227 free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id]));
337 return err; 228 return err;
338 } 229 }
@@ -341,36 +232,25 @@ int omap_mcbsp_request(unsigned int id)
341 } 232 }
342 233
343 return 0; 234 return 0;
344
345} 235}
236EXPORT_SYMBOL(omap_mcbsp_request);
346 237
347void omap_mcbsp_free(unsigned int id) 238void omap_mcbsp_free(unsigned int id)
348{ 239{
349 if (omap_mcbsp_check(id) < 0) 240 if (!omap_mcbsp_check_valid_id(id)) {
241 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
350 return; 242 return;
351
352#ifdef CONFIG_ARCH_OMAP1
353 if (cpu_class_is_omap1()) {
354 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3)
355 omap_mcbsp_dsp_free();
356 } 243 }
357#endif 244
358 245 if (mcbsp[id].pdata->ops->free)
359#ifdef CONFIG_ARCH_OMAP2 246 mcbsp[id].pdata->ops->free(id);
360 if (cpu_is_omap24xx()) { 247
361 if (id == OMAP_MCBSP1) { 248 clk_disable(mcbsp[id].clk);
362 clk_disable(mcbsp1_ick);
363 clk_disable(mcbsp1_fck);
364 } else {
365 clk_disable(mcbsp2_ick);
366 clk_disable(mcbsp2_fck);
367 }
368 }
369#endif
370 249
371 spin_lock(&mcbsp[id].lock); 250 spin_lock(&mcbsp[id].lock);
372 if (mcbsp[id].free) { 251 if (mcbsp[id].free) {
373 printk (KERN_ERR "OMAP-McBSP: McBSP%d was not reserved\n", id + 1); 252 dev_err(mcbsp[id].dev, "McBSP%d was not reserved\n",
253 mcbsp[id].id);
374 spin_unlock(&mcbsp[id].lock); 254 spin_unlock(&mcbsp[id].lock);
375 return; 255 return;
376 } 256 }
@@ -384,6 +264,7 @@ void omap_mcbsp_free(unsigned int id)
384 free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id])); 264 free_irq(mcbsp[id].tx_irq, (void *) (&mcbsp[id]));
385 } 265 }
386} 266}
267EXPORT_SYMBOL(omap_mcbsp_free);
387 268
388/* 269/*
389 * Here we start the McBSP, by enabling the sample 270 * Here we start the McBSP, by enabling the sample
@@ -395,13 +276,15 @@ void omap_mcbsp_start(unsigned int id)
395 u32 io_base; 276 u32 io_base;
396 u16 w; 277 u16 w;
397 278
398 if (omap_mcbsp_check(id) < 0) 279 if (!omap_mcbsp_check_valid_id(id)) {
280 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
399 return; 281 return;
282 }
400 283
401 io_base = mcbsp[id].io_base; 284 io_base = mcbsp[id].io_base;
402 285
403 mcbsp[id].rx_word_length = ((OMAP_MCBSP_READ(io_base, RCR1) >> 5) & 0x7); 286 mcbsp[id].rx_word_length = (OMAP_MCBSP_READ(io_base, RCR1) >> 5) & 0x7;
404 mcbsp[id].tx_word_length = ((OMAP_MCBSP_READ(io_base, XCR1) >> 5) & 0x7); 287 mcbsp[id].tx_word_length = (OMAP_MCBSP_READ(io_base, XCR1) >> 5) & 0x7;
405 288
406 /* Start the sample generator */ 289 /* Start the sample generator */
407 w = OMAP_MCBSP_READ(io_base, SPCR2); 290 w = OMAP_MCBSP_READ(io_base, SPCR2);
@@ -422,20 +305,22 @@ void omap_mcbsp_start(unsigned int id)
422 305
423 /* Dump McBSP Regs */ 306 /* Dump McBSP Regs */
424 omap_mcbsp_dump_reg(id); 307 omap_mcbsp_dump_reg(id);
425
426} 308}
309EXPORT_SYMBOL(omap_mcbsp_start);
427 310
428void omap_mcbsp_stop(unsigned int id) 311void omap_mcbsp_stop(unsigned int id)
429{ 312{
430 u32 io_base; 313 u32 io_base;
431 u16 w; 314 u16 w;
432 315
433 if (omap_mcbsp_check(id) < 0) 316 if (!omap_mcbsp_check_valid_id(id)) {
317 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
434 return; 318 return;
319 }
435 320
436 io_base = mcbsp[id].io_base; 321 io_base = mcbsp[id].io_base;
437 322
438 /* Reset transmitter */ 323 /* Reset transmitter */
439 w = OMAP_MCBSP_READ(io_base, SPCR2); 324 w = OMAP_MCBSP_READ(io_base, SPCR2);
440 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1)); 325 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1));
441 326
@@ -447,12 +332,19 @@ void omap_mcbsp_stop(unsigned int id)
447 w = OMAP_MCBSP_READ(io_base, SPCR2); 332 w = OMAP_MCBSP_READ(io_base, SPCR2);
448 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1 << 6)); 333 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1 << 6));
449} 334}
450 335EXPORT_SYMBOL(omap_mcbsp_stop);
451 336
452/* polled mcbsp i/o operations */ 337/* polled mcbsp i/o operations */
453int omap_mcbsp_pollwrite(unsigned int id, u16 buf) 338int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
454{ 339{
455 u32 base = mcbsp[id].io_base; 340 u32 base;
341
342 if (!omap_mcbsp_check_valid_id(id)) {
343 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
344 return -ENODEV;
345 }
346
347 base = mcbsp[id].io_base;
456 writew(buf, base + OMAP_MCBSP_REG_DXR1); 348 writew(buf, base + OMAP_MCBSP_REG_DXR1);
457 /* if frame sync error - clear the error */ 349 /* if frame sync error - clear the error */
458 if (readw(base + OMAP_MCBSP_REG_SPCR2) & XSYNC_ERR) { 350 if (readw(base + OMAP_MCBSP_REG_SPCR2) & XSYNC_ERR) {
@@ -474,18 +366,27 @@ int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
474 (XRST), 366 (XRST),
475 base + OMAP_MCBSP_REG_SPCR2); 367 base + OMAP_MCBSP_REG_SPCR2);
476 udelay(10); 368 udelay(10);
477 printk(KERN_ERR 369 dev_err(mcbsp[id].dev, "Could not write to"
478 " Could not write to McBSP Register\n"); 370 " McBSP%d Register\n", mcbsp[id].id);
479 return -2; 371 return -2;
480 } 372 }
481 } 373 }
482 } 374 }
375
483 return 0; 376 return 0;
484} 377}
378EXPORT_SYMBOL(omap_mcbsp_pollwrite);
485 379
486int omap_mcbsp_pollread(unsigned int id, u16 * buf) 380int omap_mcbsp_pollread(unsigned int id, u16 *buf)
487{ 381{
488 u32 base = mcbsp[id].io_base; 382 u32 base;
383
384 if (!omap_mcbsp_check_valid_id(id)) {
385 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
386 return -ENODEV;
387 }
388
389 base = mcbsp[id].io_base;
489 /* if frame sync error - clear the error */ 390 /* if frame sync error - clear the error */
490 if (readw(base + OMAP_MCBSP_REG_SPCR1) & RSYNC_ERR) { 391 if (readw(base + OMAP_MCBSP_REG_SPCR1) & RSYNC_ERR) {
491 /* clear error */ 392 /* clear error */
@@ -506,15 +407,17 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf)
506 (RRST), 407 (RRST),
507 base + OMAP_MCBSP_REG_SPCR1); 408 base + OMAP_MCBSP_REG_SPCR1);
508 udelay(10); 409 udelay(10);
509 printk(KERN_ERR 410 dev_err(mcbsp[id].dev, "Could not read from"
510 " Could not read from McBSP Register\n"); 411 " McBSP%d Register\n", mcbsp[id].id);
511 return -2; 412 return -2;
512 } 413 }
513 } 414 }
514 } 415 }
515 *buf = readw(base + OMAP_MCBSP_REG_DRR1); 416 *buf = readw(base + OMAP_MCBSP_REG_DRR1);
417
516 return 0; 418 return 0;
517} 419}
420EXPORT_SYMBOL(omap_mcbsp_pollread);
518 421
519/* 422/*
520 * IRQ based word transmission. 423 * IRQ based word transmission.
@@ -522,12 +425,15 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf)
522void omap_mcbsp_xmit_word(unsigned int id, u32 word) 425void omap_mcbsp_xmit_word(unsigned int id, u32 word)
523{ 426{
524 u32 io_base; 427 u32 io_base;
525 omap_mcbsp_word_length word_length = mcbsp[id].tx_word_length; 428 omap_mcbsp_word_length word_length;
526 429
527 if (omap_mcbsp_check(id) < 0) 430 if (!omap_mcbsp_check_valid_id(id)) {
431 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
528 return; 432 return;
433 }
529 434
530 io_base = mcbsp[id].io_base; 435 io_base = mcbsp[id].io_base;
436 word_length = mcbsp[id].tx_word_length;
531 437
532 wait_for_completion(&(mcbsp[id].tx_irq_completion)); 438 wait_for_completion(&(mcbsp[id].tx_irq_completion));
533 439
@@ -535,16 +441,20 @@ void omap_mcbsp_xmit_word(unsigned int id, u32 word)
535 OMAP_MCBSP_WRITE(io_base, DXR2, word >> 16); 441 OMAP_MCBSP_WRITE(io_base, DXR2, word >> 16);
536 OMAP_MCBSP_WRITE(io_base, DXR1, word & 0xffff); 442 OMAP_MCBSP_WRITE(io_base, DXR1, word & 0xffff);
537} 443}
444EXPORT_SYMBOL(omap_mcbsp_xmit_word);
538 445
539u32 omap_mcbsp_recv_word(unsigned int id) 446u32 omap_mcbsp_recv_word(unsigned int id)
540{ 447{
541 u32 io_base; 448 u32 io_base;
542 u16 word_lsb, word_msb = 0; 449 u16 word_lsb, word_msb = 0;
543 omap_mcbsp_word_length word_length = mcbsp[id].rx_word_length; 450 omap_mcbsp_word_length word_length;
544 451
545 if (omap_mcbsp_check(id) < 0) 452 if (!omap_mcbsp_check_valid_id(id)) {
546 return -EINVAL; 453 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
454 return -ENODEV;
455 }
547 456
457 word_length = mcbsp[id].rx_word_length;
548 io_base = mcbsp[id].io_base; 458 io_base = mcbsp[id].io_base;
549 459
550 wait_for_completion(&(mcbsp[id].rx_irq_completion)); 460 wait_for_completion(&(mcbsp[id].rx_irq_completion));
@@ -555,15 +465,24 @@ u32 omap_mcbsp_recv_word(unsigned int id)
555 465
556 return (word_lsb | (word_msb << 16)); 466 return (word_lsb | (word_msb << 16));
557} 467}
558 468EXPORT_SYMBOL(omap_mcbsp_recv_word);
559 469
560int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word) 470int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
561{ 471{
562 u32 io_base = mcbsp[id].io_base; 472 u32 io_base;
563 omap_mcbsp_word_length tx_word_length = mcbsp[id].tx_word_length; 473 omap_mcbsp_word_length tx_word_length;
564 omap_mcbsp_word_length rx_word_length = mcbsp[id].rx_word_length; 474 omap_mcbsp_word_length rx_word_length;
565 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 475 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
566 476
477 if (!omap_mcbsp_check_valid_id(id)) {
478 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
479 return -ENODEV;
480 }
481
482 io_base = mcbsp[id].io_base;
483 tx_word_length = mcbsp[id].tx_word_length;
484 rx_word_length = mcbsp[id].rx_word_length;
485
567 if (tx_word_length != rx_word_length) 486 if (tx_word_length != rx_word_length)
568 return -EINVAL; 487 return -EINVAL;
569 488
@@ -577,7 +496,8 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
577 udelay(10); 496 udelay(10);
578 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST); 497 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST);
579 udelay(10); 498 udelay(10);
580 printk("McBSP transmitter not ready\n"); 499 dev_err(mcbsp[id].dev, "McBSP%d transmitter not "
500 "ready\n", mcbsp[id].id);
581 return -EAGAIN; 501 return -EAGAIN;
582 } 502 }
583 } 503 }
@@ -597,7 +517,8 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
597 udelay(10); 517 udelay(10);
598 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST); 518 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST);
599 udelay(10); 519 udelay(10);
600 printk("McBSP receiver not ready\n"); 520 dev_err(mcbsp[id].dev, "McBSP%d receiver not "
521 "ready\n", mcbsp[id].id);
601 return -EAGAIN; 522 return -EAGAIN;
602 } 523 }
603 } 524 }
@@ -609,14 +530,24 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
609 530
610 return 0; 531 return 0;
611} 532}
533EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll);
612 534
613int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word) 535int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
614{ 536{
615 u32 io_base = mcbsp[id].io_base, clock_word = 0; 537 u32 io_base, clock_word = 0;
616 omap_mcbsp_word_length tx_word_length = mcbsp[id].tx_word_length; 538 omap_mcbsp_word_length tx_word_length;
617 omap_mcbsp_word_length rx_word_length = mcbsp[id].rx_word_length; 539 omap_mcbsp_word_length rx_word_length;
618 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 540 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
619 541
542 if (!omap_mcbsp_check_valid_id(id)) {
543 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
544 return -ENODEV;
545 }
546
547 io_base = mcbsp[id].io_base;
548 tx_word_length = mcbsp[id].tx_word_length;
549 rx_word_length = mcbsp[id].rx_word_length;
550
620 if (tx_word_length != rx_word_length) 551 if (tx_word_length != rx_word_length)
621 return -EINVAL; 552 return -EINVAL;
622 553
@@ -630,7 +561,8 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word)
630 udelay(10); 561 udelay(10);
631 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST); 562 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST);
632 udelay(10); 563 udelay(10);
633 printk("McBSP transmitter not ready\n"); 564 dev_err(mcbsp[id].dev, "McBSP%d transmitter not "
565 "ready\n", mcbsp[id].id);
634 return -EAGAIN; 566 return -EAGAIN;
635 } 567 }
636 } 568 }
@@ -650,7 +582,8 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word)
650 udelay(10); 582 udelay(10);
651 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST); 583 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST);
652 udelay(10); 584 udelay(10);
653 printk("McBSP receiver not ready\n"); 585 dev_err(mcbsp[id].dev, "McBSP%d receiver not "
586 "ready\n", mcbsp[id].id);
654 return -EAGAIN; 587 return -EAGAIN;
655 } 588 }
656 } 589 }
@@ -664,7 +597,7 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word)
664 597
665 return 0; 598 return 0;
666} 599}
667 600EXPORT_SYMBOL(omap_mcbsp_spi_master_recv_word_poll);
668 601
669/* 602/*
670 * Simple DMA based buffer rx/tx routines. 603 * Simple DMA based buffer rx/tx routines.
@@ -673,25 +606,32 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word)
673 * For anything fancier, you should use your own customized DMA 606 * For anything fancier, you should use your own customized DMA
674 * routines and callbacks. 607 * routines and callbacks.
675 */ 608 */
676int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int length) 609int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer,
610 unsigned int length)
677{ 611{
678 int dma_tx_ch; 612 int dma_tx_ch;
679 int src_port = 0; 613 int src_port = 0;
680 int dest_port = 0; 614 int dest_port = 0;
681 int sync_dev = 0; 615 int sync_dev = 0;
682 616
683 if (omap_mcbsp_check(id) < 0) 617 if (!omap_mcbsp_check_valid_id(id)) {
684 return -EINVAL; 618 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
619 return -ENODEV;
620 }
685 621
686 if (omap_request_dma(mcbsp[id].dma_tx_sync, "McBSP TX", omap_mcbsp_tx_dma_callback, 622 if (omap_request_dma(mcbsp[id].dma_tx_sync, "McBSP TX",
687 &mcbsp[id], 623 omap_mcbsp_tx_dma_callback,
688 &dma_tx_ch)) { 624 &mcbsp[id],
689 printk("OMAP-McBSP: Unable to request DMA channel for McBSP%d TX. Trying IRQ based TX\n", id+1); 625 &dma_tx_ch)) {
626 dev_err(mcbsp[id].dev, " Unable to request DMA channel for "
627 "McBSP%d TX. Trying IRQ based TX\n",
628 mcbsp[id].id);
690 return -EAGAIN; 629 return -EAGAIN;
691 } 630 }
692 mcbsp[id].dma_tx_lch = dma_tx_ch; 631 mcbsp[id].dma_tx_lch = dma_tx_ch;
693 632
694 DBG("TX DMA on channel %d\n", dma_tx_ch); 633 dev_err(mcbsp[id].dev, "McBSP%d TX DMA on channel %d\n", mcbsp[id].id,
634 dma_tx_ch);
695 635
696 init_completion(&(mcbsp[id].tx_dma_completion)); 636 init_completion(&(mcbsp[id].tx_dma_completion));
697 637
@@ -699,7 +639,7 @@ int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
699 src_port = OMAP_DMA_PORT_TIPB; 639 src_port = OMAP_DMA_PORT_TIPB;
700 dest_port = OMAP_DMA_PORT_EMIFF; 640 dest_port = OMAP_DMA_PORT_EMIFF;
701 } 641 }
702 if (cpu_is_omap24xx()) 642 if (cpu_class_is_omap2())
703 sync_dev = mcbsp[id].dma_tx_sync; 643 sync_dev = mcbsp[id].dma_tx_sync;
704 644
705 omap_set_dma_transfer_params(mcbsp[id].dma_tx_lch, 645 omap_set_dma_transfer_params(mcbsp[id].dma_tx_lch,
@@ -722,29 +662,37 @@ int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
722 662
723 omap_start_dma(mcbsp[id].dma_tx_lch); 663 omap_start_dma(mcbsp[id].dma_tx_lch);
724 wait_for_completion(&(mcbsp[id].tx_dma_completion)); 664 wait_for_completion(&(mcbsp[id].tx_dma_completion));
665
725 return 0; 666 return 0;
726} 667}
668EXPORT_SYMBOL(omap_mcbsp_xmit_buffer);
727 669
728 670int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer,
729int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int length) 671 unsigned int length)
730{ 672{
731 int dma_rx_ch; 673 int dma_rx_ch;
732 int src_port = 0; 674 int src_port = 0;
733 int dest_port = 0; 675 int dest_port = 0;
734 int sync_dev = 0; 676 int sync_dev = 0;
735 677
736 if (omap_mcbsp_check(id) < 0) 678 if (!omap_mcbsp_check_valid_id(id)) {
737 return -EINVAL; 679 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
680 return -ENODEV;
681 }
738 682
739 if (omap_request_dma(mcbsp[id].dma_rx_sync, "McBSP RX", omap_mcbsp_rx_dma_callback, 683 if (omap_request_dma(mcbsp[id].dma_rx_sync, "McBSP RX",
740 &mcbsp[id], 684 omap_mcbsp_rx_dma_callback,
741 &dma_rx_ch)) { 685 &mcbsp[id],
742 printk("Unable to request DMA channel for McBSP%d RX. Trying IRQ based RX\n", id+1); 686 &dma_rx_ch)) {
687 dev_err(mcbsp[id].dev, "Unable to request DMA channel for "
688 "McBSP%d RX. Trying IRQ based RX\n",
689 mcbsp[id].id);
743 return -EAGAIN; 690 return -EAGAIN;
744 } 691 }
745 mcbsp[id].dma_rx_lch = dma_rx_ch; 692 mcbsp[id].dma_rx_lch = dma_rx_ch;
746 693
747 DBG("RX DMA on channel %d\n", dma_rx_ch); 694 dev_err(mcbsp[id].dev, "McBSP%d RX DMA on channel %d\n", mcbsp[id].id,
695 dma_rx_ch);
748 696
749 init_completion(&(mcbsp[id].rx_dma_completion)); 697 init_completion(&(mcbsp[id].rx_dma_completion));
750 698
@@ -752,14 +700,14 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
752 src_port = OMAP_DMA_PORT_TIPB; 700 src_port = OMAP_DMA_PORT_TIPB;
753 dest_port = OMAP_DMA_PORT_EMIFF; 701 dest_port = OMAP_DMA_PORT_EMIFF;
754 } 702 }
755 if (cpu_is_omap24xx()) 703 if (cpu_class_is_omap2())
756 sync_dev = mcbsp[id].dma_rx_sync; 704 sync_dev = mcbsp[id].dma_rx_sync;
757 705
758 omap_set_dma_transfer_params(mcbsp[id].dma_rx_lch, 706 omap_set_dma_transfer_params(mcbsp[id].dma_rx_lch,
759 OMAP_DMA_DATA_TYPE_S16, 707 OMAP_DMA_DATA_TYPE_S16,
760 length >> 1, 1, 708 length >> 1, 1,
761 OMAP_DMA_SYNC_ELEMENT, 709 OMAP_DMA_SYNC_ELEMENT,
762 sync_dev, 0); 710 sync_dev, 0);
763 711
764 omap_set_dma_src_params(mcbsp[id].dma_rx_lch, 712 omap_set_dma_src_params(mcbsp[id].dma_rx_lch,
765 src_port, 713 src_port,
@@ -768,16 +716,17 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
768 0, 0); 716 0, 0);
769 717
770 omap_set_dma_dest_params(mcbsp[id].dma_rx_lch, 718 omap_set_dma_dest_params(mcbsp[id].dma_rx_lch,
771 dest_port, 719 dest_port,
772 OMAP_DMA_AMODE_POST_INC, 720 OMAP_DMA_AMODE_POST_INC,
773 buffer, 721 buffer,
774 0, 0); 722 0, 0);
775 723
776 omap_start_dma(mcbsp[id].dma_rx_lch); 724 omap_start_dma(mcbsp[id].dma_rx_lch);
777 wait_for_completion(&(mcbsp[id].rx_dma_completion)); 725 wait_for_completion(&(mcbsp[id].rx_dma_completion));
726
778 return 0; 727 return 0;
779} 728}
780 729EXPORT_SYMBOL(omap_mcbsp_recv_buffer);
781 730
782/* 731/*
783 * SPI wrapper. 732 * SPI wrapper.
@@ -785,12 +734,15 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
785 * this wrapper just need an omap_mcbsp_spi_cfg structure as an input. 734 * this wrapper just need an omap_mcbsp_spi_cfg structure as an input.
786 * Once this is done, you can call omap_mcbsp_start(). 735 * Once this is done, you can call omap_mcbsp_start().
787 */ 736 */
788void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg) 737void omap_mcbsp_set_spi_mode(unsigned int id,
738 const struct omap_mcbsp_spi_cfg *spi_cfg)
789{ 739{
790 struct omap_mcbsp_reg_cfg mcbsp_cfg; 740 struct omap_mcbsp_reg_cfg mcbsp_cfg;
791 741
792 if (omap_mcbsp_check(id) < 0) 742 if (!omap_mcbsp_check_valid_id(id)) {
743 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
793 return; 744 return;
745 }
794 746
795 memset(&mcbsp_cfg, 0, sizeof(struct omap_mcbsp_reg_cfg)); 747 memset(&mcbsp_cfg, 0, sizeof(struct omap_mcbsp_reg_cfg));
796 748
@@ -798,7 +750,7 @@ void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg *
798 mcbsp_cfg.rcr1 |= (RWDLEN1(spi_cfg->word_length) | RFRLEN1(0)); 750 mcbsp_cfg.rcr1 |= (RWDLEN1(spi_cfg->word_length) | RFRLEN1(0));
799 mcbsp_cfg.xcr1 |= (XWDLEN1(spi_cfg->word_length) | XFRLEN1(0)); 751 mcbsp_cfg.xcr1 |= (XWDLEN1(spi_cfg->word_length) | XFRLEN1(0));
800 752
801 /* Clock stop mode */ 753 /* Clock stop mode */
802 if (spi_cfg->clk_stp_mode == OMAP_MCBSP_CLK_STP_MODE_NO_DELAY) 754 if (spi_cfg->clk_stp_mode == OMAP_MCBSP_CLK_STP_MODE_NO_DELAY)
803 mcbsp_cfg.spcr1 |= (1 << 12); 755 mcbsp_cfg.spcr1 |= (1 << 12);
804 else 756 else
@@ -827,13 +779,12 @@ void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg *
827 779
828 if (spi_cfg->spi_mode == OMAP_MCBSP_SPI_MASTER) { 780 if (spi_cfg->spi_mode == OMAP_MCBSP_SPI_MASTER) {
829 mcbsp_cfg.pcr0 |= CLKXM; 781 mcbsp_cfg.pcr0 |= CLKXM;
830 mcbsp_cfg.srgr1 |= CLKGDV(spi_cfg->clk_div -1); 782 mcbsp_cfg.srgr1 |= CLKGDV(spi_cfg->clk_div - 1);
831 mcbsp_cfg.pcr0 |= FSXM; 783 mcbsp_cfg.pcr0 |= FSXM;
832 mcbsp_cfg.srgr2 &= ~FSGM; 784 mcbsp_cfg.srgr2 &= ~FSGM;
833 mcbsp_cfg.xcr2 |= XDATDLY(1); 785 mcbsp_cfg.xcr2 |= XDATDLY(1);
834 mcbsp_cfg.rcr2 |= RDATDLY(1); 786 mcbsp_cfg.rcr2 |= RDATDLY(1);
835 } 787 } else {
836 else {
837 mcbsp_cfg.pcr0 &= ~CLKXM; 788 mcbsp_cfg.pcr0 &= ~CLKXM;
838 mcbsp_cfg.srgr1 |= CLKGDV(1); 789 mcbsp_cfg.srgr1 |= CLKGDV(1);
839 mcbsp_cfg.pcr0 &= ~FSXM; 790 mcbsp_cfg.pcr0 &= ~FSXM;
@@ -846,199 +797,99 @@ void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg *
846 797
847 omap_mcbsp_config(id, &mcbsp_cfg); 798 omap_mcbsp_config(id, &mcbsp_cfg);
848} 799}
849 800EXPORT_SYMBOL(omap_mcbsp_set_spi_mode);
850 801
851/* 802/*
852 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. 803 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
853 * 730 has only 2 McBSP, and both of them are MPU peripherals. 804 * 730 has only 2 McBSP, and both of them are MPU peripherals.
854 */ 805 */
855struct omap_mcbsp_info { 806static int __init omap_mcbsp_probe(struct platform_device *pdev)
856 u32 virt_base; 807{
857 u8 dma_rx_sync, dma_tx_sync; 808 struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data;
858 u16 rx_irq, tx_irq; 809 int id = pdev->id - 1;
859}; 810 int ret = 0;
860 811
861#ifdef CONFIG_ARCH_OMAP730 812 if (!pdata) {
862static const struct omap_mcbsp_info mcbsp_730[] = { 813 dev_err(&pdev->dev, "McBSP device initialized without"
863 [0] = { .virt_base = io_p2v(OMAP730_MCBSP1_BASE), 814 "platform data\n");
864 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 815 ret = -EINVAL;
865 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 816 goto exit;
866 .rx_irq = INT_730_McBSP1RX, 817 }
867 .tx_irq = INT_730_McBSP1TX }, 818
868 [1] = { .virt_base = io_p2v(OMAP730_MCBSP2_BASE), 819 dev_dbg(&pdev->dev, "Initializing OMAP McBSP (%d).\n", pdev->id);
869 .dma_rx_sync = OMAP_DMA_MCBSP3_RX, 820
870 .dma_tx_sync = OMAP_DMA_MCBSP3_TX, 821 if (id >= OMAP_MAX_MCBSP_COUNT) {
871 .rx_irq = INT_730_McBSP2RX, 822 dev_err(&pdev->dev, "Invalid McBSP device id (%d)\n", id);
872 .tx_irq = INT_730_McBSP2TX }, 823 ret = -EINVAL;
873}; 824 goto exit;
874#endif 825 }
875 826
876#ifdef CONFIG_ARCH_OMAP15XX 827 spin_lock_init(&mcbsp[id].lock);
877static const struct omap_mcbsp_info mcbsp_1510[] = { 828 mcbsp[id].id = id + 1;
878 [0] = { .virt_base = OMAP1510_MCBSP1_BASE, 829 mcbsp[id].free = 1;
879 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 830 mcbsp[id].dma_tx_lch = -1;
880 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 831 mcbsp[id].dma_rx_lch = -1;
881 .rx_irq = INT_McBSP1RX, 832
882 .tx_irq = INT_McBSP1TX }, 833 mcbsp[id].io_base = pdata->virt_base;
883 [1] = { .virt_base = io_p2v(OMAP1510_MCBSP2_BASE), 834 /* Default I/O is IRQ based */
884 .dma_rx_sync = OMAP_DMA_MCBSP2_RX, 835 mcbsp[id].io_type = OMAP_MCBSP_IRQ_IO;
885 .dma_tx_sync = OMAP_DMA_MCBSP2_TX, 836 mcbsp[id].tx_irq = pdata->tx_irq;
886 .rx_irq = INT_1510_SPI_RX, 837 mcbsp[id].rx_irq = pdata->rx_irq;
887 .tx_irq = INT_1510_SPI_TX }, 838 mcbsp[id].dma_rx_sync = pdata->dma_rx_sync;
888 [2] = { .virt_base = OMAP1510_MCBSP3_BASE, 839 mcbsp[id].dma_tx_sync = pdata->dma_tx_sync;
889 .dma_rx_sync = OMAP_DMA_MCBSP3_RX, 840
890 .dma_tx_sync = OMAP_DMA_MCBSP3_TX, 841 if (pdata->clk_name)
891 .rx_irq = INT_McBSP3RX, 842 mcbsp[id].clk = clk_get(&pdev->dev, pdata->clk_name);
892 .tx_irq = INT_McBSP3TX }, 843 if (IS_ERR(mcbsp[id].clk)) {
893}; 844 mcbsp[id].free = 0;
894#endif 845 dev_err(&pdev->dev,
895 846 "Invalid clock configuration for McBSP%d.\n",
896#if defined(CONFIG_ARCH_OMAP16XX) 847 mcbsp[id].id);
897static const struct omap_mcbsp_info mcbsp_1610[] = { 848 ret = -EINVAL;
898 [0] = { .virt_base = OMAP1610_MCBSP1_BASE, 849 goto exit;
899 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 850 }
900 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 851
901 .rx_irq = INT_McBSP1RX, 852 mcbsp[id].pdata = pdata;
902 .tx_irq = INT_McBSP1TX }, 853 mcbsp[id].dev = &pdev->dev;
903 [1] = { .virt_base = io_p2v(OMAP1610_MCBSP2_BASE), 854 platform_set_drvdata(pdev, &mcbsp[id]);
904 .dma_rx_sync = OMAP_DMA_MCBSP2_RX, 855
905 .dma_tx_sync = OMAP_DMA_MCBSP2_TX, 856exit:
906 .rx_irq = INT_1610_McBSP2_RX, 857 return ret;
907 .tx_irq = INT_1610_McBSP2_TX }, 858}
908 [2] = { .virt_base = OMAP1610_MCBSP3_BASE,
909 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
910 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
911 .rx_irq = INT_McBSP3RX,
912 .tx_irq = INT_McBSP3TX },
913};
914#endif
915
916#if defined(CONFIG_ARCH_OMAP24XX)
917static const struct omap_mcbsp_info mcbsp_24xx[] = {
918 [0] = { .virt_base = IO_ADDRESS(OMAP24XX_MCBSP1_BASE),
919 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
920 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
921 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
922 .tx_irq = INT_24XX_MCBSP1_IRQ_TX,
923 },
924 [1] = { .virt_base = IO_ADDRESS(OMAP24XX_MCBSP2_BASE),
925 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
926 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
927 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
928 .tx_irq = INT_24XX_MCBSP2_IRQ_TX,
929 },
930};
931#endif
932 859
933static int __init omap_mcbsp_init(void) 860static int omap_mcbsp_remove(struct platform_device *pdev)
934{ 861{
935 int mcbsp_count = 0, i; 862 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
936 static const struct omap_mcbsp_info *mcbsp_info;
937 863
938 printk("Initializing OMAP McBSP system\n"); 864 platform_set_drvdata(pdev, NULL);
865 if (mcbsp) {
939 866
940#ifdef CONFIG_ARCH_OMAP1 867 if (mcbsp->pdata && mcbsp->pdata->ops &&
941 mcbsp_dsp_ck = clk_get(0, "dsp_ck"); 868 mcbsp->pdata->ops->free)
942 if (IS_ERR(mcbsp_dsp_ck)) { 869 mcbsp->pdata->ops->free(mcbsp->id);
943 printk(KERN_ERR "mcbsp: could not acquire dsp_ck handle.\n");
944 return PTR_ERR(mcbsp_dsp_ck);
945 }
946 mcbsp_api_ck = clk_get(0, "api_ck");
947 if (IS_ERR(mcbsp_api_ck)) {
948 printk(KERN_ERR "mcbsp: could not acquire api_ck handle.\n");
949 return PTR_ERR(mcbsp_api_ck);
950 }
951 mcbsp_dspxor_ck = clk_get(0, "dspxor_ck");
952 if (IS_ERR(mcbsp_dspxor_ck)) {
953 printk(KERN_ERR "mcbsp: could not acquire dspxor_ck handle.\n");
954 return PTR_ERR(mcbsp_dspxor_ck);
955 }
956#endif
957#ifdef CONFIG_ARCH_OMAP2
958 mcbsp1_ick = clk_get(0, "mcbsp1_ick");
959 if (IS_ERR(mcbsp1_ick)) {
960 printk(KERN_ERR "mcbsp: could not acquire mcbsp1_ick handle.\n");
961 return PTR_ERR(mcbsp1_ick);
962 }
963 mcbsp1_fck = clk_get(0, "mcbsp1_fck");
964 if (IS_ERR(mcbsp1_fck)) {
965 printk(KERN_ERR "mcbsp: could not acquire mcbsp1_fck handle.\n");
966 return PTR_ERR(mcbsp1_fck);
967 }
968 mcbsp2_ick = clk_get(0, "mcbsp2_ick");
969 if (IS_ERR(mcbsp2_ick)) {
970 printk(KERN_ERR "mcbsp: could not acquire mcbsp2_ick handle.\n");
971 return PTR_ERR(mcbsp2_ick);
972 }
973 mcbsp2_fck = clk_get(0, "mcbsp2_fck");
974 if (IS_ERR(mcbsp2_fck)) {
975 printk(KERN_ERR "mcbsp: could not acquire mcbsp2_fck handle.\n");
976 return PTR_ERR(mcbsp2_fck);
977 }
978#endif
979 870
980#ifdef CONFIG_ARCH_OMAP730 871 clk_disable(mcbsp->clk);
981 if (cpu_is_omap730()) { 872 clk_put(mcbsp->clk);
982 mcbsp_info = mcbsp_730; 873
983 mcbsp_count = ARRAY_SIZE(mcbsp_730); 874 mcbsp->clk = NULL;
984 } 875 mcbsp->free = 0;
985#endif 876 mcbsp->dev = NULL;
986#ifdef CONFIG_ARCH_OMAP15XX
987 if (cpu_is_omap15xx()) {
988 mcbsp_info = mcbsp_1510;
989 mcbsp_count = ARRAY_SIZE(mcbsp_1510);
990 }
991#endif
992#if defined(CONFIG_ARCH_OMAP16XX)
993 if (cpu_is_omap16xx()) {
994 mcbsp_info = mcbsp_1610;
995 mcbsp_count = ARRAY_SIZE(mcbsp_1610);
996 }
997#endif
998#if defined(CONFIG_ARCH_OMAP24XX)
999 if (cpu_is_omap24xx()) {
1000 mcbsp_info = mcbsp_24xx;
1001 mcbsp_count = ARRAY_SIZE(mcbsp_24xx);
1002 omap2_mcbsp2_mux_setup();
1003 }
1004#endif
1005 for (i = 0; i < OMAP_MAX_MCBSP_COUNT ; i++) {
1006 if (i >= mcbsp_count) {
1007 mcbsp[i].io_base = 0;
1008 mcbsp[i].free = 0;
1009 continue;
1010 }
1011 mcbsp[i].id = i + 1;
1012 mcbsp[i].free = 1;
1013 mcbsp[i].dma_tx_lch = -1;
1014 mcbsp[i].dma_rx_lch = -1;
1015
1016 mcbsp[i].io_base = mcbsp_info[i].virt_base;
1017 mcbsp[i].io_type = OMAP_MCBSP_IRQ_IO; /* Default I/O is IRQ based */
1018 mcbsp[i].tx_irq = mcbsp_info[i].tx_irq;
1019 mcbsp[i].rx_irq = mcbsp_info[i].rx_irq;
1020 mcbsp[i].dma_rx_sync = mcbsp_info[i].dma_rx_sync;
1021 mcbsp[i].dma_tx_sync = mcbsp_info[i].dma_tx_sync;
1022 spin_lock_init(&mcbsp[i].lock);
1023 } 877 }
1024 878
1025 return 0; 879 return 0;
1026} 880}
1027 881
1028arch_initcall(omap_mcbsp_init); 882static struct platform_driver omap_mcbsp_driver = {
883 .probe = omap_mcbsp_probe,
884 .remove = omap_mcbsp_remove,
885 .driver = {
886 .name = "omap-mcbsp",
887 },
888};
889
890int __init omap_mcbsp_init(void)
891{
892 /* Register the McBSP driver */
893 return platform_driver_register(&omap_mcbsp_driver);
894}
1029 895
1030EXPORT_SYMBOL(omap_mcbsp_config);
1031EXPORT_SYMBOL(omap_mcbsp_request);
1032EXPORT_SYMBOL(omap_mcbsp_set_io_type);
1033EXPORT_SYMBOL(omap_mcbsp_free);
1034EXPORT_SYMBOL(omap_mcbsp_start);
1035EXPORT_SYMBOL(omap_mcbsp_stop);
1036EXPORT_SYMBOL(omap_mcbsp_pollread);
1037EXPORT_SYMBOL(omap_mcbsp_pollwrite);
1038EXPORT_SYMBOL(omap_mcbsp_xmit_word);
1039EXPORT_SYMBOL(omap_mcbsp_recv_word);
1040EXPORT_SYMBOL(omap_mcbsp_xmit_buffer);
1041EXPORT_SYMBOL(omap_mcbsp_recv_buffer);
1042EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll);
1043EXPORT_SYMBOL(omap_mcbsp_spi_master_recv_word_poll);
1044EXPORT_SYMBOL(omap_mcbsp_set_spi_mode);
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 1f23f0459e5f..554ee58e1294 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -10,6 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#undef DEBUG
13 14
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
@@ -24,25 +25,43 @@
24#include <asm/arch/sram.h> 25#include <asm/arch/sram.h>
25#include <asm/arch/board.h> 26#include <asm/arch/board.h>
26 27
28#include <asm/arch/control.h>
29
30#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
31# include "../mach-omap2/prm.h"
32# include "../mach-omap2/cm.h"
33# include "../mach-omap2/sdrc.h"
34#endif
35
27#define OMAP1_SRAM_PA 0x20000000 36#define OMAP1_SRAM_PA 0x20000000
28#define OMAP1_SRAM_VA 0xd0000000 37#define OMAP1_SRAM_VA VMALLOC_END
29#define OMAP2_SRAM_PA 0x40200000 38#define OMAP2_SRAM_PA 0x40200000
30#define OMAP2_SRAM_PUB_PA 0x4020f800 39#define OMAP2_SRAM_PUB_PA 0x4020f800
31#define OMAP2_SRAM_VA 0xd0000000 40#define OMAP2_SRAM_VA VMALLOC_END
32#define OMAP2_SRAM_PUB_VA 0xd0000800 41#define OMAP2_SRAM_PUB_VA (VMALLOC_END + 0x800)
33 42#define OMAP3_SRAM_PA 0x40200000
34#if defined(CONFIG_ARCH_OMAP24XX) 43#define OMAP3_SRAM_VA 0xd7000000
44#define OMAP3_SRAM_PUB_PA 0x40208000
45#define OMAP3_SRAM_PUB_VA 0xd7008000
46
47#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
35#define SRAM_BOOTLOADER_SZ 0x00 48#define SRAM_BOOTLOADER_SZ 0x00
36#else 49#else
37#define SRAM_BOOTLOADER_SZ 0x80 50#define SRAM_BOOTLOADER_SZ 0x80
38#endif 51#endif
39 52
40#define VA_REQINFOPERM0 IO_ADDRESS(0x68005048) 53#define OMAP24XX_VA_REQINFOPERM0 IO_ADDRESS(0x68005048)
41#define VA_READPERM0 IO_ADDRESS(0x68005050) 54#define OMAP24XX_VA_READPERM0 IO_ADDRESS(0x68005050)
42#define VA_WRITEPERM0 IO_ADDRESS(0x68005058) 55#define OMAP24XX_VA_WRITEPERM0 IO_ADDRESS(0x68005058)
43#define VA_CONTROL_STAT IO_ADDRESS(0x480002F8) 56
57#define OMAP34XX_VA_REQINFOPERM0 IO_ADDRESS(0x68012848)
58#define OMAP34XX_VA_READPERM0 IO_ADDRESS(0x68012850)
59#define OMAP34XX_VA_WRITEPERM0 IO_ADDRESS(0x68012858)
60#define OMAP34XX_VA_ADDR_MATCH2 IO_ADDRESS(0x68012880)
61#define OMAP34XX_VA_SMS_RG_ATT0 IO_ADDRESS(0x6C000048)
62#define OMAP34XX_VA_CONTROL_STAT IO_ADDRESS(0x480022F0)
63
44#define GP_DEVICE 0x300 64#define GP_DEVICE 0x300
45#define TYPE_MASK 0x700
46 65
47#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) 66#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
48 67
@@ -68,14 +87,21 @@ static int is_sram_locked(void)
68 int type = 0; 87 int type = 0;
69 88
70 if (cpu_is_omap242x()) 89 if (cpu_is_omap242x())
71 type = __raw_readl(VA_CONTROL_STAT) & TYPE_MASK; 90 type = system_rev & OMAP2_DEVICETYPE_MASK;
72 91
73 if (type == GP_DEVICE) { 92 if (type == GP_DEVICE) {
74 /* RAMFW: R/W access to all initiators for all qualifier sets */ 93 /* RAMFW: R/W access to all initiators for all qualifier sets */
75 if (cpu_is_omap242x()) { 94 if (cpu_is_omap242x()) {
76 __raw_writel(0xFF, VA_REQINFOPERM0); /* all q-vects */ 95 __raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */
77 __raw_writel(0xCFDE, VA_READPERM0); /* all i-read */ 96 __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */
78 __raw_writel(0xCFDE, VA_WRITEPERM0); /* all i-write */ 97 __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
98 }
99 if (cpu_is_omap34xx()) {
100 __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
101 __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */
102 __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
103 __raw_writel(0x0, OMAP34XX_VA_ADDR_MATCH2);
104 __raw_writel(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0);
79 } 105 }
80 return 0; 106 return 0;
81 } else 107 } else
@@ -92,18 +118,30 @@ void __init omap_detect_sram(void)
92{ 118{
93 unsigned long reserved; 119 unsigned long reserved;
94 120
95 if (cpu_is_omap24xx()) { 121 if (cpu_class_is_omap2()) {
96 if (is_sram_locked()) { 122 if (is_sram_locked()) {
97 omap_sram_base = OMAP2_SRAM_PUB_VA; 123 if (cpu_is_omap34xx()) {
98 omap_sram_start = OMAP2_SRAM_PUB_PA; 124 omap_sram_base = OMAP3_SRAM_PUB_VA;
99 omap_sram_size = 0x800; /* 2K */ 125 omap_sram_start = OMAP3_SRAM_PUB_PA;
126 omap_sram_size = 0x8000; /* 32K */
127 } else {
128 omap_sram_base = OMAP2_SRAM_PUB_VA;
129 omap_sram_start = OMAP2_SRAM_PUB_PA;
130 omap_sram_size = 0x800; /* 2K */
131 }
100 } else { 132 } else {
101 omap_sram_base = OMAP2_SRAM_VA; 133 if (cpu_is_omap34xx()) {
102 omap_sram_start = OMAP2_SRAM_PA; 134 omap_sram_base = OMAP3_SRAM_VA;
103 if (cpu_is_omap242x()) 135 omap_sram_start = OMAP3_SRAM_PA;
104 omap_sram_size = 0xa0000; /* 640K */
105 else if (cpu_is_omap243x())
106 omap_sram_size = 0x10000; /* 64K */ 136 omap_sram_size = 0x10000; /* 64K */
137 } else {
138 omap_sram_base = OMAP2_SRAM_VA;
139 omap_sram_start = OMAP2_SRAM_PA;
140 if (cpu_is_omap242x())
141 omap_sram_size = 0xa0000; /* 640K */
142 else if (cpu_is_omap243x())
143 omap_sram_size = 0x10000; /* 64K */
144 }
107 } 145 }
108 } else { 146 } else {
109 omap_sram_base = OMAP1_SRAM_VA; 147 omap_sram_base = OMAP1_SRAM_VA;
@@ -157,6 +195,13 @@ void __init omap_map_sram(void)
157 omap_sram_io_desc[0].pfn = __phys_to_pfn(base); 195 omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
158 } 196 }
159 197
198 if (cpu_is_omap34xx()) {
199 omap_sram_io_desc[0].virtual = OMAP3_SRAM_VA;
200 base = OMAP3_SRAM_PA;
201 base = ROUND_DOWN(base, PAGE_SIZE);
202 omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
203 }
204
160 omap_sram_io_desc[0].length = 1024 * 1024; /* Use section desc */ 205 omap_sram_io_desc[0].length = 1024 * 1024; /* Use section desc */
161 iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc)); 206 iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
162 207
@@ -191,6 +236,7 @@ void * omap_sram_push(void * start, unsigned long size)
191 omap_sram_ceil -= size; 236 omap_sram_ceil -= size;
192 omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, sizeof(void *)); 237 omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, sizeof(void *));
193 memcpy((void *)omap_sram_ceil, start, size); 238 memcpy((void *)omap_sram_ceil, start, size);
239 flush_icache_range((unsigned long)start, (unsigned long)(start + size));
194 240
195 return (void *)omap_sram_ceil; 241 return (void *)omap_sram_ceil;
196} 242}
@@ -214,8 +260,9 @@ void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
214 260
215int __init omap1_sram_init(void) 261int __init omap1_sram_init(void)
216{ 262{
217 _omap_sram_reprogram_clock = omap_sram_push(sram_reprogram_clock, 263 _omap_sram_reprogram_clock =
218 sram_reprogram_clock_sz); 264 omap_sram_push(omap1_sram_reprogram_clock,
265 omap1_sram_reprogram_clock_sz);
219 266
220 return 0; 267 return 0;
221} 268}
@@ -224,7 +271,7 @@ int __init omap1_sram_init(void)
224#define omap1_sram_init() do {} while (0) 271#define omap1_sram_init() do {} while (0)
225#endif 272#endif
226 273
227#ifdef CONFIG_ARCH_OMAP2 274#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
228 275
229static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, 276static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
230 u32 base_cs, u32 force_unlock); 277 u32 base_cs, u32 force_unlock);
@@ -259,19 +306,109 @@ u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass)
259 306
260 return _omap2_set_prcm(dpll_ctrl_val, sdrc_rfr_val, bypass); 307 return _omap2_set_prcm(dpll_ctrl_val, sdrc_rfr_val, bypass);
261} 308}
309#endif
310
311#ifdef CONFIG_ARCH_OMAP2420
312int __init omap242x_sram_init(void)
313{
314 _omap2_sram_ddr_init = omap_sram_push(omap242x_sram_ddr_init,
315 omap242x_sram_ddr_init_sz);
316
317 _omap2_sram_reprogram_sdrc = omap_sram_push(omap242x_sram_reprogram_sdrc,
318 omap242x_sram_reprogram_sdrc_sz);
319
320 _omap2_set_prcm = omap_sram_push(omap242x_sram_set_prcm,
321 omap242x_sram_set_prcm_sz);
322
323 return 0;
324}
325#else
326static inline int omap242x_sram_init(void)
327{
328 return 0;
329}
330#endif
331
332#ifdef CONFIG_ARCH_OMAP2430
333int __init omap243x_sram_init(void)
334{
335 _omap2_sram_ddr_init = omap_sram_push(omap243x_sram_ddr_init,
336 omap243x_sram_ddr_init_sz);
337
338 _omap2_sram_reprogram_sdrc = omap_sram_push(omap243x_sram_reprogram_sdrc,
339 omap243x_sram_reprogram_sdrc_sz);
340
341 _omap2_set_prcm = omap_sram_push(omap243x_sram_set_prcm,
342 omap243x_sram_set_prcm_sz);
343
344 return 0;
345}
346#else
347static inline int omap243x_sram_init(void)
348{
349 return 0;
350}
351#endif
352
353#ifdef CONFIG_ARCH_OMAP3
354
355static u32 (*_omap2_sram_reprogram_gpmc)(u32 perf_level);
356u32 omap2_sram_reprogram_gpmc(u32 perf_level)
357{
358 if (!_omap2_sram_reprogram_gpmc)
359 omap_sram_error();
360
361 return _omap2_sram_reprogram_gpmc(perf_level);
362}
363
364static u32 (*_omap2_sram_configure_core_dpll)(u32 m, u32 n,
365 u32 freqsel, u32 m2);
366u32 omap2_sram_configure_core_dpll(u32 m, u32 n, u32 freqsel, u32 m2)
367{
368 if (!_omap2_sram_configure_core_dpll)
369 omap_sram_error();
370
371 return _omap2_sram_configure_core_dpll(m, n, freqsel, m2);
372}
262 373
263int __init omap2_sram_init(void) 374/* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */
375void restore_sram_functions(void)
264{ 376{
265 _omap2_sram_ddr_init = omap_sram_push(sram_ddr_init, sram_ddr_init_sz); 377 omap_sram_ceil = omap_sram_base + omap_sram_size;
266 378
267 _omap2_sram_reprogram_sdrc = omap_sram_push(sram_reprogram_sdrc, 379 _omap2_sram_reprogram_gpmc = omap_sram_push(omap34xx_sram_reprogram_gpmc,
268 sram_reprogram_sdrc_sz); 380 omap34xx_sram_reprogram_gpmc_sz);
269 _omap2_set_prcm = omap_sram_push(sram_set_prcm, sram_set_prcm_sz); 381
382 _omap2_sram_configure_core_dpll =
383 omap_sram_push(omap34xx_sram_configure_core_dpll,
384 omap34xx_sram_configure_core_dpll_sz);
385}
386
387int __init omap34xx_sram_init(void)
388{
389 _omap2_sram_ddr_init = omap_sram_push(omap34xx_sram_ddr_init,
390 omap34xx_sram_ddr_init_sz);
391
392 _omap2_sram_reprogram_sdrc = omap_sram_push(omap34xx_sram_reprogram_sdrc,
393 omap34xx_sram_reprogram_sdrc_sz);
394
395 _omap2_set_prcm = omap_sram_push(omap34xx_sram_set_prcm,
396 omap34xx_sram_set_prcm_sz);
397
398 _omap2_sram_reprogram_gpmc = omap_sram_push(omap34xx_sram_reprogram_gpmc,
399 omap34xx_sram_reprogram_gpmc_sz);
400
401 _omap2_sram_configure_core_dpll =
402 omap_sram_push(omap34xx_sram_configure_core_dpll,
403 omap34xx_sram_configure_core_dpll_sz);
270 404
271 return 0; 405 return 0;
272} 406}
273#else 407#else
274#define omap2_sram_init() do {} while (0) 408static inline int omap34xx_sram_init(void)
409{
410 return 0;
411}
275#endif 412#endif
276 413
277int __init omap_sram_init(void) 414int __init omap_sram_init(void)
@@ -279,10 +416,14 @@ int __init omap_sram_init(void)
279 omap_detect_sram(); 416 omap_detect_sram();
280 omap_map_sram(); 417 omap_map_sram();
281 418
282 if (!cpu_is_omap24xx()) 419 if (!(cpu_class_is_omap2()))
283 omap1_sram_init(); 420 omap1_sram_init();
284 else 421 else if (cpu_is_omap242x())
285 omap2_sram_init(); 422 omap242x_sram_init();
423 else if (cpu_is_omap2430())
424 omap243x_sram_init();
425 else if (cpu_is_omap34xx())
426 omap34xx_sram_init();
286 427
287 return 0; 428 return 0;
288} 429}
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index a619475c4b76..2699c16d4da0 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -1,4 +1,4 @@
1/* 1 /*
2 * arch/arm/plat-omap/usb.c -- platform level USB initialization 2 * arch/arm/plat-omap/usb.c -- platform level USB initialization
3 * 3 *
4 * Copyright (C) 2004 Texas Instruments, Inc. 4 * Copyright (C) 2004 Texas Instruments, Inc.
@@ -156,8 +156,12 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
156 156
157 if (nwires == 0) { 157 if (nwires == 0) {
158 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) { 158 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) {
159 u32 l;
160
159 /* pulldown D+/D- */ 161 /* pulldown D+/D- */
160 USB_TRANSCEIVER_CTRL_REG &= ~(3 << 1); 162 l = omap_readl(USB_TRANSCEIVER_CTRL);
163 l &= ~(3 << 1);
164 omap_writel(l, USB_TRANSCEIVER_CTRL);
161 } 165 }
162 return 0; 166 return 0;
163 } 167 }
@@ -171,6 +175,8 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
171 175
172 /* internal transceiver (unavailable on 17xx, 24xx) */ 176 /* internal transceiver (unavailable on 17xx, 24xx) */
173 if (!cpu_class_is_omap2() && nwires == 2) { 177 if (!cpu_class_is_omap2() && nwires == 2) {
178 u32 l;
179
174 // omap_cfg_reg(P9_USB_DP); 180 // omap_cfg_reg(P9_USB_DP);
175 // omap_cfg_reg(R8_USB_DM); 181 // omap_cfg_reg(R8_USB_DM);
176 182
@@ -185,9 +191,11 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
185 * - OTG support on this port not yet written 191 * - OTG support on this port not yet written
186 */ 192 */
187 193
188 USB_TRANSCEIVER_CTRL_REG &= ~(7 << 4); 194 l = omap_readl(USB_TRANSCEIVER_CTRL);
195 l &= ~(7 << 4);
189 if (!is_device) 196 if (!is_device)
190 USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 197 l |= (3 << 1);
198 omap_writel(l, USB_TRANSCEIVER_CTRL);
191 199
192 return 3 << 16; 200 return 3 << 16;
193 } 201 }
@@ -217,8 +225,13 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
217 * with VBUS switching and overcurrent detection. 225 * with VBUS switching and overcurrent detection.
218 */ 226 */
219 227
220 if (cpu_class_is_omap1() && nwires != 6) 228 if (cpu_class_is_omap1() && nwires != 6) {
221 USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB2_UNI_R; 229 u32 l;
230
231 l = omap_readl(USB_TRANSCEIVER_CTRL);
232 l &= ~CONF_USB2_UNI_R;
233 omap_writel(l, USB_TRANSCEIVER_CTRL);
234 }
222 235
223 switch (nwires) { 236 switch (nwires) {
224 case 3: 237 case 3:
@@ -238,9 +251,13 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
238 omap_cfg_reg(K20_24XX_USB0_VM); 251 omap_cfg_reg(K20_24XX_USB0_VM);
239 omap2_usb_devconf_set(0, USB_UNIDIR); 252 omap2_usb_devconf_set(0, USB_UNIDIR);
240 } else { 253 } else {
254 u32 l;
255
241 omap_cfg_reg(AA9_USB0_VP); 256 omap_cfg_reg(AA9_USB0_VP);
242 omap_cfg_reg(R9_USB0_VM); 257 omap_cfg_reg(R9_USB0_VM);
243 USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R; 258 l = omap_readl(USB_TRANSCEIVER_CTRL);
259 l |= CONF_USB2_UNI_R;
260 omap_writel(l, USB_TRANSCEIVER_CTRL);
244 } 261 }
245 break; 262 break;
246 default: 263 default:
@@ -254,8 +271,13 @@ static u32 __init omap_usb1_init(unsigned nwires)
254{ 271{
255 u32 syscon1 = 0; 272 u32 syscon1 = 0;
256 273
257 if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) 274 if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) {
258 USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB1_UNI_R; 275 u32 l;
276
277 l = omap_readl(USB_TRANSCEIVER_CTRL);
278 l &= ~CONF_USB1_UNI_R;
279 omap_writel(l, USB_TRANSCEIVER_CTRL);
280 }
259 if (cpu_is_omap24xx()) 281 if (cpu_is_omap24xx())
260 omap2_usb_devconf_clear(1, USB_BIDIR_TLL); 282 omap2_usb_devconf_clear(1, USB_BIDIR_TLL);
261 283
@@ -316,8 +338,13 @@ static u32 __init omap_usb1_init(unsigned nwires)
316 syscon1 = 3; 338 syscon1 = 3;
317 omap_cfg_reg(USB1_VP); 339 omap_cfg_reg(USB1_VP);
318 omap_cfg_reg(USB1_VM); 340 omap_cfg_reg(USB1_VM);
319 if (!cpu_is_omap15xx()) 341 if (!cpu_is_omap15xx()) {
320 USB_TRANSCEIVER_CTRL_REG |= CONF_USB1_UNI_R; 342 u32 l;
343
344 l = omap_readl(USB_TRANSCEIVER_CTRL);
345 l |= CONF_USB1_UNI_R;
346 omap_writel(l, USB_TRANSCEIVER_CTRL);
347 }
321 break; 348 break;
322 default: 349 default:
323bad: 350bad:
@@ -340,8 +367,13 @@ static u32 __init omap_usb2_init(unsigned nwires, unsigned alt_pingroup)
340 if (alt_pingroup || nwires == 0) 367 if (alt_pingroup || nwires == 0)
341 return 0; 368 return 0;
342 369
343 if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) 370 if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) {
344 USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB2_UNI_R; 371 u32 l;
372
373 l = omap_readl(USB_TRANSCEIVER_CTRL);
374 l &= ~CONF_USB2_UNI_R;
375 omap_writel(l, USB_TRANSCEIVER_CTRL);
376 }
345 377
346 /* external transceiver */ 378 /* external transceiver */
347 if (cpu_is_omap15xx()) { 379 if (cpu_is_omap15xx()) {
@@ -410,9 +442,13 @@ static u32 __init omap_usb2_init(unsigned nwires, unsigned alt_pingroup)
410 omap_cfg_reg(USB2_VP); 442 omap_cfg_reg(USB2_VP);
411 omap_cfg_reg(USB2_VM); 443 omap_cfg_reg(USB2_VM);
412 } else { 444 } else {
445 u32 l;
446
413 omap_cfg_reg(AA9_USB2_VP); 447 omap_cfg_reg(AA9_USB2_VP);
414 omap_cfg_reg(R9_USB2_VM); 448 omap_cfg_reg(R9_USB2_VM);
415 USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R; 449 l = omap_readl(USB_TRANSCEIVER_CTRL);
450 l |= CONF_USB2_UNI_R;
451 omap_writel(l, USB_TRANSCEIVER_CTRL);
416 } 452 }
417 break; 453 break;
418 default: 454 default:
@@ -531,10 +567,6 @@ static struct platform_device otg_device = {
531 567
532/*-------------------------------------------------------------------------*/ 568/*-------------------------------------------------------------------------*/
533 569
534#define ULPD_CLOCK_CTRL_REG __REG16(ULPD_CLOCK_CTRL)
535#define ULPD_SOFT_REQ_REG __REG16(ULPD_SOFT_REQ)
536
537
538// FIXME correct answer depends on hmc_mode, 570// FIXME correct answer depends on hmc_mode,
539// as does (on omap1) any nonzero value for config->otg port number 571// as does (on omap1) any nonzero value for config->otg port number
540#ifdef CONFIG_USB_GADGET_OMAP 572#ifdef CONFIG_USB_GADGET_OMAP
@@ -550,17 +582,17 @@ static struct platform_device otg_device = {
550void __init 582void __init
551omap_otg_init(struct omap_usb_config *config) 583omap_otg_init(struct omap_usb_config *config)
552{ 584{
553 u32 syscon = OTG_SYSCON_1_REG & 0xffff; 585 u32 syscon;
554 int status; 586 int status;
555 int alt_pingroup = 0; 587 int alt_pingroup = 0;
556 588
557 /* NOTE: no bus or clock setup (yet?) */ 589 /* NOTE: no bus or clock setup (yet?) */
558 590
559 syscon = OTG_SYSCON_1_REG & 0xffff; 591 syscon = omap_readl(OTG_SYSCON_1) & 0xffff;
560 if (!(syscon & OTG_RESET_DONE)) 592 if (!(syscon & OTG_RESET_DONE))
561 pr_debug("USB resets not complete?\n"); 593 pr_debug("USB resets not complete?\n");
562 594
563 // OTG_IRQ_EN_REG = 0; 595 //omap_writew(0, OTG_IRQ_EN);
564 596
565 /* pin muxing and transceiver pinouts */ 597 /* pin muxing and transceiver pinouts */
566 if (config->pins[0] > 2) /* alt pingroup 2 */ 598 if (config->pins[0] > 2) /* alt pingroup 2 */
@@ -568,8 +600,8 @@ omap_otg_init(struct omap_usb_config *config)
568 syscon |= omap_usb0_init(config->pins[0], is_usb0_device(config)); 600 syscon |= omap_usb0_init(config->pins[0], is_usb0_device(config));
569 syscon |= omap_usb1_init(config->pins[1]); 601 syscon |= omap_usb1_init(config->pins[1]);
570 syscon |= omap_usb2_init(config->pins[2], alt_pingroup); 602 syscon |= omap_usb2_init(config->pins[2], alt_pingroup);
571 pr_debug("OTG_SYSCON_1_REG = %08x\n", syscon); 603 pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1));
572 OTG_SYSCON_1_REG = syscon; 604 omap_writel(syscon, OTG_SYSCON_1);
573 605
574 syscon = config->hmc_mode; 606 syscon = config->hmc_mode;
575 syscon |= USBX_SYNCHRO | (4 << 16) /* B_ASE0_BRST */; 607 syscon |= USBX_SYNCHRO | (4 << 16) /* B_ASE0_BRST */;
@@ -578,9 +610,10 @@ omap_otg_init(struct omap_usb_config *config)
578 syscon |= OTG_EN; 610 syscon |= OTG_EN;
579#endif 611#endif
580 if (cpu_class_is_omap1()) 612 if (cpu_class_is_omap1())
581 pr_debug("USB_TRANSCEIVER_CTRL_REG = %03x\n", USB_TRANSCEIVER_CTRL_REG); 613 pr_debug("USB_TRANSCEIVER_CTRL = %03x\n",
582 pr_debug("OTG_SYSCON_2_REG = %08x\n", syscon); 614 omap_readl(USB_TRANSCEIVER_CTRL));
583 OTG_SYSCON_2_REG = syscon; 615 pr_debug("OTG_SYSCON_2 = %08x\n", omap_readl(OTG_SYSCON_2));
616 omap_writel(syscon, OTG_SYSCON_2);
584 617
585 printk("USB: hmc %d", config->hmc_mode); 618 printk("USB: hmc %d", config->hmc_mode);
586 if (!alt_pingroup) 619 if (!alt_pingroup)
@@ -597,12 +630,19 @@ omap_otg_init(struct omap_usb_config *config)
597 printk("\n"); 630 printk("\n");
598 631
599 if (cpu_class_is_omap1()) { 632 if (cpu_class_is_omap1()) {
633 u16 w;
634
600 /* leave USB clocks/controllers off until needed */ 635 /* leave USB clocks/controllers off until needed */
601 ULPD_SOFT_REQ_REG &= ~SOFT_USB_CLK_REQ; 636 w = omap_readw(ULPD_SOFT_REQ);
602 ULPD_CLOCK_CTRL_REG &= ~USB_MCLK_EN; 637 w &= ~SOFT_USB_CLK_REQ;
603 ULPD_CLOCK_CTRL_REG |= DIS_USB_PVCI_CLK; 638 omap_writew(w, ULPD_SOFT_REQ);
639
640 w = omap_readw(ULPD_CLOCK_CTRL);
641 w &= ~USB_MCLK_EN;
642 w |= DIS_USB_PVCI_CLK;
643 omap_writew(w, ULPD_CLOCK_CTRL);
604 } 644 }
605 syscon = OTG_SYSCON_1_REG; 645 syscon = omap_readl(OTG_SYSCON_1);
606 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; 646 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN;
607 647
608#ifdef CONFIG_USB_GADGET_OMAP 648#ifdef CONFIG_USB_GADGET_OMAP
@@ -639,8 +679,8 @@ omap_otg_init(struct omap_usb_config *config)
639 pr_debug("can't register OTG device, %d\n", status); 679 pr_debug("can't register OTG device, %d\n", status);
640 } 680 }
641#endif 681#endif
642 pr_debug("OTG_SYSCON_1_REG = %08x\n", syscon); 682 pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1));
643 OTG_SYSCON_1_REG = syscon; 683 omap_writel(syscon, OTG_SYSCON_1);
644 684
645 status = 0; 685 status = 0;
646} 686}
@@ -653,18 +693,19 @@ static inline void omap_otg_init(struct omap_usb_config *config) {}
653 693
654#ifdef CONFIG_ARCH_OMAP15XX 694#ifdef CONFIG_ARCH_OMAP15XX
655 695
656#define ULPD_DPLL_CTRL_REG __REG16(ULPD_DPLL_CTRL) 696/* ULPD_DPLL_CTRL */
657#define DPLL_IOB (1 << 13) 697#define DPLL_IOB (1 << 13)
658#define DPLL_PLL_ENABLE (1 << 4) 698#define DPLL_PLL_ENABLE (1 << 4)
659#define DPLL_LOCK (1 << 0) 699#define DPLL_LOCK (1 << 0)
660 700
661#define ULPD_APLL_CTRL_REG __REG16(ULPD_APLL_CTRL) 701/* ULPD_APLL_CTRL */
662#define APLL_NDPLL_SWITCH (1 << 0) 702#define APLL_NDPLL_SWITCH (1 << 0)
663 703
664 704
665static void __init omap_1510_usb_init(struct omap_usb_config *config) 705static void __init omap_1510_usb_init(struct omap_usb_config *config)
666{ 706{
667 unsigned int val; 707 unsigned int val;
708 u16 w;
668 709
669 omap_usb0_init(config->pins[0], is_usb0_device(config)); 710 omap_usb0_init(config->pins[0], is_usb0_device(config));
670 omap_usb1_init(config->pins[1]); 711 omap_usb1_init(config->pins[1]);
@@ -685,12 +726,22 @@ static void __init omap_1510_usb_init(struct omap_usb_config *config)
685 printk("\n"); 726 printk("\n");
686 727
687 /* use DPLL for 48 MHz function clock */ 728 /* use DPLL for 48 MHz function clock */
688 pr_debug("APLL %04x DPLL %04x REQ %04x\n", ULPD_APLL_CTRL_REG, 729 pr_debug("APLL %04x DPLL %04x REQ %04x\n", omap_readw(ULPD_APLL_CTRL),
689 ULPD_DPLL_CTRL_REG, ULPD_SOFT_REQ_REG); 730 omap_readw(ULPD_DPLL_CTRL), omap_readw(ULPD_SOFT_REQ));
690 ULPD_APLL_CTRL_REG &= ~APLL_NDPLL_SWITCH; 731
691 ULPD_DPLL_CTRL_REG |= DPLL_IOB | DPLL_PLL_ENABLE; 732 w = omap_readw(ULPD_APLL_CTRL);
692 ULPD_SOFT_REQ_REG |= SOFT_UDC_REQ | SOFT_DPLL_REQ; 733 w &= ~APLL_NDPLL_SWITCH;
693 while (!(ULPD_DPLL_CTRL_REG & DPLL_LOCK)) 734 omap_writew(w, ULPD_APLL_CTRL);
735
736 w = omap_readw(ULPD_DPLL_CTRL);
737 w |= DPLL_IOB | DPLL_PLL_ENABLE;
738 omap_writew(w, ULPD_DPLL_CTRL);
739
740 w = omap_readw(ULPD_SOFT_REQ);
741 w |= SOFT_UDC_REQ | SOFT_DPLL_REQ;
742 omap_writew(w, ULPD_SOFT_REQ);
743
744 while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK))
694 cpu_relax(); 745 cpu_relax();
695 746
696#ifdef CONFIG_USB_GADGET_OMAP 747#ifdef CONFIG_USB_GADGET_OMAP
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index c5b669d234bc..fe66a1835169 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -36,8 +36,8 @@ static void orion_irq_unmask(u32 irq)
36 36
37static struct irq_chip orion_irq_chip = { 37static struct irq_chip orion_irq_chip = {
38 .name = "orion_irq", 38 .name = "orion_irq",
39 .ack = orion_irq_mask,
40 .mask = orion_irq_mask, 39 .mask = orion_irq_mask,
40 .mask_ack = orion_irq_mask,
41 .unmask = orion_irq_unmask, 41 .unmask = orion_irq_unmask,
42}; 42};
43 43
@@ -59,6 +59,7 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
59 set_irq_chip(irq, &orion_irq_chip); 59 set_irq_chip(irq, &orion_irq_chip);
60 set_irq_chip_data(irq, maskaddr); 60 set_irq_chip_data(irq, maskaddr);
61 set_irq_handler(irq, handle_level_irq); 61 set_irq_handler(irq, handle_level_irq);
62 irq_desc[irq].status |= IRQ_LEVEL;
62 set_irq_flags(irq, IRQF_VALID); 63 set_irq_flags(irq, IRQF_VALID);
63 } 64 }
64} 65}
diff --git a/arch/arm/plat-orion/pcie.c b/arch/arm/plat-orion/pcie.c
index abfda53f1800..ca32c60e14d7 100644
--- a/arch/arm/plat-orion/pcie.c
+++ b/arch/arm/plat-orion/pcie.c
@@ -39,6 +39,7 @@
39#define PCIE_CONF_DATA_OFF 0x18fc 39#define PCIE_CONF_DATA_OFF 0x18fc
40#define PCIE_MASK_OFF 0x1910 40#define PCIE_MASK_OFF 0x1910
41#define PCIE_CTRL_OFF 0x1a00 41#define PCIE_CTRL_OFF 0x1a00
42#define PCIE_CTRL_X1_MODE 0x0001
42#define PCIE_STAT_OFF 0x1a04 43#define PCIE_STAT_OFF 0x1a04
43#define PCIE_STAT_DEV_OFFS 20 44#define PCIE_STAT_DEV_OFFS 20
44#define PCIE_STAT_DEV_MASK 0x1f 45#define PCIE_STAT_DEV_MASK 0x1f
@@ -62,6 +63,11 @@ int orion_pcie_link_up(void __iomem *base)
62 return !(readl(base + PCIE_STAT_OFF) & PCIE_STAT_LINK_DOWN); 63 return !(readl(base + PCIE_STAT_OFF) & PCIE_STAT_LINK_DOWN);
63} 64}
64 65
66int __init orion_pcie_x4_mode(void __iomem *base)
67{
68 return !(readl(base + PCIE_CTRL_OFF) & PCIE_CTRL_X1_MODE);
69}
70
65int orion_pcie_get_local_bus_nr(void __iomem *base) 71int orion_pcie_get_local_bus_nr(void __iomem *base)
66{ 72{
67 u32 stat = readl(base + PCIE_STAT_OFF); 73 u32 stat = readl(base + PCIE_STAT_OFF);
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 28b5285446e8..93c4ef9f0067 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -74,7 +74,7 @@ orion_clkevt_next_event(unsigned long delta, struct clock_event_device *dev)
74 /* 74 /*
75 * Clear and enable clockevent timer interrupt. 75 * Clear and enable clockevent timer interrupt.
76 */ 76 */
77 writel(~BRIDGE_INT_TIMER1, BRIDGE_CAUSE); 77 writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
78 78
79 u = readl(BRIDGE_MASK); 79 u = readl(BRIDGE_MASK);
80 u |= BRIDGE_INT_TIMER1; 80 u |= BRIDGE_INT_TIMER1;
@@ -138,7 +138,7 @@ orion_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
138 /* 138 /*
139 * ACK pending timer interrupt. 139 * ACK pending timer interrupt.
140 */ 140 */
141 writel(~BRIDGE_INT_TIMER1, BRIDGE_CAUSE); 141 writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
142 142
143 } 143 }
144 local_irq_restore(flags); 144 local_irq_restore(flags);
@@ -159,7 +159,7 @@ static irqreturn_t orion_timer_interrupt(int irq, void *dev_id)
159 /* 159 /*
160 * ACK timer interrupt and call event handler. 160 * ACK timer interrupt and call event handler.
161 */ 161 */
162 writel(~BRIDGE_INT_TIMER1, BRIDGE_CAUSE); 162 writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
163 orion_clkevt.event_handler(&orion_clkevt); 163 orion_clkevt.event_handler(&orion_clkevt);
164 164
165 return IRQ_HANDLED; 165 return IRQ_HANDLED;
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index b66fb3c4e228..5e28c217b8c2 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -9,6 +9,7 @@ config PLAT_S3C24XX
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 default y if ARCH_S3C2410 10 default y if ARCH_S3C2410
11 select NO_IOPORT 11 select NO_IOPORT
12 select HAVE_GPIO_LIB
12 help 13 help
13 Base platform code for any Samsung S3C24XX device 14 Base platform code for any Samsung S3C24XX device
14 15
@@ -20,6 +21,13 @@ config CPU_S3C244X
20 help 21 help
21 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems. 22 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems.
22 23
24config S3C24XX_PWM
25 bool "PWM device support"
26 select HAVE_PWM
27 help
28 Support for exporting the PWM timer blocks via the pwm device
29 system.
30
23config PM_SIMTEC 31config PM_SIMTEC
24 bool 32 bool
25 help 33 help
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index 131d20237dd7..d82767b2b833 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -16,8 +16,10 @@ obj-y += cpu.o
16obj-y += irq.o 16obj-y += irq.o
17obj-y += devs.o 17obj-y += devs.o
18obj-y += gpio.o 18obj-y += gpio.o
19obj-y += gpiolib.o
19obj-y += time.o 20obj-y += time.o
20obj-y += clock.o 21obj-y += clock.o
22obj-y += pwm-clock.o
21 23
22# Architecture dependant builds 24# Architecture dependant builds
23 25
@@ -27,5 +29,6 @@ obj-$(CONFIG_CPU_S3C244X) += s3c244x-clock.o
27obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o 29obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
28obj-$(CONFIG_PM) += pm.o 30obj-$(CONFIG_PM) += pm.o
29obj-$(CONFIG_PM) += sleep.o 31obj-$(CONFIG_PM) += sleep.o
32obj-$(CONFIG_HAVE_PWM) += pwm.o
30obj-$(CONFIG_S3C2410_DMA) += dma.o 33obj-$(CONFIG_S3C2410_DMA) += dma.o
31obj-$(CONFIG_MACH_SMDK) += common-smdk.o 34obj-$(CONFIG_MACH_SMDK) += common-smdk.o
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index e546e933b3f7..eea3b32ff798 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -495,106 +495,6 @@ struct platform_device s3c_device_spi1 = {
495 495
496EXPORT_SYMBOL(s3c_device_spi1); 496EXPORT_SYMBOL(s3c_device_spi1);
497 497
498/* pwm timer blocks */
499
500static struct resource s3c_timer0_resource[] = {
501 [0] = {
502 .start = S3C24XX_PA_TIMER + 0x0C,
503 .end = S3C24XX_PA_TIMER + 0x0C + 0xB,
504 .flags = IORESOURCE_MEM,
505 },
506 [1] = {
507 .start = IRQ_TIMER0,
508 .end = IRQ_TIMER0,
509 .flags = IORESOURCE_IRQ,
510 }
511
512};
513
514struct platform_device s3c_device_timer0 = {
515 .name = "s3c2410-timer",
516 .id = 0,
517 .num_resources = ARRAY_SIZE(s3c_timer0_resource),
518 .resource = s3c_timer0_resource,
519};
520
521EXPORT_SYMBOL(s3c_device_timer0);
522
523/* timer 1 */
524
525static struct resource s3c_timer1_resource[] = {
526 [0] = {
527 .start = S3C24XX_PA_TIMER + 0x18,
528 .end = S3C24XX_PA_TIMER + 0x23,
529 .flags = IORESOURCE_MEM,
530 },
531 [1] = {
532 .start = IRQ_TIMER1,
533 .end = IRQ_TIMER1,
534 .flags = IORESOURCE_IRQ,
535 }
536
537};
538
539struct platform_device s3c_device_timer1 = {
540 .name = "s3c2410-timer",
541 .id = 1,
542 .num_resources = ARRAY_SIZE(s3c_timer1_resource),
543 .resource = s3c_timer1_resource,
544};
545
546EXPORT_SYMBOL(s3c_device_timer1);
547
548/* timer 2 */
549
550static struct resource s3c_timer2_resource[] = {
551 [0] = {
552 .start = S3C24XX_PA_TIMER + 0x24,
553 .end = S3C24XX_PA_TIMER + 0x2F,
554 .flags = IORESOURCE_MEM,
555 },
556 [1] = {
557 .start = IRQ_TIMER2,
558 .end = IRQ_TIMER2,
559 .flags = IORESOURCE_IRQ,
560 }
561
562};
563
564struct platform_device s3c_device_timer2 = {
565 .name = "s3c2410-timer",
566 .id = 2,
567 .num_resources = ARRAY_SIZE(s3c_timer2_resource),
568 .resource = s3c_timer2_resource,
569};
570
571EXPORT_SYMBOL(s3c_device_timer2);
572
573/* timer 3 */
574
575static struct resource s3c_timer3_resource[] = {
576 [0] = {
577 .start = S3C24XX_PA_TIMER + 0x30,
578 .end = S3C24XX_PA_TIMER + 0x3B,
579 .flags = IORESOURCE_MEM,
580 },
581 [1] = {
582 .start = IRQ_TIMER3,
583 .end = IRQ_TIMER3,
584 .flags = IORESOURCE_IRQ,
585 }
586
587};
588
589struct platform_device s3c_device_timer3 = {
590 .name = "s3c2410-timer",
591 .id = 3,
592 .num_resources = ARRAY_SIZE(s3c_timer3_resource),
593 .resource = s3c_timer3_resource,
594};
595
596EXPORT_SYMBOL(s3c_device_timer3);
597
598#ifdef CONFIG_CPU_S3C2440 498#ifdef CONFIG_CPU_S3C2440
599 499
600/* Camif Controller */ 500/* Camif Controller */
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
new file mode 100644
index 000000000000..825d8d0c5ca2
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -0,0 +1,259 @@
1/* linux/arch/arm/plat-s3c24xx/gpiolib.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX GPIOlib support
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.
12*/
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/io.h>
20#include <linux/gpio.h>
21
22#include <asm/hardware.h>
23#include <asm/irq.h>
24
25#include <asm/arch/regs-gpio.h>
26
27struct s3c24xx_gpio_chip {
28 struct gpio_chip chip;
29 void __iomem *base;
30};
31
32static inline struct s3c24xx_gpio_chip *to_s3c_chip(struct gpio_chip *gpc)
33{
34 return container_of(gpc, struct s3c24xx_gpio_chip, chip);
35}
36
37/* these routines are exported for use by other parts of the platform
38 * and system support, but are not intended to be used directly by the
39 * drivers themsevles.
40 */
41
42int s3c24xx_gpiolib_input(struct gpio_chip *chip, unsigned offset)
43{
44 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
45 void __iomem *base = ourchip->base;
46 unsigned long flags;
47 unsigned long con;
48
49 local_irq_save(flags);
50
51 con = __raw_readl(base + 0x00);
52 con &= ~(3 << (offset * 2));
53 con |= (S3C2410_GPIO_OUTPUT & 0xf) << (offset * 2);
54
55 __raw_writel(con, base + 0x00);
56
57 local_irq_restore(flags);
58 return 0;
59}
60
61int s3c24xx_gpiolib_output(struct gpio_chip *chip,
62 unsigned offset, int value)
63{
64 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
65 void __iomem *base = ourchip->base;
66 unsigned long flags;
67 unsigned long dat;
68 unsigned long con;
69
70 local_irq_save(flags);
71
72 dat = __raw_readl(base + 0x04);
73 dat &= ~(1 << offset);
74 if (value)
75 dat |= 1 << offset;
76 __raw_writel(dat, base + 0x04);
77
78 con = __raw_readl(base + 0x00);
79 con &= ~(3 << (offset * 2));
80 con |= (S3C2410_GPIO_OUTPUT & 0xf) << (offset * 2);
81
82 __raw_writel(con, base + 0x00);
83 __raw_writel(dat, base + 0x04);
84
85 local_irq_restore(flags);
86 return 0;
87}
88
89void s3c24xx_gpiolib_set(struct gpio_chip *chip, unsigned offset, int value)
90{
91 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
92 void __iomem *base = ourchip->base;
93 unsigned long flags;
94 unsigned long dat;
95
96 local_irq_save(flags);
97
98 dat = __raw_readl(base + 0x04);
99 dat &= ~(1 << offset);
100 if (value)
101 dat |= 1 << offset;
102 __raw_writel(dat, base + 0x04);
103
104 local_irq_restore(flags);
105}
106
107int s3c24xx_gpiolib_get(struct gpio_chip *chip, unsigned offset)
108{
109 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
110 unsigned long val;
111
112 val = __raw_readl(ourchip->base + 0x04);
113 val >>= offset;
114 val &= 1;
115
116 return val;
117}
118
119static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
120{
121 return -EINVAL;
122}
123
124static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
125 unsigned offset, int value)
126{
127 struct s3c24xx_gpio_chip *ourchip = to_s3c_chip(chip);
128 void __iomem *base = ourchip->base;
129 unsigned long flags;
130 unsigned long dat;
131 unsigned long con;
132
133 local_irq_save(flags);
134
135 con = __raw_readl(base + 0x00);
136 dat = __raw_readl(base + 0x04);
137
138 dat &= ~(1 << offset);
139 if (value)
140 dat |= 1 << offset;
141
142 __raw_writel(dat, base + 0x04);
143
144 con &= ~(1 << offset);
145
146 __raw_writel(con, base + 0x00);
147 __raw_writel(dat, base + 0x04);
148
149 local_irq_restore(flags);
150 return 0;
151}
152
153
154struct s3c24xx_gpio_chip gpios[] = {
155 [0] = {
156 .base = S3C24XX_GPIO_BASE(S3C2410_GPA0),
157 .chip = {
158 .base = S3C2410_GPA0,
159 .owner = THIS_MODULE,
160 .label = "GPIOA",
161 .ngpio = 24,
162 .direction_input = s3c24xx_gpiolib_banka_input,
163 .direction_output = s3c24xx_gpiolib_banka_output,
164 .set = s3c24xx_gpiolib_set,
165 .get = s3c24xx_gpiolib_get,
166 },
167 },
168 [1] = {
169 .base = S3C24XX_GPIO_BASE(S3C2410_GPB0),
170 .chip = {
171 .base = S3C2410_GPB0,
172 .owner = THIS_MODULE,
173 .label = "GPIOB",
174 .ngpio = 16,
175 .direction_input = s3c24xx_gpiolib_input,
176 .direction_output = s3c24xx_gpiolib_output,
177 .set = s3c24xx_gpiolib_set,
178 .get = s3c24xx_gpiolib_get,
179 },
180 },
181 [2] = {
182 .base = S3C24XX_GPIO_BASE(S3C2410_GPC0),
183 .chip = {
184 .base = S3C2410_GPC0,
185 .owner = THIS_MODULE,
186 .label = "GPIOC",
187 .ngpio = 16,
188 .direction_input = s3c24xx_gpiolib_input,
189 .direction_output = s3c24xx_gpiolib_output,
190 .set = s3c24xx_gpiolib_set,
191 .get = s3c24xx_gpiolib_get,
192 },
193 },
194 [3] = {
195 .base = S3C24XX_GPIO_BASE(S3C2410_GPD0),
196 .chip = {
197 .base = S3C2410_GPD0,
198 .owner = THIS_MODULE,
199 .label = "GPIOD",
200 .ngpio = 16,
201 .direction_input = s3c24xx_gpiolib_input,
202 .direction_output = s3c24xx_gpiolib_output,
203 .set = s3c24xx_gpiolib_set,
204 .get = s3c24xx_gpiolib_get,
205 },
206 },
207 [4] = {
208 .base = S3C24XX_GPIO_BASE(S3C2410_GPE0),
209 .chip = {
210 .base = S3C2410_GPE0,
211 .label = "GPIOE",
212 .owner = THIS_MODULE,
213 .ngpio = 16,
214 .direction_input = s3c24xx_gpiolib_input,
215 .direction_output = s3c24xx_gpiolib_output,
216 .set = s3c24xx_gpiolib_set,
217 .get = s3c24xx_gpiolib_get,
218 },
219 },
220 [5] = {
221 .base = S3C24XX_GPIO_BASE(S3C2410_GPF0),
222 .chip = {
223 .base = S3C2410_GPF0,
224 .owner = THIS_MODULE,
225 .label = "GPIOF",
226 .ngpio = 8,
227 .direction_input = s3c24xx_gpiolib_input,
228 .direction_output = s3c24xx_gpiolib_output,
229 .set = s3c24xx_gpiolib_set,
230 .get = s3c24xx_gpiolib_get,
231 },
232 },
233 [6] = {
234 .base = S3C24XX_GPIO_BASE(S3C2410_GPG0),
235 .chip = {
236 .base = S3C2410_GPG0,
237 .owner = THIS_MODULE,
238 .label = "GPIOG",
239 .ngpio = 10,
240 .direction_input = s3c24xx_gpiolib_input,
241 .direction_output = s3c24xx_gpiolib_output,
242 .set = s3c24xx_gpiolib_set,
243 .get = s3c24xx_gpiolib_get,
244 },
245 },
246};
247
248static __init int s3c24xx_gpiolib_init(void)
249{
250 struct s3c24xx_gpio_chip *chip = gpios;
251 int gpn;
252
253 for (gpn = 0; gpn < ARRAY_SIZE(gpios); gpn++, chip++)
254 gpiochip_add(&chip->chip);
255
256 return 0;
257}
258
259arch_initcall(s3c24xx_gpiolib_init);
diff --git a/arch/arm/plat-s3c24xx/pwm-clock.c b/arch/arm/plat-s3c24xx/pwm-clock.c
new file mode 100644
index 000000000000..2cda3e3c6786
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/pwm-clock.c
@@ -0,0 +1,437 @@
1/* linux/arch/arm/plat-s3c24xx/pwm-clock.c
2 *
3 * Copyright (c) 2007 Simtec Electronics
4 * Copyright (c) 2007, 2008 Ben Dooks
5 * Ben Dooks <ben-linux@fluff.org>
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.
10*/
11
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/clk.h>
18#include <linux/err.h>
19#include <linux/io.h>
20
21#include <asm/hardware.h>
22#include <asm/irq.h>
23
24#include <asm/arch/regs-clock.h>
25#include <asm/arch/regs-gpio.h>
26
27#include <asm/plat-s3c24xx/clock.h>
28#include <asm/plat-s3c24xx/cpu.h>
29
30#include <asm/plat-s3c/regs-timer.h>
31
32/* Each of the timers 0 through 5 go through the following
33 * clock tree, with the inputs depending on the timers.
34 *
35 * pclk ---- [ prescaler 0 ] -+---> timer 0
36 * +---> timer 1
37 *
38 * pclk ---- [ prescaler 1 ] -+---> timer 2
39 * +---> timer 3
40 * \---> timer 4
41 *
42 * Which are fed into the timers as so:
43 *
44 * prescaled 0 ---- [ div 2,4,8,16 ] ---\
45 * [mux] -> timer 0
46 * tclk 0 ------------------------------/
47 *
48 * prescaled 0 ---- [ div 2,4,8,16 ] ---\
49 * [mux] -> timer 1
50 * tclk 0 ------------------------------/
51 *
52 *
53 * prescaled 1 ---- [ div 2,4,8,16 ] ---\
54 * [mux] -> timer 2
55 * tclk 1 ------------------------------/
56 *
57 * prescaled 1 ---- [ div 2,4,8,16 ] ---\
58 * [mux] -> timer 3
59 * tclk 1 ------------------------------/
60 *
61 * prescaled 1 ---- [ div 2,4,8, 16 ] --\
62 * [mux] -> timer 4
63 * tclk 1 ------------------------------/
64 *
65 * Since the mux and the divider are tied together in the
66 * same register space, it is impossible to set the parent
67 * and the rate at the same time. To avoid this, we add an
68 * intermediate 'prescaled-and-divided' clock to select
69 * as the parent for the timer input clock called tdiv.
70 *
71 * prescaled clk --> pwm-tdiv ---\
72 * [ mux ] --> timer X
73 * tclk -------------------------/
74*/
75
76static unsigned long clk_pwm_scaler_getrate(struct clk *clk)
77{
78 unsigned long tcfg0 = __raw_readl(S3C2410_TCFG0);
79
80 if (clk->id == 1) {
81 tcfg0 &= S3C2410_TCFG_PRESCALER1_MASK;
82 tcfg0 >>= S3C2410_TCFG_PRESCALER1_SHIFT;
83 } else {
84 tcfg0 &= S3C2410_TCFG_PRESCALER0_MASK;
85 }
86
87 return clk_get_rate(clk->parent) / (tcfg0 + 1);
88}
89
90/* TODO - add set rate calls. */
91
92struct clk clk_timer_scaler[] = {
93 [0] = {
94 .name = "pwm-scaler0",
95 .id = -1,
96 .get_rate = clk_pwm_scaler_getrate,
97 },
98 [1] = {
99 .name = "pwm-scaler1",
100 .id = -1,
101 .get_rate = clk_pwm_scaler_getrate,
102 },
103};
104
105struct clk clk_timer_tclk[] = {
106 [0] = {
107 .name = "pwm-tclk0",
108 .id = -1,
109 },
110 [1] = {
111 .name = "pwm-tclk1",
112 .id = -1,
113 },
114};
115
116struct pwm_tdiv_clk {
117 struct clk clk;
118 unsigned int divisor;
119};
120
121static inline struct pwm_tdiv_clk *to_tdiv(struct clk *clk)
122{
123 return container_of(clk, struct pwm_tdiv_clk, clk);
124}
125
126static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
127{
128 return 1 << (1 + tcfg1);
129}
130
131static unsigned long clk_pwm_tdiv_get_rate(struct clk *clk)
132{
133 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
134 unsigned int divisor;
135
136 tcfg1 >>= S3C2410_TCFG1_SHIFT(clk->id);
137 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
138
139 if (tcfg1 == S3C2410_TCFG1_MUX_TCLK)
140 divisor = to_tdiv(clk)->divisor;
141 else
142 divisor = tcfg_to_divisor(tcfg1);
143
144 return clk_get_rate(clk->parent) / divisor;
145}
146
147static unsigned long clk_pwm_tdiv_round_rate(struct clk *clk,
148 unsigned long rate)
149{
150 unsigned long parent_rate;
151 unsigned long divisor;
152
153 parent_rate = clk_get_rate(clk->parent);
154 divisor = parent_rate / rate;
155
156 if (divisor <= 2)
157 divisor = 2;
158 else if (divisor <= 4)
159 divisor = 4;
160 else if (divisor <= 8)
161 divisor = 8;
162 else
163 divisor = 16;
164
165 return parent_rate / divisor;
166}
167
168static unsigned long clk_pwm_tdiv_bits(struct pwm_tdiv_clk *divclk)
169{
170 unsigned long bits;
171
172 switch (divclk->divisor) {
173 case 2:
174 bits = S3C2410_TCFG1_MUX_DIV2;
175 break;
176 case 4:
177 bits = S3C2410_TCFG1_MUX_DIV4;
178 break;
179 case 8:
180 bits = S3C2410_TCFG1_MUX_DIV8;
181 break;
182 case 16:
183 default:
184 bits = S3C2410_TCFG1_MUX_DIV16;
185 break;
186 }
187
188 return bits;
189}
190
191static void clk_pwm_tdiv_update(struct pwm_tdiv_clk *divclk)
192{
193 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
194 unsigned long bits = clk_pwm_tdiv_bits(divclk);
195 unsigned long flags;
196 unsigned long shift = S3C2410_TCFG1_SHIFT(divclk->clk.id);
197
198 local_irq_save(flags);
199
200 tcfg1 = __raw_readl(S3C2410_TCFG1);
201 tcfg1 &= ~(S3C2410_TCFG1_MUX_MASK << shift);
202 tcfg1 |= bits << shift;
203 __raw_writel(tcfg1, S3C2410_TCFG1);
204
205 local_irq_restore(flags);
206}
207
208static int clk_pwm_tdiv_set_rate(struct clk *clk, unsigned long rate)
209{
210 struct pwm_tdiv_clk *divclk = to_tdiv(clk);
211 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
212 unsigned long parent_rate = clk_get_rate(clk->parent);
213 unsigned long divisor;
214
215 tcfg1 >>= S3C2410_TCFG1_SHIFT(clk->id);
216 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
217
218 rate = clk_round_rate(clk, rate);
219 divisor = parent_rate / rate;
220
221 if (divisor > 16)
222 return -EINVAL;
223
224 divclk->divisor = divisor;
225
226 /* Update the current MUX settings if we are currently
227 * selected as the clock source for this clock. */
228
229 if (tcfg1 != S3C2410_TCFG1_MUX_TCLK)
230 clk_pwm_tdiv_update(divclk);
231
232 return 0;
233}
234
235struct pwm_tdiv_clk clk_timer_tdiv[] = {
236 [0] = {
237 .clk = {
238 .name = "pwm-tdiv",
239 .parent = &clk_timer_scaler[0],
240 .get_rate = clk_pwm_tdiv_get_rate,
241 .set_rate = clk_pwm_tdiv_set_rate,
242 .round_rate = clk_pwm_tdiv_round_rate,
243 },
244 },
245 [1] = {
246 .clk = {
247 .name = "pwm-tdiv",
248 .parent = &clk_timer_scaler[0],
249 .get_rate = clk_pwm_tdiv_get_rate,
250 .set_rate = clk_pwm_tdiv_set_rate,
251 .round_rate = clk_pwm_tdiv_round_rate,
252 }
253 },
254 [2] = {
255 .clk = {
256 .name = "pwm-tdiv",
257 .parent = &clk_timer_scaler[1],
258 .get_rate = clk_pwm_tdiv_get_rate,
259 .set_rate = clk_pwm_tdiv_set_rate,
260 .round_rate = clk_pwm_tdiv_round_rate,
261 },
262 },
263 [3] = {
264 .clk = {
265 .name = "pwm-tdiv",
266 .parent = &clk_timer_scaler[1],
267 .get_rate = clk_pwm_tdiv_get_rate,
268 .set_rate = clk_pwm_tdiv_set_rate,
269 .round_rate = clk_pwm_tdiv_round_rate,
270 },
271 },
272 [4] = {
273 .clk = {
274 .name = "pwm-tdiv",
275 .parent = &clk_timer_scaler[1],
276 .get_rate = clk_pwm_tdiv_get_rate,
277 .set_rate = clk_pwm_tdiv_set_rate,
278 .round_rate = clk_pwm_tdiv_round_rate,
279 },
280 },
281};
282
283static int __init clk_pwm_tdiv_register(unsigned int id)
284{
285 struct pwm_tdiv_clk *divclk = &clk_timer_tdiv[id];
286 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
287
288 tcfg1 >>= S3C2410_TCFG1_SHIFT(id);
289 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
290
291 divclk->clk.id = id;
292 divclk->divisor = tcfg_to_divisor(tcfg1);
293
294 return s3c24xx_register_clock(&divclk->clk);
295}
296
297static inline struct clk *s3c24xx_pwmclk_tclk(unsigned int id)
298{
299 return (id >= 2) ? &clk_timer_tclk[1] : &clk_timer_tclk[0];
300}
301
302static inline struct clk *s3c24xx_pwmclk_tdiv(unsigned int id)
303{
304 return &clk_timer_tdiv[id].clk;
305}
306
307static int clk_pwm_tin_set_parent(struct clk *clk, struct clk *parent)
308{
309 unsigned int id = clk->id;
310 unsigned long tcfg1;
311 unsigned long flags;
312 unsigned long bits;
313 unsigned long shift = S3C2410_TCFG1_SHIFT(id);
314
315 if (parent == s3c24xx_pwmclk_tclk(id))
316 bits = S3C2410_TCFG1_MUX_TCLK << shift;
317 else if (parent == s3c24xx_pwmclk_tdiv(id))
318 bits = clk_pwm_tdiv_bits(to_tdiv(clk)) << shift;
319 else
320 return -EINVAL;
321
322 clk->parent = parent;
323
324 local_irq_save(flags);
325
326 tcfg1 = __raw_readl(S3C2410_TCFG1);
327 tcfg1 &= ~(S3C2410_TCFG1_MUX_MASK << shift);
328 __raw_writel(tcfg1 | bits, S3C2410_TCFG1);
329
330 local_irq_restore(flags);
331
332 return 0;
333}
334
335static struct clk clk_tin[] = {
336 [0] = {
337 .name = "pwm-tin",
338 .id = 0,
339 .set_parent = clk_pwm_tin_set_parent,
340 },
341 [1] = {
342 .name = "pwm-tin",
343 .id = 1,
344 .set_parent = clk_pwm_tin_set_parent,
345 },
346 [2] = {
347 .name = "pwm-tin",
348 .id = 2,
349 .set_parent = clk_pwm_tin_set_parent,
350 },
351 [3] = {
352 .name = "pwm-tin",
353 .id = 3,
354 .set_parent = clk_pwm_tin_set_parent,
355 },
356 [4] = {
357 .name = "pwm-tin",
358 .id = 4,
359 .set_parent = clk_pwm_tin_set_parent,
360 },
361};
362
363static __init int clk_pwm_tin_register(struct clk *pwm)
364{
365 unsigned long tcfg1 = __raw_readl(S3C2410_TCFG1);
366 unsigned int id = pwm->id;
367
368 struct clk *parent;
369 int ret;
370
371 ret = s3c24xx_register_clock(pwm);
372 if (ret < 0)
373 return ret;
374
375 tcfg1 >>= S3C2410_TCFG1_SHIFT(id);
376 tcfg1 &= S3C2410_TCFG1_MUX_MASK;
377
378 if (tcfg1 == S3C2410_TCFG1_MUX_TCLK)
379 parent = s3c24xx_pwmclk_tclk(id);
380 else
381 parent = s3c24xx_pwmclk_tdiv(id);
382
383 return clk_set_parent(pwm, parent);
384}
385
386static __init int s3c24xx_pwmclk_init(void)
387{
388 struct clk *clk_timers;
389 unsigned int clk;
390 int ret;
391
392 clk_timers = clk_get(NULL, "timers");
393 if (IS_ERR(clk_timers)) {
394 printk(KERN_ERR "%s: no parent clock\n", __func__);
395 return -EINVAL;
396 }
397
398 for (clk = 0; clk < ARRAY_SIZE(clk_timer_scaler); clk++) {
399 clk_timer_scaler[clk].parent = clk_timers;
400 ret = s3c24xx_register_clock(&clk_timer_scaler[clk]);
401 if (ret < 0) {
402 printk(KERN_ERR "error adding pwm scaler%d clock\n", clk);
403 goto err;
404 }
405 }
406
407 for (clk = 0; clk < ARRAY_SIZE(clk_timer_tclk); clk++) {
408 ret = s3c24xx_register_clock(&clk_timer_tclk[clk]);
409 if (ret < 0) {
410 printk(KERN_ERR "error adding pww tclk%d\n", clk);
411 goto err;
412 }
413 }
414
415 for (clk = 0; clk < ARRAY_SIZE(clk_timer_tdiv); clk++) {
416 ret = clk_pwm_tdiv_register(clk);
417 if (ret < 0) {
418 printk(KERN_ERR "error adding pwm%d tdiv clock\n", clk);
419 goto err;
420 }
421 }
422
423 for (clk = 0; clk < ARRAY_SIZE(clk_tin); clk++) {
424 ret = clk_pwm_tin_register(&clk_tin[clk]);
425 if (ret < 0) {
426 printk(KERN_ERR "error adding pwm%d tin clock\n", clk);
427 goto err;
428 }
429 }
430
431 return 0;
432
433 err:
434 return ret;
435}
436
437arch_initcall(s3c24xx_pwmclk_init);
diff --git a/arch/arm/plat-s3c24xx/pwm.c b/arch/arm/plat-s3c24xx/pwm.c
new file mode 100644
index 000000000000..18c4bdc49a05
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/pwm.c
@@ -0,0 +1,402 @@
1/* arch/arm/plat-s3c24xx/pwm.c
2 *
3 * Copyright (c) 2007 Ben Dooks
4 * Copyright (c) 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org>
6 *
7 * S3C24XX PWM device core
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.
12*/
13
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/platform_device.h>
17#include <linux/err.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20#include <linux/pwm.h>
21
22#include <asm/plat-s3c/regs-timer.h>
23
24struct pwm_device {
25 struct list_head list;
26 struct platform_device *pdev;
27
28 struct clk *clk_div;
29 struct clk *clk;
30 const char *label;
31
32 unsigned int period_ns;
33 unsigned int duty_ns;
34
35 unsigned char tcon_base;
36 unsigned char running;
37 unsigned char use_count;
38 unsigned char pwm_id;
39};
40
41#define pwm_dbg(_pwm, msg...) dev_info(&(_pwm)->pdev->dev, msg)
42
43static struct clk *clk_scaler[2];
44
45/* Standard setup for a timer block. */
46
47#define TIMER_RESOURCE_SIZE (1)
48
49#define TIMER_RESOURCE(_tmr, _irq) \
50 (struct resource [TIMER_RESOURCE_SIZE]) { \
51 [0] = { \
52 .start = _irq, \
53 .end = _irq, \
54 .flags = IORESOURCE_IRQ \
55 } \
56 }
57
58#define DEFINE_TIMER(_tmr_no, _irq) \
59 .name = "s3c24xx-pwm", \
60 .id = _tmr_no, \
61 .num_resources = TIMER_RESOURCE_SIZE, \
62 .resource = TIMER_RESOURCE(_tmr_no, _irq), \
63
64/* since we already have an static mapping for the timer, we do not
65 * bother setting any IO resource for the base.
66 */
67
68struct platform_device s3c_device_timer[] = {
69 [0] = { DEFINE_TIMER(0, IRQ_TIMER0) },
70 [1] = { DEFINE_TIMER(1, IRQ_TIMER1) },
71 [2] = { DEFINE_TIMER(2, IRQ_TIMER2) },
72 [3] = { DEFINE_TIMER(3, IRQ_TIMER3) },
73 [4] = { DEFINE_TIMER(4, IRQ_TIMER4) },
74};
75
76static inline int pwm_is_tdiv(struct pwm_device *pwm)
77{
78 return clk_get_parent(pwm->clk) == pwm->clk_div;
79}
80
81static DEFINE_MUTEX(pwm_lock);
82static LIST_HEAD(pwm_list);
83
84struct pwm_device *pwm_request(int pwm_id, const char *label)
85{
86 struct pwm_device *pwm;
87 int found = 0;
88
89 mutex_lock(&pwm_lock);
90
91 list_for_each_entry(pwm, &pwm_list, list) {
92 if (pwm->pwm_id == pwm_id) {
93 found = 1;
94 break;
95 }
96 }
97
98 if (found) {
99 if (pwm->use_count == 0) {
100 pwm->use_count = 1;
101 pwm->label = label;
102 } else
103 pwm = ERR_PTR(-EBUSY);
104 } else
105 pwm = ERR_PTR(-ENOENT);
106
107 mutex_unlock(&pwm_lock);
108 return pwm;
109}
110
111EXPORT_SYMBOL(pwm_request);
112
113
114void pwm_free(struct pwm_device *pwm)
115{
116 mutex_lock(&pwm_lock);
117
118 if (pwm->use_count) {
119 pwm->use_count--;
120 pwm->label = NULL;
121 } else
122 printk(KERN_ERR "PWM%d device already freed\n", pwm->pwm_id);
123
124 mutex_unlock(&pwm_lock);
125}
126
127EXPORT_SYMBOL(pwm_free);
128
129#define pwm_tcon_start(pwm) (1 << (pwm->tcon_base + 0))
130#define pwm_tcon_invert(pwm) (1 << (pwm->tcon_base + 2))
131#define pwm_tcon_autoreload(pwm) (1 << (pwm->tcon_base + 3))
132#define pwm_tcon_manulupdate(pwm) (1 << (pwm->tcon_base + 1))
133
134int pwm_enable(struct pwm_device *pwm)
135{
136 unsigned long flags;
137 unsigned long tcon;
138
139 local_irq_save(flags);
140
141 tcon = __raw_readl(S3C2410_TCON);
142 tcon |= pwm_tcon_start(pwm);
143 __raw_writel(tcon, S3C2410_TCON);
144
145 local_irq_restore(flags);
146
147 pwm->running = 1;
148 return 0;
149}
150
151EXPORT_SYMBOL(pwm_enable);
152
153void pwm_disable(struct pwm_device *pwm)
154{
155 unsigned long flags;
156 unsigned long tcon;
157
158 local_irq_save(flags);
159
160 tcon = __raw_readl(S3C2410_TCON);
161 tcon &= ~pwm_tcon_start(pwm);
162 __raw_writel(tcon, S3C2410_TCON);
163
164 local_irq_restore(flags);
165
166 pwm->running = 0;
167}
168
169EXPORT_SYMBOL(pwm_disable);
170
171unsigned long pwm_calc_tin(struct pwm_device *pwm, unsigned long freq)
172{
173 unsigned long tin_parent_rate;
174 unsigned int div;
175
176 tin_parent_rate = clk_get_rate(clk_get_parent(pwm->clk_div));
177 pwm_dbg(pwm, "tin parent at %lu\n", tin_parent_rate);
178
179 for (div = 2; div <= 16; div *= 2) {
180 if ((tin_parent_rate / (div << 16)) < freq)
181 return tin_parent_rate / div;
182 }
183
184 return tin_parent_rate / 16;
185}
186
187#define NS_IN_HZ (1000000000UL)
188
189int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
190{
191 unsigned long tin_rate;
192 unsigned long tin_ns;
193 unsigned long period;
194 unsigned long flags;
195 unsigned long tcon;
196 unsigned long tcnt;
197 long tcmp;
198
199 /* We currently avoid using 64bit arithmetic by using the
200 * fact that anything faster than 1Hz is easily representable
201 * by 32bits. */
202
203 if (period_ns > NS_IN_HZ || duty_ns > NS_IN_HZ)
204 return -ERANGE;
205
206 if (duty_ns > period_ns)
207 return -EINVAL;
208
209 if (period_ns == pwm->period_ns &&
210 duty_ns == pwm->duty_ns)
211 return 0;
212
213 /* The TCMP and TCNT can be read without a lock, they're not
214 * shared between the timers. */
215
216 tcmp = __raw_readl(S3C2410_TCMPB(pwm->pwm_id));
217 tcnt = __raw_readl(S3C2410_TCNTB(pwm->pwm_id));
218
219 period = NS_IN_HZ / period_ns;
220
221 pwm_dbg(pwm, "duty_ns=%d, period_ns=%d (%lu)\n",
222 duty_ns, period_ns, period);
223
224 /* Check to see if we are changing the clock rate of the PWM */
225
226 if (pwm->period_ns != period_ns) {
227 if (pwm_is_tdiv(pwm)) {
228 tin_rate = pwm_calc_tin(pwm, period);
229 clk_set_rate(pwm->clk_div, tin_rate);
230 } else
231 tin_rate = clk_get_rate(pwm->clk);
232
233 pwm->period_ns = period_ns;
234
235 pwm_dbg(pwm, "tin_rate=%lu\n", tin_rate);
236
237 tin_ns = NS_IN_HZ / tin_rate;
238 tcnt = period_ns / tin_ns;
239 } else
240 tin_ns = NS_IN_HZ / clk_get_rate(pwm->clk);
241
242 /* Note, counters count down */
243
244 tcmp = duty_ns / tin_ns;
245 tcmp = tcnt - tcmp;
246
247 pwm_dbg(pwm, "tin_ns=%lu, tcmp=%ld/%lu\n", tin_ns, tcmp, tcnt);
248
249 if (tcmp < 0)
250 tcmp = 0;
251
252 /* Update the PWM register block. */
253
254 local_irq_save(flags);
255
256 __raw_writel(tcmp, S3C2410_TCMPB(pwm->pwm_id));
257 __raw_writel(tcnt, S3C2410_TCNTB(pwm->pwm_id));
258
259 tcon = __raw_readl(S3C2410_TCON);
260 tcon |= pwm_tcon_manulupdate(pwm);
261 tcon |= pwm_tcon_autoreload(pwm);
262 __raw_writel(tcon, S3C2410_TCON);
263
264 tcon &= ~pwm_tcon_manulupdate(pwm);
265 __raw_writel(tcon, S3C2410_TCON);
266
267 local_irq_restore(flags);
268
269 return 0;
270}
271
272EXPORT_SYMBOL(pwm_config);
273
274static int pwm_register(struct pwm_device *pwm)
275{
276 pwm->duty_ns = -1;
277 pwm->period_ns = -1;
278
279 mutex_lock(&pwm_lock);
280 list_add_tail(&pwm->list, &pwm_list);
281 mutex_unlock(&pwm_lock);
282
283 return 0;
284}
285
286static int s3c_pwm_probe(struct platform_device *pdev)
287{
288 struct device *dev = &pdev->dev;
289 struct pwm_device *pwm;
290 unsigned long flags;
291 unsigned long tcon;
292 unsigned int id = pdev->id;
293 int ret;
294
295 if (id == 4) {
296 dev_err(dev, "TIMER4 is currently not supported\n");
297 return -ENXIO;
298 }
299
300 pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL);
301 if (pwm == NULL) {
302 dev_err(dev, "failed to allocate pwm_device\n");
303 return -ENOMEM;
304 }
305
306 pwm->pdev = pdev;
307 pwm->pwm_id = id;
308
309 /* calculate base of control bits in TCON */
310 pwm->tcon_base = id == 0 ? 0 : (id * 4) + 4;
311
312 pwm->clk = clk_get(dev, "pwm-tin");
313 if (IS_ERR(pwm->clk)) {
314 dev_err(dev, "failed to get pwm tin clk\n");
315 ret = PTR_ERR(pwm->clk);
316 goto err_alloc;
317 }
318
319 pwm->clk_div = clk_get(dev, "pwm-tdiv");
320 if (IS_ERR(pwm->clk_div)) {
321 dev_err(dev, "failed to get pwm tdiv clk\n");
322 ret = PTR_ERR(pwm->clk_div);
323 goto err_clk_tin;
324 }
325
326 local_irq_save(flags);
327
328 tcon = __raw_readl(S3C2410_TCON);
329 tcon |= pwm_tcon_invert(pwm);
330 __raw_writel(tcon, S3C2410_TCON);
331
332 local_irq_restore(flags);
333
334
335 ret = pwm_register(pwm);
336 if (ret) {
337 dev_err(dev, "failed to register pwm\n");
338 goto err_clk_tdiv;
339 }
340
341 pwm_dbg(pwm, "config bits %02x\n",
342 (__raw_readl(S3C2410_TCON) >> pwm->tcon_base) & 0x0f);
343
344 dev_info(dev, "tin at %lu, tdiv at %lu, tin=%sclk, base %d\n",
345 clk_get_rate(pwm->clk),
346 clk_get_rate(pwm->clk_div),
347 pwm_is_tdiv(pwm) ? "div" : "ext", pwm->tcon_base);
348
349 platform_set_drvdata(pdev, pwm);
350 return 0;
351
352 err_clk_tdiv:
353 clk_put(pwm->clk_div);
354
355 err_clk_tin:
356 clk_put(pwm->clk);
357
358 err_alloc:
359 kfree(pwm);
360 return ret;
361}
362
363static int s3c_pwm_remove(struct platform_device *pdev)
364{
365 struct pwm_device *pwm = platform_get_drvdata(pdev);
366
367 clk_put(pwm->clk_div);
368 clk_put(pwm->clk);
369 kfree(pwm);
370
371 return 0;
372}
373
374static struct platform_driver s3c_pwm_driver = {
375 .driver = {
376 .name = "s3c24xx-pwm",
377 .owner = THIS_MODULE,
378 },
379 .probe = s3c_pwm_probe,
380 .remove = __devexit_p(s3c_pwm_remove),
381};
382
383static int __init pwm_init(void)
384{
385 int ret;
386
387 clk_scaler[0] = clk_get(NULL, "pwm-scaler0");
388 clk_scaler[1] = clk_get(NULL, "pwm-scaler1");
389
390 if (IS_ERR(clk_scaler[0]) || IS_ERR(clk_scaler[1])) {
391 printk(KERN_ERR "%s: failed to get scaler clocks\n", __func__);
392 return -EINVAL;
393 }
394
395 ret = platform_driver_register(&s3c_pwm_driver);
396 if (ret)
397 printk(KERN_ERR "%s: failed to add pwm driver\n", __func__);
398
399 return ret;
400}
401
402arch_initcall(pwm_init);
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 207a8b5a0c4a..0be5630ff568 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: Sat Apr 19 11:23:38 2008 15# Last update: Mon Jul 7 16:25:39 2008
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -560,7 +560,6 @@ husky MACH_HUSKY HUSKY 543
560boxer MACH_BOXER BOXER 544 560boxer MACH_BOXER BOXER 544
561shepherd MACH_SHEPHERD SHEPHERD 545 561shepherd MACH_SHEPHERD SHEPHERD 545
562aml42800aa MACH_AML42800AA AML42800AA 546 562aml42800aa MACH_AML42800AA AML42800AA 546
563ml674001 MACH_MACH_TYPE_ML674001 MACH_TYPE_ML674001 547
564lpc2294 MACH_LPC2294 LPC2294 548 563lpc2294 MACH_LPC2294 LPC2294 548
565switchgrass MACH_SWITCHGRASS SWITCHGRASS 549 564switchgrass MACH_SWITCHGRASS SWITCHGRASS 549
566ens_cmu MACH_ENS_CMU ENS_CMU 550 565ens_cmu MACH_ENS_CMU ENS_CMU 550
@@ -748,7 +747,6 @@ anubis MACH_ANUBIS ANUBIS 734
748ite8152 MACH_ITE8152 ITE8152 735 747ite8152 MACH_ITE8152 ITE8152 735
749lpc3xxx MACH_LPC3XXX LPC3XXX 736 748lpc3xxx MACH_LPC3XXX LPC3XXX 736
750puppeteer MACH_PUPPETEER PUPPETEER 737 749puppeteer MACH_PUPPETEER PUPPETEER 737
751vt001 MACH_MACH_VADATECH MACH_VADATECH 738
752e570 MACH_E570 E570 739 750e570 MACH_E570 E570 739
753x50 MACH_X50 X50 740 751x50 MACH_X50 X50 740
754recon MACH_RECON RECON 741 752recon MACH_RECON RECON 741
@@ -839,7 +837,7 @@ ccxp270 MACH_CCXP CCXP 825
839omap_gsample MACH_OMAP_GSAMPLE OMAP_GSAMPLE 826 837omap_gsample MACH_OMAP_GSAMPLE OMAP_GSAMPLE 826
840realview_eb MACH_REALVIEW_EB REALVIEW_EB 827 838realview_eb MACH_REALVIEW_EB REALVIEW_EB 827
841samoa MACH_SAMOA SAMOA 828 839samoa MACH_SAMOA SAMOA 828
842t3xscale MACH_T3XSCALE T3XSCALE 829 840palmt3 MACH_PALMT3 PALMT3 829
843i878 MACH_I878 I878 830 841i878 MACH_I878 I878 830
844borzoi MACH_BORZOI BORZOI 831 842borzoi MACH_BORZOI BORZOI 831
845gecko MACH_GECKO GECKO 832 843gecko MACH_GECKO GECKO 832
@@ -895,7 +893,7 @@ mio8390 MACH_MIO8390 MIO8390 881
895omi_board MACH_OMI_BOARD OMI_BOARD 882 893omi_board MACH_OMI_BOARD OMI_BOARD 882
896mx21civ MACH_MX21CIV MX21CIV 883 894mx21civ MACH_MX21CIV MX21CIV 883
897mahi_cdac MACH_MAHI_CDAC MAHI_CDAC 884 895mahi_cdac MACH_MAHI_CDAC MAHI_CDAC 884
898xscale_palmtx MACH_XSCALE_PALMTX XSCALE_PALMTX 885 896palmtx MACH_PALMTX PALMTX 885
899s3c2413 MACH_S3C2413 S3C2413 887 897s3c2413 MACH_S3C2413 S3C2413 887
900samsys_ep0 MACH_SAMSYS_EP0 SAMSYS_EP0 888 898samsys_ep0 MACH_SAMSYS_EP0 SAMSYS_EP0 888
901wg302v1 MACH_WG302V1 WG302V1 889 899wg302v1 MACH_WG302V1 WG302V1 889
@@ -918,7 +916,7 @@ nxdb500 MACH_NXDB500 NXDB500 905
918apf9328 MACH_APF9328 APF9328 906 916apf9328 MACH_APF9328 APF9328 906
919omap_wipoq MACH_OMAP_WIPOQ OMAP_WIPOQ 907 917omap_wipoq MACH_OMAP_WIPOQ OMAP_WIPOQ 907
920omap_twip MACH_OMAP_TWIP OMAP_TWIP 908 918omap_twip MACH_OMAP_TWIP OMAP_TWIP 908
921xscale_treo650 MACH_XSCALE_PALMTREO650 XSCALE_PALMTREO650 909 919palmtreo650 MACH_PALMTREO650 PALMTREO650 909
922acumen MACH_ACUMEN ACUMEN 910 920acumen MACH_ACUMEN ACUMEN 910
923xp100 MACH_XP100 XP100 911 921xp100 MACH_XP100 XP100 911
924fs2410 MACH_FS2410 FS2410 912 922fs2410 MACH_FS2410 FS2410 912
@@ -926,8 +924,8 @@ pxa270_cerf MACH_PXA270_CERF PXA270_CERF 913
926sq2ftlpalm MACH_SQ2FTLPALM SQ2FTLPALM 914 924sq2ftlpalm MACH_SQ2FTLPALM SQ2FTLPALM 914
927bsemserver MACH_BSEMSERVER BSEMSERVER 915 925bsemserver MACH_BSEMSERVER BSEMSERVER 915
928netclient MACH_NETCLIENT NETCLIENT 916 926netclient MACH_NETCLIENT NETCLIENT 916
929xscale_palmtt5 MACH_XSCALE_PALMTT5 XSCALE_PALMTT5 917 927palmt5 MACH_PALMT5 PALMT5 917
930xscale_palmtc MACH_OMAP_PALMTC OMAP_PALMTC 918 928palmtc MACH_PALMTC PALMTC 918
931omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919 929omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919
932mxc30030evb MACH_MXC30030EVB MXC30030EVB 920 930mxc30030evb MACH_MXC30030EVB MXC30030EVB 920
933rea_2d MACH_REA_2D REA_2D 921 931rea_2d MACH_REA_2D REA_2D 921
@@ -1220,7 +1218,6 @@ empca400 MACH_EMPCA400 EMPCA400 1211
1220em7210 MACH_EM7210 EM7210 1212 1218em7210 MACH_EM7210 EM7210 1212
1221htchermes MACH_HTCHERMES HTCHERMES 1213 1219htchermes MACH_HTCHERMES HTCHERMES 1213
1222eti_c1 MACH_ETI_C1 ETI_C1 1214 1220eti_c1 MACH_ETI_C1 ETI_C1 1214
1223mach_dep2410 MACH_MACH_DEP2410 MACH_DEP2410 1215
1224ac100 MACH_AC100 AC100 1216 1221ac100 MACH_AC100 AC100 1216
1225sneetch MACH_SNEETCH SNEETCH 1217 1222sneetch MACH_SNEETCH SNEETCH 1217
1226studentmate MACH_STUDENTMATE STUDENTMATE 1218 1223studentmate MACH_STUDENTMATE STUDENTMATE 1218
@@ -1421,10 +1418,10 @@ looxc550 MACH_LOOXC550 LOOXC550 1417
1421cnty_titan MACH_CNTY_TITAN CNTY_TITAN 1418 1418cnty_titan MACH_CNTY_TITAN CNTY_TITAN 1418
1422app3xx MACH_APP3XX APP3XX 1419 1419app3xx MACH_APP3XX APP3XX 1419
1423sideoatsgrama MACH_SIDEOATSGRAMA SIDEOATSGRAMA 1420 1420sideoatsgrama MACH_SIDEOATSGRAMA SIDEOATSGRAMA 1420
1424xscale_palmt700p MACH_XSCALE_PALMT700P XSCALE_PALMT700P 1421 1421palmtreo700p MACH_PALMTREO700P PALMTREO700P 1421
1425xscale_palmt700w MACH_XSCALE_PALMT700W XSCALE_PALMT700W 1422 1422palmtreo700w MACH_PALMTREO700W PALMTREO700W 1422
1426xscale_palmt750 MACH_XSCALE_PALMT750 XSCALE_PALMT750 1423 1423palmtreo750 MACH_PALMTREO750 PALMTREO750 1423
1427xscale_palmt755p MACH_XSCALE_PALMT755P XSCALE_PALMT755P 1424 1424palmtreo755p MACH_PALMTREO755P PALMTREO755P 1424
1428ezreganut9200 MACH_EZREGANUT9200 EZREGANUT9200 1425 1425ezreganut9200 MACH_EZREGANUT9200 EZREGANUT9200 1425
1429sarge MACH_SARGE SARGE 1426 1426sarge MACH_SARGE SARGE 1426
1430a696 MACH_A696 A696 1427 1427a696 MACH_A696 A696 1427
@@ -1463,7 +1460,7 @@ artemis MACH_ARTEMIS ARTEMIS 1462
1463htctitan MACH_HTCTITAN HTCTITAN 1463 1460htctitan MACH_HTCTITAN HTCTITAN 1463
1464qranium MACH_QRANIUM QRANIUM 1464 1461qranium MACH_QRANIUM QRANIUM 1464
1465adx_wsc2 MACH_ADX_WSC2 ADX_WSC2 1465 1462adx_wsc2 MACH_ADX_WSC2 ADX_WSC2 1465
1466adx_medcom MACH_ADX_MEDINET ADX_MEDINET 1466 1463adx_medcom MACH_ADX_MEDCOM ADX_MEDCOM 1466
1467bboard MACH_BBOARD BBOARD 1467 1464bboard MACH_BBOARD BBOARD 1467
1468cambria MACH_CAMBRIA CAMBRIA 1468 1465cambria MACH_CAMBRIA CAMBRIA 1468
1469mt7xxx MACH_MT7XXX MT7XXX 1469 1466mt7xxx MACH_MT7XXX MT7XXX 1469
@@ -1519,7 +1516,7 @@ wp188 MACH_WP188 WP188 1518
1519corsica MACH_CORSICA CORSICA 1519 1516corsica MACH_CORSICA CORSICA 1519
1520bigeye MACH_BIGEYE BIGEYE 1520 1517bigeye MACH_BIGEYE BIGEYE 1520
1521tll5000 MACH_TLL5000 TLL5000 1522 1518tll5000 MACH_TLL5000 TLL5000 1522
1522hni270 MACH_HNI_X270 HNI_X270 1523 1519bebot MACH_BEBOT BEBOT 1523
1523qong MACH_QONG QONG 1524 1520qong MACH_QONG QONG 1524
1524tcompact MACH_TCOMPACT TCOMPACT 1525 1521tcompact MACH_TCOMPACT TCOMPACT 1525
1525puma5 MACH_PUMA5 PUMA5 1526 1522puma5 MACH_PUMA5 PUMA5 1526
@@ -1636,7 +1633,6 @@ awlug4lcu MACH_AWLUG4LCU AWLUG4LCU 1637
1636palermoc MACH_PALERMOC PALERMOC 1638 1633palermoc MACH_PALERMOC PALERMOC 1638
1637omap_ldp MACH_OMAP_LDP OMAP_LDP 1639 1634omap_ldp MACH_OMAP_LDP OMAP_LDP 1639
1638ip500 MACH_IP500 IP500 1640 1635ip500 MACH_IP500 IP500 1640
1639mx35ads MACH_MACH_MX35ADS MACH_MX35ADS 1641
1640ase2 MACH_ASE2 ASE2 1642 1636ase2 MACH_ASE2 ASE2 1642
1641mx35evb MACH_MX35EVB MX35EVB 1643 1637mx35evb MACH_MX35EVB MX35EVB 1643
1642aml_m8050 MACH_AML_M8050 AML_M8050 1644 1638aml_m8050 MACH_AML_M8050 AML_M8050 1644
@@ -1647,7 +1643,7 @@ badger MACH_BADGER BADGER 1648
1647trizeps4wl MACH_TRIZEPS4WL TRIZEPS4WL 1649 1643trizeps4wl MACH_TRIZEPS4WL TRIZEPS4WL 1649
1648trizeps5 MACH_TRIZEPS5 TRIZEPS5 1650 1644trizeps5 MACH_TRIZEPS5 TRIZEPS5 1650
1649marlin MACH_MARLIN MARLIN 1651 1645marlin MACH_MARLIN MARLIN 1651
1650ts7800 MACH_TS7800 TS7800 1652 1646ts78xx MACH_TS78XX TS78XX 1652
1651hpipaq214 MACH_HPIPAQ214 HPIPAQ214 1653 1647hpipaq214 MACH_HPIPAQ214 HPIPAQ214 1653
1652at572d940dcm MACH_AT572D940DCM AT572D940DCM 1654 1648at572d940dcm MACH_AT572D940DCM AT572D940DCM 1654
1653ne1board MACH_NE1BOARD NE1BOARD 1655 1649ne1board MACH_NE1BOARD NE1BOARD 1655
@@ -1720,3 +1716,99 @@ htc_kaiser MACH_HTC_KAISER HTC_KAISER 1724
1720lg_ks20 MACH_LG_KS20 LG_KS20 1725 1716lg_ks20 MACH_LG_KS20 LG_KS20 1725
1721hhgps MACH_HHGPS HHGPS 1726 1717hhgps MACH_HHGPS HHGPS 1726
1722nokia_n810_wimax MACH_NOKIA_N810_WIMAX NOKIA_N810_WIMAX 1727 1718nokia_n810_wimax MACH_NOKIA_N810_WIMAX NOKIA_N810_WIMAX 1727
1719insight MACH_INSIGHT INSIGHT 1728
1720sapphire MACH_SAPPHIRE SAPPHIRE 1729
1721csb637xo MACH_CSB637XO CSB637XO 1730
1722evisiong MACH_EVISIONG EVISIONG 1731
1723stmp37xx MACH_STMP37XX STMP37XX 1732
1724stmp378x MACH_STMP38XX STMP38XX 1733
1725tnt MACH_TNT TNT 1734
1726tbxt MACH_TBXT TBXT 1735
1727playmate MACH_PLAYMATE PLAYMATE 1736
1728pns10 MACH_PNS10 PNS10 1737
1729eznavi MACH_EZNAVI EZNAVI 1738
1730ps4000 MACH_PS4000 PS4000 1739
1731ezx_a780 MACH_EZX_A780 EZX_A780 1740
1732ezx_e680 MACH_EZX_E680 EZX_E680 1741
1733ezx_a1200 MACH_EZX_A1200 EZX_A1200 1742
1734ezx_e6 MACH_EZX_E6 EZX_E6 1743
1735ezx_e2 MACH_EZX_E2 EZX_E2 1744
1736ezx_a910 MACH_EZX_A910 EZX_A910 1745
1737cwmx31 MACH_CWMX31 CWMX31 1746
1738sl2312 MACH_SL2312 SL2312 1747
1739blenny MACH_BLENNY BLENNY 1748
1740ds107 MACH_DS107 DS107 1749
1741dsx07 MACH_DSX07 DSX07 1750
1742picocom1 MACH_PICOCOM1 PICOCOM1 1751
1743lynx_wolverine MACH_LYNX_WOLVERINE LYNX_WOLVERINE 1752
1744ubisys_p9_sc19 MACH_UBISYS_P9_SC19 UBISYS_P9_SC19 1753
1745kratos_low MACH_KRATOS_LOW KRATOS_LOW 1754
1746m700 MACH_M700 M700 1755
1747edmini_v2 MACH_EDMINI_V2 EDMINI_V2 1756
1748zipit2 MACH_ZIPIT2 ZIPIT2 1757
1749hslfemtocell MACH_HSLFEMTOCELL HSLFEMTOCELL 1758
1750daintree_at91 MACH_DAINTREE_AT91 DAINTREE_AT91 1759
1751sg560usb MACH_SG560USB SG560USB 1760
1752omap3_pandora MACH_OMAP3_PANDORA OMAP3_PANDORA 1761
1753usr8200 MACH_USR8200 USR8200 1762
1754s1s65k MACH_S1S65K S1S65K 1763
1755s2s65a MACH_S2S65A S2S65A 1764
1756icore MACH_ICORE ICORE 1765
1757mss2 MACH_MSS2 MSS2 1766
1758belmont MACH_BELMONT BELMONT 1767
1759asusp525 MACH_ASUSP525 ASUSP525 1768
1760lb88rc8480 MACH_LB88RC8480 LB88RC8480 1769
1761hipxa MACH_HIPXA HIPXA 1770
1762mx25_3ds MACH_MX25_3DS MX25_3DS 1771
1763m800 MACH_M800 M800 1772
1764omap3530_lv_som MACH_OMAP3530_LV_SOM OMAP3530_LV_SOM 1773
1765prima_evb MACH_PRIMA_EVB PRIMA_EVB 1774
1766mx31bt1 MACH_MX31BT1 MX31BT1 1775
1767atlas4_evb MACH_ATLAS4_EVB ATLAS4_EVB 1776
1768mx31cicada MACH_MX31CICADA MX31CICADA 1777
1769mi424wr MACH_MI424WR MI424WR 1778
1770axs_ultrax MACH_AXS_ULTRAX AXS_ULTRAX 1779
1771at572d940deb MACH_AT572D940DEB AT572D940DEB 1780
1772davinci_da8xx_evm MACH_DAVINCI_DA8XX_EVM DAVINCI_DA8XX_EVM 1781
1773ep9302 MACH_EP9302 EP9302 1782
1774at572d940hfeb MACH_AT572D940HFEB AT572D940HFEB 1783
1775cybook3 MACH_CYBOOK3 CYBOOK3 1784
1776wdg002 MACH_WDG002 WDG002 1785
1777sg560adsl MACH_SG560ADSL SG560ADSL 1786
1778nextio_n2800_ica MACH_NEXTIO_N2800_ICA NEXTIO_N2800_ICA 1787
1779marvell_newdb MACH_MARVELL_NEWDB MARVELL_NEWDB 1789
1780vandihud MACH_VANDIHUD VANDIHUD 1790
1781magx_e8 MACH_MAGX_E8 MAGX_E8 1791
1782magx_z6 MACH_MAGX_Z6 MAGX_Z6 1792
1783magx_v8 MACH_MAGX_V8 MAGX_V8 1793
1784magx_u9 MACH_MAGX_U9 MAGX_U9 1794
1785toughcf08 MACH_TOUGHCF08 TOUGHCF08 1795
1786zw4400 MACH_ZW4400 ZW4400 1796
1787marat91 MACH_MARAT91 MARAT91 1797
1788overo MACH_OVERO OVERO 1798
1789at2440evb MACH_AT2440EVB AT2440EVB 1799
1790neocore926 MACH_NEOCORE926 NEOCORE926 1800
1791wnr854t MACH_WNR854T WNR854T 1801
1792imx27 MACH_IMX27 IMX27 1802
1793moose_db MACH_MOOSE_DB MOOSE_DB 1803
1794fab4 MACH_FAB4 FAB4 1804
1795htcdiamond MACH_HTCDIAMOND HTCDIAMOND 1805
1796fiona MACH_FIONA FIONA 1806
1797mxc30030_x MACH_MXC30030_X MXC30030_X 1807
1798bmp1000 MACH_BMP1000 BMP1000 1808
1799logi9200 MACH_LOGI9200 LOGI9200 1809
1800tqma31 MACH_TQMA31 TQMA31 1810
1801ccw9p9215js MACH_CCW9P9215JS CCW9P9215JS 1811
1802rd88f5181l_ge MACH_RD88F5181L_GE RD88F5181L_GE 1812
1803sifmain MACH_SIFMAIN SIFMAIN 1813
1804sam9_l9261 MACH_SAM9_L9261 SAM9_L9261 1814
1805cc9m2443js MACH_CC9M2443JS CC9M2443JS 1815
1806xaria300 MACH_XARIA300 XARIA300 1816
1807it9200 MACH_IT9200 IT9200 1817
1808rd88f5181l_fxo MACH_RD88F5181L_FXO RD88F5181L_FXO 1818
1809kriss_sensor MACH_KRISS_SENSOR KRISS_SENSOR 1819
1810pilz_pmi5 MACH_PILZ_PMI5 PILZ_PMI5 1820
1811jade MACH_JADE JADE 1821
1812ks8695_softplc MACH_KS8695_SOFTPLC KS8695_SOFTPLC 1822
1813gprisc4 MACH_GPRISC4 GPRISC4 1823
1814stamp9260 MACH_STAMP9260 STAMP9260 1824
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 09ad7995080c..45d63c986015 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -88,6 +88,7 @@ config PLATFORM_AT32AP
88 select MMU 88 select MMU
89 select PERFORMANCE_COUNTERS 89 select PERFORMANCE_COUNTERS
90 select HAVE_GPIO_LIB 90 select HAVE_GPIO_LIB
91 select GENERIC_ALLOCATOR
91 92
92# 93#
93# CPU types 94# CPU types
@@ -147,6 +148,9 @@ config PHYS_OFFSET
147 148
148source "kernel/Kconfig.preempt" 149source "kernel/Kconfig.preempt"
149 150
151config QUICKLIST
152 def_bool y
153
150config HAVE_ARCH_BOOTMEM_NODE 154config HAVE_ARCH_BOOTMEM_NODE
151 def_bool n 155 def_bool n
152 156
@@ -201,6 +205,11 @@ endmenu
201 205
202menu "Power management options" 206menu "Power management options"
203 207
208source "kernel/power/Kconfig"
209
210config ARCH_SUSPEND_POSSIBLE
211 def_bool y
212
204menu "CPU Frequency scaling" 213menu "CPU Frequency scaling"
205 214
206source "drivers/cpufreq/Kconfig" 215source "drivers/cpufreq/Kconfig"
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index a398be284966..a51bb9fb3c89 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -9,6 +9,8 @@
9 */ 9 */
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
12#include <linux/irq.h>
13#include <linux/i2c.h>
12#include <linux/i2c-gpio.h> 14#include <linux/i2c-gpio.h>
13#include <linux/init.h> 15#include <linux/init.h>
14#include <linux/linkage.h> 16#include <linux/linkage.h>
@@ -25,6 +27,13 @@
25#include <asm/arch/init.h> 27#include <asm/arch/init.h>
26#include <asm/arch/portmux.h> 28#include <asm/arch/portmux.h>
27 29
30/* Oscillator frequencies. These are board-specific */
31unsigned long at32_board_osc_rates[3] = {
32 [0] = 32768, /* 32.768 kHz on RTC osc */
33 [1] = 20000000, /* 20 MHz on osc0 */
34 [2] = 12000000, /* 12 MHz on osc1 */
35};
36
28/* Initialized by bootloader-specific startup code. */ 37/* Initialized by bootloader-specific startup code. */
29struct tag *bootloader_tags __initdata; 38struct tag *bootloader_tags __initdata;
30 39
@@ -140,6 +149,10 @@ static struct platform_device i2c_gpio_device = {
140 }, 149 },
141}; 150};
142 151
152static struct i2c_board_info __initdata i2c_info[] = {
153 /* NOTE: original ATtiny24 firmware is at address 0x0b */
154};
155
143static int __init atngw100_init(void) 156static int __init atngw100_init(void)
144{ 157{
145 unsigned i; 158 unsigned i;
@@ -165,12 +178,28 @@ static int __init atngw100_init(void)
165 } 178 }
166 platform_device_register(&ngw_gpio_leds); 179 platform_device_register(&ngw_gpio_leds);
167 180
181 /* all these i2c/smbus pins should have external pullups for
182 * open-drain sharing among all I2C devices. SDA and SCL do;
183 * PB28/EXTINT3 doesn't; it should be SMBALERT# (for PMBus),
184 * but it's not available off-board.
185 */
186 at32_select_periph(GPIO_PIN_PB(28), 0, AT32_GPIOF_PULLUP);
168 at32_select_gpio(i2c_gpio_data.sda_pin, 187 at32_select_gpio(i2c_gpio_data.sda_pin,
169 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); 188 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
170 at32_select_gpio(i2c_gpio_data.scl_pin, 189 at32_select_gpio(i2c_gpio_data.scl_pin,
171 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); 190 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
172 platform_device_register(&i2c_gpio_device); 191 platform_device_register(&i2c_gpio_device);
192 i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
173 193
174 return 0; 194 return 0;
175} 195}
176postcore_initcall(atngw100_init); 196postcore_initcall(atngw100_init);
197
198static int __init atngw100_arch_init(void)
199{
200 /* set_irq_type() after the arch_initcall for EIC has run, and
201 * before the I2C subsystem could try using this IRQ.
202 */
203 return set_irq_type(AT32_EXTINT(3), IRQ_TYPE_EDGE_FALLING);
204}
205arch_initcall(atngw100_arch_init);
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 000eb4220a12..86b363c1c25b 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -28,6 +28,12 @@
28 28
29#include "atstk1000.h" 29#include "atstk1000.h"
30 30
31/* Oscillator frequencies. These are board specific */
32unsigned long at32_board_osc_rates[3] = {
33 [0] = 32768, /* 32.768 kHz on RTC osc */
34 [1] = 20000000, /* 20 MHz on osc0 */
35 [2] = 12000000, /* 12 MHz on osc1 */
36};
31 37
32struct eth_addr { 38struct eth_addr {
33 u8 addr[6]; 39 u8 addr[6];
@@ -232,7 +238,7 @@ static int __init atstk1002_init(void)
232 set_hw_addr(at32_add_device_eth(1, &eth_data[1])); 238 set_hw_addr(at32_add_device_eth(1, &eth_data[1]));
233#else 239#else
234 at32_add_device_lcdc(0, &atstk1000_lcdc_data, 240 at32_add_device_lcdc(0, &atstk1000_lcdc_data,
235 fbmem_start, fbmem_size); 241 fbmem_start, fbmem_size, 0);
236#endif 242#endif
237 at32_add_device_usba(0, NULL); 243 at32_add_device_usba(0, NULL);
238#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM 244#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
diff --git a/arch/avr32/boards/atstk1000/atstk1003.c b/arch/avr32/boards/atstk1000/atstk1003.c
index a0b223df35a2..ea109f435a83 100644
--- a/arch/avr32/boards/atstk1000/atstk1003.c
+++ b/arch/avr32/boards/atstk1000/atstk1003.c
@@ -27,6 +27,13 @@
27 27
28#include "atstk1000.h" 28#include "atstk1000.h"
29 29
30/* Oscillator frequencies. These are board specific */
31unsigned long at32_board_osc_rates[3] = {
32 [0] = 32768, /* 32.768 kHz on RTC osc */
33 [1] = 20000000, /* 20 MHz on osc0 */
34 [2] = 12000000, /* 12 MHz on osc1 */
35};
36
30#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC 37#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
31static struct at73c213_board_info at73c213_data = { 38static struct at73c213_board_info at73c213_data = {
32 .ssc_id = 0, 39 .ssc_id = 0,
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c
index e765a8652b3e..c7236df74d74 100644
--- a/arch/avr32/boards/atstk1000/atstk1004.c
+++ b/arch/avr32/boards/atstk1000/atstk1004.c
@@ -29,6 +29,13 @@
29 29
30#include "atstk1000.h" 30#include "atstk1000.h"
31 31
32/* Oscillator frequencies. These are board specific */
33unsigned long at32_board_osc_rates[3] = {
34 [0] = 32768, /* 32.768 kHz on RTC osc */
35 [1] = 20000000, /* 20 MHz on osc0 */
36 [2] = 12000000, /* 12 MHz on osc1 */
37};
38
32#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC 39#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
33static struct at73c213_board_info at73c213_data = { 40static struct at73c213_board_info at73c213_data = {
34 .ssc_id = 0, 41 .ssc_id = 0,
@@ -133,7 +140,7 @@ static int __init atstk1004_init(void)
133 at32_add_device_mci(0); 140 at32_add_device_mci(0);
134#endif 141#endif
135 at32_add_device_lcdc(0, &atstk1000_lcdc_data, 142 at32_add_device_lcdc(0, &atstk1000_lcdc_data,
136 fbmem_start, fbmem_size); 143 fbmem_start, fbmem_size, 0);
137 at32_add_device_usba(0, NULL); 144 at32_add_device_usba(0, NULL);
138#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM 145#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
139 at32_add_device_ssc(0, ATMEL_SSC_TX); 146 at32_add_device_ssc(0, ATMEL_SSC_TX);
diff --git a/arch/avr32/kernel/entry-avr32b.S b/arch/avr32/kernel/entry-avr32b.S
index 5f31702d6b1c..2b398cae110c 100644
--- a/arch/avr32/kernel/entry-avr32b.S
+++ b/arch/avr32/kernel/entry-avr32b.S
@@ -74,50 +74,41 @@ exception_vectors:
74 .align 2 74 .align 2
75 bral do_dtlb_modified 75 bral do_dtlb_modified
76 76
77 /*
78 * r0 : PGD/PT/PTE
79 * r1 : Offending address
80 * r2 : Scratch register
81 * r3 : Cause (5, 12 or 13)
82 */
83#define tlbmiss_save pushm r0-r3 77#define tlbmiss_save pushm r0-r3
84#define tlbmiss_restore popm r0-r3 78#define tlbmiss_restore popm r0-r3
85 79
86 .section .tlbx.ex.text,"ax",@progbits 80 .org 0x50
87 .global itlb_miss 81 .global itlb_miss
88itlb_miss: 82itlb_miss:
89 tlbmiss_save 83 tlbmiss_save
90 rjmp tlb_miss_common 84 rjmp tlb_miss_common
91 85
92 .section .tlbr.ex.text,"ax",@progbits 86 .org 0x60
93dtlb_miss_read: 87dtlb_miss_read:
94 tlbmiss_save 88 tlbmiss_save
95 rjmp tlb_miss_common 89 rjmp tlb_miss_common
96 90
97 .section .tlbw.ex.text,"ax",@progbits 91 .org 0x70
98dtlb_miss_write: 92dtlb_miss_write:
99 tlbmiss_save 93 tlbmiss_save
100 94
101 .global tlb_miss_common 95 .global tlb_miss_common
96 .align 2
102tlb_miss_common: 97tlb_miss_common:
103 mfsr r0, SYSREG_TLBEAR 98 mfsr r0, SYSREG_TLBEAR
104 mfsr r1, SYSREG_PTBR 99 mfsr r1, SYSREG_PTBR
105 100
106 /* Is it the vmalloc space? */ 101 /*
107 bld r0, 31 102 * First level lookup: The PGD contains virtual pointers to
108 brcs handle_vmalloc_miss 103 * the second-level page tables, but they may be NULL if not
109 104 * present.
110 /* First level lookup */ 105 */
111pgtbl_lookup: 106pgtbl_lookup:
112 lsr r2, r0, PGDIR_SHIFT 107 lsr r2, r0, PGDIR_SHIFT
113 ld.w r3, r1[r2 << 2] 108 ld.w r3, r1[r2 << 2]
114 bfextu r1, r0, PAGE_SHIFT, PGDIR_SHIFT - PAGE_SHIFT 109 bfextu r1, r0, PAGE_SHIFT, PGDIR_SHIFT - PAGE_SHIFT
115 bld r3, _PAGE_BIT_PRESENT 110 cp.w r3, 0
116 brcc page_table_not_present 111 breq page_table_not_present
117
118 /* Translate to virtual address in P1. */
119 andl r3, 0xf000
120 sbr r3, 31
121 112
122 /* Second level lookup */ 113 /* Second level lookup */
123 ld.w r2, r3[r1 << 2] 114 ld.w r2, r3[r1 << 2]
@@ -148,16 +139,55 @@ pgtbl_lookup:
148 tlbmiss_restore 139 tlbmiss_restore
149 rete 140 rete
150 141
151handle_vmalloc_miss: 142 /* The slow path of the TLB miss handler */
152 /* Simply do the lookup in init's page table */ 143 .align 2
144page_table_not_present:
145 /* Do we need to synchronize with swapper_pg_dir? */
146 bld r0, 31
147 brcs sync_with_swapper_pg_dir
148
149page_not_present:
150 tlbmiss_restore
151 sub sp, 4
152 stmts --sp, r0-lr
153 rcall save_full_context_ex
154 mfsr r12, SYSREG_ECR
155 mov r11, sp
156 rcall do_page_fault
157 rjmp ret_from_exception
158
159 .align 2
160sync_with_swapper_pg_dir:
161 /*
162 * If swapper_pg_dir contains a non-NULL second-level page
163 * table pointer, copy it into the current PGD. If not, we
164 * must handle it as a full-blown page fault.
165 *
166 * Jumping back to pgtbl_lookup causes an unnecessary lookup,
167 * but it is guaranteed to be a cache hit, it won't happen
168 * very often, and we absolutely do not want to sacrifice any
169 * performance in the fast path in order to improve this.
170 */
153 mov r1, lo(swapper_pg_dir) 171 mov r1, lo(swapper_pg_dir)
154 orh r1, hi(swapper_pg_dir) 172 orh r1, hi(swapper_pg_dir)
173 ld.w r3, r1[r2 << 2]
174 cp.w r3, 0
175 breq page_not_present
176 mfsr r1, SYSREG_PTBR
177 st.w r1[r2 << 2], r3
155 rjmp pgtbl_lookup 178 rjmp pgtbl_lookup
156 179
180 /*
181 * We currently have two bytes left at this point until we
182 * crash into the system call handler...
183 *
184 * Don't worry, the assembler will let us know.
185 */
186
157 187
158 /* --- System Call --- */ 188 /* --- System Call --- */
159 189
160 .section .scall.text,"ax",@progbits 190 .org 0x100
161system_call: 191system_call:
162#ifdef CONFIG_PREEMPT 192#ifdef CONFIG_PREEMPT
163 mask_interrupts 193 mask_interrupts
@@ -266,18 +296,6 @@ syscall_exit_work:
266 brcc syscall_exit_cont 296 brcc syscall_exit_cont
267 rjmp enter_monitor_mode 297 rjmp enter_monitor_mode
268 298
269 /* The slow path of the TLB miss handler */
270page_table_not_present:
271page_not_present:
272 tlbmiss_restore
273 sub sp, 4
274 stmts --sp, r0-lr
275 rcall save_full_context_ex
276 mfsr r12, SYSREG_ECR
277 mov r11, sp
278 rcall do_page_fault
279 rjmp ret_from_exception
280
281 /* This function expects to find offending PC in SYSREG_RAR_EX */ 299 /* This function expects to find offending PC in SYSREG_RAR_EX */
282 .type save_full_context_ex, @function 300 .type save_full_context_ex, @function
283 .align 2 301 .align 2
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c
index 5616a00c10ba..c5b11f9067f1 100644
--- a/arch/avr32/kernel/signal.c
+++ b/arch/avr32/kernel/signal.c
@@ -93,6 +93,9 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
93 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 93 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
94 goto badframe; 94 goto badframe;
95 95
96 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
97 goto badframe;
98
96 pr_debug("Context restored: pc = %08lx, lr = %08lx, sp = %08lx\n", 99 pr_debug("Context restored: pc = %08lx, lr = %08lx, sp = %08lx\n",
97 regs->pc, regs->lr, regs->sp); 100 regs->pc, regs->lr, regs->sp);
98 101
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 00a9862380ff..abd954fb7ba0 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -7,21 +7,13 @@
7 */ 7 */
8#include <linux/clk.h> 8#include <linux/clk.h>
9#include <linux/clockchips.h> 9#include <linux/clockchips.h>
10#include <linux/time.h> 10#include <linux/init.h>
11#include <linux/module.h>
12#include <linux/interrupt.h> 11#include <linux/interrupt.h>
13#include <linux/irq.h> 12#include <linux/irq.h>
14#include <linux/kernel_stat.h> 13#include <linux/kernel.h>
15#include <linux/errno.h> 14#include <linux/time.h>
16#include <linux/init.h>
17#include <linux/profile.h>
18#include <linux/sysdev.h>
19#include <linux/err.h>
20 15
21#include <asm/div64.h>
22#include <asm/sysreg.h> 16#include <asm/sysreg.h>
23#include <asm/io.h>
24#include <asm/sections.h>
25 17
26#include <asm/arch/pm.h> 18#include <asm/arch/pm.h>
27 19
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 481cfd40c053..7910d41eb886 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -68,14 +68,6 @@ SECTIONS
68 _evba = .; 68 _evba = .;
69 _text = .; 69 _text = .;
70 *(.ex.text) 70 *(.ex.text)
71 . = 0x50;
72 *(.tlbx.ex.text)
73 . = 0x60;
74 *(.tlbr.ex.text)
75 . = 0x70;
76 *(.tlbw.ex.text)
77 . = 0x100;
78 *(.scall.text)
79 *(.irq.text) 71 *(.irq.text)
80 KPROBES_TEXT 72 KPROBES_TEXT
81 TEXT_TEXT 73 TEXT_TEXT
@@ -93,8 +85,6 @@ SECTIONS
93 __stop___ex_table = .; 85 __stop___ex_table = .;
94 } 86 }
95 87
96 BUG_TABLE
97
98 RODATA 88 RODATA
99 89
100 . = ALIGN(THREAD_SIZE); 90 . = ALIGN(THREAD_SIZE);
@@ -107,6 +97,10 @@ SECTIONS
107 */ 97 */
108 *(.data.init_task) 98 *(.data.init_task)
109 99
100 /* Then, the page-aligned data */
101 . = ALIGN(PAGE_SIZE);
102 *(.data.page_aligned)
103
110 /* Then, the cacheline aligned data */ 104 /* Then, the cacheline aligned data */
111 . = ALIGN(L1_CACHE_BYTES); 105 . = ALIGN(L1_CACHE_BYTES);
112 *(.data.cacheline_aligned) 106 *(.data.cacheline_aligned)
diff --git a/arch/avr32/lib/io-readsb.S b/arch/avr32/lib/io-readsb.S
index 2be5da7ed26b..cb2d86945559 100644
--- a/arch/avr32/lib/io-readsb.S
+++ b/arch/avr32/lib/io-readsb.S
@@ -41,7 +41,7 @@ __raw_readsb:
412: sub r10, -4 412: sub r10, -4
42 reteq r12 42 reteq r12
43 43
443: ld.uh r8, r12[0] 443: ld.ub r8, r12[0]
45 sub r10, 1 45 sub r10, 1
46 st.b r11++, r8 46 st.b r11++, r8
47 brne 3b 47 brne 3b
diff --git a/arch/avr32/mach-at32ap/Makefile b/arch/avr32/mach-at32ap/Makefile
index e89009439e4a..d5018e2eed25 100644
--- a/arch/avr32/mach-at32ap/Makefile
+++ b/arch/avr32/mach-at32ap/Makefile
@@ -1,3 +1,8 @@
1obj-y += at32ap.o clock.o intc.o extint.o pio.o hsmc.o 1obj-y += pdc.o clock.o intc.o extint.o pio.o hsmc.o
2obj-$(CONFIG_CPU_AT32AP700X) += at32ap700x.o pm-at32ap700x.o 2obj-$(CONFIG_CPU_AT32AP700X) += at32ap700x.o pm-at32ap700x.o
3obj-$(CONFIG_CPU_FREQ_AT32AP) += cpufreq.o 3obj-$(CONFIG_CPU_FREQ_AT32AP) += cpufreq.o
4obj-$(CONFIG_PM) += pm.o
5
6ifeq ($(CONFIG_PM_DEBUG),y)
7CFLAGS_pm.o += -DDEBUG
8endif
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 0f24b4f85c17..07b21b121eef 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -20,6 +20,7 @@
20#include <asm/arch/at32ap700x.h> 20#include <asm/arch/at32ap700x.h>
21#include <asm/arch/board.h> 21#include <asm/arch/board.h>
22#include <asm/arch/portmux.h> 22#include <asm/arch/portmux.h>
23#include <asm/arch/sram.h>
23 24
24#include <video/atmel_lcdc.h> 25#include <video/atmel_lcdc.h>
25 26
@@ -93,19 +94,12 @@ static struct clk devname##_##_name = { \
93 94
94static DEFINE_SPINLOCK(pm_lock); 95static DEFINE_SPINLOCK(pm_lock);
95 96
96unsigned long at32ap7000_osc_rates[3] = {
97 [0] = 32768,
98 /* FIXME: these are ATSTK1002-specific */
99 [1] = 20000000,
100 [2] = 12000000,
101};
102
103static struct clk osc0; 97static struct clk osc0;
104static struct clk osc1; 98static struct clk osc1;
105 99
106static unsigned long osc_get_rate(struct clk *clk) 100static unsigned long osc_get_rate(struct clk *clk)
107{ 101{
108 return at32ap7000_osc_rates[clk->index]; 102 return at32_board_osc_rates[clk->index];
109} 103}
110 104
111static unsigned long pll_get_rate(struct clk *clk, unsigned long control) 105static unsigned long pll_get_rate(struct clk *clk, unsigned long control)
@@ -682,6 +676,14 @@ static struct clk hramc_clk = {
682 .users = 1, 676 .users = 1,
683 .index = 3, 677 .index = 3,
684}; 678};
679static struct clk sdramc_clk = {
680 .name = "sdramc_clk",
681 .parent = &pbb_clk,
682 .mode = pbb_clk_mode,
683 .get_rate = pbb_clk_get_rate,
684 .users = 1,
685 .index = 14,
686};
685 687
686static struct resource smc0_resource[] = { 688static struct resource smc0_resource[] = {
687 PBMEM(0xfff03400), 689 PBMEM(0xfff03400),
@@ -841,6 +843,81 @@ void __init at32_add_system_devices(void)
841} 843}
842 844
843/* -------------------------------------------------------------------- 845/* --------------------------------------------------------------------
846 * PSIF
847 * -------------------------------------------------------------------- */
848static struct resource atmel_psif0_resource[] __initdata = {
849 {
850 .start = 0xffe03c00,
851 .end = 0xffe03cff,
852 .flags = IORESOURCE_MEM,
853 },
854 IRQ(18),
855};
856static struct clk atmel_psif0_pclk = {
857 .name = "pclk",
858 .parent = &pba_clk,
859 .mode = pba_clk_mode,
860 .get_rate = pba_clk_get_rate,
861 .index = 15,
862};
863
864static struct resource atmel_psif1_resource[] __initdata = {
865 {
866 .start = 0xffe03d00,
867 .end = 0xffe03dff,
868 .flags = IORESOURCE_MEM,
869 },
870 IRQ(18),
871};
872static struct clk atmel_psif1_pclk = {
873 .name = "pclk",
874 .parent = &pba_clk,
875 .mode = pba_clk_mode,
876 .get_rate = pba_clk_get_rate,
877 .index = 15,
878};
879
880struct platform_device *__init at32_add_device_psif(unsigned int id)
881{
882 struct platform_device *pdev;
883
884 if (!(id == 0 || id == 1))
885 return NULL;
886
887 pdev = platform_device_alloc("atmel_psif", id);
888 if (!pdev)
889 return NULL;
890
891 switch (id) {
892 case 0:
893 if (platform_device_add_resources(pdev, atmel_psif0_resource,
894 ARRAY_SIZE(atmel_psif0_resource)))
895 goto err_add_resources;
896 atmel_psif0_pclk.dev = &pdev->dev;
897 select_peripheral(PA(8), PERIPH_A, 0); /* CLOCK */
898 select_peripheral(PA(9), PERIPH_A, 0); /* DATA */
899 break;
900 case 1:
901 if (platform_device_add_resources(pdev, atmel_psif1_resource,
902 ARRAY_SIZE(atmel_psif1_resource)))
903 goto err_add_resources;
904 atmel_psif1_pclk.dev = &pdev->dev;
905 select_peripheral(PB(11), PERIPH_A, 0); /* CLOCK */
906 select_peripheral(PB(12), PERIPH_A, 0); /* DATA */
907 break;
908 default:
909 return NULL;
910 }
911
912 platform_device_add(pdev);
913 return pdev;
914
915err_add_resources:
916 platform_device_put(pdev);
917 return NULL;
918}
919
920/* --------------------------------------------------------------------
844 * USART 921 * USART
845 * -------------------------------------------------------------------- */ 922 * -------------------------------------------------------------------- */
846 923
@@ -1113,7 +1190,8 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n)
1113 switch (id) { 1190 switch (id) {
1114 case 0: 1191 case 0:
1115 pdev = &atmel_spi0_device; 1192 pdev = &atmel_spi0_device;
1116 select_peripheral(PA(0), PERIPH_A, 0); /* MISO */ 1193 /* pullup MISO so a level is always defined */
1194 select_peripheral(PA(0), PERIPH_A, AT32_GPIOF_PULLUP);
1117 select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */ 1195 select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */
1118 select_peripheral(PA(2), PERIPH_A, 0); /* SCK */ 1196 select_peripheral(PA(2), PERIPH_A, 0); /* SCK */
1119 at32_spi_setup_slaves(0, b, n, spi0_pins); 1197 at32_spi_setup_slaves(0, b, n, spi0_pins);
@@ -1121,7 +1199,8 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n)
1121 1199
1122 case 1: 1200 case 1:
1123 pdev = &atmel_spi1_device; 1201 pdev = &atmel_spi1_device;
1124 select_peripheral(PB(0), PERIPH_B, 0); /* MISO */ 1202 /* pullup MISO so a level is always defined */
1203 select_peripheral(PB(0), PERIPH_B, AT32_GPIOF_PULLUP);
1125 select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */ 1204 select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */
1126 select_peripheral(PB(5), PERIPH_B, 0); /* SCK */ 1205 select_peripheral(PB(5), PERIPH_B, 0); /* SCK */
1127 at32_spi_setup_slaves(1, b, n, spi1_pins); 1206 at32_spi_setup_slaves(1, b, n, spi1_pins);
@@ -1264,7 +1343,8 @@ static struct clk atmel_lcdfb0_pixclk = {
1264 1343
1265struct platform_device *__init 1344struct platform_device *__init
1266at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, 1345at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
1267 unsigned long fbmem_start, unsigned long fbmem_len) 1346 unsigned long fbmem_start, unsigned long fbmem_len,
1347 unsigned int pin_config)
1268{ 1348{
1269 struct platform_device *pdev; 1349 struct platform_device *pdev;
1270 struct atmel_lcdfb_info *info; 1350 struct atmel_lcdfb_info *info;
@@ -1291,37 +1371,77 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
1291 switch (id) { 1371 switch (id) {
1292 case 0: 1372 case 0:
1293 pdev = &atmel_lcdfb0_device; 1373 pdev = &atmel_lcdfb0_device;
1294 select_peripheral(PC(19), PERIPH_A, 0); /* CC */ 1374
1295 select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ 1375 switch (pin_config) {
1296 select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ 1376 case 0:
1297 select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */ 1377 select_peripheral(PC(19), PERIPH_A, 0); /* CC */
1298 select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */ 1378 select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */
1299 select_peripheral(PC(24), PERIPH_A, 0); /* MODE */ 1379 select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */
1300 select_peripheral(PC(25), PERIPH_A, 0); /* PWR */ 1380 select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */
1301 select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */ 1381 select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */
1302 select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */ 1382 select_peripheral(PC(24), PERIPH_A, 0); /* MODE */
1303 select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */ 1383 select_peripheral(PC(25), PERIPH_A, 0); /* PWR */
1304 select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */ 1384 select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */
1305 select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */ 1385 select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */
1306 select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */ 1386 select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */
1307 select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */ 1387 select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */
1308 select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */ 1388 select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */
1309 select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */ 1389 select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */
1310 select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */ 1390 select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */
1311 select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */ 1391 select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */
1312 select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */ 1392 select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */
1313 select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */ 1393 select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */
1314 select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */ 1394 select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */
1315 select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */ 1395 select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */
1316 select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */ 1396 select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */
1317 select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */ 1397 select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */
1318 select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */ 1398 select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */
1319 select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */ 1399 select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */
1320 select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */ 1400 select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */
1321 select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */ 1401 select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */
1322 select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */ 1402 select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */
1323 select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ 1403 select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */
1324 select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ 1404 select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */
1405 select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */
1406 select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */
1407 select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */
1408 break;
1409 case 1:
1410 select_peripheral(PE(0), PERIPH_B, 0); /* CC */
1411 select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */
1412 select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */
1413 select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */
1414 select_peripheral(PE(1), PERIPH_B, 0); /* DVAL */
1415 select_peripheral(PE(2), PERIPH_B, 0); /* MODE */
1416 select_peripheral(PC(25), PERIPH_A, 0); /* PWR */
1417 select_peripheral(PE(3), PERIPH_B, 0); /* DATA0 */
1418 select_peripheral(PE(4), PERIPH_B, 0); /* DATA1 */
1419 select_peripheral(PE(5), PERIPH_B, 0); /* DATA2 */
1420 select_peripheral(PE(6), PERIPH_B, 0); /* DATA3 */
1421 select_peripheral(PE(7), PERIPH_B, 0); /* DATA4 */
1422 select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */
1423 select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */
1424 select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */
1425 select_peripheral(PE(8), PERIPH_B, 0); /* DATA8 */
1426 select_peripheral(PE(9), PERIPH_B, 0); /* DATA9 */
1427 select_peripheral(PE(10), PERIPH_B, 0); /* DATA10 */
1428 select_peripheral(PE(11), PERIPH_B, 0); /* DATA11 */
1429 select_peripheral(PE(12), PERIPH_B, 0); /* DATA12 */
1430 select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */
1431 select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */
1432 select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */
1433 select_peripheral(PE(13), PERIPH_B, 0); /* DATA16 */
1434 select_peripheral(PE(14), PERIPH_B, 0); /* DATA17 */
1435 select_peripheral(PE(15), PERIPH_B, 0); /* DATA18 */
1436 select_peripheral(PE(16), PERIPH_B, 0); /* DATA19 */
1437 select_peripheral(PE(17), PERIPH_B, 0); /* DATA20 */
1438 select_peripheral(PE(18), PERIPH_B, 0); /* DATA21 */
1439 select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */
1440 select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */
1441 break;
1442 default:
1443 goto err_invalid_id;
1444 }
1325 1445
1326 clk_set_parent(&atmel_lcdfb0_pixclk, &pll0); 1446 clk_set_parent(&atmel_lcdfb0_pixclk, &pll0);
1327 clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0)); 1447 clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0));
@@ -1360,7 +1480,7 @@ static struct resource atmel_pwm0_resource[] __initdata = {
1360 IRQ(24), 1480 IRQ(24),
1361}; 1481};
1362static struct clk atmel_pwm0_mck = { 1482static struct clk atmel_pwm0_mck = {
1363 .name = "mck", 1483 .name = "pwm_clk",
1364 .parent = &pbb_clk, 1484 .parent = &pbb_clk,
1365 .mode = pbb_clk_mode, 1485 .mode = pbb_clk_mode,
1366 .get_rate = pbb_clk_get_rate, 1486 .get_rate = pbb_clk_get_rate,
@@ -1887,6 +2007,7 @@ struct clk *at32_clock_list[] = {
1887 &hmatrix_clk, 2007 &hmatrix_clk,
1888 &ebi_clk, 2008 &ebi_clk,
1889 &hramc_clk, 2009 &hramc_clk,
2010 &sdramc_clk,
1890 &smc0_pclk, 2011 &smc0_pclk,
1891 &smc0_mck, 2012 &smc0_mck,
1892 &pdc_hclk, 2013 &pdc_hclk,
@@ -1900,6 +2021,8 @@ struct clk *at32_clock_list[] = {
1900 &pio4_mck, 2021 &pio4_mck,
1901 &at32_tcb0_t0_clk, 2022 &at32_tcb0_t0_clk,
1902 &at32_tcb1_t0_clk, 2023 &at32_tcb1_t0_clk,
2024 &atmel_psif0_pclk,
2025 &atmel_psif1_pclk,
1903 &atmel_usart0_usart, 2026 &atmel_usart0_usart,
1904 &atmel_usart1_usart, 2027 &atmel_usart1_usart,
1905 &atmel_usart2_usart, 2028 &atmel_usart2_usart,
@@ -1935,16 +2058,7 @@ struct clk *at32_clock_list[] = {
1935}; 2058};
1936unsigned int at32_nr_clocks = ARRAY_SIZE(at32_clock_list); 2059unsigned int at32_nr_clocks = ARRAY_SIZE(at32_clock_list);
1937 2060
1938void __init at32_portmux_init(void) 2061void __init setup_platform(void)
1939{
1940 at32_init_pio(&pio0_device);
1941 at32_init_pio(&pio1_device);
1942 at32_init_pio(&pio2_device);
1943 at32_init_pio(&pio3_device);
1944 at32_init_pio(&pio4_device);
1945}
1946
1947void __init at32_clock_init(void)
1948{ 2062{
1949 u32 cpu_mask = 0, hsb_mask = 0, pba_mask = 0, pbb_mask = 0; 2063 u32 cpu_mask = 0, hsb_mask = 0, pba_mask = 0, pbb_mask = 0;
1950 int i; 2064 int i;
@@ -1999,4 +2113,36 @@ void __init at32_clock_init(void)
1999 pm_writel(HSB_MASK, hsb_mask); 2113 pm_writel(HSB_MASK, hsb_mask);
2000 pm_writel(PBA_MASK, pba_mask); 2114 pm_writel(PBA_MASK, pba_mask);
2001 pm_writel(PBB_MASK, pbb_mask); 2115 pm_writel(PBB_MASK, pbb_mask);
2116
2117 /* Initialize the port muxes */
2118 at32_init_pio(&pio0_device);
2119 at32_init_pio(&pio1_device);
2120 at32_init_pio(&pio2_device);
2121 at32_init_pio(&pio3_device);
2122 at32_init_pio(&pio4_device);
2123}
2124
2125struct gen_pool *sram_pool;
2126
2127static int __init sram_init(void)
2128{
2129 struct gen_pool *pool;
2130
2131 /* 1KiB granularity */
2132 pool = gen_pool_create(10, -1);
2133 if (!pool)
2134 goto fail;
2135
2136 if (gen_pool_add(pool, 0x24000000, 0x8000, -1))
2137 goto err_pool_add;
2138
2139 sram_pool = pool;
2140 return 0;
2141
2142err_pool_add:
2143 gen_pool_destroy(pool);
2144fail:
2145 pr_err("Failed to create SRAM pool\n");
2146 return -ENOMEM;
2002} 2147}
2148core_initcall(sram_init);
diff --git a/arch/avr32/mach-at32ap/intc.c b/arch/avr32/mach-at32ap/intc.c
index 097cf4e84052..994c4545e2b7 100644
--- a/arch/avr32/mach-at32ap/intc.c
+++ b/arch/avr32/mach-at32ap/intc.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 Atmel Corporation 2 * Copyright (C) 2006, 2008 Atmel Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
@@ -12,14 +12,20 @@
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/sysdev.h>
15 16
16#include <asm/io.h> 17#include <asm/io.h>
17 18
18#include "intc.h" 19#include "intc.h"
19 20
20struct intc { 21struct intc {
21 void __iomem *regs; 22 void __iomem *regs;
22 struct irq_chip chip; 23 struct irq_chip chip;
24 struct sys_device sysdev;
25#ifdef CONFIG_PM
26 unsigned long suspend_ipr;
27 unsigned long saved_ipr[64];
28#endif
23}; 29};
24 30
25extern struct platform_device at32_intc0_device; 31extern struct platform_device at32_intc0_device;
@@ -136,6 +142,74 @@ fail:
136 panic("Interrupt controller initialization failed!\n"); 142 panic("Interrupt controller initialization failed!\n");
137} 143}
138 144
145#ifdef CONFIG_PM
146void intc_set_suspend_handler(unsigned long offset)
147{
148 intc0.suspend_ipr = offset;
149}
150
151static int intc_suspend(struct sys_device *sdev, pm_message_t state)
152{
153 struct intc *intc = container_of(sdev, struct intc, sysdev);
154 int i;
155
156 if (unlikely(!irqs_disabled())) {
157 pr_err("intc_suspend: called with interrupts enabled\n");
158 return -EINVAL;
159 }
160
161 if (unlikely(!intc->suspend_ipr)) {
162 pr_err("intc_suspend: suspend_ipr not initialized\n");
163 return -EINVAL;
164 }
165
166 for (i = 0; i < 64; i++) {
167 intc->saved_ipr[i] = intc_readl(intc, INTPR0 + 4 * i);
168 intc_writel(intc, INTPR0 + 4 * i, intc->suspend_ipr);
169 }
170
171 return 0;
172}
173
174static int intc_resume(struct sys_device *sdev)
175{
176 struct intc *intc = container_of(sdev, struct intc, sysdev);
177 int i;
178
179 WARN_ON(!irqs_disabled());
180
181 for (i = 0; i < 64; i++)
182 intc_writel(intc, INTPR0 + 4 * i, intc->saved_ipr[i]);
183
184 return 0;
185}
186#else
187#define intc_suspend NULL
188#define intc_resume NULL
189#endif
190
191static struct sysdev_class intc_class = {
192 .name = "intc",
193 .suspend = intc_suspend,
194 .resume = intc_resume,
195};
196
197static int __init intc_init_sysdev(void)
198{
199 int ret;
200
201 ret = sysdev_class_register(&intc_class);
202 if (ret)
203 return ret;
204
205 intc0.sysdev.id = 0;
206 intc0.sysdev.cls = &intc_class;
207 ret = sysdev_register(&intc0.sysdev);
208
209 return ret;
210}
211device_initcall(intc_init_sysdev);
212
139unsigned long intc_get_pending(unsigned int group) 213unsigned long intc_get_pending(unsigned int group)
140{ 214{
141 return intc_readl(&intc0, INTREQ0 + 4 * group); 215 return intc_readl(&intc0, INTREQ0 + 4 * group);
diff --git a/arch/avr32/mach-at32ap/at32ap.c b/arch/avr32/mach-at32ap/pdc.c
index 7c4987f3287a..1040bda4fda7 100644
--- a/arch/avr32/mach-at32ap/at32ap.c
+++ b/arch/avr32/mach-at32ap/pdc.c
@@ -11,14 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13 13
14#include <asm/arch/init.h>
15
16void __init setup_platform(void)
17{
18 at32_clock_init();
19 at32_portmux_init();
20}
21
22static int __init pdc_probe(struct platform_device *pdev) 14static int __init pdc_probe(struct platform_device *pdev)
23{ 15{
24 struct clk *pclk, *hclk; 16 struct clk *pclk, *hclk;
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 38a8fa31c0b5..60da03ba7117 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -318,6 +318,8 @@ static void pio_bank_show(struct seq_file *s, struct gpio_chip *chip)
318 const char *label; 318 const char *label;
319 319
320 label = gpiochip_is_requested(chip, i); 320 label = gpiochip_is_requested(chip, i);
321 if (!label && (imr & mask))
322 label = "[irq]";
321 if (!label) 323 if (!label)
322 continue; 324 continue;
323 325
diff --git a/arch/avr32/mach-at32ap/pio.h b/arch/avr32/mach-at32ap/pio.h
index 7795116a483a..9484dfcc08f2 100644
--- a/arch/avr32/mach-at32ap/pio.h
+++ b/arch/avr32/mach-at32ap/pio.h
@@ -57,7 +57,7 @@
57 57
58/* Bitfields in IFDR */ 58/* Bitfields in IFDR */
59 59
60/* Bitfields in ISFR */ 60/* Bitfields in IFSR */
61 61
62/* Bitfields in SODR */ 62/* Bitfields in SODR */
63 63
diff --git a/arch/avr32/mach-at32ap/pm-at32ap700x.S b/arch/avr32/mach-at32ap/pm-at32ap700x.S
index 949e2485e278..0a53ad314ff4 100644
--- a/arch/avr32/mach-at32ap/pm-at32ap700x.S
+++ b/arch/avr32/mach-at32ap/pm-at32ap700x.S
@@ -12,6 +12,12 @@
12#include <asm/thread_info.h> 12#include <asm/thread_info.h>
13#include <asm/arch/pm.h> 13#include <asm/arch/pm.h>
14 14
15#include "pm.h"
16#include "sdramc.h"
17
18/* Same as 0xfff00000 but fits in a 21 bit signed immediate */
19#define PM_BASE -0x100000
20
15 .section .bss, "wa", @nobits 21 .section .bss, "wa", @nobits
16 .global disable_idle_sleep 22 .global disable_idle_sleep
17 .type disable_idle_sleep, @object 23 .type disable_idle_sleep, @object
@@ -64,3 +70,105 @@ cpu_idle_skip_sleep:
64 unmask_interrupts 70 unmask_interrupts
65 retal r12 71 retal r12
66 .size cpu_idle_skip_sleep, . - cpu_idle_skip_sleep 72 .size cpu_idle_skip_sleep, . - cpu_idle_skip_sleep
73
74#ifdef CONFIG_PM
75 .section .init.text, "ax", @progbits
76
77 .global pm_exception
78 .type pm_exception, @function
79pm_exception:
80 /*
81 * Exceptions are masked when we switch to this handler, so
82 * we'll only get "unrecoverable" exceptions (offset 0.)
83 */
84 sub r12, pc, . - .Lpanic_msg
85 lddpc pc, .Lpanic_addr
86
87 .align 2
88.Lpanic_addr:
89 .long panic
90.Lpanic_msg:
91 .asciz "Unrecoverable exception during suspend\n"
92 .size pm_exception, . - pm_exception
93
94 .global pm_irq0
95 .type pm_irq0, @function
96pm_irq0:
97 /* Disable interrupts and return after the sleep instruction */
98 mfsr r9, SYSREG_RSR_INT0
99 mtsr SYSREG_RAR_INT0, r8
100 sbr r9, SYSREG_GM_OFFSET
101 mtsr SYSREG_RSR_INT0, r9
102 rete
103
104 /*
105 * void cpu_enter_standby(unsigned long sdramc_base)
106 *
107 * Enter PM_SUSPEND_STANDBY mode. At this point, all drivers
108 * are suspended and interrupts are disabled. Interrupts
109 * marked as 'wakeup' event sources may still come along and
110 * get us out of here.
111 *
112 * The SDRAM will be put into self-refresh mode (which does
113 * not require a clock from the CPU), and the CPU will be put
114 * into "frozen" mode (HSB bus stopped). The SDRAM controller
115 * will automatically bring the SDRAM into normal mode on the
116 * first access, and the power manager will automatically
117 * start the HSB and CPU clocks upon a wakeup event.
118 *
119 * This code uses the same "skip sleep" technique as above.
120 * It is very important that we jump directly to
121 * cpu_after_sleep after the sleep instruction since that's
122 * where we'll end up if the interrupt handler decides that we
123 * need to skip the sleep instruction.
124 */
125 .global pm_standby
126 .type pm_standby, @function
127pm_standby:
128 /*
129 * interrupts are already masked at this point, and EVBA
130 * points to pm_exception above.
131 */
132 ld.w r10, r12[SDRAMC_LPR]
133 sub r8, pc, . - 1f /* return address for irq handler */
134 mov r11, SDRAMC_LPR_LPCB_SELF_RFR
135 bfins r10, r11, 0, 2 /* LPCB <- self Refresh */
136 sync 0 /* flush write buffer */
137 st.w r12[SDRAMC_LPR], r11 /* put SDRAM in self-refresh mode */
138 ld.w r11, r12[SDRAMC_LPR]
139 unmask_interrupts
140 sleep CPU_SLEEP_FROZEN
1411: mask_interrupts
142 retal r12
143 .size pm_standby, . - pm_standby
144
145 .global pm_suspend_to_ram
146 .type pm_suspend_to_ram, @function
147pm_suspend_to_ram:
148 /*
149 * interrupts are already masked at this point, and EVBA
150 * points to pm_exception above.
151 */
152 mov r11, 0
153 cache r11[2], 8 /* clean all dcache lines */
154 sync 0 /* flush write buffer */
155 ld.w r10, r12[SDRAMC_LPR]
156 sub r8, pc, . - 1f /* return address for irq handler */
157 mov r11, SDRAMC_LPR_LPCB_SELF_RFR
158 bfins r10, r11, 0, 2 /* LPCB <- self refresh */
159 st.w r12[SDRAMC_LPR], r10 /* put SDRAM in self-refresh mode */
160 ld.w r11, r12[SDRAMC_LPR]
161
162 unmask_interrupts
163 sleep CPU_SLEEP_STOP
1641: mask_interrupts
165
166 retal r12
167 .size pm_suspend_to_ram, . - pm_suspend_to_ram
168
169 .global pm_sram_end
170 .type pm_sram_end, @function
171pm_sram_end:
172 .size pm_sram_end, 0
173
174#endif /* CONFIG_PM */
diff --git a/arch/avr32/mach-at32ap/pm.c b/arch/avr32/mach-at32ap/pm.c
new file mode 100644
index 000000000000..0b764320135d
--- /dev/null
+++ b/arch/avr32/mach-at32ap/pm.c
@@ -0,0 +1,245 @@
1/*
2 * AVR32 AP Power Management
3 *
4 * Copyright (C) 2008 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10#include <linux/io.h>
11#include <linux/suspend.h>
12#include <linux/vmalloc.h>
13
14#include <asm/cacheflush.h>
15#include <asm/sysreg.h>
16
17#include <asm/arch/pm.h>
18#include <asm/arch/sram.h>
19
20/* FIXME: This is only valid for AP7000 */
21#define SDRAMC_BASE 0xfff03800
22
23#include "sdramc.h"
24
25#define SRAM_PAGE_FLAGS (SYSREG_BIT(TLBELO_D) | SYSREG_BF(SZ, 1) \
26 | SYSREG_BF(AP, 3) | SYSREG_BIT(G))
27
28
29static unsigned long pm_sram_start;
30static size_t pm_sram_size;
31static struct vm_struct *pm_sram_area;
32
33static void (*avr32_pm_enter_standby)(unsigned long sdramc_base);
34static void (*avr32_pm_enter_str)(unsigned long sdramc_base);
35
36/*
37 * Must be called with interrupts disabled. Exceptions will be masked
38 * on return (i.e. all exceptions will be "unrecoverable".)
39 */
40static void *avr32_pm_map_sram(void)
41{
42 unsigned long vaddr;
43 unsigned long page_addr;
44 u32 tlbehi;
45 u32 mmucr;
46
47 vaddr = (unsigned long)pm_sram_area->addr;
48 page_addr = pm_sram_start & PAGE_MASK;
49
50 /*
51 * Mask exceptions and grab the first TLB entry. We won't be
52 * needing it while sleeping.
53 */
54 asm volatile("ssrf %0" : : "i"(SYSREG_EM_OFFSET) : "memory");
55
56 mmucr = sysreg_read(MMUCR);
57 tlbehi = sysreg_read(TLBEHI);
58 sysreg_write(MMUCR, SYSREG_BFINS(DRP, 0, mmucr));
59
60 tlbehi = SYSREG_BF(ASID, SYSREG_BFEXT(ASID, tlbehi));
61 tlbehi |= vaddr & PAGE_MASK;
62 tlbehi |= SYSREG_BIT(TLBEHI_V);
63
64 sysreg_write(TLBELO, page_addr | SRAM_PAGE_FLAGS);
65 sysreg_write(TLBEHI, tlbehi);
66 __builtin_tlbw();
67
68 return (void *)(vaddr + pm_sram_start - page_addr);
69}
70
71/*
72 * Must be called with interrupts disabled. Exceptions will be
73 * unmasked on return.
74 */
75static void avr32_pm_unmap_sram(void)
76{
77 u32 mmucr;
78 u32 tlbehi;
79 u32 tlbarlo;
80
81 /* Going to update TLB entry at index 0 */
82 mmucr = sysreg_read(MMUCR);
83 tlbehi = sysreg_read(TLBEHI);
84 sysreg_write(MMUCR, SYSREG_BFINS(DRP, 0, mmucr));
85
86 /* Clear the "valid" bit */
87 tlbehi = SYSREG_BF(ASID, SYSREG_BFEXT(ASID, tlbehi));
88 sysreg_write(TLBEHI, tlbehi);
89
90 /* Mark it as "not accessed" */
91 tlbarlo = sysreg_read(TLBARLO);
92 sysreg_write(TLBARLO, tlbarlo | 0x80000000U);
93
94 /* Update the TLB */
95 __builtin_tlbw();
96
97 /* Unmask exceptions */
98 asm volatile("csrf %0" : : "i"(SYSREG_EM_OFFSET) : "memory");
99}
100
101static int avr32_pm_valid_state(suspend_state_t state)
102{
103 switch (state) {
104 case PM_SUSPEND_ON:
105 case PM_SUSPEND_STANDBY:
106 case PM_SUSPEND_MEM:
107 return 1;
108
109 default:
110 return 0;
111 }
112}
113
114static int avr32_pm_enter(suspend_state_t state)
115{
116 u32 lpr_saved;
117 u32 evba_saved;
118 void *sram;
119
120 switch (state) {
121 case PM_SUSPEND_STANDBY:
122 sram = avr32_pm_map_sram();
123
124 /* Switch to in-sram exception handlers */
125 evba_saved = sysreg_read(EVBA);
126 sysreg_write(EVBA, (unsigned long)sram);
127
128 /*
129 * Save the LPR register so that we can re-enable
130 * SDRAM Low Power mode on resume.
131 */
132 lpr_saved = sdramc_readl(LPR);
133 pr_debug("%s: Entering standby...\n", __func__);
134 avr32_pm_enter_standby(SDRAMC_BASE);
135 sdramc_writel(LPR, lpr_saved);
136
137 /* Switch back to regular exception handlers */
138 sysreg_write(EVBA, evba_saved);
139
140 avr32_pm_unmap_sram();
141 break;
142
143 case PM_SUSPEND_MEM:
144 sram = avr32_pm_map_sram();
145
146 /* Switch to in-sram exception handlers */
147 evba_saved = sysreg_read(EVBA);
148 sysreg_write(EVBA, (unsigned long)sram);
149
150 /*
151 * Save the LPR register so that we can re-enable
152 * SDRAM Low Power mode on resume.
153 */
154 lpr_saved = sdramc_readl(LPR);
155 pr_debug("%s: Entering suspend-to-ram...\n", __func__);
156 avr32_pm_enter_str(SDRAMC_BASE);
157 sdramc_writel(LPR, lpr_saved);
158
159 /* Switch back to regular exception handlers */
160 sysreg_write(EVBA, evba_saved);
161
162 avr32_pm_unmap_sram();
163 break;
164
165 case PM_SUSPEND_ON:
166 pr_debug("%s: Entering idle...\n", __func__);
167 cpu_enter_idle();
168 break;
169
170 default:
171 pr_debug("%s: Invalid suspend state %d\n", __func__, state);
172 goto out;
173 }
174
175 pr_debug("%s: wakeup\n", __func__);
176
177out:
178 return 0;
179}
180
181static struct platform_suspend_ops avr32_pm_ops = {
182 .valid = avr32_pm_valid_state,
183 .enter = avr32_pm_enter,
184};
185
186static unsigned long avr32_pm_offset(void *symbol)
187{
188 extern u8 pm_exception[];
189
190 return (unsigned long)symbol - (unsigned long)pm_exception;
191}
192
193static int __init avr32_pm_init(void)
194{
195 extern u8 pm_exception[];
196 extern u8 pm_irq0[];
197 extern u8 pm_standby[];
198 extern u8 pm_suspend_to_ram[];
199 extern u8 pm_sram_end[];
200 void *dst;
201
202 /*
203 * To keep things simple, we depend on not needing more than a
204 * single page.
205 */
206 pm_sram_size = avr32_pm_offset(pm_sram_end);
207 if (pm_sram_size > PAGE_SIZE)
208 goto err;
209
210 pm_sram_start = sram_alloc(pm_sram_size);
211 if (!pm_sram_start)
212 goto err_alloc_sram;
213
214 /* Grab a virtual area we can use later on. */
215 pm_sram_area = get_vm_area(pm_sram_size, VM_IOREMAP);
216 if (!pm_sram_area)
217 goto err_vm_area;
218 pm_sram_area->phys_addr = pm_sram_start;
219
220 local_irq_disable();
221 dst = avr32_pm_map_sram();
222 memcpy(dst, pm_exception, pm_sram_size);
223 flush_dcache_region(dst, pm_sram_size);
224 invalidate_icache_region(dst, pm_sram_size);
225 avr32_pm_unmap_sram();
226 local_irq_enable();
227
228 avr32_pm_enter_standby = dst + avr32_pm_offset(pm_standby);
229 avr32_pm_enter_str = dst + avr32_pm_offset(pm_suspend_to_ram);
230 intc_set_suspend_handler(avr32_pm_offset(pm_irq0));
231
232 suspend_set_ops(&avr32_pm_ops);
233
234 printk("AVR32 AP Power Management enabled\n");
235
236 return 0;
237
238err_vm_area:
239 sram_free(pm_sram_start, pm_sram_size);
240err_alloc_sram:
241err:
242 pr_err("AVR32 Power Management initialization failed\n");
243 return -ENOMEM;
244}
245arch_initcall(avr32_pm_init);
diff --git a/arch/avr32/mach-at32ap/sdramc.h b/arch/avr32/mach-at32ap/sdramc.h
new file mode 100644
index 000000000000..66eeaed49073
--- /dev/null
+++ b/arch/avr32/mach-at32ap/sdramc.h
@@ -0,0 +1,76 @@
1/*
2 * Register definitions for the AT32AP SDRAM Controller
3 *
4 * Copyright (C) 2008 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10
11/* Register offsets */
12#define SDRAMC_MR 0x0000
13#define SDRAMC_TR 0x0004
14#define SDRAMC_CR 0x0008
15#define SDRAMC_HSR 0x000c
16#define SDRAMC_LPR 0x0010
17#define SDRAMC_IER 0x0014
18#define SDRAMC_IDR 0x0018
19#define SDRAMC_IMR 0x001c
20#define SDRAMC_ISR 0x0020
21#define SDRAMC_MDR 0x0024
22
23/* MR - Mode Register */
24#define SDRAMC_MR_MODE_NORMAL ( 0 << 0)
25#define SDRAMC_MR_MODE_NOP ( 1 << 0)
26#define SDRAMC_MR_MODE_BANKS_PRECHARGE ( 2 << 0)
27#define SDRAMC_MR_MODE_LOAD_MODE ( 3 << 0)
28#define SDRAMC_MR_MODE_AUTO_REFRESH ( 4 << 0)
29#define SDRAMC_MR_MODE_EXT_LOAD_MODE ( 5 << 0)
30#define SDRAMC_MR_MODE_POWER_DOWN ( 6 << 0)
31
32/* CR - Configuration Register */
33#define SDRAMC_CR_NC_8_BITS ( 0 << 0)
34#define SDRAMC_CR_NC_9_BITS ( 1 << 0)
35#define SDRAMC_CR_NC_10_BITS ( 2 << 0)
36#define SDRAMC_CR_NC_11_BITS ( 3 << 0)
37#define SDRAMC_CR_NR_11_BITS ( 0 << 2)
38#define SDRAMC_CR_NR_12_BITS ( 1 << 2)
39#define SDRAMC_CR_NR_13_BITS ( 2 << 2)
40#define SDRAMC_CR_NB_2_BANKS ( 0 << 4)
41#define SDRAMC_CR_NB_4_BANKS ( 1 << 4)
42#define SDRAMC_CR_CAS(x) ((x) << 5)
43#define SDRAMC_CR_DBW_32_BITS ( 0 << 7)
44#define SDRAMC_CR_DBW_16_BITS ( 1 << 7)
45#define SDRAMC_CR_TWR(x) ((x) << 8)
46#define SDRAMC_CR_TRC(x) ((x) << 12)
47#define SDRAMC_CR_TRP(x) ((x) << 16)
48#define SDRAMC_CR_TRCD(x) ((x) << 20)
49#define SDRAMC_CR_TRAS(x) ((x) << 24)
50#define SDRAMC_CR_TXSR(x) ((x) << 28)
51
52/* HSR - High Speed Register */
53#define SDRAMC_HSR_DA ( 1 << 0)
54
55/* LPR - Low Power Register */
56#define SDRAMC_LPR_LPCB_INHIBIT ( 0 << 0)
57#define SDRAMC_LPR_LPCB_SELF_RFR ( 1 << 0)
58#define SDRAMC_LPR_LPCB_PDOWN ( 2 << 0)
59#define SDRAMC_LPR_LPCB_DEEP_PDOWN ( 3 << 0)
60#define SDRAMC_LPR_PASR(x) ((x) << 4)
61#define SDRAMC_LPR_TCSR(x) ((x) << 8)
62#define SDRAMC_LPR_DS(x) ((x) << 10)
63#define SDRAMC_LPR_TIMEOUT(x) ((x) << 12)
64
65/* IER/IDR/IMR/ISR - Interrupt Enable/Disable/Mask/Status Register */
66#define SDRAMC_ISR_RES ( 1 << 0)
67
68/* MDR - Memory Device Register */
69#define SDRAMC_MDR_MD_SDRAM ( 0 << 0)
70#define SDRAMC_MDR_MD_LOW_PWR_SDRAM ( 1 << 0)
71
72/* Register access macros */
73#define sdramc_readl(reg) \
74 __raw_readl((void __iomem __force *)SDRAMC_BASE + SDRAMC_##reg)
75#define sdramc_writel(reg, value) \
76 __raw_writel(value, (void __iomem __force *)SDRAMC_BASE + SDRAMC_##reg)
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index 0e64ddc45e37..3f90a87527bb 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -11,6 +11,7 @@
11#include <linux/swap.h> 11#include <linux/swap.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mmzone.h> 13#include <linux/mmzone.h>
14#include <linux/module.h>
14#include <linux/bootmem.h> 15#include <linux/bootmem.h>
15#include <linux/pagemap.h> 16#include <linux/pagemap.h>
16#include <linux/nodemask.h> 17#include <linux/nodemask.h>
@@ -23,11 +24,14 @@
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/sections.h> 25#include <asm/sections.h>
25 26
27#define __page_aligned __attribute__((section(".data.page_aligned")))
28
26DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 29DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
27 30
28pgd_t swapper_pg_dir[PTRS_PER_PGD]; 31pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned;
29 32
30struct page *empty_zero_page; 33struct page *empty_zero_page;
34EXPORT_SYMBOL(empty_zero_page);
31 35
32/* 36/*
33 * Cache of MMU context last used. 37 * Cache of MMU context last used.
@@ -106,19 +110,9 @@ void __init paging_init(void)
106 zero_page = alloc_bootmem_low_pages_node(NODE_DATA(0), 110 zero_page = alloc_bootmem_low_pages_node(NODE_DATA(0),
107 PAGE_SIZE); 111 PAGE_SIZE);
108 112
109 { 113 sysreg_write(PTBR, (unsigned long)swapper_pg_dir);
110 pgd_t *pg_dir; 114 enable_mmu();
111 int i; 115 printk ("CPU: Paging enabled\n");
112
113 pg_dir = swapper_pg_dir;
114 sysreg_write(PTBR, (unsigned long)pg_dir);
115
116 for (i = 0; i < PTRS_PER_PGD; i++)
117 pgd_val(pg_dir[i]) = 0;
118
119 enable_mmu();
120 printk ("CPU: Paging enabled\n");
121 }
122 116
123 for_each_online_node(nid) { 117 for_each_online_node(nid) {
124 pg_data_t *pgdat = NODE_DATA(nid); 118 pg_data_t *pgdat = NODE_DATA(nid);
diff --git a/arch/avr32/mm/tlb.c b/arch/avr32/mm/tlb.c
index cd12edbea9f2..06677be98ffb 100644
--- a/arch/avr32/mm/tlb.c
+++ b/arch/avr32/mm/tlb.c
@@ -11,21 +11,21 @@
11 11
12#include <asm/mmu_context.h> 12#include <asm/mmu_context.h>
13 13
14#define _TLBEHI_I 0x100 14/* TODO: Get the correct number from the CONFIG1 system register */
15#define NR_TLB_ENTRIES 32
15 16
16void show_dtlb_entry(unsigned int index) 17static void show_dtlb_entry(unsigned int index)
17{ 18{
18 unsigned int tlbehi, tlbehi_save, tlbelo, mmucr, mmucr_save; 19 u32 tlbehi, tlbehi_save, tlbelo, mmucr, mmucr_save;
19 unsigned long flags; 20 unsigned long flags;
20 21
21 local_irq_save(flags); 22 local_irq_save(flags);
22 mmucr_save = sysreg_read(MMUCR); 23 mmucr_save = sysreg_read(MMUCR);
23 tlbehi_save = sysreg_read(TLBEHI); 24 tlbehi_save = sysreg_read(TLBEHI);
24 mmucr = mmucr_save & 0x13; 25 mmucr = SYSREG_BFINS(DRP, index, mmucr_save);
25 mmucr |= index << 14;
26 sysreg_write(MMUCR, mmucr); 26 sysreg_write(MMUCR, mmucr);
27 27
28 asm volatile("tlbr" : : : "memory"); 28 __builtin_tlbr();
29 cpu_sync_pipeline(); 29 cpu_sync_pipeline();
30 30
31 tlbehi = sysreg_read(TLBEHI); 31 tlbehi = sysreg_read(TLBEHI);
@@ -33,15 +33,17 @@ void show_dtlb_entry(unsigned int index)
33 33
34 printk("%2u: %c %c %02x %05x %05x %o %o %c %c %c %c\n", 34 printk("%2u: %c %c %02x %05x %05x %o %o %c %c %c %c\n",
35 index, 35 index,
36 (tlbehi & 0x200)?'1':'0', 36 SYSREG_BFEXT(TLBEHI_V, tlbehi) ? '1' : '0',
37 (tlbelo & 0x100)?'1':'0', 37 SYSREG_BFEXT(G, tlbelo) ? '1' : '0',
38 (tlbehi & 0xff), 38 SYSREG_BFEXT(ASID, tlbehi),
39 (tlbehi >> 12), (tlbelo >> 12), 39 SYSREG_BFEXT(VPN, tlbehi) >> 2,
40 (tlbelo >> 4) & 7, (tlbelo >> 2) & 3, 40 SYSREG_BFEXT(PFN, tlbelo) >> 2,
41 (tlbelo & 0x200)?'1':'0', 41 SYSREG_BFEXT(AP, tlbelo),
42 (tlbelo & 0x080)?'1':'0', 42 SYSREG_BFEXT(SZ, tlbelo),
43 (tlbelo & 0x001)?'1':'0', 43 SYSREG_BFEXT(TLBELO_C, tlbelo) ? 'C' : ' ',
44 (tlbelo & 0x002)?'1':'0'); 44 SYSREG_BFEXT(B, tlbelo) ? 'B' : ' ',
45 SYSREG_BFEXT(W, tlbelo) ? 'W' : ' ',
46 SYSREG_BFEXT(TLBELO_D, tlbelo) ? 'D' : ' ');
45 47
46 sysreg_write(MMUCR, mmucr_save); 48 sysreg_write(MMUCR, mmucr_save);
47 sysreg_write(TLBEHI, tlbehi_save); 49 sysreg_write(TLBEHI, tlbehi_save);
@@ -54,29 +56,33 @@ void dump_dtlb(void)
54 unsigned int i; 56 unsigned int i;
55 57
56 printk("ID V G ASID VPN PFN AP SZ C B W D\n"); 58 printk("ID V G ASID VPN PFN AP SZ C B W D\n");
57 for (i = 0; i < 32; i++) 59 for (i = 0; i < NR_TLB_ENTRIES; i++)
58 show_dtlb_entry(i); 60 show_dtlb_entry(i);
59} 61}
60 62
61static unsigned long last_mmucr; 63static void update_dtlb(unsigned long address, pte_t pte)
62
63static inline void set_replacement_pointer(unsigned shift)
64{ 64{
65 unsigned long mmucr, mmucr_save; 65 u32 tlbehi;
66 u32 mmucr;
66 67
67 mmucr = mmucr_save = sysreg_read(MMUCR); 68 /*
69 * We're not changing the ASID here, so no need to flush the
70 * pipeline.
71 */
72 tlbehi = sysreg_read(TLBEHI);
73 tlbehi = SYSREG_BF(ASID, SYSREG_BFEXT(ASID, tlbehi));
74 tlbehi |= address & MMU_VPN_MASK;
75 tlbehi |= SYSREG_BIT(TLBEHI_V);
76 sysreg_write(TLBEHI, tlbehi);
68 77
69 /* Does this mapping already exist? */ 78 /* Does this mapping already exist? */
70 __asm__ __volatile__( 79 __builtin_tlbs();
71 " tlbs\n" 80 mmucr = sysreg_read(MMUCR);
72 " mfsr %0, %1"
73 : "=r"(mmucr)
74 : "i"(SYSREG_MMUCR));
75 81
76 if (mmucr & SYSREG_BIT(MMUCR_N)) { 82 if (mmucr & SYSREG_BIT(MMUCR_N)) {
77 /* Not found -- pick a not-recently-accessed entry */ 83 /* Not found -- pick a not-recently-accessed entry */
78 unsigned long rp; 84 unsigned int rp;
79 unsigned long tlbar = sysreg_read(TLBARLO); 85 u32 tlbar = sysreg_read(TLBARLO);
80 86
81 rp = 32 - fls(tlbar); 87 rp = 32 - fls(tlbar);
82 if (rp == 32) { 88 if (rp == 32) {
@@ -84,30 +90,14 @@ static inline void set_replacement_pointer(unsigned shift)
84 sysreg_write(TLBARLO, -1L); 90 sysreg_write(TLBARLO, -1L);
85 } 91 }
86 92
87 mmucr &= 0x13; 93 mmucr = SYSREG_BFINS(DRP, rp, mmucr);
88 mmucr |= (rp << shift);
89
90 sysreg_write(MMUCR, mmucr); 94 sysreg_write(MMUCR, mmucr);
91 } 95 }
92 96
93 last_mmucr = mmucr;
94}
95
96static void update_dtlb(unsigned long address, pte_t pte, unsigned long asid)
97{
98 unsigned long vpn;
99
100 vpn = (address & MMU_VPN_MASK) | _TLBEHI_VALID | asid;
101 sysreg_write(TLBEHI, vpn);
102 cpu_sync_pipeline();
103
104 set_replacement_pointer(14);
105
106 sysreg_write(TLBELO, pte_val(pte) & _PAGE_FLAGS_HARDWARE_MASK); 97 sysreg_write(TLBELO, pte_val(pte) & _PAGE_FLAGS_HARDWARE_MASK);
107 98
108 /* Let's go */ 99 /* Let's go */
109 asm volatile("nop\n\ttlbw" : : : "memory"); 100 __builtin_tlbw();
110 cpu_sync_pipeline();
111} 101}
112 102
113void update_mmu_cache(struct vm_area_struct *vma, 103void update_mmu_cache(struct vm_area_struct *vma,
@@ -120,39 +110,40 @@ void update_mmu_cache(struct vm_area_struct *vma,
120 return; 110 return;
121 111
122 local_irq_save(flags); 112 local_irq_save(flags);
123 update_dtlb(address, pte, get_asid()); 113 update_dtlb(address, pte);
124 local_irq_restore(flags); 114 local_irq_restore(flags);
125} 115}
126 116
127void __flush_tlb_page(unsigned long asid, unsigned long page) 117static void __flush_tlb_page(unsigned long asid, unsigned long page)
128{ 118{
129 unsigned long mmucr, tlbehi; 119 u32 mmucr, tlbehi;
130 120
131 page |= asid; 121 /*
132 sysreg_write(TLBEHI, page); 122 * Caller is responsible for masking out non-PFN bits in page
133 cpu_sync_pipeline(); 123 * and changing the current ASID if necessary. This means that
134 asm volatile("tlbs"); 124 * we don't need to flush the pipeline after writing TLBEHI.
125 */
126 tlbehi = page | asid;
127 sysreg_write(TLBEHI, tlbehi);
128
129 __builtin_tlbs();
135 mmucr = sysreg_read(MMUCR); 130 mmucr = sysreg_read(MMUCR);
136 131
137 if (!(mmucr & SYSREG_BIT(MMUCR_N))) { 132 if (!(mmucr & SYSREG_BIT(MMUCR_N))) {
138 unsigned long tlbarlo; 133 unsigned int entry;
139 unsigned long entry; 134 u32 tlbarlo;
140 135
141 /* Clear the "valid" bit */ 136 /* Clear the "valid" bit */
142 tlbehi = sysreg_read(TLBEHI);
143 tlbehi &= ~_TLBEHI_VALID;
144 sysreg_write(TLBEHI, tlbehi); 137 sysreg_write(TLBEHI, tlbehi);
145 cpu_sync_pipeline();
146 138
147 /* mark the entry as "not accessed" */ 139 /* mark the entry as "not accessed" */
148 entry = (mmucr >> 14) & 0x3f; 140 entry = SYSREG_BFEXT(DRP, mmucr);
149 tlbarlo = sysreg_read(TLBARLO); 141 tlbarlo = sysreg_read(TLBARLO);
150 tlbarlo |= (0x80000000 >> entry); 142 tlbarlo |= (0x80000000UL >> entry);
151 sysreg_write(TLBARLO, tlbarlo); 143 sysreg_write(TLBARLO, tlbarlo);
152 144
153 /* update the entry with valid bit clear */ 145 /* update the entry with valid bit clear */
154 asm volatile("tlbw"); 146 __builtin_tlbw();
155 cpu_sync_pipeline();
156 } 147 }
157} 148}
158 149
@@ -190,17 +181,22 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
190 181
191 local_irq_save(flags); 182 local_irq_save(flags);
192 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 183 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
184
193 if (size > (MMU_DTLB_ENTRIES / 4)) { /* Too many entries to flush */ 185 if (size > (MMU_DTLB_ENTRIES / 4)) { /* Too many entries to flush */
194 mm->context = NO_CONTEXT; 186 mm->context = NO_CONTEXT;
195 if (mm == current->mm) 187 if (mm == current->mm)
196 activate_context(mm); 188 activate_context(mm);
197 } else { 189 } else {
198 unsigned long asid = mm->context & MMU_CONTEXT_ASID_MASK; 190 unsigned long asid;
199 unsigned long saved_asid = MMU_NO_ASID; 191 unsigned long saved_asid;
192
193 asid = mm->context & MMU_CONTEXT_ASID_MASK;
194 saved_asid = MMU_NO_ASID;
200 195
201 start &= PAGE_MASK; 196 start &= PAGE_MASK;
202 end += (PAGE_SIZE - 1); 197 end += (PAGE_SIZE - 1);
203 end &= PAGE_MASK; 198 end &= PAGE_MASK;
199
204 if (mm != current->mm) { 200 if (mm != current->mm) {
205 saved_asid = get_asid(); 201 saved_asid = get_asid();
206 set_asid(asid); 202 set_asid(asid);
@@ -218,33 +214,34 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
218} 214}
219 215
220/* 216/*
221 * TODO: If this is only called for addresses > TASK_SIZE, we can probably 217 * This function depends on the pages to be flushed having the G
222 * skip the ASID stuff and just use the Global bit... 218 * (global) bit set in their pte. This is true for all
219 * PAGE_KERNEL(_RO) pages.
223 */ 220 */
224void flush_tlb_kernel_range(unsigned long start, unsigned long end) 221void flush_tlb_kernel_range(unsigned long start, unsigned long end)
225{ 222{
226 unsigned long flags; 223 unsigned long flags;
227 int size; 224 int size;
228 225
229 local_irq_save(flags);
230 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 226 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
231 if (size > (MMU_DTLB_ENTRIES / 4)) { /* Too many entries to flush */ 227 if (size > (MMU_DTLB_ENTRIES / 4)) { /* Too many entries to flush */
232 flush_tlb_all(); 228 flush_tlb_all();
233 } else { 229 } else {
234 unsigned long asid = init_mm.context & MMU_CONTEXT_ASID_MASK; 230 unsigned long asid;
235 unsigned long saved_asid = get_asid(); 231
232 local_irq_save(flags);
233 asid = get_asid();
236 234
237 start &= PAGE_MASK; 235 start &= PAGE_MASK;
238 end += (PAGE_SIZE - 1); 236 end += (PAGE_SIZE - 1);
239 end &= PAGE_MASK; 237 end &= PAGE_MASK;
240 set_asid(asid); 238
241 while (start < end) { 239 while (start < end) {
242 __flush_tlb_page(asid, start); 240 __flush_tlb_page(asid, start);
243 start += PAGE_SIZE; 241 start += PAGE_SIZE;
244 } 242 }
245 set_asid(saved_asid); 243 local_irq_restore(flags);
246 } 244 }
247 local_irq_restore(flags);
248} 245}
249 246
250void flush_tlb_mm(struct mm_struct *mm) 247void flush_tlb_mm(struct mm_struct *mm)
@@ -280,7 +277,7 @@ static void *tlb_start(struct seq_file *tlb, loff_t *pos)
280{ 277{
281 static unsigned long tlb_index; 278 static unsigned long tlb_index;
282 279
283 if (*pos >= 32) 280 if (*pos >= NR_TLB_ENTRIES)
284 return NULL; 281 return NULL;
285 282
286 tlb_index = 0; 283 tlb_index = 0;
@@ -291,7 +288,7 @@ static void *tlb_next(struct seq_file *tlb, void *v, loff_t *pos)
291{ 288{
292 unsigned long *index = v; 289 unsigned long *index = v;
293 290
294 if (*index >= 31) 291 if (*index >= NR_TLB_ENTRIES - 1)
295 return NULL; 292 return NULL;
296 293
297 ++*pos; 294 ++*pos;
@@ -313,16 +310,16 @@ static int tlb_show(struct seq_file *tlb, void *v)
313 if (*index == 0) 310 if (*index == 0)
314 seq_puts(tlb, "ID V G ASID VPN PFN AP SZ C B W D\n"); 311 seq_puts(tlb, "ID V G ASID VPN PFN AP SZ C B W D\n");
315 312
316 BUG_ON(*index >= 32); 313 BUG_ON(*index >= NR_TLB_ENTRIES);
317 314
318 local_irq_save(flags); 315 local_irq_save(flags);
319 mmucr_save = sysreg_read(MMUCR); 316 mmucr_save = sysreg_read(MMUCR);
320 tlbehi_save = sysreg_read(TLBEHI); 317 tlbehi_save = sysreg_read(TLBEHI);
321 mmucr = mmucr_save & 0x13; 318 mmucr = SYSREG_BFINS(DRP, *index, mmucr_save);
322 mmucr |= *index << 14;
323 sysreg_write(MMUCR, mmucr); 319 sysreg_write(MMUCR, mmucr);
324 320
325 asm volatile("tlbr" : : : "memory"); 321 /* TLBR might change the ASID */
322 __builtin_tlbr();
326 cpu_sync_pipeline(); 323 cpu_sync_pipeline();
327 324
328 tlbehi = sysreg_read(TLBEHI); 325 tlbehi = sysreg_read(TLBEHI);
@@ -334,16 +331,18 @@ static int tlb_show(struct seq_file *tlb, void *v)
334 local_irq_restore(flags); 331 local_irq_restore(flags);
335 332
336 seq_printf(tlb, "%2lu: %c %c %02x %05x %05x %o %o %c %c %c %c\n", 333 seq_printf(tlb, "%2lu: %c %c %02x %05x %05x %o %o %c %c %c %c\n",
337 *index, 334 *index,
338 (tlbehi & 0x200)?'1':'0', 335 SYSREG_BFEXT(TLBEHI_V, tlbehi) ? '1' : '0',
339 (tlbelo & 0x100)?'1':'0', 336 SYSREG_BFEXT(G, tlbelo) ? '1' : '0',
340 (tlbehi & 0xff), 337 SYSREG_BFEXT(ASID, tlbehi),
341 (tlbehi >> 12), (tlbelo >> 12), 338 SYSREG_BFEXT(VPN, tlbehi) >> 2,
342 (tlbelo >> 4) & 7, (tlbelo >> 2) & 3, 339 SYSREG_BFEXT(PFN, tlbelo) >> 2,
343 (tlbelo & 0x200)?'1':'0', 340 SYSREG_BFEXT(AP, tlbelo),
344 (tlbelo & 0x080)?'1':'0', 341 SYSREG_BFEXT(SZ, tlbelo),
345 (tlbelo & 0x001)?'1':'0', 342 SYSREG_BFEXT(TLBELO_C, tlbelo) ? '1' : '0',
346 (tlbelo & 0x002)?'1':'0'); 343 SYSREG_BFEXT(B, tlbelo) ? '1' : '0',
344 SYSREG_BFEXT(W, tlbelo) ? '1' : '0',
345 SYSREG_BFEXT(TLBELO_D, tlbelo) ? '1' : '0');
347 346
348 return 0; 347 return 0;
349} 348}
diff --git a/arch/blackfin/mach-bf561/coreb.c b/arch/blackfin/mach-bf561/coreb.c
index 1b44e9e6dc3b..8598098c0840 100644
--- a/arch/blackfin/mach-bf561/coreb.c
+++ b/arch/blackfin/mach-bf561/coreb.c
@@ -194,6 +194,7 @@ static loff_t coreb_lseek(struct file *file, loff_t offset, int origin)
194 return ret; 194 return ret;
195} 195}
196 196
197/* No BKL needed here */
197static int coreb_open(struct inode *inode, struct file *file) 198static int coreb_open(struct inode *inode, struct file *file)
198{ 199{
199 spin_lock_irq(&coreb_lock); 200 spin_lock_irq(&coreb_lock);
diff --git a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c
index f1cac9dc75b8..1f2ae909d3e6 100644
--- a/arch/cris/arch-v10/drivers/eeprom.c
+++ b/arch/cris/arch-v10/drivers/eeprom.c
@@ -28,6 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/smp_lock.h>
31#include <linux/wait.h> 32#include <linux/wait.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include "i2c.h" 34#include "i2c.h"
@@ -375,10 +376,9 @@ int __init eeprom_init(void)
375} 376}
376 377
377/* Opens the device. */ 378/* Opens the device. */
378
379static int eeprom_open(struct inode * inode, struct file * file) 379static int eeprom_open(struct inode * inode, struct file * file)
380{ 380{
381 381 cycle_kernel_lock();
382 if(iminor(inode) != EEPROM_MINOR_NR) 382 if(iminor(inode) != EEPROM_MINOR_NR)
383 return -ENXIO; 383 return -ENXIO;
384 if(imajor(inode) != EEPROM_MAJOR_NR) 384 if(imajor(inode) != EEPROM_MAJOR_NR)
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index 68a998bd1069..86048e697eb5 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -16,6 +16,7 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/smp_lock.h>
19#include <linux/string.h> 20#include <linux/string.h>
20#include <linux/poll.h> 21#include <linux/poll.h>
21#include <linux/init.h> 22#include <linux/init.h>
@@ -323,6 +324,7 @@ gpio_open(struct inode *inode, struct file *filp)
323 if (!priv) 324 if (!priv)
324 return -ENOMEM; 325 return -ENOMEM;
325 326
327 lock_kernel();
326 priv->minor = p; 328 priv->minor = p;
327 329
328 /* initialize the io/alarm struct */ 330 /* initialize the io/alarm struct */
@@ -357,6 +359,7 @@ gpio_open(struct inode *inode, struct file *filp)
357 alarmlist = priv; 359 alarmlist = priv;
358 spin_unlock_irqrestore(&gpio_lock, flags); 360 spin_unlock_irqrestore(&gpio_lock, flags);
359 361
362 unlock_kernel();
360 return 0; 363 return 0;
361} 364}
362 365
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
index d6d22067d0c8..2797e67ce4f4 100644
--- a/arch/cris/arch-v10/drivers/i2c.c
+++ b/arch/cris/arch-v10/drivers/i2c.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/smp_lock.h>
18#include <linux/errno.h> 19#include <linux/errno.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/fs.h> 21#include <linux/fs.h>
@@ -566,6 +567,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
566static int 567static int
567i2c_open(struct inode *inode, struct file *filp) 568i2c_open(struct inode *inode, struct file *filp)
568{ 569{
570 cycle_kernel_lock();
569 return 0; 571 return 0;
570} 572}
571 573
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
index 069546e342c5..91fea623c7c9 100644
--- a/arch/cris/arch-v10/drivers/sync_serial.c
+++ b/arch/cris/arch-v10/drivers/sync_serial.c
@@ -21,6 +21,7 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/poll.h> 22#include <linux/poll.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/smp_lock.h>
24#include <linux/timer.h> 25#include <linux/timer.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/dma.h> 27#include <asm/dma.h>
@@ -443,18 +444,21 @@ static int sync_serial_open(struct inode *inode, struct file *file)
443 int dev = MINOR(inode->i_rdev); 444 int dev = MINOR(inode->i_rdev);
444 struct sync_port *port; 445 struct sync_port *port;
445 int mode; 446 int mode;
447 int err = -EBUSY;
446 448
449 lock_kernel();
447 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev)); 450 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
448 451
449 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) { 452 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) {
450 DEBUG(printk(KERN_DEBUG "Invalid minor %d\n", dev)); 453 DEBUG(printk(KERN_DEBUG "Invalid minor %d\n", dev));
451 return -ENODEV; 454 err = -ENODEV;
455 goto out;
452 } 456 }
453 port = &ports[dev]; 457 port = &ports[dev];
454 /* Allow open this device twice (assuming one reader and one writer) */ 458 /* Allow open this device twice (assuming one reader and one writer) */
455 if (port->busy == 2) { 459 if (port->busy == 2) {
456 DEBUG(printk(KERN_DEBUG "Device is busy.. \n")); 460 DEBUG(printk(KERN_DEBUG "Device is busy.. \n"));
457 return -EBUSY; 461 goto out;
458 } 462 }
459 if (port->init_irqs) { 463 if (port->init_irqs) {
460 if (port->use_dma) { 464 if (port->use_dma) {
@@ -465,14 +469,14 @@ static int sync_serial_open(struct inode *inode, struct file *file)
465 &ports[0])) { 469 &ports[0])) {
466 printk(KERN_CRIT "Can't alloc " 470 printk(KERN_CRIT "Can't alloc "
467 "sync serial port 1 IRQ"); 471 "sync serial port 1 IRQ");
468 return -EBUSY; 472 goto out;
469 } else if (request_irq(25, rx_interrupt, 0, 473 } else if (request_irq(25, rx_interrupt, 0,
470 "synchronous serial 1 dma rx", 474 "synchronous serial 1 dma rx",
471 &ports[0])) { 475 &ports[0])) {
472 free_irq(24, &port[0]); 476 free_irq(24, &port[0]);
473 printk(KERN_CRIT "Can't alloc " 477 printk(KERN_CRIT "Can't alloc "
474 "sync serial port 1 IRQ"); 478 "sync serial port 1 IRQ");
475 return -EBUSY; 479 goto out;
476 } else if (cris_request_dma(8, 480 } else if (cris_request_dma(8,
477 "synchronous serial 1 dma tr", 481 "synchronous serial 1 dma tr",
478 DMA_VERBOSE_ON_ERROR, 482 DMA_VERBOSE_ON_ERROR,
@@ -482,7 +486,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
482 printk(KERN_CRIT "Can't alloc " 486 printk(KERN_CRIT "Can't alloc "
483 "sync serial port 1 " 487 "sync serial port 1 "
484 "TX DMA channel"); 488 "TX DMA channel");
485 return -EBUSY; 489 goto out;
486 } else if (cris_request_dma(9, 490 } else if (cris_request_dma(9,
487 "synchronous serial 1 dma rec", 491 "synchronous serial 1 dma rec",
488 DMA_VERBOSE_ON_ERROR, 492 DMA_VERBOSE_ON_ERROR,
@@ -493,7 +497,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
493 printk(KERN_CRIT "Can't alloc " 497 printk(KERN_CRIT "Can't alloc "
494 "sync serial port 1 " 498 "sync serial port 1 "
495 "RX DMA channel"); 499 "RX DMA channel");
496 return -EBUSY; 500 goto out;
497 } 501 }
498#endif 502#endif
499 RESET_DMA(8); WAIT_DMA(8); 503 RESET_DMA(8); WAIT_DMA(8);
@@ -520,14 +524,14 @@ static int sync_serial_open(struct inode *inode, struct file *file)
520 &ports[1])) { 524 &ports[1])) {
521 printk(KERN_CRIT "Can't alloc " 525 printk(KERN_CRIT "Can't alloc "
522 "sync serial port 3 IRQ"); 526 "sync serial port 3 IRQ");
523 return -EBUSY; 527 goto out;
524 } else if (request_irq(21, rx_interrupt, 0, 528 } else if (request_irq(21, rx_interrupt, 0,
525 "synchronous serial 3 dma rx", 529 "synchronous serial 3 dma rx",
526 &ports[1])) { 530 &ports[1])) {
527 free_irq(20, &ports[1]); 531 free_irq(20, &ports[1]);
528 printk(KERN_CRIT "Can't alloc " 532 printk(KERN_CRIT "Can't alloc "
529 "sync serial port 3 IRQ"); 533 "sync serial port 3 IRQ");
530 return -EBUSY; 534 goto out;
531 } else if (cris_request_dma(4, 535 } else if (cris_request_dma(4,
532 "synchronous serial 3 dma tr", 536 "synchronous serial 3 dma tr",
533 DMA_VERBOSE_ON_ERROR, 537 DMA_VERBOSE_ON_ERROR,
@@ -537,7 +541,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
537 printk(KERN_CRIT "Can't alloc " 541 printk(KERN_CRIT "Can't alloc "
538 "sync serial port 3 " 542 "sync serial port 3 "
539 "TX DMA channel"); 543 "TX DMA channel");
540 return -EBUSY; 544 goto out;
541 } else if (cris_request_dma(5, 545 } else if (cris_request_dma(5,
542 "synchronous serial 3 dma rec", 546 "synchronous serial 3 dma rec",
543 DMA_VERBOSE_ON_ERROR, 547 DMA_VERBOSE_ON_ERROR,
@@ -548,7 +552,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
548 printk(KERN_CRIT "Can't alloc " 552 printk(KERN_CRIT "Can't alloc "
549 "sync serial port 3 " 553 "sync serial port 3 "
550 "RX DMA channel"); 554 "RX DMA channel");
551 return -EBUSY; 555 goto out;
552 } 556 }
553#endif 557#endif
554 RESET_DMA(4); WAIT_DMA(4); 558 RESET_DMA(4); WAIT_DMA(4);
@@ -581,7 +585,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
581 &ports[0])) { 585 &ports[0])) {
582 printk(KERN_CRIT "Can't alloc " 586 printk(KERN_CRIT "Can't alloc "
583 "sync serial manual irq"); 587 "sync serial manual irq");
584 return -EBUSY; 588 goto out;
585 } 589 }
586 } else if (port == &ports[1]) { 590 } else if (port == &ports[1]) {
587 if (request_irq(8, 591 if (request_irq(8,
@@ -591,7 +595,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
591 &ports[1])) { 595 &ports[1])) {
592 printk(KERN_CRIT "Can't alloc " 596 printk(KERN_CRIT "Can't alloc "
593 "sync serial manual irq"); 597 "sync serial manual irq");
594 return -EBUSY; 598 goto out;
595 } 599 }
596 } 600 }
597 port->init_irqs = 0; 601 port->init_irqs = 0;
@@ -620,7 +624,11 @@ static int sync_serial_open(struct inode *inode, struct file *file)
620 *R_IRQ_MASK1_SET = 1 << port->data_avail_bit; 624 *R_IRQ_MASK1_SET = 1 << port->data_avail_bit;
621 DEBUG(printk(KERN_DEBUG "sser%d rec started\n", dev)); 625 DEBUG(printk(KERN_DEBUG "sser%d rec started\n", dev));
622 } 626 }
623 return 0; 627 ret = 0;
628
629out:
630 unlock_kernel();
631 return ret;
624} 632}
625 633
626static int sync_serial_release(struct inode *inode, struct file *file) 634static int sync_serial_release(struct inode *inode, struct file *file)
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index 9fb58202be99..67c61ea86813 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -11,6 +11,7 @@
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/smp_lock.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
15#include <linux/stddef.h> 16#include <linux/stddef.h>
16 17
@@ -2302,11 +2303,11 @@ static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_
2302 return 0; 2303 return 0;
2303} 2304}
2304 2305
2305
2306static int cryptocop_open(struct inode *inode, struct file *filp) 2306static int cryptocop_open(struct inode *inode, struct file *filp)
2307{ 2307{
2308 int p = iminor(inode); 2308 int p = iminor(inode);
2309 2309
2310 cycle_kernel_lock();
2310 if (p != CRYPTOCOP_MINOR) return -EINVAL; 2311 if (p != CRYPTOCOP_MINOR) return -EINVAL;
2311 2312
2312 filp->private_data = NULL; 2313 filp->private_data = NULL;
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
index c2fb7a5c1396..179e7b804331 100644
--- a/arch/cris/arch-v32/drivers/i2c.c
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -33,6 +33,7 @@
33#include <linux/fs.h> 33#include <linux/fs.h>
34#include <linux/string.h> 34#include <linux/string.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/smp_lock.h>
36 37
37#include <asm/etraxi2c.h> 38#include <asm/etraxi2c.h>
38 39
@@ -636,6 +637,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
636static int 637static int
637i2c_open(struct inode *inode, struct file *filp) 638i2c_open(struct inode *inode, struct file *filp)
638{ 639{
640 cycle_kernel_lock();
639 return 0; 641 return 0;
640} 642}
641 643
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index de107dad9f4f..ef98608e5067 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/smp_lock.h>
26 27
27#include <asm/etraxgpio.h> 28#include <asm/etraxgpio.h>
28#include <hwregs/reg_map.h> 29#include <hwregs/reg_map.h>
@@ -390,6 +391,8 @@ static int gpio_open(struct inode *inode, struct file *filp)
390 391
391 if (!priv) 392 if (!priv)
392 return -ENOMEM; 393 return -ENOMEM;
394
395 lock_kernel();
393 memset(priv, 0, sizeof(*priv)); 396 memset(priv, 0, sizeof(*priv));
394 397
395 priv->minor = p; 398 priv->minor = p;
@@ -412,6 +415,7 @@ static int gpio_open(struct inode *inode, struct file *filp)
412 spin_unlock_irq(&gpio_lock); 415 spin_unlock_irq(&gpio_lock);
413 } 416 }
414 417
418 unlock_kernel();
415 return 0; 419 return 0;
416} 420}
417 421
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index 7863fd4efc2b..fe1fde893887 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/smp_lock.h>
25 26
26#include <asm/etraxgpio.h> 27#include <asm/etraxgpio.h>
27#include <hwregs/reg_map.h> 28#include <hwregs/reg_map.h>
@@ -426,9 +427,10 @@ gpio_open(struct inode *inode, struct file *filp)
426 return -EINVAL; 427 return -EINVAL;
427 428
428 priv = kmalloc(sizeof(struct gpio_private), GFP_KERNEL); 429 priv = kmalloc(sizeof(struct gpio_private), GFP_KERNEL);
429
430 if (!priv) 430 if (!priv)
431 return -ENOMEM; 431 return -ENOMEM;
432
433 lock_kernel();
432 memset(priv, 0, sizeof(*priv)); 434 memset(priv, 0, sizeof(*priv));
433 435
434 priv->minor = p; 436 priv->minor = p;
@@ -449,6 +451,7 @@ gpio_open(struct inode *inode, struct file *filp)
449 alarmlist = priv; 451 alarmlist = priv;
450 spin_unlock_irq(&alarm_lock); 452 spin_unlock_irq(&alarm_lock);
451 453
454 unlock_kernel();
452 return 0; 455 return 0;
453} 456}
454 457
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index 47c377df6fb3..d2a0fbf5341f 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -14,6 +14,7 @@
14#include <linux/major.h> 14#include <linux/major.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/smp_lock.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/poll.h> 19#include <linux/poll.h>
19#include <linux/init.h> 20#include <linux/init.h>
@@ -429,23 +430,26 @@ static inline int sync_data_avail_to_end(struct sync_port *port)
429static int sync_serial_open(struct inode *inode, struct file *file) 430static int sync_serial_open(struct inode *inode, struct file *file)
430{ 431{
431 int dev = iminor(inode); 432 int dev = iminor(inode);
433 int ret = -EBUSY;
432 sync_port *port; 434 sync_port *port;
433 reg_dma_rw_cfg cfg = {.en = regk_dma_yes}; 435 reg_dma_rw_cfg cfg = {.en = regk_dma_yes};
434 reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes}; 436 reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes};
435 437
438 lock_kernel();
436 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev)); 439 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
437 440
438 if (dev < 0 || dev >= NBR_PORTS || !ports[dev].enabled) 441 if (dev < 0 || dev >= NBR_PORTS || !ports[dev].enabled)
439 { 442 {
440 DEBUG(printk(KERN_DEBUG "Invalid minor %d\n", dev)); 443 DEBUG(printk(KERN_DEBUG "Invalid minor %d\n", dev));
441 return -ENODEV; 444 ret = -ENODEV;
445 goto out;
442 } 446 }
443 port = &ports[dev]; 447 port = &ports[dev];
444 /* Allow open this device twice (assuming one reader and one writer) */ 448 /* Allow open this device twice (assuming one reader and one writer) */
445 if (port->busy == 2) 449 if (port->busy == 2)
446 { 450 {
447 DEBUG(printk(KERN_DEBUG "Device is busy.. \n")); 451 DEBUG(printk(KERN_DEBUG "Device is busy.. \n"));
448 return -EBUSY; 452 goto out;
449 } 453 }
450 454
451 455
@@ -459,7 +463,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
459 "synchronous serial 0 dma tr", 463 "synchronous serial 0 dma tr",
460 &ports[0])) { 464 &ports[0])) {
461 printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ"); 465 printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ");
462 return -EBUSY; 466 goto out;
463 } else if (request_irq(DMA_IN_INTR_VECT, 467 } else if (request_irq(DMA_IN_INTR_VECT,
464 rx_interrupt, 468 rx_interrupt,
465 0, 469 0,
@@ -467,7 +471,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
467 &ports[0])) { 471 &ports[0])) {
468 free_irq(DMA_OUT_INTR_VECT, &port[0]); 472 free_irq(DMA_OUT_INTR_VECT, &port[0]);
469 printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ"); 473 printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ");
470 return -EBUSY; 474 goto out;
471 } else if (crisv32_request_dma(OUT_DMA_NBR, 475 } else if (crisv32_request_dma(OUT_DMA_NBR,
472 "synchronous serial 0 dma tr", 476 "synchronous serial 0 dma tr",
473 DMA_VERBOSE_ON_ERROR, 477 DMA_VERBOSE_ON_ERROR,
@@ -476,7 +480,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
476 free_irq(DMA_OUT_INTR_VECT, &port[0]); 480 free_irq(DMA_OUT_INTR_VECT, &port[0]);
477 free_irq(DMA_IN_INTR_VECT, &port[0]); 481 free_irq(DMA_IN_INTR_VECT, &port[0]);
478 printk(KERN_CRIT "Can't allocate sync serial port 0 TX DMA channel"); 482 printk(KERN_CRIT "Can't allocate sync serial port 0 TX DMA channel");
479 return -EBUSY; 483 goto out;
480 } else if (crisv32_request_dma(IN_DMA_NBR, 484 } else if (crisv32_request_dma(IN_DMA_NBR,
481 "synchronous serial 0 dma rec", 485 "synchronous serial 0 dma rec",
482 DMA_VERBOSE_ON_ERROR, 486 DMA_VERBOSE_ON_ERROR,
@@ -486,7 +490,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
486 free_irq(DMA_OUT_INTR_VECT, &port[0]); 490 free_irq(DMA_OUT_INTR_VECT, &port[0]);
487 free_irq(DMA_IN_INTR_VECT, &port[0]); 491 free_irq(DMA_IN_INTR_VECT, &port[0]);
488 printk(KERN_CRIT "Can't allocate sync serial port 1 RX DMA channel"); 492 printk(KERN_CRIT "Can't allocate sync serial port 1 RX DMA channel");
489 return -EBUSY; 493 goto out;
490 } 494 }
491#endif 495#endif
492 } 496 }
@@ -499,7 +503,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
499 "synchronous serial 1 dma tr", 503 "synchronous serial 1 dma tr",
500 &ports[1])) { 504 &ports[1])) {
501 printk(KERN_CRIT "Can't allocate sync serial port 1 IRQ"); 505 printk(KERN_CRIT "Can't allocate sync serial port 1 IRQ");
502 return -EBUSY; 506 goto out;
503 } else if (request_irq(DMA7_INTR_VECT, 507 } else if (request_irq(DMA7_INTR_VECT,
504 rx_interrupt, 508 rx_interrupt,
505 0, 509 0,
@@ -507,7 +511,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
507 &ports[1])) { 511 &ports[1])) {
508 free_irq(DMA6_INTR_VECT, &ports[1]); 512 free_irq(DMA6_INTR_VECT, &ports[1]);
509 printk(KERN_CRIT "Can't allocate sync serial port 3 IRQ"); 513 printk(KERN_CRIT "Can't allocate sync serial port 3 IRQ");
510 return -EBUSY; 514 goto out;
511 } else if (crisv32_request_dma( 515 } else if (crisv32_request_dma(
512 SYNC_SER1_TX_DMA_NBR, 516 SYNC_SER1_TX_DMA_NBR,
513 "synchronous serial 1 dma tr", 517 "synchronous serial 1 dma tr",
@@ -517,7 +521,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
517 free_irq(DMA6_INTR_VECT, &ports[1]); 521 free_irq(DMA6_INTR_VECT, &ports[1]);
518 free_irq(DMA7_INTR_VECT, &ports[1]); 522 free_irq(DMA7_INTR_VECT, &ports[1]);
519 printk(KERN_CRIT "Can't allocate sync serial port 3 TX DMA channel"); 523 printk(KERN_CRIT "Can't allocate sync serial port 3 TX DMA channel");
520 return -EBUSY; 524 goto out;
521 } else if (crisv32_request_dma( 525 } else if (crisv32_request_dma(
522 SYNC_SER1_RX_DMA_NBR, 526 SYNC_SER1_RX_DMA_NBR,
523 "synchronous serial 3 dma rec", 527 "synchronous serial 3 dma rec",
@@ -528,7 +532,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
528 free_irq(DMA6_INTR_VECT, &ports[1]); 532 free_irq(DMA6_INTR_VECT, &ports[1]);
529 free_irq(DMA7_INTR_VECT, &ports[1]); 533 free_irq(DMA7_INTR_VECT, &ports[1]);
530 printk(KERN_CRIT "Can't allocate sync serial port 3 RX DMA channel"); 534 printk(KERN_CRIT "Can't allocate sync serial port 3 RX DMA channel");
531 return -EBUSY; 535 goto out;
532 } 536 }
533#endif 537#endif
534 } 538 }
@@ -554,7 +558,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
554 "synchronous serial manual irq", 558 "synchronous serial manual irq",
555 &ports[0])) { 559 &ports[0])) {
556 printk("Can't allocate sync serial manual irq"); 560 printk("Can't allocate sync serial manual irq");
557 return -EBUSY; 561 goto out;
558 } 562 }
559 } 563 }
560#ifdef CONFIG_ETRAXFS 564#ifdef CONFIG_ETRAXFS
@@ -565,7 +569,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
565 "synchronous serial manual irq", 569 "synchronous serial manual irq",
566 &ports[1])) { 570 &ports[1])) {
567 printk(KERN_CRIT "Can't allocate sync serial manual irq"); 571 printk(KERN_CRIT "Can't allocate sync serial manual irq");
568 return -EBUSY; 572 goto out;
569 } 573 }
570 } 574 }
571#endif 575#endif
@@ -578,7 +582,10 @@ static int sync_serial_open(struct inode *inode, struct file *file)
578 } /* port->init_irqs */ 582 } /* port->init_irqs */
579 583
580 port->busy++; 584 port->busy++;
581 return 0; 585 ret = 0;
586out:
587 unlock_kernel();
588 return ret;
582} 589}
583 590
584static int sync_serial_release(struct inode *inode, struct file *file) 591static int sync_serial_release(struct inode *inode, struct file *file)
diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c
index a812d03879f8..e8ac3f7d72df 100644
--- a/arch/m68k/bvme6000/rtc.c
+++ b/arch/m68k/bvme6000/rtc.c
@@ -10,6 +10,7 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/miscdevice.h> 11#include <linux/miscdevice.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/smp_lock.h>
13#include <linux/ioport.h> 14#include <linux/ioport.h>
14#include <linux/capability.h> 15#include <linux/capability.h>
15#include <linux/fcntl.h> 16#include <linux/fcntl.h>
@@ -140,10 +141,14 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
140 141
141static int rtc_open(struct inode *inode, struct file *file) 142static int rtc_open(struct inode *inode, struct file *file)
142{ 143{
143 if(rtc_status) 144 lock_kernel();
145 if(rtc_status) {
146 unlock_kernel();
144 return -EBUSY; 147 return -EBUSY;
148 }
145 149
146 rtc_status = 1; 150 rtc_status = 1;
151 unlock_kernel();
147 return 0; 152 return 0;
148} 153}
149 154
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
index e341387787ab..432a9f13b2ed 100644
--- a/arch/m68k/mvme16x/rtc.c
+++ b/arch/m68k/mvme16x/rtc.c
@@ -10,6 +10,7 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/miscdevice.h> 11#include <linux/miscdevice.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/smp_lock.h>
13#include <linux/ioport.h> 14#include <linux/ioport.h>
14#include <linux/capability.h> 15#include <linux/capability.h>
15#include <linux/fcntl.h> 16#include <linux/fcntl.h>
@@ -127,11 +128,14 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
127 128
128static int rtc_open(struct inode *inode, struct file *file) 129static int rtc_open(struct inode *inode, struct file *file)
129{ 130{
131 lock_kernel();
130 if( !atomic_dec_and_test(&rtc_ready) ) 132 if( !atomic_dec_and_test(&rtc_ready) )
131 { 133 {
132 atomic_inc( &rtc_ready ); 134 atomic_inc( &rtc_ready );
135 unlock_kernel();
133 return -EBUSY; 136 return -EBUSY;
134 } 137 }
138 unlock_kernel();
135 139
136 return 0; 140 return 0;
137} 141}
diff --git a/arch/mips/basler/excite/excite_iodev.c b/arch/mips/basler/excite/excite_iodev.c
index 476d20e08d0e..a1e3526b4a94 100644
--- a/arch/mips/basler/excite/excite_iodev.c
+++ b/arch/mips/basler/excite/excite_iodev.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/miscdevice.h> 28#include <linux/miscdevice.h>
29#include <linux/smp_lock.h>
29 30
30#include "excite_iodev.h" 31#include "excite_iodev.h"
31 32
@@ -110,8 +111,14 @@ static int __exit iodev_remove(struct device *dev)
110 111
111static int iodev_open(struct inode *i, struct file *f) 112static int iodev_open(struct inode *i, struct file *f)
112{ 113{
113 return request_irq(iodev_irq, iodev_irqhdl, IRQF_DISABLED, 114 int ret;
115
116 lock_kernel();
117 ret = request_irq(iodev_irq, iodev_irqhdl, IRQF_DISABLED,
114 iodev_name, &miscdev); 118 iodev_name, &miscdev);
119 unlock_kernel();
120
121 return ret;
115} 122}
116 123
117static int iodev_release(struct inode *i, struct file *f) 124static int iodev_release(struct inode *i, struct file *f)
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index b88f1c18ff4d..b55641961232 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -28,6 +28,7 @@
28#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
29#include <linux/elf.h> 29#include <linux/elf.h>
30#include <linux/seq_file.h> 30#include <linux/seq_file.h>
31#include <linux/smp_lock.h>
31#include <linux/syscalls.h> 32#include <linux/syscalls.h>
32#include <linux/moduleloader.h> 33#include <linux/moduleloader.h>
33#include <linux/interrupt.h> 34#include <linux/interrupt.h>
@@ -392,8 +393,12 @@ out:
392static int file_open(struct inode *inode, struct file *filp) 393static int file_open(struct inode *inode, struct file *filp)
393{ 394{
394 int minor = iminor(inode); 395 int minor = iminor(inode);
396 int err;
395 397
396 return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1); 398 lock_kernel();
399 err = rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1);
400 unlock_kernel();
401 return err;
397} 402}
398 403
399static int file_release(struct inode *inode, struct file *filp) 404static int file_release(struct inode *inode, struct file *filp)
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 2794501ff302..972b2d2b8401 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -38,6 +38,7 @@
38#include <linux/vmalloc.h> 38#include <linux/vmalloc.h>
39#include <linux/elf.h> 39#include <linux/elf.h>
40#include <linux/seq_file.h> 40#include <linux/seq_file.h>
41#include <linux/smp_lock.h>
41#include <linux/syscalls.h> 42#include <linux/syscalls.h>
42#include <linux/moduleloader.h> 43#include <linux/moduleloader.h>
43#include <linux/interrupt.h> 44#include <linux/interrupt.h>
@@ -1050,17 +1051,20 @@ static int vpe_open(struct inode *inode, struct file *filp)
1050 enum vpe_state state; 1051 enum vpe_state state;
1051 struct vpe_notifications *not; 1052 struct vpe_notifications *not;
1052 struct vpe *v; 1053 struct vpe *v;
1053 int ret; 1054 int ret, err = 0;
1054 1055
1056 lock_kernel();
1055 if (minor != iminor(inode)) { 1057 if (minor != iminor(inode)) {
1056 /* assume only 1 device at the moment. */ 1058 /* assume only 1 device at the moment. */
1057 printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); 1059 printk(KERN_WARNING "VPE loader: only vpe1 is supported\n");
1058 return -ENODEV; 1060 err = -ENODEV;
1061 goto out;
1059 } 1062 }
1060 1063
1061 if ((v = get_vpe(tclimit)) == NULL) { 1064 if ((v = get_vpe(tclimit)) == NULL) {
1062 printk(KERN_WARNING "VPE loader: unable to get vpe\n"); 1065 printk(KERN_WARNING "VPE loader: unable to get vpe\n");
1063 return -ENODEV; 1066 err = -ENODEV;
1067 goto out;
1064 } 1068 }
1065 1069
1066 state = xchg(&v->state, VPE_STATE_INUSE); 1070 state = xchg(&v->state, VPE_STATE_INUSE);
@@ -1100,6 +1104,8 @@ static int vpe_open(struct inode *inode, struct file *filp)
1100 v->shared_ptr = NULL; 1104 v->shared_ptr = NULL;
1101 v->__start = 0; 1105 v->__start = 0;
1102 1106
1107out:
1108 unlock_kernel();
1103 return 0; 1109 return 0;
1104} 1110}
1105 1111
diff --git a/arch/mips/sibyte/common/sb_tbprof.c b/arch/mips/sibyte/common/sb_tbprof.c
index 63b444eaf01e..28b012ab8dcb 100644
--- a/arch/mips/sibyte/common/sb_tbprof.c
+++ b/arch/mips/sibyte/common/sb_tbprof.c
@@ -28,6 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/smp_lock.h>
31#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
32#include <linux/fs.h> 33#include <linux/fs.h>
33#include <linux/errno.h> 34#include <linux/errno.h>
@@ -402,18 +403,26 @@ static int sbprof_zbprof_stop(void)
402static int sbprof_tb_open(struct inode *inode, struct file *filp) 403static int sbprof_tb_open(struct inode *inode, struct file *filp)
403{ 404{
404 int minor; 405 int minor;
406 int err = 0;
405 407
408 lock_kernel();
406 minor = iminor(inode); 409 minor = iminor(inode);
407 if (minor != 0) 410 if (minor != 0) {
408 return -ENODEV; 411 err = -ENODEV;
412 goto out;
413 }
409 414
410 if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) 415 if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) {
411 return -EBUSY; 416 err = -EBUSY;
417 goto out;
418 }
412 419
413 memset(&sbp, 0, sizeof(struct sbprof_tb)); 420 memset(&sbp, 0, sizeof(struct sbprof_tb));
414 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); 421 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES);
415 if (!sbp.sbprof_tbbuf) 422 if (!sbp.sbprof_tbbuf) {
416 return -ENOMEM; 423 err = -ENOMEM;
424 goto out;
425 }
417 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); 426 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES);
418 init_waitqueue_head(&sbp.tb_sync); 427 init_waitqueue_head(&sbp.tb_sync);
419 init_waitqueue_head(&sbp.tb_read); 428 init_waitqueue_head(&sbp.tb_read);
@@ -421,7 +430,9 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp)
421 430
422 sbp.open = SB_OPEN; 431 sbp.open = SB_OPEN;
423 432
424 return 0; 433 out:
434 unlock_kernel();
435 return err;
425} 436}
426 437
427static int sbprof_tb_release(struct inode *inode, struct file *filp) 438static int sbprof_tb_release(struct inode *inode, struct file *filp)
diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
index 89d6d5ad44b5..f696f57faa15 100644
--- a/arch/parisc/kernel/perf.c
+++ b/arch/parisc/kernel/perf.c
@@ -46,6 +46,7 @@
46#include <linux/init.h> 46#include <linux/init.h>
47#include <linux/proc_fs.h> 47#include <linux/proc_fs.h>
48#include <linux/miscdevice.h> 48#include <linux/miscdevice.h>
49#include <linux/smp_lock.h>
49#include <linux/spinlock.h> 50#include <linux/spinlock.h>
50 51
51#include <asm/uaccess.h> 52#include <asm/uaccess.h>
@@ -260,13 +261,16 @@ printk("Preparing to start counters\n");
260 */ 261 */
261static int perf_open(struct inode *inode, struct file *file) 262static int perf_open(struct inode *inode, struct file *file)
262{ 263{
264 lock_kernel();
263 spin_lock(&perf_lock); 265 spin_lock(&perf_lock);
264 if (perf_enabled) { 266 if (perf_enabled) {
265 spin_unlock(&perf_lock); 267 spin_unlock(&perf_lock);
268 unlock_kernel();
266 return -EBUSY; 269 return -EBUSY;
267 } 270 }
268 perf_enabled = 1; 271 perf_enabled = 1;
269 spin_unlock(&perf_lock); 272 spin_unlock(&perf_lock);
273 unlock_kernel();
270 274
271 return 0; 275 return 0;
272} 276}
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 2e516b871752..1a3b6ccd3620 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -67,7 +67,6 @@ SECTIONS
67 _etext = .; 67 _etext = .;
68 68
69 RODATA 69 RODATA
70 BUG_TABLE
71 70
72 /* writeable */ 71 /* writeable */
73 /* Make sure this is page aligned so 72 /* Make sure this is page aligned so
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 06b72771ae22..1530a41fc56d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -108,12 +108,14 @@ config ARCH_NO_VIRT_TO_BUS
108config PPC 108config PPC
109 bool 109 bool
110 default y 110 default y
111 select HAVE_DYNAMIC_FTRACE
112 select HAVE_FTRACE
111 select HAVE_IDE 113 select HAVE_IDE
112 select HAVE_OPROFILE
113 select HAVE_KPROBES 114 select HAVE_KPROBES
114 select HAVE_KRETPROBES 115 select HAVE_KRETPROBES
115 select HAVE_LMB 116 select HAVE_LMB
116 select HAVE_DMA_ATTRS if PPC64 117 select HAVE_DMA_ATTRS if PPC64
118 select HAVE_OPROFILE
117 119
118config EARLY_PRINTK 120config EARLY_PRINTK
119 bool 121 bool
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 9ebeb2406b5b..bf0b1fd0ec34 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -12,6 +12,18 @@ CFLAGS_prom_init.o += -fPIC
12CFLAGS_btext.o += -fPIC 12CFLAGS_btext.o += -fPIC
13endif 13endif
14 14
15ifdef CONFIG_FTRACE
16# Do not trace early boot code
17CFLAGS_REMOVE_cputable.o = -pg
18CFLAGS_REMOVE_prom_init.o = -pg
19
20ifdef CONFIG_DYNAMIC_FTRACE
21# dynamic ftrace setup.
22CFLAGS_REMOVE_ftrace.o = -pg
23endif
24
25endif
26
15obj-y := cputable.o ptrace.o syscalls.o \ 27obj-y := cputable.o ptrace.o syscalls.o \
16 irq.o align.o signal_32.o pmc.o vdso.o \ 28 irq.o align.o signal_32.o pmc.o vdso.o \
17 init_task.o process.o systbl.o idle.o \ 29 init_task.o process.o systbl.o idle.o \
@@ -79,6 +91,8 @@ obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o \
79obj-$(CONFIG_AUDIT) += audit.o 91obj-$(CONFIG_AUDIT) += audit.o
80obj64-$(CONFIG_AUDIT) += compat_audit.o 92obj64-$(CONFIG_AUDIT) += compat_audit.o
81 93
94obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
95
82obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o 96obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o
83 97
84ifneq ($(CONFIG_PPC_INDIRECT_IO),y) 98ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index ab2d62f70b14..da52269aec1e 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -30,6 +30,7 @@
30#include <asm/ppc_asm.h> 30#include <asm/ppc_asm.h>
31#include <asm/asm-offsets.h> 31#include <asm/asm-offsets.h>
32#include <asm/unistd.h> 32#include <asm/unistd.h>
33#include <asm/ftrace.h>
33 34
34#undef SHOW_SYSCALLS 35#undef SHOW_SYSCALLS
35#undef SHOW_SYSCALLS_TASK 36#undef SHOW_SYSCALLS_TASK
@@ -1151,3 +1152,129 @@ machine_check_in_rtas:
1151 /* XXX load up BATs and panic */ 1152 /* XXX load up BATs and panic */
1152 1153
1153#endif /* CONFIG_PPC_RTAS */ 1154#endif /* CONFIG_PPC_RTAS */
1155
1156#ifdef CONFIG_FTRACE
1157#ifdef CONFIG_DYNAMIC_FTRACE
1158_GLOBAL(mcount)
1159_GLOBAL(_mcount)
1160 stwu r1,-48(r1)
1161 stw r3, 12(r1)
1162 stw r4, 16(r1)
1163 stw r5, 20(r1)
1164 stw r6, 24(r1)
1165 mflr r3
1166 stw r7, 28(r1)
1167 mfcr r5
1168 stw r8, 32(r1)
1169 stw r9, 36(r1)
1170 stw r10,40(r1)
1171 stw r3, 44(r1)
1172 stw r5, 8(r1)
1173 subi r3, r3, MCOUNT_INSN_SIZE
1174 .globl mcount_call
1175mcount_call:
1176 bl ftrace_stub
1177 nop
1178 lwz r6, 8(r1)
1179 lwz r0, 44(r1)
1180 lwz r3, 12(r1)
1181 mtctr r0
1182 lwz r4, 16(r1)
1183 mtcr r6
1184 lwz r5, 20(r1)
1185 lwz r6, 24(r1)
1186 lwz r0, 52(r1)
1187 lwz r7, 28(r1)
1188 lwz r8, 32(r1)
1189 mtlr r0
1190 lwz r9, 36(r1)
1191 lwz r10,40(r1)
1192 addi r1, r1, 48
1193 bctr
1194
1195_GLOBAL(ftrace_caller)
1196 /* Based off of objdump optput from glibc */
1197 stwu r1,-48(r1)
1198 stw r3, 12(r1)
1199 stw r4, 16(r1)
1200 stw r5, 20(r1)
1201 stw r6, 24(r1)
1202 mflr r3
1203 lwz r4, 52(r1)
1204 mfcr r5
1205 stw r7, 28(r1)
1206 stw r8, 32(r1)
1207 stw r9, 36(r1)
1208 stw r10,40(r1)
1209 stw r3, 44(r1)
1210 stw r5, 8(r1)
1211 subi r3, r3, MCOUNT_INSN_SIZE
1212.globl ftrace_call
1213ftrace_call:
1214 bl ftrace_stub
1215 nop
1216 lwz r6, 8(r1)
1217 lwz r0, 44(r1)
1218 lwz r3, 12(r1)
1219 mtctr r0
1220 lwz r4, 16(r1)
1221 mtcr r6
1222 lwz r5, 20(r1)
1223 lwz r6, 24(r1)
1224 lwz r0, 52(r1)
1225 lwz r7, 28(r1)
1226 lwz r8, 32(r1)
1227 mtlr r0
1228 lwz r9, 36(r1)
1229 lwz r10,40(r1)
1230 addi r1, r1, 48
1231 bctr
1232#else
1233_GLOBAL(mcount)
1234_GLOBAL(_mcount)
1235 stwu r1,-48(r1)
1236 stw r3, 12(r1)
1237 stw r4, 16(r1)
1238 stw r5, 20(r1)
1239 stw r6, 24(r1)
1240 mflr r3
1241 lwz r4, 52(r1)
1242 mfcr r5
1243 stw r7, 28(r1)
1244 stw r8, 32(r1)
1245 stw r9, 36(r1)
1246 stw r10,40(r1)
1247 stw r3, 44(r1)
1248 stw r5, 8(r1)
1249
1250 subi r3, r3, MCOUNT_INSN_SIZE
1251 LOAD_REG_ADDR(r5, ftrace_trace_function)
1252 lwz r5,0(r5)
1253
1254 mtctr r5
1255 bctrl
1256
1257 nop
1258
1259 lwz r6, 8(r1)
1260 lwz r0, 44(r1)
1261 lwz r3, 12(r1)
1262 mtctr r0
1263 lwz r4, 16(r1)
1264 mtcr r6
1265 lwz r5, 20(r1)
1266 lwz r6, 24(r1)
1267 lwz r0, 52(r1)
1268 lwz r7, 28(r1)
1269 lwz r8, 32(r1)
1270 mtlr r0
1271 lwz r9, 36(r1)
1272 lwz r10,40(r1)
1273 addi r1, r1, 48
1274 bctr
1275#endif
1276
1277_GLOBAL(ftrace_stub)
1278 blr
1279
1280#endif /* CONFIG_MCOUNT */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 12eb95a80ce9..d7369243ae44 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -31,6 +31,7 @@
31#include <asm/bug.h> 31#include <asm/bug.h>
32#include <asm/ptrace.h> 32#include <asm/ptrace.h>
33#include <asm/irqflags.h> 33#include <asm/irqflags.h>
34#include <asm/ftrace.h>
34 35
35/* 36/*
36 * System calls. 37 * System calls.
@@ -875,3 +876,67 @@ _GLOBAL(enter_prom)
875 ld r0,16(r1) 876 ld r0,16(r1)
876 mtlr r0 877 mtlr r0
877 blr 878 blr
879
880#ifdef CONFIG_FTRACE
881#ifdef CONFIG_DYNAMIC_FTRACE
882_GLOBAL(mcount)
883_GLOBAL(_mcount)
884 /* Taken from output of objdump from lib64/glibc */
885 mflr r3
886 stdu r1, -112(r1)
887 std r3, 128(r1)
888 subi r3, r3, MCOUNT_INSN_SIZE
889 .globl mcount_call
890mcount_call:
891 bl ftrace_stub
892 nop
893 ld r0, 128(r1)
894 mtlr r0
895 addi r1, r1, 112
896 blr
897
898_GLOBAL(ftrace_caller)
899 /* Taken from output of objdump from lib64/glibc */
900 mflr r3
901 ld r11, 0(r1)
902 stdu r1, -112(r1)
903 std r3, 128(r1)
904 ld r4, 16(r11)
905 subi r3, r3, MCOUNT_INSN_SIZE
906.globl ftrace_call
907ftrace_call:
908 bl ftrace_stub
909 nop
910 ld r0, 128(r1)
911 mtlr r0
912 addi r1, r1, 112
913_GLOBAL(ftrace_stub)
914 blr
915#else
916_GLOBAL(mcount)
917 blr
918
919_GLOBAL(_mcount)
920 /* Taken from output of objdump from lib64/glibc */
921 mflr r3
922 ld r11, 0(r1)
923 stdu r1, -112(r1)
924 std r3, 128(r1)
925 ld r4, 16(r11)
926
927 subi r3, r3, MCOUNT_INSN_SIZE
928 LOAD_REG_ADDR(r5,ftrace_trace_function)
929 ld r5,0(r5)
930 ld r5,0(r5)
931 mtctr r5
932 bctrl
933
934 nop
935 ld r0, 128(r1)
936 mtlr r0
937 addi r1, r1, 112
938_GLOBAL(ftrace_stub)
939 blr
940
941#endif
942#endif
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
new file mode 100644
index 000000000000..3855ceb937b0
--- /dev/null
+++ b/arch/powerpc/kernel/ftrace.c
@@ -0,0 +1,154 @@
1/*
2 * Code for replacing ftrace calls with jumps.
3 *
4 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
5 *
6 * Thanks goes out to P.A. Semi, Inc for supplying me with a PPC64 box.
7 *
8 */
9
10#include <linux/spinlock.h>
11#include <linux/hardirq.h>
12#include <linux/ftrace.h>
13#include <linux/percpu.h>
14#include <linux/init.h>
15#include <linux/list.h>
16
17#include <asm/cacheflush.h>
18#include <asm/ftrace.h>
19
20
21static unsigned int ftrace_nop = 0x60000000;
22
23#ifdef CONFIG_PPC32
24# define GET_ADDR(addr) addr
25#else
26/* PowerPC64's functions are data that points to the functions */
27# define GET_ADDR(addr) *(unsigned long *)addr
28#endif
29
30
31static unsigned int notrace ftrace_calc_offset(long ip, long addr)
32{
33 return (int)(addr - ip);
34}
35
36notrace unsigned char *ftrace_nop_replace(void)
37{
38 return (char *)&ftrace_nop;
39}
40
41notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
42{
43 static unsigned int op;
44
45 /*
46 * It would be nice to just use create_function_call, but that will
47 * update the code itself. Here we need to just return the
48 * instruction that is going to be modified, without modifying the
49 * code.
50 */
51 addr = GET_ADDR(addr);
52
53 /* Set to "bl addr" */
54 op = 0x48000001 | (ftrace_calc_offset(ip, addr) & 0x03fffffc);
55
56 /*
57 * No locking needed, this must be called via kstop_machine
58 * which in essence is like running on a uniprocessor machine.
59 */
60 return (unsigned char *)&op;
61}
62
63#ifdef CONFIG_PPC64
64# define _ASM_ALIGN " .align 3 "
65# define _ASM_PTR " .llong "
66#else
67# define _ASM_ALIGN " .align 2 "
68# define _ASM_PTR " .long "
69#endif
70
71notrace int
72ftrace_modify_code(unsigned long ip, unsigned char *old_code,
73 unsigned char *new_code)
74{
75 unsigned replaced;
76 unsigned old = *(unsigned *)old_code;
77 unsigned new = *(unsigned *)new_code;
78 int faulted = 0;
79
80 /*
81 * Note: Due to modules and __init, code can
82 * disappear and change, we need to protect against faulting
83 * as well as code changing.
84 *
85 * No real locking needed, this code is run through
86 * kstop_machine.
87 */
88 asm volatile (
89 "1: lwz %1, 0(%2)\n"
90 " cmpw %1, %5\n"
91 " bne 2f\n"
92 " stwu %3, 0(%2)\n"
93 "2:\n"
94 ".section .fixup, \"ax\"\n"
95 "3: li %0, 1\n"
96 " b 2b\n"
97 ".previous\n"
98 ".section __ex_table,\"a\"\n"
99 _ASM_ALIGN "\n"
100 _ASM_PTR "1b, 3b\n"
101 ".previous"
102 : "=r"(faulted), "=r"(replaced)
103 : "r"(ip), "r"(new),
104 "0"(faulted), "r"(old)
105 : "memory");
106
107 if (replaced != old && replaced != new)
108 faulted = 2;
109
110 if (!faulted)
111 flush_icache_range(ip, ip + 8);
112
113 return faulted;
114}
115
116notrace int ftrace_update_ftrace_func(ftrace_func_t func)
117{
118 unsigned long ip = (unsigned long)(&ftrace_call);
119 unsigned char old[MCOUNT_INSN_SIZE], *new;
120 int ret;
121
122 memcpy(old, &ftrace_call, MCOUNT_INSN_SIZE);
123 new = ftrace_call_replace(ip, (unsigned long)func);
124 ret = ftrace_modify_code(ip, old, new);
125
126 return ret;
127}
128
129notrace int ftrace_mcount_set(unsigned long *data)
130{
131 unsigned long ip = (long)(&mcount_call);
132 unsigned long *addr = data;
133 unsigned char old[MCOUNT_INSN_SIZE], *new;
134
135 /*
136 * Replace the mcount stub with a pointer to the
137 * ip recorder function.
138 */
139 memcpy(old, &mcount_call, MCOUNT_INSN_SIZE);
140 new = ftrace_call_replace(ip, *addr);
141 *addr = ftrace_modify_code(ip, old, new);
142
143 return 0;
144}
145
146int __init ftrace_dyn_arch_init(void *data)
147{
148 /* This is running in kstop_machine */
149
150 ftrace_mcount_set(data);
151
152 return 0;
153}
154
diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c
index e31aca9208eb..1882bf419fa6 100644
--- a/arch/powerpc/kernel/io.c
+++ b/arch/powerpc/kernel/io.c
@@ -120,7 +120,8 @@ EXPORT_SYMBOL(_outsl_ns);
120 120
121#define IO_CHECK_ALIGN(v,a) ((((unsigned long)(v)) & ((a) - 1)) == 0) 121#define IO_CHECK_ALIGN(v,a) ((((unsigned long)(v)) & ((a) - 1)) == 0)
122 122
123void _memset_io(volatile void __iomem *addr, int c, unsigned long n) 123notrace void
124_memset_io(volatile void __iomem *addr, int c, unsigned long n)
124{ 125{
125 void *p = (void __force *)addr; 126 void *p = (void __force *)addr;
126 u32 lc = c; 127 u32 lc = c;
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index d6df018bb584..6ac8612da3c3 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -98,7 +98,7 @@ EXPORT_SYMBOL(irq_desc);
98 98
99int distribute_irqs = 1; 99int distribute_irqs = 1;
100 100
101static inline unsigned long get_hard_enabled(void) 101static inline notrace unsigned long get_hard_enabled(void)
102{ 102{
103 unsigned long enabled; 103 unsigned long enabled;
104 104
@@ -108,13 +108,13 @@ static inline unsigned long get_hard_enabled(void)
108 return enabled; 108 return enabled;
109} 109}
110 110
111static inline void set_soft_enabled(unsigned long enable) 111static inline notrace void set_soft_enabled(unsigned long enable)
112{ 112{
113 __asm__ __volatile__("stb %0,%1(13)" 113 __asm__ __volatile__("stb %0,%1(13)"
114 : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled))); 114 : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled)));
115} 115}
116 116
117void raw_local_irq_restore(unsigned long en) 117notrace void raw_local_irq_restore(unsigned long en)
118{ 118{
119 /* 119 /*
120 * get_paca()->soft_enabled = en; 120 * get_paca()->soft_enabled = en;
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 958ecb9ae7dc..e1ea4fe5cfbd 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -42,6 +42,7 @@
42#include <asm/div64.h> 42#include <asm/div64.h>
43#include <asm/signal.h> 43#include <asm/signal.h>
44#include <asm/dcr.h> 44#include <asm/dcr.h>
45#include <asm/ftrace.h>
45 46
46#ifdef CONFIG_PPC32 47#ifdef CONFIG_PPC32
47extern void transfer_to_handler(void); 48extern void transfer_to_handler(void);
@@ -67,6 +68,10 @@ EXPORT_SYMBOL(single_step_exception);
67EXPORT_SYMBOL(sys_sigreturn); 68EXPORT_SYMBOL(sys_sigreturn);
68#endif 69#endif
69 70
71#ifdef CONFIG_FTRACE
72EXPORT_SYMBOL(_mcount);
73#endif
74
70EXPORT_SYMBOL(strcpy); 75EXPORT_SYMBOL(strcpy);
71EXPORT_SYMBOL(strncpy); 76EXPORT_SYMBOL(strncpy);
72EXPORT_SYMBOL(strcat); 77EXPORT_SYMBOL(strcat);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 0109e7f0ccf9..4efebe88e64a 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -81,7 +81,7 @@ int ucache_bsize;
81 * from the address that it was linked at, so we must use RELOC/PTRRELOC 81 * from the address that it was linked at, so we must use RELOC/PTRRELOC
82 * to access static data (including strings). -- paulus 82 * to access static data (including strings). -- paulus
83 */ 83 */
84unsigned long __init early_init(unsigned long dt_ptr) 84notrace unsigned long __init early_init(unsigned long dt_ptr)
85{ 85{
86 unsigned long offset = reloc_offset(); 86 unsigned long offset = reloc_offset();
87 struct cpu_spec *spec; 87 struct cpu_spec *spec;
@@ -115,7 +115,7 @@ unsigned long __init early_init(unsigned long dt_ptr)
115 * This is called very early on the boot process, after a minimal 115 * This is called very early on the boot process, after a minimal
116 * MMU environment has been set up but before MMU_init is called. 116 * MMU environment has been set up but before MMU_init is called.
117 */ 117 */
118void __init machine_init(unsigned long dt_ptr, unsigned long phys) 118notrace void __init machine_init(unsigned long dt_ptr, unsigned long phys)
119{ 119{
120 /* Enable early debugging if any specified (see udbg.h) */ 120 /* Enable early debugging if any specified (see udbg.h) */
121 udbg_early_init(); 121 udbg_early_init();
@@ -142,7 +142,7 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys)
142 142
143#ifdef CONFIG_BOOKE_WDT 143#ifdef CONFIG_BOOKE_WDT
144/* Checks wdt=x and wdt_period=xx command-line option */ 144/* Checks wdt=x and wdt_period=xx command-line option */
145int __init early_parse_wdt(char *p) 145notrace int __init early_parse_wdt(char *p)
146{ 146{
147 if (p && strncmp(p, "0", 1) != 0) 147 if (p && strncmp(p, "0", 1) != 0)
148 booke_wdt_enabled = 1; 148 booke_wdt_enabled = 1;
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 6856f6c15727..87a72c66ce27 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -64,8 +64,6 @@ SECTIONS
64 64
65 NOTES 65 NOTES
66 66
67 BUG_TABLE
68
69/* 67/*
70 * Init sections discarded at runtime 68 * Init sections discarded at runtime
71 */ 69 */
diff --git a/arch/powerpc/platforms/powermac/Makefile b/arch/powerpc/platforms/powermac/Makefile
index 4d72c8f72159..89774177b209 100644
--- a/arch/powerpc/platforms/powermac/Makefile
+++ b/arch/powerpc/platforms/powermac/Makefile
@@ -1,5 +1,10 @@
1CFLAGS_bootx_init.o += -fPIC 1CFLAGS_bootx_init.o += -fPIC
2 2
3ifdef CONFIG_FTRACE
4# Do not trace early boot code
5CFLAGS_REMOVE_bootx_init.o = -pg
6endif
7
3obj-y += pic.o setup.o time.o feature.o pci.o \ 8obj-y += pic.o setup.o time.o feature.o pci.o \
4 sleep.o low_i2c.o cache.o pfunc_core.o \ 9 sleep.o low_i2c.o cache.o pfunc_core.o \
5 pfunc_base.o 10 pfunc_base.o
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 107e492cb47e..5dc8f8028d52 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -146,6 +146,7 @@ config MATHEMU
146config COMPAT 146config COMPAT
147 bool "Kernel support for 31 bit emulation" 147 bool "Kernel support for 31 bit emulation"
148 depends on 64BIT 148 depends on 64BIT
149 select COMPAT_BINFMT_ELF
149 help 150 help
150 Select this option if you want to enable your system kernel to 151 Select this option if you want to enable your system kernel to
151 handle system-calls from ELF binaries for 31 bit ESA. This option 152 handle system-calls from ELF binaries for 31 bit ESA. This option
@@ -312,6 +313,10 @@ config ARCH_SPARSEMEM_DEFAULT
312config ARCH_SELECT_MEMORY_MODEL 313config ARCH_SELECT_MEMORY_MODEL
313 def_bool y 314 def_bool y
314 315
316config ARCH_ENABLE_MEMORY_HOTPLUG
317 def_bool y
318 depends on SPARSEMEM
319
315source "mm/Kconfig" 320source "mm/Kconfig"
316 321
317comment "I/O subsystem configuration" 322comment "I/O subsystem configuration"
@@ -344,6 +349,22 @@ config QDIO_DEBUG
344 349
345 If unsure, say N. 350 If unsure, say N.
346 351
352config CHSC_SCH
353 tristate "Support for CHSC subchannels"
354 help
355 This driver allows usage of CHSC subchannels. A CHSC subchannel
356 is usually present on LPAR only.
357 The driver creates a device /dev/chsc, which may be used to
358 obtain I/O configuration information about the machine and
359 to issue asynchronous chsc commands (DANGEROUS).
360 You will usually only want to use this interface on a special
361 LPAR designated for system management.
362
363 To compile this driver as a module, choose M here: the
364 module will be called chsc_sch.
365
366 If unsure, say N.
367
347comment "Misc" 368comment "Misc"
348 369
349config IPL 370config IPL
diff --git a/arch/s390/appldata/appldata.h b/arch/s390/appldata/appldata.h
index db3ae8505103..17a2636fec0a 100644
--- a/arch/s390/appldata/appldata.h
+++ b/arch/s390/appldata/appldata.h
@@ -3,13 +3,11 @@
3 * 3 *
4 * Definitions and interface for Linux - z/VM Monitor Stream. 4 * Definitions and interface for Linux - z/VM Monitor Stream.
5 * 5 *
6 * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. 6 * Copyright IBM Corp. 2003, 2008
7 * 7 *
8 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> 8 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com>
9 */ 9 */
10 10
11//#define APPLDATA_DEBUG /* Debug messages on/off */
12
13#define APPLDATA_MAX_REC_SIZE 4024 /* Maximum size of the */ 11#define APPLDATA_MAX_REC_SIZE 4024 /* Maximum size of the */
14 /* data buffer */ 12 /* data buffer */
15#define APPLDATA_MAX_PROCS 100 13#define APPLDATA_MAX_PROCS 100
@@ -32,12 +30,6 @@
32#define P_ERROR(x...) printk(KERN_ERR MY_PRINT_NAME " error: " x) 30#define P_ERROR(x...) printk(KERN_ERR MY_PRINT_NAME " error: " x)
33#define P_WARNING(x...) printk(KERN_WARNING MY_PRINT_NAME " status: " x) 31#define P_WARNING(x...) printk(KERN_WARNING MY_PRINT_NAME " status: " x)
34 32
35#ifdef APPLDATA_DEBUG
36#define P_DEBUG(x...) printk(KERN_DEBUG MY_PRINT_NAME " debug: " x)
37#else
38#define P_DEBUG(x...) do {} while (0)
39#endif
40
41struct appldata_ops { 33struct appldata_ops {
42 struct list_head list; 34 struct list_head list;
43 struct ctl_table_header *sysctl_header; 35 struct ctl_table_header *sysctl_header;
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index ad40729bec3d..9cb3d92447a3 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -5,7 +5,7 @@
5 * Exports appldata_register_ops() and appldata_unregister_ops() for the 5 * Exports appldata_register_ops() and appldata_unregister_ops() for the
6 * data gathering modules. 6 * data gathering modules.
7 * 7 *
8 * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. 8 * Copyright IBM Corp. 2003, 2008
9 * 9 *
10 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> 10 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com>
11 */ 11 */
@@ -108,9 +108,6 @@ static LIST_HEAD(appldata_ops_list);
108 */ 108 */
109static void appldata_timer_function(unsigned long data) 109static void appldata_timer_function(unsigned long data)
110{ 110{
111 P_DEBUG(" -= Timer =-\n");
112 P_DEBUG("CPU: %i, expire_count: %i\n", smp_processor_id(),
113 atomic_read(&appldata_expire_count));
114 if (atomic_dec_and_test(&appldata_expire_count)) { 111 if (atomic_dec_and_test(&appldata_expire_count)) {
115 atomic_set(&appldata_expire_count, num_online_cpus()); 112 atomic_set(&appldata_expire_count, num_online_cpus());
116 queue_work(appldata_wq, (struct work_struct *) data); 113 queue_work(appldata_wq, (struct work_struct *) data);
@@ -128,14 +125,11 @@ static void appldata_work_fn(struct work_struct *work)
128 struct appldata_ops *ops; 125 struct appldata_ops *ops;
129 int i; 126 int i;
130 127
131 P_DEBUG(" -= Work Queue =-\n");
132 i = 0; 128 i = 0;
133 get_online_cpus(); 129 get_online_cpus();
134 spin_lock(&appldata_ops_lock); 130 spin_lock(&appldata_ops_lock);
135 list_for_each(lh, &appldata_ops_list) { 131 list_for_each(lh, &appldata_ops_list) {
136 ops = list_entry(lh, struct appldata_ops, list); 132 ops = list_entry(lh, struct appldata_ops, list);
137 P_DEBUG("list_for_each loop: %i) active = %u, name = %s\n",
138 ++i, ops->active, ops->name);
139 if (ops->active == 1) { 133 if (ops->active == 1) {
140 ops->callback(ops->data); 134 ops->callback(ops->data);
141 } 135 }
@@ -212,7 +206,6 @@ __appldata_vtimer_setup(int cmd)
212 0, 1); 206 0, 1);
213 } 207 }
214 appldata_timer_active = 1; 208 appldata_timer_active = 1;
215 P_INFO("Monitoring timer started.\n");
216 break; 209 break;
217 case APPLDATA_DEL_TIMER: 210 case APPLDATA_DEL_TIMER:
218 for_each_online_cpu(i) 211 for_each_online_cpu(i)
@@ -221,7 +214,6 @@ __appldata_vtimer_setup(int cmd)
221 break; 214 break;
222 appldata_timer_active = 0; 215 appldata_timer_active = 0;
223 atomic_set(&appldata_expire_count, num_online_cpus()); 216 atomic_set(&appldata_expire_count, num_online_cpus());
224 P_INFO("Monitoring timer stopped.\n");
225 break; 217 break;
226 case APPLDATA_MOD_TIMER: 218 case APPLDATA_MOD_TIMER:
227 per_cpu_interval = (u64) (appldata_interval*1000 / 219 per_cpu_interval = (u64) (appldata_interval*1000 /
@@ -313,10 +305,8 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
313 } 305 }
314 interval = 0; 306 interval = 0;
315 sscanf(buf, "%i", &interval); 307 sscanf(buf, "%i", &interval);
316 if (interval <= 0) { 308 if (interval <= 0)
317 P_ERROR("Timer CPU interval has to be > 0!\n");
318 return -EINVAL; 309 return -EINVAL;
319 }
320 310
321 get_online_cpus(); 311 get_online_cpus();
322 spin_lock(&appldata_timer_lock); 312 spin_lock(&appldata_timer_lock);
@@ -324,9 +314,6 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
324 __appldata_vtimer_setup(APPLDATA_MOD_TIMER); 314 __appldata_vtimer_setup(APPLDATA_MOD_TIMER);
325 spin_unlock(&appldata_timer_lock); 315 spin_unlock(&appldata_timer_lock);
326 put_online_cpus(); 316 put_online_cpus();
327
328 P_INFO("Monitoring CPU interval set to %u milliseconds.\n",
329 interval);
330out: 317out:
331 *lenp = len; 318 *lenp = len;
332 *ppos += len; 319 *ppos += len;
@@ -406,23 +393,16 @@ appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
406 P_ERROR("START DIAG 0xDC for %s failed, " 393 P_ERROR("START DIAG 0xDC for %s failed, "
407 "return code: %d\n", ops->name, rc); 394 "return code: %d\n", ops->name, rc);
408 module_put(ops->owner); 395 module_put(ops->owner);
409 } else { 396 } else
410 P_INFO("Monitoring %s data enabled, "
411 "DIAG 0xDC started.\n", ops->name);
412 ops->active = 1; 397 ops->active = 1;
413 }
414 } else if ((buf[0] == '0') && (ops->active == 1)) { 398 } else if ((buf[0] == '0') && (ops->active == 1)) {
415 ops->active = 0; 399 ops->active = 0;
416 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, 400 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC,
417 (unsigned long) ops->data, ops->size, 401 (unsigned long) ops->data, ops->size,
418 ops->mod_lvl); 402 ops->mod_lvl);
419 if (rc != 0) { 403 if (rc != 0)
420 P_ERROR("STOP DIAG 0xDC for %s failed, " 404 P_ERROR("STOP DIAG 0xDC for %s failed, "
421 "return code: %d\n", ops->name, rc); 405 "return code: %d\n", ops->name, rc);
422 } else {
423 P_INFO("Monitoring %s data disabled, "
424 "DIAG 0xDC stopped.\n", ops->name);
425 }
426 module_put(ops->owner); 406 module_put(ops->owner);
427 } 407 }
428 spin_unlock(&appldata_ops_lock); 408 spin_unlock(&appldata_ops_lock);
@@ -468,7 +448,6 @@ int appldata_register_ops(struct appldata_ops *ops)
468 ops->sysctl_header = register_sysctl_table(ops->ctl_table); 448 ops->sysctl_header = register_sysctl_table(ops->ctl_table);
469 if (!ops->sysctl_header) 449 if (!ops->sysctl_header)
470 goto out; 450 goto out;
471 P_INFO("%s-ops registered!\n", ops->name);
472 return 0; 451 return 0;
473out: 452out:
474 spin_lock(&appldata_ops_lock); 453 spin_lock(&appldata_ops_lock);
@@ -490,7 +469,6 @@ void appldata_unregister_ops(struct appldata_ops *ops)
490 spin_unlock(&appldata_ops_lock); 469 spin_unlock(&appldata_ops_lock);
491 unregister_sysctl_table(ops->sysctl_header); 470 unregister_sysctl_table(ops->sysctl_header);
492 kfree(ops->ctl_table); 471 kfree(ops->ctl_table);
493 P_INFO("%s-ops unregistered!\n", ops->name);
494} 472}
495/********************** module-ops management <END> **************************/ 473/********************** module-ops management <END> **************************/
496 474
@@ -553,14 +531,9 @@ static int __init appldata_init(void)
553{ 531{
554 int i; 532 int i;
555 533
556 P_DEBUG("sizeof(parameter_list) = %lu\n",
557 sizeof(struct appldata_parameter_list));
558
559 appldata_wq = create_singlethread_workqueue("appldata"); 534 appldata_wq = create_singlethread_workqueue("appldata");
560 if (!appldata_wq) { 535 if (!appldata_wq)
561 P_ERROR("Could not create work queue\n");
562 return -ENOMEM; 536 return -ENOMEM;
563 }
564 537
565 get_online_cpus(); 538 get_online_cpus();
566 for_each_online_cpu(i) 539 for_each_online_cpu(i)
@@ -571,8 +544,6 @@ static int __init appldata_init(void)
571 register_hotcpu_notifier(&appldata_nb); 544 register_hotcpu_notifier(&appldata_nb);
572 545
573 appldata_sysctl_header = register_sysctl_table(appldata_dir_table); 546 appldata_sysctl_header = register_sysctl_table(appldata_dir_table);
574
575 P_DEBUG("Base interface initialized.\n");
576 return 0; 547 return 0;
577} 548}
578 549
@@ -584,7 +555,9 @@ EXPORT_SYMBOL_GPL(appldata_register_ops);
584EXPORT_SYMBOL_GPL(appldata_unregister_ops); 555EXPORT_SYMBOL_GPL(appldata_unregister_ops);
585EXPORT_SYMBOL_GPL(appldata_diag); 556EXPORT_SYMBOL_GPL(appldata_diag);
586 557
558#ifdef CONFIG_SWAP
587EXPORT_SYMBOL_GPL(si_swapinfo); 559EXPORT_SYMBOL_GPL(si_swapinfo);
560#endif
588EXPORT_SYMBOL_GPL(nr_threads); 561EXPORT_SYMBOL_GPL(nr_threads);
589EXPORT_SYMBOL_GPL(nr_running); 562EXPORT_SYMBOL_GPL(nr_running);
590EXPORT_SYMBOL_GPL(nr_iowait); 563EXPORT_SYMBOL_GPL(nr_iowait);
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index 51181ccdb87b..3ed56b7d1b2f 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -14,14 +14,13 @@
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/kernel_stat.h> 16#include <linux/kernel_stat.h>
17#include <asm/io.h>
18#include <linux/pagemap.h> 17#include <linux/pagemap.h>
19#include <linux/swap.h> 18#include <linux/swap.h>
19#include <asm/io.h>
20 20
21#include "appldata.h" 21#include "appldata.h"
22 22
23 23
24#define MY_PRINT_NAME "appldata_mem" /* for debug messages, etc. */
25#define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* Converts #Pages to KB */ 24#define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* Converts #Pages to KB */
26 25
27/* 26/*
@@ -70,30 +69,6 @@ static struct appldata_mem_data {
70} __attribute__((packed)) appldata_mem_data; 69} __attribute__((packed)) appldata_mem_data;
71 70
72 71
73static inline void appldata_debug_print(struct appldata_mem_data *mem_data)
74{
75 P_DEBUG("--- MEM - RECORD ---\n");
76 P_DEBUG("pgpgin = %8lu KB\n", mem_data->pgpgin);
77 P_DEBUG("pgpgout = %8lu KB\n", mem_data->pgpgout);
78 P_DEBUG("pswpin = %8lu Pages\n", mem_data->pswpin);
79 P_DEBUG("pswpout = %8lu Pages\n", mem_data->pswpout);
80 P_DEBUG("pgalloc = %8lu \n", mem_data->pgalloc);
81 P_DEBUG("pgfault = %8lu \n", mem_data->pgfault);
82 P_DEBUG("pgmajfault = %8lu \n", mem_data->pgmajfault);
83 P_DEBUG("sharedram = %8lu KB\n", mem_data->sharedram);
84 P_DEBUG("totalram = %8lu KB\n", mem_data->totalram);
85 P_DEBUG("freeram = %8lu KB\n", mem_data->freeram);
86 P_DEBUG("totalhigh = %8lu KB\n", mem_data->totalhigh);
87 P_DEBUG("freehigh = %8lu KB\n", mem_data->freehigh);
88 P_DEBUG("bufferram = %8lu KB\n", mem_data->bufferram);
89 P_DEBUG("cached = %8lu KB\n", mem_data->cached);
90 P_DEBUG("totalswap = %8lu KB\n", mem_data->totalswap);
91 P_DEBUG("freeswap = %8lu KB\n", mem_data->freeswap);
92 P_DEBUG("sync_count_1 = %u\n", mem_data->sync_count_1);
93 P_DEBUG("sync_count_2 = %u\n", mem_data->sync_count_2);
94 P_DEBUG("timestamp = %lX\n", mem_data->timestamp);
95}
96
97/* 72/*
98 * appldata_get_mem_data() 73 * appldata_get_mem_data()
99 * 74 *
@@ -140,9 +115,6 @@ static void appldata_get_mem_data(void *data)
140 115
141 mem_data->timestamp = get_clock(); 116 mem_data->timestamp = get_clock();
142 mem_data->sync_count_2++; 117 mem_data->sync_count_2++;
143#ifdef APPLDATA_DEBUG
144 appldata_debug_print(mem_data);
145#endif
146} 118}
147 119
148 120
@@ -164,17 +136,7 @@ static struct appldata_ops ops = {
164 */ 136 */
165static int __init appldata_mem_init(void) 137static int __init appldata_mem_init(void)
166{ 138{
167 int rc; 139 return appldata_register_ops(&ops);
168
169 P_DEBUG("sizeof(mem) = %lu\n", sizeof(struct appldata_mem_data));
170
171 rc = appldata_register_ops(&ops);
172 if (rc != 0) {
173 P_ERROR("Error registering ops, rc = %i\n", rc);
174 } else {
175 P_DEBUG("%s-ops registered!\n", ops.name);
176 }
177 return rc;
178} 140}
179 141
180/* 142/*
@@ -185,7 +147,6 @@ static int __init appldata_mem_init(void)
185static void __exit appldata_mem_exit(void) 147static void __exit appldata_mem_exit(void)
186{ 148{
187 appldata_unregister_ops(&ops); 149 appldata_unregister_ops(&ops);
188 P_DEBUG("%s-ops unregistered!\n", ops.name);
189} 150}
190 151
191 152
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 4d8344336001..3b746556e1a3 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -21,9 +21,6 @@
21#include "appldata.h" 21#include "appldata.h"
22 22
23 23
24#define MY_PRINT_NAME "appldata_net_sum" /* for debug messages, etc. */
25
26
27/* 24/*
28 * Network data 25 * Network data
29 * 26 *
@@ -60,26 +57,6 @@ static struct appldata_net_sum_data {
60} __attribute__((packed)) appldata_net_sum_data; 57} __attribute__((packed)) appldata_net_sum_data;
61 58
62 59
63static inline void appldata_print_debug(struct appldata_net_sum_data *net_data)
64{
65 P_DEBUG("--- NET - RECORD ---\n");
66
67 P_DEBUG("nr_interfaces = %u\n", net_data->nr_interfaces);
68 P_DEBUG("rx_packets = %8lu\n", net_data->rx_packets);
69 P_DEBUG("tx_packets = %8lu\n", net_data->tx_packets);
70 P_DEBUG("rx_bytes = %8lu\n", net_data->rx_bytes);
71 P_DEBUG("tx_bytes = %8lu\n", net_data->tx_bytes);
72 P_DEBUG("rx_errors = %8lu\n", net_data->rx_errors);
73 P_DEBUG("tx_errors = %8lu\n", net_data->tx_errors);
74 P_DEBUG("rx_dropped = %8lu\n", net_data->rx_dropped);
75 P_DEBUG("tx_dropped = %8lu\n", net_data->tx_dropped);
76 P_DEBUG("collisions = %8lu\n", net_data->collisions);
77
78 P_DEBUG("sync_count_1 = %u\n", net_data->sync_count_1);
79 P_DEBUG("sync_count_2 = %u\n", net_data->sync_count_2);
80 P_DEBUG("timestamp = %lX\n", net_data->timestamp);
81}
82
83/* 60/*
84 * appldata_get_net_sum_data() 61 * appldata_get_net_sum_data()
85 * 62 *
@@ -135,9 +112,6 @@ static void appldata_get_net_sum_data(void *data)
135 112
136 net_data->timestamp = get_clock(); 113 net_data->timestamp = get_clock();
137 net_data->sync_count_2++; 114 net_data->sync_count_2++;
138#ifdef APPLDATA_DEBUG
139 appldata_print_debug(net_data);
140#endif
141} 115}
142 116
143 117
@@ -159,17 +133,7 @@ static struct appldata_ops ops = {
159 */ 133 */
160static int __init appldata_net_init(void) 134static int __init appldata_net_init(void)
161{ 135{
162 int rc; 136 return appldata_register_ops(&ops);
163
164 P_DEBUG("sizeof(net) = %lu\n", sizeof(struct appldata_net_sum_data));
165
166 rc = appldata_register_ops(&ops);
167 if (rc != 0) {
168 P_ERROR("Error registering ops, rc = %i\n", rc);
169 } else {
170 P_DEBUG("%s-ops registered!\n", ops.name);
171 }
172 return rc;
173} 137}
174 138
175/* 139/*
@@ -180,7 +144,6 @@ static int __init appldata_net_init(void)
180static void __exit appldata_net_exit(void) 144static void __exit appldata_net_exit(void)
181{ 145{
182 appldata_unregister_ops(&ops); 146 appldata_unregister_ops(&ops);
183 P_DEBUG("%s-ops unregistered!\n", ops.name);
184} 147}
185 148
186 149
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c
index 6b3eafe10453..eb44f9f8ab91 100644
--- a/arch/s390/appldata/appldata_os.c
+++ b/arch/s390/appldata/appldata_os.c
@@ -89,44 +89,6 @@ static struct appldata_ops ops = {
89}; 89};
90 90
91 91
92static inline void appldata_print_debug(struct appldata_os_data *os_data)
93{
94 int a0, a1, a2, i;
95
96 P_DEBUG("--- OS - RECORD ---\n");
97 P_DEBUG("nr_threads = %u\n", os_data->nr_threads);
98 P_DEBUG("nr_running = %u\n", os_data->nr_running);
99 P_DEBUG("nr_iowait = %u\n", os_data->nr_iowait);
100 P_DEBUG("avenrun(int) = %8x / %8x / %8x\n", os_data->avenrun[0],
101 os_data->avenrun[1], os_data->avenrun[2]);
102 a0 = os_data->avenrun[0];
103 a1 = os_data->avenrun[1];
104 a2 = os_data->avenrun[2];
105 P_DEBUG("avenrun(float) = %d.%02d / %d.%02d / %d.%02d\n",
106 LOAD_INT(a0), LOAD_FRAC(a0), LOAD_INT(a1), LOAD_FRAC(a1),
107 LOAD_INT(a2), LOAD_FRAC(a2));
108
109 P_DEBUG("nr_cpus = %u\n", os_data->nr_cpus);
110 for (i = 0; i < os_data->nr_cpus; i++) {
111 P_DEBUG("cpu%u : user = %u, nice = %u, system = %u, "
112 "idle = %u, irq = %u, softirq = %u, iowait = %u, "
113 "steal = %u\n",
114 os_data->os_cpu[i].cpu_id,
115 os_data->os_cpu[i].per_cpu_user,
116 os_data->os_cpu[i].per_cpu_nice,
117 os_data->os_cpu[i].per_cpu_system,
118 os_data->os_cpu[i].per_cpu_idle,
119 os_data->os_cpu[i].per_cpu_irq,
120 os_data->os_cpu[i].per_cpu_softirq,
121 os_data->os_cpu[i].per_cpu_iowait,
122 os_data->os_cpu[i].per_cpu_steal);
123 }
124
125 P_DEBUG("sync_count_1 = %u\n", os_data->sync_count_1);
126 P_DEBUG("sync_count_2 = %u\n", os_data->sync_count_2);
127 P_DEBUG("timestamp = %lX\n", os_data->timestamp);
128}
129
130/* 92/*
131 * appldata_get_os_data() 93 * appldata_get_os_data()
132 * 94 *
@@ -180,13 +142,10 @@ static void appldata_get_os_data(void *data)
180 APPLDATA_START_INTERVAL_REC, 142 APPLDATA_START_INTERVAL_REC,
181 (unsigned long) ops.data, new_size, 143 (unsigned long) ops.data, new_size,
182 ops.mod_lvl); 144 ops.mod_lvl);
183 if (rc != 0) { 145 if (rc != 0)
184 P_ERROR("os: START NEW DIAG 0xDC failed, " 146 P_ERROR("os: START NEW DIAG 0xDC failed, "
185 "return code: %d, new size = %i\n", rc, 147 "return code: %d, new size = %i\n", rc,
186 new_size); 148 new_size);
187 P_INFO("os: stopping old record now\n");
188 } else
189 P_INFO("os: new record size = %i\n", new_size);
190 149
191 rc = appldata_diag(APPLDATA_RECORD_OS_ID, 150 rc = appldata_diag(APPLDATA_RECORD_OS_ID,
192 APPLDATA_STOP_REC, 151 APPLDATA_STOP_REC,
@@ -204,9 +163,6 @@ static void appldata_get_os_data(void *data)
204 } 163 }
205 os_data->timestamp = get_clock(); 164 os_data->timestamp = get_clock();
206 os_data->sync_count_2++; 165 os_data->sync_count_2++;
207#ifdef APPLDATA_DEBUG
208 appldata_print_debug(os_data);
209#endif
210} 166}
211 167
212 168
@@ -227,12 +183,9 @@ static int __init appldata_os_init(void)
227 rc = -ENOMEM; 183 rc = -ENOMEM;
228 goto out; 184 goto out;
229 } 185 }
230 P_DEBUG("max. sizeof(os) = %i, sizeof(os_cpu) = %lu\n", max_size,
231 sizeof(struct appldata_os_per_cpu));
232 186
233 appldata_os_data = kzalloc(max_size, GFP_DMA); 187 appldata_os_data = kzalloc(max_size, GFP_DMA);
234 if (appldata_os_data == NULL) { 188 if (appldata_os_data == NULL) {
235 P_ERROR("No memory for %s!\n", ops.name);
236 rc = -ENOMEM; 189 rc = -ENOMEM;
237 goto out; 190 goto out;
238 } 191 }
@@ -240,17 +193,12 @@ static int __init appldata_os_init(void)
240 appldata_os_data->per_cpu_size = sizeof(struct appldata_os_per_cpu); 193 appldata_os_data->per_cpu_size = sizeof(struct appldata_os_per_cpu);
241 appldata_os_data->cpu_offset = offsetof(struct appldata_os_data, 194 appldata_os_data->cpu_offset = offsetof(struct appldata_os_data,
242 os_cpu); 195 os_cpu);
243 P_DEBUG("cpu offset = %u\n", appldata_os_data->cpu_offset);
244 196
245 ops.data = appldata_os_data; 197 ops.data = appldata_os_data;
246 ops.callback = &appldata_get_os_data; 198 ops.callback = &appldata_get_os_data;
247 rc = appldata_register_ops(&ops); 199 rc = appldata_register_ops(&ops);
248 if (rc != 0) { 200 if (rc != 0)
249 P_ERROR("Error registering ops, rc = %i\n", rc);
250 kfree(appldata_os_data); 201 kfree(appldata_os_data);
251 } else {
252 P_DEBUG("%s-ops registered!\n", ops.name);
253 }
254out: 202out:
255 return rc; 203 return rc;
256} 204}
@@ -264,7 +212,6 @@ static void __exit appldata_os_exit(void)
264{ 212{
265 appldata_unregister_ops(&ops); 213 appldata_unregister_ops(&ops);
266 kfree(appldata_os_data); 214 kfree(appldata_os_data);
267 P_DEBUG("%s-ops unregistered!\n", ops.name);
268} 215}
269 216
270 217
diff --git a/arch/s390/crypto/crypt_s390.h b/arch/s390/crypto/crypt_s390.h
index 9992f95ef992..0ef9829f2ad6 100644
--- a/arch/s390/crypto/crypt_s390.h
+++ b/arch/s390/crypto/crypt_s390.h
@@ -296,6 +296,10 @@ static inline int crypt_s390_func_available(int func)
296 unsigned char status[16]; 296 unsigned char status[16];
297 int ret; 297 int ret;
298 298
299 /* check if CPACF facility (bit 17) is available */
300 if (!(stfl() & 1ULL << (31 - 17)))
301 return 0;
302
299 switch (func & CRYPT_S390_OP_MASK) { 303 switch (func & CRYPT_S390_OP_MASK) {
300 case CRYPT_S390_KM: 304 case CRYPT_S390_KM:
301 ret = crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0); 305 ret = crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0);
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index 0cfefddd8375..eca724d229ec 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -6,6 +6,7 @@
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/smp_lock.h>
9#include <linux/miscdevice.h> 10#include <linux/miscdevice.h>
10#include <linux/module.h> 11#include <linux/module.h>
11#include <linux/moduleparam.h> 12#include <linux/moduleparam.h>
@@ -48,6 +49,7 @@ static unsigned char parm_block[32] = {
48 49
49static int prng_open(struct inode *inode, struct file *file) 50static int prng_open(struct inode *inode, struct file *file)
50{ 51{
52 cycle_kernel_lock();
51 return nonseekable_open(inode, file); 53 return nonseekable_open(inode, file);
52} 54}
53 55
@@ -185,11 +187,8 @@ static int __init prng_init(void)
185 prng_seed(16); 187 prng_seed(16);
186 188
187 ret = misc_register(&prng_dev); 189 ret = misc_register(&prng_dev);
188 if (ret) { 190 if (ret)
189 printk(KERN_WARNING
190 "Could not register misc device for PRNG.\n");
191 goto out_buf; 191 goto out_buf;
192 }
193 return 0; 192 return 0;
194 193
195out_buf: 194out_buf:
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 4b010ff814c9..7383781f3e6a 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -150,33 +150,24 @@ static ssize_t hypfs_aio_read(struct kiocb *iocb, const struct iovec *iov,
150 unsigned long nr_segs, loff_t offset) 150 unsigned long nr_segs, loff_t offset)
151{ 151{
152 char *data; 152 char *data;
153 size_t len; 153 ssize_t ret;
154 struct file *filp = iocb->ki_filp; 154 struct file *filp = iocb->ki_filp;
155 /* XXX: temporary */ 155 /* XXX: temporary */
156 char __user *buf = iov[0].iov_base; 156 char __user *buf = iov[0].iov_base;
157 size_t count = iov[0].iov_len; 157 size_t count = iov[0].iov_len;
158 158
159 if (nr_segs != 1) { 159 if (nr_segs != 1)
160 count = -EINVAL; 160 return -EINVAL;
161 goto out;
162 }
163 161
164 data = filp->private_data; 162 data = filp->private_data;
165 len = strlen(data); 163 ret = simple_read_from_buffer(buf, count, &offset, data, strlen(data));
166 if (offset > len) { 164 if (ret <= 0)
167 count = 0; 165 return ret;
168 goto out; 166
169 } 167 iocb->ki_pos += ret;
170 if (count > len - offset)
171 count = len - offset;
172 if (copy_to_user(buf, data + offset, count)) {
173 count = -EFAULT;
174 goto out;
175 }
176 iocb->ki_pos += count;
177 file_accessed(filp); 168 file_accessed(filp);
178out: 169
179 return count; 170 return ret;
180} 171}
181static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov, 172static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
182 unsigned long nr_segs, loff_t offset) 173 unsigned long nr_segs, loff_t offset)
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 6302f5082588..50f657e77344 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -7,9 +7,14 @@
7# 7#
8CFLAGS_smp.o := -Wno-nonnull 8CFLAGS_smp.o := -Wno-nonnull
9 9
10#
11# Pass UTS_MACHINE for user_regset definition
12#
13CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
14
10obj-y := bitmap.o traps.o time.o process.o base.o early.o \ 15obj-y := bitmap.o traps.o time.o process.o base.o early.o \
11 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ 16 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
12 s390_ext.o debug.o irq.o ipl.o dis.o diag.o 17 s390_ext.o debug.o irq.o ipl.o dis.o diag.o mem_detect.o
13 18
14obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 19obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
15obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 20obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
@@ -23,7 +28,7 @@ obj-$(CONFIG_AUDIT) += audit.o
23compat-obj-$(CONFIG_AUDIT) += compat_audit.o 28compat-obj-$(CONFIG_AUDIT) += compat_audit.o
24obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \ 29obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \
25 compat_wrapper.o compat_exec_domain.o \ 30 compat_wrapper.o compat_exec_domain.o \
26 binfmt_elf32.o $(compat-obj-y) 31 $(compat-obj-y)
27 32
28obj-$(CONFIG_VIRT_TIMER) += vtime.o 33obj-$(CONFIG_VIRT_TIMER) += vtime.o
29obj-$(CONFIG_STACKTRACE) += stacktrace.o 34obj-$(CONFIG_STACKTRACE) += stacktrace.o
diff --git a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c
deleted file mode 100644
index 3e1c315b736d..000000000000
--- a/arch/s390/kernel/binfmt_elf32.c
+++ /dev/null
@@ -1,214 +0,0 @@
1/*
2 * Support for 32-bit Linux for S390 ELF binaries.
3 *
4 * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Gerhard Tonn (ton@de.ibm.com)
6 *
7 * Heavily inspired by the 32-bit Sparc compat code which is
8 * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com)
9 * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz)
10 */
11
12#define __ASMS390_ELF_H
13
14#include <linux/time.h>
15
16/*
17 * These are used to set parameters in the core dumps.
18 */
19#define ELF_CLASS ELFCLASS32
20#define ELF_DATA ELFDATA2MSB
21#define ELF_ARCH EM_S390
22
23/*
24 * This is used to ensure we don't load something for the wrong architecture.
25 */
26#define elf_check_arch(x) \
27 (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
28 && (x)->e_ident[EI_CLASS] == ELF_CLASS)
29
30/* ELF register definitions */
31#define NUM_GPRS 16
32#define NUM_FPRS 16
33#define NUM_ACRS 16
34
35/* For SVR4/S390 the function pointer to be registered with `atexit` is
36 passed in R14. */
37#define ELF_PLAT_INIT(_r, load_addr) \
38 do { \
39 _r->gprs[14] = 0; \
40 } while(0)
41
42#define USE_ELF_CORE_DUMP
43#define ELF_EXEC_PAGESIZE 4096
44
45/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
46 use of this is to invoke "./ld.so someprog" to test out a new version of
47 the loader. We need to make sure that it is out of the way of the program
48 that it will "exec", and that there is sufficient room for the brk. */
49
50#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
51
52/* Wow, the "main" arch needs arch dependent functions too.. :) */
53
54/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
55 now struct_user_regs, they are different) */
56
57#define ELF_CORE_COPY_REGS(pr_reg, regs) dump_regs32(regs, &pr_reg);
58
59#define ELF_CORE_COPY_TASK_REGS(tsk, regs) dump_task_regs32(tsk, regs)
60
61#define ELF_CORE_COPY_FPREGS(tsk, fpregs) dump_task_fpu(tsk, fpregs)
62
63/* This yields a mask that user programs can use to figure out what
64 instruction set this CPU supports. */
65
66#define ELF_HWCAP (0)
67
68/* This yields a string that ld.so will use to load implementation
69 specific libraries for optimization. This is more specific in
70 intent than poking at uname or /proc/cpuinfo.
71
72 For the moment, we have only optimizations for the Intel generations,
73 but that could change... */
74
75#define ELF_PLATFORM (NULL)
76
77#define SET_PERSONALITY(ex, ibcs2) \
78do { \
79 if (ibcs2) \
80 set_personality(PER_SVR4); \
81 else if (current->personality != PER_LINUX32) \
82 set_personality(PER_LINUX); \
83 set_thread_flag(TIF_31BIT); \
84} while (0)
85
86#include "compat_linux.h"
87
88typedef _s390_fp_regs32 elf_fpregset_t;
89
90typedef struct
91{
92
93 _psw_t32 psw;
94 __u32 gprs[__NUM_GPRS];
95 __u32 acrs[__NUM_ACRS];
96 __u32 orig_gpr2;
97} s390_regs32;
98typedef s390_regs32 elf_gregset_t;
99
100static inline int dump_regs32(struct pt_regs *ptregs, elf_gregset_t *regs)
101{
102 int i;
103
104 memcpy(&regs->psw.mask, &ptregs->psw.mask, 4);
105 memcpy(&regs->psw.addr, (char *)&ptregs->psw.addr + 4, 4);
106 for (i = 0; i < NUM_GPRS; i++)
107 regs->gprs[i] = ptregs->gprs[i];
108 save_access_regs(regs->acrs);
109 regs->orig_gpr2 = ptregs->orig_gpr2;
110 return 1;
111}
112
113static inline int dump_task_regs32(struct task_struct *tsk, elf_gregset_t *regs)
114{
115 struct pt_regs *ptregs = task_pt_regs(tsk);
116 int i;
117
118 memcpy(&regs->psw.mask, &ptregs->psw.mask, 4);
119 memcpy(&regs->psw.addr, (char *)&ptregs->psw.addr + 4, 4);
120 for (i = 0; i < NUM_GPRS; i++)
121 regs->gprs[i] = ptregs->gprs[i];
122 memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs));
123 regs->orig_gpr2 = ptregs->orig_gpr2;
124 return 1;
125}
126
127static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
128{
129 if (tsk == current)
130 save_fp_regs((s390_fp_regs *) fpregs);
131 else
132 memcpy(fpregs, &tsk->thread.fp_regs, sizeof(elf_fpregset_t));
133 return 1;
134}
135
136#include <asm/processor.h>
137#include <asm/pgalloc.h>
138#include <linux/module.h>
139#include <linux/elfcore.h>
140#include <linux/binfmts.h>
141#include <linux/compat.h>
142
143#define elf_prstatus elf_prstatus32
144struct elf_prstatus32
145{
146 struct elf_siginfo pr_info; /* Info associated with signal */
147 short pr_cursig; /* Current signal */
148 u32 pr_sigpend; /* Set of pending signals */
149 u32 pr_sighold; /* Set of held signals */
150 pid_t pr_pid;
151 pid_t pr_ppid;
152 pid_t pr_pgrp;
153 pid_t pr_sid;
154 struct compat_timeval pr_utime; /* User time */
155 struct compat_timeval pr_stime; /* System time */
156 struct compat_timeval pr_cutime; /* Cumulative user time */
157 struct compat_timeval pr_cstime; /* Cumulative system time */
158 elf_gregset_t pr_reg; /* GP registers */
159 int pr_fpvalid; /* True if math co-processor being used. */
160};
161
162#define elf_prpsinfo elf_prpsinfo32
163struct elf_prpsinfo32
164{
165 char pr_state; /* numeric process state */
166 char pr_sname; /* char for pr_state */
167 char pr_zomb; /* zombie */
168 char pr_nice; /* nice val */
169 u32 pr_flag; /* flags */
170 u16 pr_uid;
171 u16 pr_gid;
172 pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
173 /* Lots missing */
174 char pr_fname[16]; /* filename of executable */
175 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
176};
177
178#include <linux/highuid.h>
179
180/*
181#define init_elf_binfmt init_elf32_binfmt
182*/
183
184#undef start_thread
185#define start_thread start_thread31
186
187static inline void start_thread31(struct pt_regs *regs, unsigned long new_psw,
188 unsigned long new_stackp)
189{
190 set_fs(USER_DS);
191 regs->psw.mask = psw_user32_bits;
192 regs->psw.addr = new_psw;
193 regs->gprs[15] = new_stackp;
194 crst_table_downgrade(current->mm, 1UL << 31);
195}
196
197MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries,"
198 " Copyright 2000 IBM Corporation");
199MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>");
200
201#undef MODULE_DESCRIPTION
202#undef MODULE_AUTHOR
203
204#undef cputime_to_timeval
205#define cputime_to_timeval cputime_to_compat_timeval
206static inline void
207cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
208{
209 value->tv_usec = cputime % 1000000;
210 value->tv_sec = cputime / 1000000;
211}
212
213#include "../../../fs/binfmt_elf.c"
214
diff --git a/arch/s390/kernel/compat_ptrace.h b/arch/s390/kernel/compat_ptrace.h
index 419aef913ee1..cde81fa64f89 100644
--- a/arch/s390/kernel/compat_ptrace.h
+++ b/arch/s390/kernel/compat_ptrace.h
@@ -1,7 +1,7 @@
1#ifndef _PTRACE32_H 1#ifndef _PTRACE32_H
2#define _PTRACE32_H 2#define _PTRACE32_H
3 3
4#include "compat_linux.h" /* needed for _psw_t32 */ 4#include "compat_linux.h" /* needed for psw_compat_t */
5 5
6typedef struct { 6typedef struct {
7 __u32 cr[3]; 7 __u32 cr[3];
@@ -38,7 +38,7 @@ typedef struct {
38 38
39struct user_regs_struct32 39struct user_regs_struct32
40{ 40{
41 _psw_t32 psw; 41 psw_compat_t psw;
42 u32 gprs[NUM_GPRS]; 42 u32 gprs[NUM_GPRS];
43 u32 acrs[NUM_ACRS]; 43 u32 acrs[NUM_ACRS];
44 u32 orig_gpr2; 44 u32 orig_gpr2;
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index c93d1296cc0a..d80fcd4a7fe1 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -1079,7 +1079,6 @@ __init debug_init(void)
1079 s390dbf_sysctl_header = register_sysctl_table(s390dbf_dir_table); 1079 s390dbf_sysctl_header = register_sysctl_table(s390dbf_dir_table);
1080 mutex_lock(&debug_mutex); 1080 mutex_lock(&debug_mutex);
1081 debug_debugfs_root_entry = debugfs_create_dir(DEBUG_DIR_ROOT,NULL); 1081 debug_debugfs_root_entry = debugfs_create_dir(DEBUG_DIR_ROOT,NULL);
1082 printk(KERN_INFO "debug: Initialization complete\n");
1083 initialized = 1; 1082 initialized = 1;
1084 mutex_unlock(&debug_mutex); 1083 mutex_unlock(&debug_mutex);
1085 1084
@@ -1193,7 +1192,6 @@ debug_get_uint(char *buf)
1193 for(; isspace(*buf); buf++); 1192 for(; isspace(*buf); buf++);
1194 rc = simple_strtoul(buf, &buf, 10); 1193 rc = simple_strtoul(buf, &buf, 10);
1195 if(*buf){ 1194 if(*buf){
1196 printk("debug: no integer specified!\n");
1197 rc = -EINVAL; 1195 rc = -EINVAL;
1198 } 1196 }
1199 return rc; 1197 return rc;
@@ -1340,19 +1338,12 @@ static void debug_flush(debug_info_t* id, int area)
1340 memset(id->areas[i][j], 0, PAGE_SIZE); 1338 memset(id->areas[i][j], 0, PAGE_SIZE);
1341 } 1339 }
1342 } 1340 }
1343 printk(KERN_INFO "debug: %s: all areas flushed\n",id->name);
1344 } else if(area >= 0 && area < id->nr_areas) { 1341 } else if(area >= 0 && area < id->nr_areas) {
1345 id->active_entries[area] = 0; 1342 id->active_entries[area] = 0;
1346 id->active_pages[area] = 0; 1343 id->active_pages[area] = 0;
1347 for(i = 0; i < id->pages_per_area; i++) { 1344 for(i = 0; i < id->pages_per_area; i++) {
1348 memset(id->areas[area][i],0,PAGE_SIZE); 1345 memset(id->areas[area][i],0,PAGE_SIZE);
1349 } 1346 }
1350 printk(KERN_INFO "debug: %s: area %i has been flushed\n",
1351 id->name, area);
1352 } else {
1353 printk(KERN_INFO
1354 "debug: %s: area %i cannot be flushed (range: %i - %i)\n",
1355 id->name, area, 0, id->nr_areas-1);
1356 } 1347 }
1357 spin_unlock_irqrestore(&id->lock,flags); 1348 spin_unlock_irqrestore(&id->lock,flags);
1358} 1349}
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index d0e09684b9ce..2a2ca268b1dd 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -14,6 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/pfn.h> 15#include <linux/pfn.h>
16#include <linux/uaccess.h> 16#include <linux/uaccess.h>
17#include <asm/ebcdic.h>
17#include <asm/ipl.h> 18#include <asm/ipl.h>
18#include <asm/lowcore.h> 19#include <asm/lowcore.h>
19#include <asm/processor.h> 20#include <asm/processor.h>
@@ -26,12 +27,40 @@
26/* 27/*
27 * Create a Kernel NSS if the SAVESYS= parameter is defined 28 * Create a Kernel NSS if the SAVESYS= parameter is defined
28 */ 29 */
29#define DEFSYS_CMD_SIZE 96 30#define DEFSYS_CMD_SIZE 128
30#define SAVESYS_CMD_SIZE 32 31#define SAVESYS_CMD_SIZE 32
31 32
32char kernel_nss_name[NSS_NAME_SIZE + 1]; 33char kernel_nss_name[NSS_NAME_SIZE + 1];
33 34
35static void __init setup_boot_command_line(void);
36
37
34#ifdef CONFIG_SHARED_KERNEL 38#ifdef CONFIG_SHARED_KERNEL
39int __init savesys_ipl_nss(char *cmd, const int cmdlen);
40
41asm(
42 " .section .init.text,\"ax\",@progbits\n"
43 " .align 4\n"
44 " .type savesys_ipl_nss, @function\n"
45 "savesys_ipl_nss:\n"
46#ifdef CONFIG_64BIT
47 " stmg 6,15,48(15)\n"
48 " lgr 14,3\n"
49 " sam31\n"
50 " diag 2,14,0x8\n"
51 " sam64\n"
52 " lgr 2,14\n"
53 " lmg 6,15,48(15)\n"
54#else
55 " stm 6,15,24(15)\n"
56 " lr 14,3\n"
57 " diag 2,14,0x8\n"
58 " lr 2,14\n"
59 " lm 6,15,24(15)\n"
60#endif
61 " br 14\n"
62 " .size savesys_ipl_nss, .-savesys_ipl_nss\n");
63
35static noinline __init void create_kernel_nss(void) 64static noinline __init void create_kernel_nss(void)
36{ 65{
37 unsigned int i, stext_pfn, eshared_pfn, end_pfn, min_size; 66 unsigned int i, stext_pfn, eshared_pfn, end_pfn, min_size;
@@ -39,6 +68,7 @@ static noinline __init void create_kernel_nss(void)
39 unsigned int sinitrd_pfn, einitrd_pfn; 68 unsigned int sinitrd_pfn, einitrd_pfn;
40#endif 69#endif
41 int response; 70 int response;
71 size_t len;
42 char *savesys_ptr; 72 char *savesys_ptr;
43 char upper_command_line[COMMAND_LINE_SIZE]; 73 char upper_command_line[COMMAND_LINE_SIZE];
44 char defsys_cmd[DEFSYS_CMD_SIZE]; 74 char defsys_cmd[DEFSYS_CMD_SIZE];
@@ -49,8 +79,8 @@ static noinline __init void create_kernel_nss(void)
49 return; 79 return;
50 80
51 /* Convert COMMAND_LINE to upper case */ 81 /* Convert COMMAND_LINE to upper case */
52 for (i = 0; i < strlen(COMMAND_LINE); i++) 82 for (i = 0; i < strlen(boot_command_line); i++)
53 upper_command_line[i] = toupper(COMMAND_LINE[i]); 83 upper_command_line[i] = toupper(boot_command_line[i]);
54 84
55 savesys_ptr = strstr(upper_command_line, "SAVESYS="); 85 savesys_ptr = strstr(upper_command_line, "SAVESYS=");
56 86
@@ -83,7 +113,8 @@ static noinline __init void create_kernel_nss(void)
83 } 113 }
84#endif 114#endif
85 115
86 sprintf(defsys_cmd, "%s EW MINSIZE=%.7iK", defsys_cmd, min_size); 116 sprintf(defsys_cmd, "%s EW MINSIZE=%.7iK PARMREGS=0-13",
117 defsys_cmd, min_size);
87 sprintf(savesys_cmd, "SAVESYS %s \n IPL %s", 118 sprintf(savesys_cmd, "SAVESYS %s \n IPL %s",
88 kernel_nss_name, kernel_nss_name); 119 kernel_nss_name, kernel_nss_name);
89 120
@@ -94,13 +125,24 @@ static noinline __init void create_kernel_nss(void)
94 return; 125 return;
95 } 126 }
96 127
97 __cpcmd(savesys_cmd, NULL, 0, &response); 128 len = strlen(savesys_cmd);
129 ASCEBC(savesys_cmd, len);
130 response = savesys_ipl_nss(savesys_cmd, len);
98 131
99 if (response != strlen(savesys_cmd)) { 132 /* On success: response is equal to the command size,
133 * max SAVESYS_CMD_SIZE
134 * On error: response contains the numeric portion of cp error message.
135 * for SAVESYS it will be >= 263
136 */
137 if (response > SAVESYS_CMD_SIZE) {
100 kernel_nss_name[0] = '\0'; 138 kernel_nss_name[0] = '\0';
101 return; 139 return;
102 } 140 }
103 141
142 /* re-setup boot command line with new ipl vm parms */
143 ipl_update_parameters();
144 setup_boot_command_line();
145
104 ipl_flags = IPL_NSS_VALID; 146 ipl_flags = IPL_NSS_VALID;
105} 147}
106 148
@@ -141,109 +183,11 @@ static noinline __init void detect_machine_type(void)
141 if (cpuinfo->cpu_id.version == 0xff) 183 if (cpuinfo->cpu_id.version == 0xff)
142 machine_flags |= MACHINE_FLAG_VM; 184 machine_flags |= MACHINE_FLAG_VM;
143 185
144 /* Running on a P/390 ? */
145 if (cpuinfo->cpu_id.machine == 0x7490)
146 machine_flags |= MACHINE_FLAG_P390;
147
148 /* Running under KVM ? */ 186 /* Running under KVM ? */
149 if (cpuinfo->cpu_id.version == 0xfe) 187 if (cpuinfo->cpu_id.version == 0xfe)
150 machine_flags |= MACHINE_FLAG_KVM; 188 machine_flags |= MACHINE_FLAG_KVM;
151} 189}
152 190
153#ifdef CONFIG_64BIT
154static noinline __init int memory_fast_detect(void)
155{
156 unsigned long val0 = 0;
157 unsigned long val1 = 0xc;
158 int ret = -ENOSYS;
159
160 if (ipl_flags & IPL_NSS_VALID)
161 return -ENOSYS;
162
163 asm volatile(
164 " diag %1,%2,0x260\n"
165 "0: lhi %0,0\n"
166 "1:\n"
167 EX_TABLE(0b,1b)
168 : "+d" (ret), "+d" (val0), "+d" (val1) : : "cc");
169
170 if (ret || val0 != val1)
171 return -ENOSYS;
172
173 memory_chunk[0].size = val0 + 1;
174 return 0;
175}
176#else
177static inline int memory_fast_detect(void)
178{
179 return -ENOSYS;
180}
181#endif
182
183static inline __init unsigned long __tprot(unsigned long addr)
184{
185 int cc = -1;
186
187 asm volatile(
188 " tprot 0(%1),0\n"
189 "0: ipm %0\n"
190 " srl %0,28\n"
191 "1:\n"
192 EX_TABLE(0b,1b)
193 : "+d" (cc) : "a" (addr) : "cc");
194 return (unsigned long)cc;
195}
196
197/* Checking memory in 128KB increments. */
198#define CHUNK_INCR (1UL << 17)
199#define ADDR2G (1UL << 31)
200
201static noinline __init void find_memory_chunks(unsigned long memsize)
202{
203 unsigned long addr = 0, old_addr = 0;
204 unsigned long old_cc = CHUNK_READ_WRITE;
205 unsigned long cc;
206 int chunk = 0;
207
208 while (chunk < MEMORY_CHUNKS) {
209 cc = __tprot(addr);
210 while (cc == old_cc) {
211 addr += CHUNK_INCR;
212 if (memsize && addr >= memsize)
213 break;
214#ifndef CONFIG_64BIT
215 if (addr == ADDR2G)
216 break;
217#endif
218 cc = __tprot(addr);
219 }
220
221 if (old_addr != addr &&
222 (old_cc == CHUNK_READ_WRITE || old_cc == CHUNK_READ_ONLY)) {
223 memory_chunk[chunk].addr = old_addr;
224 memory_chunk[chunk].size = addr - old_addr;
225 memory_chunk[chunk].type = old_cc;
226 chunk++;
227 }
228
229 old_addr = addr;
230 old_cc = cc;
231
232#ifndef CONFIG_64BIT
233 if (addr == ADDR2G)
234 break;
235#endif
236 /*
237 * Finish memory detection at the first hole
238 * if storage size is unknown.
239 */
240 if (cc == -1UL && !memsize)
241 break;
242 if (memsize && addr >= memsize)
243 break;
244 }
245}
246
247static __init void early_pgm_check_handler(void) 191static __init void early_pgm_check_handler(void)
248{ 192{
249 unsigned long addr; 193 unsigned long addr;
@@ -380,23 +324,61 @@ static __init void detect_machine_facilities(void)
380#endif 324#endif
381} 325}
382 326
327static __init void rescue_initrd(void)
328{
329#ifdef CONFIG_BLK_DEV_INITRD
330 /*
331 * Move the initrd right behind the bss section in case it starts
332 * within the bss section. So we don't overwrite it when the bss
333 * section gets cleared.
334 */
335 if (!INITRD_START || !INITRD_SIZE)
336 return;
337 if (INITRD_START >= (unsigned long) __bss_stop)
338 return;
339 memmove(__bss_stop, (void *) INITRD_START, INITRD_SIZE);
340 INITRD_START = (unsigned long) __bss_stop;
341#endif
342}
343
344/* Set up boot command line */
345static void __init setup_boot_command_line(void)
346{
347 char *parm = NULL;
348
349 /* copy arch command line */
350 strlcpy(boot_command_line, COMMAND_LINE, ARCH_COMMAND_LINE_SIZE);
351 boot_command_line[ARCH_COMMAND_LINE_SIZE - 1] = 0;
352
353 /* append IPL PARM data to the boot command line */
354 if (MACHINE_IS_VM) {
355 parm = boot_command_line + strlen(boot_command_line);
356 *parm++ = ' ';
357 get_ipl_vmparm(parm);
358 if (parm[0] == '=')
359 memmove(boot_command_line, parm + 1, strlen(parm));
360 }
361}
362
363
383/* 364/*
384 * Save ipl parameters, clear bss memory, initialize storage keys 365 * Save ipl parameters, clear bss memory, initialize storage keys
385 * and create a kernel NSS at startup if the SAVESYS= parm is defined 366 * and create a kernel NSS at startup if the SAVESYS= parm is defined
386 */ 367 */
387void __init startup_init(void) 368void __init startup_init(void)
388{ 369{
389 unsigned long long memsize;
390
391 ipl_save_parameters(); 370 ipl_save_parameters();
371 rescue_initrd();
392 clear_bss_section(); 372 clear_bss_section();
393 init_kernel_storage_key(); 373 init_kernel_storage_key();
394 lockdep_init(); 374 lockdep_init();
395 lockdep_off(); 375 lockdep_off();
396 detect_machine_type();
397 create_kernel_nss();
398 sort_main_extable(); 376 sort_main_extable();
399 setup_lowcore_early(); 377 setup_lowcore_early();
378 detect_machine_type();
379 ipl_update_parameters();
380 setup_boot_command_line();
381 create_kernel_nss();
400 detect_mvpg(); 382 detect_mvpg();
401 detect_ieee(); 383 detect_ieee();
402 detect_csp(); 384 detect_csp();
@@ -404,18 +386,7 @@ void __init startup_init(void)
404 detect_diag44(); 386 detect_diag44();
405 detect_machine_facilities(); 387 detect_machine_facilities();
406 setup_hpage(); 388 setup_hpage();
407 sclp_read_info_early();
408 sclp_facilities_detect(); 389 sclp_facilities_detect();
409 memsize = sclp_memory_detect(); 390 detect_memory_layout(memory_chunk);
410#ifndef CONFIG_64BIT
411 /*
412 * Can't deal with more than 2G in 31 bit addressing mode, so
413 * limit the value in order to avoid strange side effects.
414 */
415 if (memsize > ADDR2G)
416 memsize = ADDR2G;
417#endif
418 if (memory_fast_detect() < 0)
419 find_memory_chunks((unsigned long) memsize);
420 lockdep_on(); 391 lockdep_on();
421} 392}
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 532542447d66..54b2779b5e2f 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -14,6 +14,7 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16#include <linux/ctype.h> 16#include <linux/ctype.h>
17#include <linux/fs.h>
17#include <asm/ipl.h> 18#include <asm/ipl.h>
18#include <asm/smp.h> 19#include <asm/smp.h>
19#include <asm/setup.h> 20#include <asm/setup.h>
@@ -22,6 +23,7 @@
22#include <asm/ebcdic.h> 23#include <asm/ebcdic.h>
23#include <asm/reset.h> 24#include <asm/reset.h>
24#include <asm/sclp.h> 25#include <asm/sclp.h>
26#include <asm/setup.h>
25 27
26#define IPL_PARM_BLOCK_VERSION 0 28#define IPL_PARM_BLOCK_VERSION 0
27 29
@@ -121,6 +123,7 @@ enum ipl_method {
121 REIPL_METHOD_FCP_RO_VM, 123 REIPL_METHOD_FCP_RO_VM,
122 REIPL_METHOD_FCP_DUMP, 124 REIPL_METHOD_FCP_DUMP,
123 REIPL_METHOD_NSS, 125 REIPL_METHOD_NSS,
126 REIPL_METHOD_NSS_DIAG,
124 REIPL_METHOD_DEFAULT, 127 REIPL_METHOD_DEFAULT,
125}; 128};
126 129
@@ -134,14 +137,15 @@ enum dump_method {
134 137
135static int diag308_set_works = 0; 138static int diag308_set_works = 0;
136 139
140static struct ipl_parameter_block ipl_block;
141
137static int reipl_capabilities = IPL_TYPE_UNKNOWN; 142static int reipl_capabilities = IPL_TYPE_UNKNOWN;
138 143
139static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN; 144static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN;
140static enum ipl_method reipl_method = REIPL_METHOD_DEFAULT; 145static enum ipl_method reipl_method = REIPL_METHOD_DEFAULT;
141static struct ipl_parameter_block *reipl_block_fcp; 146static struct ipl_parameter_block *reipl_block_fcp;
142static struct ipl_parameter_block *reipl_block_ccw; 147static struct ipl_parameter_block *reipl_block_ccw;
143 148static struct ipl_parameter_block *reipl_block_nss;
144static char reipl_nss_name[NSS_NAME_SIZE + 1];
145 149
146static int dump_capabilities = DUMP_TYPE_NONE; 150static int dump_capabilities = DUMP_TYPE_NONE;
147static enum dump_type dump_type = DUMP_TYPE_NONE; 151static enum dump_type dump_type = DUMP_TYPE_NONE;
@@ -263,6 +267,56 @@ static ssize_t ipl_type_show(struct kobject *kobj, struct kobj_attribute *attr,
263 267
264static struct kobj_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); 268static struct kobj_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type);
265 269
270/* VM IPL PARM routines */
271static void reipl_get_ascii_vmparm(char *dest,
272 const struct ipl_parameter_block *ipb)
273{
274 int i;
275 int len = 0;
276 char has_lowercase = 0;
277
278 if ((ipb->ipl_info.ccw.vm_flags & DIAG308_VM_FLAGS_VP_VALID) &&
279 (ipb->ipl_info.ccw.vm_parm_len > 0)) {
280
281 len = ipb->ipl_info.ccw.vm_parm_len;
282 memcpy(dest, ipb->ipl_info.ccw.vm_parm, len);
283 /* If at least one character is lowercase, we assume mixed
284 * case; otherwise we convert everything to lowercase.
285 */
286 for (i = 0; i < len; i++)
287 if ((dest[i] > 0x80 && dest[i] < 0x8a) || /* a-i */
288 (dest[i] > 0x90 && dest[i] < 0x9a) || /* j-r */
289 (dest[i] > 0xa1 && dest[i] < 0xaa)) { /* s-z */
290 has_lowercase = 1;
291 break;
292 }
293 if (!has_lowercase)
294 EBC_TOLOWER(dest, len);
295 EBCASC(dest, len);
296 }
297 dest[len] = 0;
298}
299
300void get_ipl_vmparm(char *dest)
301{
302 if (diag308_set_works && (ipl_block.hdr.pbt == DIAG308_IPL_TYPE_CCW))
303 reipl_get_ascii_vmparm(dest, &ipl_block);
304 else
305 dest[0] = 0;
306}
307
308static ssize_t ipl_vm_parm_show(struct kobject *kobj,
309 struct kobj_attribute *attr, char *page)
310{
311 char parm[DIAG308_VMPARM_SIZE + 1] = {};
312
313 get_ipl_vmparm(parm);
314 return sprintf(page, "%s\n", parm);
315}
316
317static struct kobj_attribute sys_ipl_vm_parm_attr =
318 __ATTR(parm, S_IRUGO, ipl_vm_parm_show, NULL);
319
266static ssize_t sys_ipl_device_show(struct kobject *kobj, 320static ssize_t sys_ipl_device_show(struct kobject *kobj,
267 struct kobj_attribute *attr, char *page) 321 struct kobj_attribute *attr, char *page)
268{ 322{
@@ -285,14 +339,8 @@ static struct kobj_attribute sys_ipl_device_attr =
285static ssize_t ipl_parameter_read(struct kobject *kobj, struct bin_attribute *attr, 339static ssize_t ipl_parameter_read(struct kobject *kobj, struct bin_attribute *attr,
286 char *buf, loff_t off, size_t count) 340 char *buf, loff_t off, size_t count)
287{ 341{
288 unsigned int size = IPL_PARMBLOCK_SIZE; 342 return memory_read_from_buffer(buf, count, &off, IPL_PARMBLOCK_START,
289 343 IPL_PARMBLOCK_SIZE);
290 if (off > size)
291 return 0;
292 if (off + count > size)
293 count = size - off;
294 memcpy(buf, (void *)IPL_PARMBLOCK_START + off, count);
295 return count;
296} 344}
297 345
298static struct bin_attribute ipl_parameter_attr = { 346static struct bin_attribute ipl_parameter_attr = {
@@ -310,12 +358,7 @@ static ssize_t ipl_scp_data_read(struct kobject *kobj, struct bin_attribute *att
310 unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len; 358 unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len;
311 void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data; 359 void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data;
312 360
313 if (off > size) 361 return memory_read_from_buffer(buf, count, &off, scp_data, size);
314 return 0;
315 if (off + count > size)
316 count = size - off;
317 memcpy(buf, scp_data + off, count);
318 return count;
319} 362}
320 363
321static struct bin_attribute ipl_scp_data_attr = { 364static struct bin_attribute ipl_scp_data_attr = {
@@ -370,15 +413,27 @@ static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj,
370static struct kobj_attribute sys_ipl_ccw_loadparm_attr = 413static struct kobj_attribute sys_ipl_ccw_loadparm_attr =
371 __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL); 414 __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL);
372 415
373static struct attribute *ipl_ccw_attrs[] = { 416static struct attribute *ipl_ccw_attrs_vm[] = {
374 &sys_ipl_type_attr.attr, 417 &sys_ipl_type_attr.attr,
375 &sys_ipl_device_attr.attr, 418 &sys_ipl_device_attr.attr,
376 &sys_ipl_ccw_loadparm_attr.attr, 419 &sys_ipl_ccw_loadparm_attr.attr,
420 &sys_ipl_vm_parm_attr.attr,
377 NULL, 421 NULL,
378}; 422};
379 423
380static struct attribute_group ipl_ccw_attr_group = { 424static struct attribute *ipl_ccw_attrs_lpar[] = {
381 .attrs = ipl_ccw_attrs, 425 &sys_ipl_type_attr.attr,
426 &sys_ipl_device_attr.attr,
427 &sys_ipl_ccw_loadparm_attr.attr,
428 NULL,
429};
430
431static struct attribute_group ipl_ccw_attr_group_vm = {
432 .attrs = ipl_ccw_attrs_vm,
433};
434
435static struct attribute_group ipl_ccw_attr_group_lpar = {
436 .attrs = ipl_ccw_attrs_lpar
382}; 437};
383 438
384/* NSS ipl device attributes */ 439/* NSS ipl device attributes */
@@ -388,6 +443,8 @@ DEFINE_IPL_ATTR_RO(ipl_nss, name, "%s\n", kernel_nss_name);
388static struct attribute *ipl_nss_attrs[] = { 443static struct attribute *ipl_nss_attrs[] = {
389 &sys_ipl_type_attr.attr, 444 &sys_ipl_type_attr.attr,
390 &sys_ipl_nss_name_attr.attr, 445 &sys_ipl_nss_name_attr.attr,
446 &sys_ipl_ccw_loadparm_attr.attr,
447 &sys_ipl_vm_parm_attr.attr,
391 NULL, 448 NULL,
392}; 449};
393 450
@@ -450,7 +507,12 @@ static int __init ipl_init(void)
450 } 507 }
451 switch (ipl_info.type) { 508 switch (ipl_info.type) {
452 case IPL_TYPE_CCW: 509 case IPL_TYPE_CCW:
453 rc = sysfs_create_group(&ipl_kset->kobj, &ipl_ccw_attr_group); 510 if (MACHINE_IS_VM)
511 rc = sysfs_create_group(&ipl_kset->kobj,
512 &ipl_ccw_attr_group_vm);
513 else
514 rc = sysfs_create_group(&ipl_kset->kobj,
515 &ipl_ccw_attr_group_lpar);
454 break; 516 break;
455 case IPL_TYPE_FCP: 517 case IPL_TYPE_FCP:
456 case IPL_TYPE_FCP_DUMP: 518 case IPL_TYPE_FCP_DUMP:
@@ -481,6 +543,83 @@ static struct shutdown_action __refdata ipl_action = {
481 * reipl shutdown action: Reboot Linux on shutdown. 543 * reipl shutdown action: Reboot Linux on shutdown.
482 */ 544 */
483 545
546/* VM IPL PARM attributes */
547static ssize_t reipl_generic_vmparm_show(struct ipl_parameter_block *ipb,
548 char *page)
549{
550 char vmparm[DIAG308_VMPARM_SIZE + 1] = {};
551
552 reipl_get_ascii_vmparm(vmparm, ipb);
553 return sprintf(page, "%s\n", vmparm);
554}
555
556static ssize_t reipl_generic_vmparm_store(struct ipl_parameter_block *ipb,
557 size_t vmparm_max,
558 const char *buf, size_t len)
559{
560 int i, ip_len;
561
562 /* ignore trailing newline */
563 ip_len = len;
564 if ((len > 0) && (buf[len - 1] == '\n'))
565 ip_len--;
566
567 if (ip_len > vmparm_max)
568 return -EINVAL;
569
570 /* parm is used to store kernel options, check for common chars */
571 for (i = 0; i < ip_len; i++)
572 if (!(isalnum(buf[i]) || isascii(buf[i]) || isprint(buf[i])))
573 return -EINVAL;
574
575 memset(ipb->ipl_info.ccw.vm_parm, 0, DIAG308_VMPARM_SIZE);
576 ipb->ipl_info.ccw.vm_parm_len = ip_len;
577 if (ip_len > 0) {
578 ipb->ipl_info.ccw.vm_flags |= DIAG308_VM_FLAGS_VP_VALID;
579 memcpy(ipb->ipl_info.ccw.vm_parm, buf, ip_len);
580 ASCEBC(ipb->ipl_info.ccw.vm_parm, ip_len);
581 } else {
582 ipb->ipl_info.ccw.vm_flags &= ~DIAG308_VM_FLAGS_VP_VALID;
583 }
584
585 return len;
586}
587
588/* NSS wrapper */
589static ssize_t reipl_nss_vmparm_show(struct kobject *kobj,
590 struct kobj_attribute *attr, char *page)
591{
592 return reipl_generic_vmparm_show(reipl_block_nss, page);
593}
594
595static ssize_t reipl_nss_vmparm_store(struct kobject *kobj,
596 struct kobj_attribute *attr,
597 const char *buf, size_t len)
598{
599 return reipl_generic_vmparm_store(reipl_block_nss, 56, buf, len);
600}
601
602/* CCW wrapper */
603static ssize_t reipl_ccw_vmparm_show(struct kobject *kobj,
604 struct kobj_attribute *attr, char *page)
605{
606 return reipl_generic_vmparm_show(reipl_block_ccw, page);
607}
608
609static ssize_t reipl_ccw_vmparm_store(struct kobject *kobj,
610 struct kobj_attribute *attr,
611 const char *buf, size_t len)
612{
613 return reipl_generic_vmparm_store(reipl_block_ccw, 64, buf, len);
614}
615
616static struct kobj_attribute sys_reipl_nss_vmparm_attr =
617 __ATTR(parm, S_IRUGO | S_IWUSR, reipl_nss_vmparm_show,
618 reipl_nss_vmparm_store);
619static struct kobj_attribute sys_reipl_ccw_vmparm_attr =
620 __ATTR(parm, S_IRUGO | S_IWUSR, reipl_ccw_vmparm_show,
621 reipl_ccw_vmparm_store);
622
484/* FCP reipl device attributes */ 623/* FCP reipl device attributes */
485 624
486DEFINE_IPL_ATTR_RW(reipl_fcp, wwpn, "0x%016llx\n", "%016llx\n", 625DEFINE_IPL_ATTR_RW(reipl_fcp, wwpn, "0x%016llx\n", "%016llx\n",
@@ -513,27 +652,26 @@ static struct attribute_group reipl_fcp_attr_group = {
513DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n", 652DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
514 reipl_block_ccw->ipl_info.ccw.devno); 653 reipl_block_ccw->ipl_info.ccw.devno);
515 654
516static void reipl_get_ascii_loadparm(char *loadparm) 655static void reipl_get_ascii_loadparm(char *loadparm,
656 struct ipl_parameter_block *ibp)
517{ 657{
518 memcpy(loadparm, &reipl_block_ccw->ipl_info.ccw.load_param, 658 memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN);
519 LOADPARM_LEN);
520 EBCASC(loadparm, LOADPARM_LEN); 659 EBCASC(loadparm, LOADPARM_LEN);
521 loadparm[LOADPARM_LEN] = 0; 660 loadparm[LOADPARM_LEN] = 0;
522 strstrip(loadparm); 661 strstrip(loadparm);
523} 662}
524 663
525static ssize_t reipl_ccw_loadparm_show(struct kobject *kobj, 664static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb,
526 struct kobj_attribute *attr, char *page) 665 char *page)
527{ 666{
528 char buf[LOADPARM_LEN + 1]; 667 char buf[LOADPARM_LEN + 1];
529 668
530 reipl_get_ascii_loadparm(buf); 669 reipl_get_ascii_loadparm(buf, ipb);
531 return sprintf(page, "%s\n", buf); 670 return sprintf(page, "%s\n", buf);
532} 671}
533 672
534static ssize_t reipl_ccw_loadparm_store(struct kobject *kobj, 673static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb,
535 struct kobj_attribute *attr, 674 const char *buf, size_t len)
536 const char *buf, size_t len)
537{ 675{
538 int i, lp_len; 676 int i, lp_len;
539 677
@@ -552,35 +690,128 @@ static ssize_t reipl_ccw_loadparm_store(struct kobject *kobj,
552 return -EINVAL; 690 return -EINVAL;
553 } 691 }
554 /* initialize loadparm with blanks */ 692 /* initialize loadparm with blanks */
555 memset(&reipl_block_ccw->ipl_info.ccw.load_param, ' ', LOADPARM_LEN); 693 memset(ipb->ipl_info.ccw.load_parm, ' ', LOADPARM_LEN);
556 /* copy and convert to ebcdic */ 694 /* copy and convert to ebcdic */
557 memcpy(&reipl_block_ccw->ipl_info.ccw.load_param, buf, lp_len); 695 memcpy(ipb->ipl_info.ccw.load_parm, buf, lp_len);
558 ASCEBC(reipl_block_ccw->ipl_info.ccw.load_param, LOADPARM_LEN); 696 ASCEBC(ipb->ipl_info.ccw.load_parm, LOADPARM_LEN);
559 return len; 697 return len;
560} 698}
561 699
700/* NSS wrapper */
701static ssize_t reipl_nss_loadparm_show(struct kobject *kobj,
702 struct kobj_attribute *attr, char *page)
703{
704 return reipl_generic_loadparm_show(reipl_block_nss, page);
705}
706
707static ssize_t reipl_nss_loadparm_store(struct kobject *kobj,
708 struct kobj_attribute *attr,
709 const char *buf, size_t len)
710{
711 return reipl_generic_loadparm_store(reipl_block_nss, buf, len);
712}
713
714/* CCW wrapper */
715static ssize_t reipl_ccw_loadparm_show(struct kobject *kobj,
716 struct kobj_attribute *attr, char *page)
717{
718 return reipl_generic_loadparm_show(reipl_block_ccw, page);
719}
720
721static ssize_t reipl_ccw_loadparm_store(struct kobject *kobj,
722 struct kobj_attribute *attr,
723 const char *buf, size_t len)
724{
725 return reipl_generic_loadparm_store(reipl_block_ccw, buf, len);
726}
727
562static struct kobj_attribute sys_reipl_ccw_loadparm_attr = 728static struct kobj_attribute sys_reipl_ccw_loadparm_attr =
563 __ATTR(loadparm, 0644, reipl_ccw_loadparm_show, 729 __ATTR(loadparm, S_IRUGO | S_IWUSR, reipl_ccw_loadparm_show,
564 reipl_ccw_loadparm_store); 730 reipl_ccw_loadparm_store);
565 731
566static struct attribute *reipl_ccw_attrs[] = { 732static struct attribute *reipl_ccw_attrs_vm[] = {
567 &sys_reipl_ccw_device_attr.attr, 733 &sys_reipl_ccw_device_attr.attr,
568 &sys_reipl_ccw_loadparm_attr.attr, 734 &sys_reipl_ccw_loadparm_attr.attr,
735 &sys_reipl_ccw_vmparm_attr.attr,
569 NULL, 736 NULL,
570}; 737};
571 738
572static struct attribute_group reipl_ccw_attr_group = { 739static struct attribute *reipl_ccw_attrs_lpar[] = {
740 &sys_reipl_ccw_device_attr.attr,
741 &sys_reipl_ccw_loadparm_attr.attr,
742 NULL,
743};
744
745static struct attribute_group reipl_ccw_attr_group_vm = {
746 .name = IPL_CCW_STR,
747 .attrs = reipl_ccw_attrs_vm,
748};
749
750static struct attribute_group reipl_ccw_attr_group_lpar = {
573 .name = IPL_CCW_STR, 751 .name = IPL_CCW_STR,
574 .attrs = reipl_ccw_attrs, 752 .attrs = reipl_ccw_attrs_lpar,
575}; 753};
576 754
577 755
578/* NSS reipl device attributes */ 756/* NSS reipl device attributes */
757static void reipl_get_ascii_nss_name(char *dst,
758 struct ipl_parameter_block *ipb)
759{
760 memcpy(dst, ipb->ipl_info.ccw.nss_name, NSS_NAME_SIZE);
761 EBCASC(dst, NSS_NAME_SIZE);
762 dst[NSS_NAME_SIZE] = 0;
763}
764
765static ssize_t reipl_nss_name_show(struct kobject *kobj,
766 struct kobj_attribute *attr, char *page)
767{
768 char nss_name[NSS_NAME_SIZE + 1] = {};
579 769
580DEFINE_IPL_ATTR_STR_RW(reipl_nss, name, "%s\n", "%s\n", reipl_nss_name); 770 reipl_get_ascii_nss_name(nss_name, reipl_block_nss);
771 return sprintf(page, "%s\n", nss_name);
772}
773
774static ssize_t reipl_nss_name_store(struct kobject *kobj,
775 struct kobj_attribute *attr,
776 const char *buf, size_t len)
777{
778 int nss_len;
779
780 /* ignore trailing newline */
781 nss_len = len;
782 if ((len > 0) && (buf[len - 1] == '\n'))
783 nss_len--;
784
785 if (nss_len > NSS_NAME_SIZE)
786 return -EINVAL;
787
788 memset(reipl_block_nss->ipl_info.ccw.nss_name, 0x40, NSS_NAME_SIZE);
789 if (nss_len > 0) {
790 reipl_block_nss->ipl_info.ccw.vm_flags |=
791 DIAG308_VM_FLAGS_NSS_VALID;
792 memcpy(reipl_block_nss->ipl_info.ccw.nss_name, buf, nss_len);
793 ASCEBC(reipl_block_nss->ipl_info.ccw.nss_name, nss_len);
794 EBC_TOUPPER(reipl_block_nss->ipl_info.ccw.nss_name, nss_len);
795 } else {
796 reipl_block_nss->ipl_info.ccw.vm_flags &=
797 ~DIAG308_VM_FLAGS_NSS_VALID;
798 }
799
800 return len;
801}
802
803static struct kobj_attribute sys_reipl_nss_name_attr =
804 __ATTR(name, S_IRUGO | S_IWUSR, reipl_nss_name_show,
805 reipl_nss_name_store);
806
807static struct kobj_attribute sys_reipl_nss_loadparm_attr =
808 __ATTR(loadparm, S_IRUGO | S_IWUSR, reipl_nss_loadparm_show,
809 reipl_nss_loadparm_store);
581 810
582static struct attribute *reipl_nss_attrs[] = { 811static struct attribute *reipl_nss_attrs[] = {
583 &sys_reipl_nss_name_attr.attr, 812 &sys_reipl_nss_name_attr.attr,
813 &sys_reipl_nss_loadparm_attr.attr,
814 &sys_reipl_nss_vmparm_attr.attr,
584 NULL, 815 NULL,
585}; 816};
586 817
@@ -617,7 +848,10 @@ static int reipl_set_type(enum ipl_type type)
617 reipl_method = REIPL_METHOD_FCP_DUMP; 848 reipl_method = REIPL_METHOD_FCP_DUMP;
618 break; 849 break;
619 case IPL_TYPE_NSS: 850 case IPL_TYPE_NSS:
620 reipl_method = REIPL_METHOD_NSS; 851 if (diag308_set_works)
852 reipl_method = REIPL_METHOD_NSS_DIAG;
853 else
854 reipl_method = REIPL_METHOD_NSS;
621 break; 855 break;
622 case IPL_TYPE_UNKNOWN: 856 case IPL_TYPE_UNKNOWN:
623 reipl_method = REIPL_METHOD_DEFAULT; 857 reipl_method = REIPL_METHOD_DEFAULT;
@@ -655,11 +889,38 @@ static struct kobj_attribute reipl_type_attr =
655 889
656static struct kset *reipl_kset; 890static struct kset *reipl_kset;
657 891
892static void get_ipl_string(char *dst, struct ipl_parameter_block *ipb,
893 const enum ipl_method m)
894{
895 char loadparm[LOADPARM_LEN + 1] = {};
896 char vmparm[DIAG308_VMPARM_SIZE + 1] = {};
897 char nss_name[NSS_NAME_SIZE + 1] = {};
898 size_t pos = 0;
899
900 reipl_get_ascii_loadparm(loadparm, ipb);
901 reipl_get_ascii_nss_name(nss_name, ipb);
902 reipl_get_ascii_vmparm(vmparm, ipb);
903
904 switch (m) {
905 case REIPL_METHOD_CCW_VM:
906 pos = sprintf(dst, "IPL %X CLEAR", ipb->ipl_info.ccw.devno);
907 break;
908 case REIPL_METHOD_NSS:
909 pos = sprintf(dst, "IPL %s", nss_name);
910 break;
911 default:
912 break;
913 }
914 if (strlen(loadparm) > 0)
915 pos += sprintf(dst + pos, " LOADPARM '%s'", loadparm);
916 if (strlen(vmparm) > 0)
917 sprintf(dst + pos, " PARM %s", vmparm);
918}
919
658static void reipl_run(struct shutdown_trigger *trigger) 920static void reipl_run(struct shutdown_trigger *trigger)
659{ 921{
660 struct ccw_dev_id devid; 922 struct ccw_dev_id devid;
661 static char buf[100]; 923 static char buf[128];
662 char loadparm[LOADPARM_LEN + 1];
663 924
664 switch (reipl_method) { 925 switch (reipl_method) {
665 case REIPL_METHOD_CCW_CIO: 926 case REIPL_METHOD_CCW_CIO:
@@ -668,13 +929,7 @@ static void reipl_run(struct shutdown_trigger *trigger)
668 reipl_ccw_dev(&devid); 929 reipl_ccw_dev(&devid);
669 break; 930 break;
670 case REIPL_METHOD_CCW_VM: 931 case REIPL_METHOD_CCW_VM:
671 reipl_get_ascii_loadparm(loadparm); 932 get_ipl_string(buf, reipl_block_ccw, REIPL_METHOD_CCW_VM);
672 if (strlen(loadparm) == 0)
673 sprintf(buf, "IPL %X CLEAR",
674 reipl_block_ccw->ipl_info.ccw.devno);
675 else
676 sprintf(buf, "IPL %X CLEAR LOADPARM '%s'",
677 reipl_block_ccw->ipl_info.ccw.devno, loadparm);
678 __cpcmd(buf, NULL, 0, NULL); 933 __cpcmd(buf, NULL, 0, NULL);
679 break; 934 break;
680 case REIPL_METHOD_CCW_DIAG: 935 case REIPL_METHOD_CCW_DIAG:
@@ -691,8 +946,12 @@ static void reipl_run(struct shutdown_trigger *trigger)
691 case REIPL_METHOD_FCP_RO_VM: 946 case REIPL_METHOD_FCP_RO_VM:
692 __cpcmd("IPL", NULL, 0, NULL); 947 __cpcmd("IPL", NULL, 0, NULL);
693 break; 948 break;
949 case REIPL_METHOD_NSS_DIAG:
950 diag308(DIAG308_SET, reipl_block_nss);
951 diag308(DIAG308_IPL, NULL);
952 break;
694 case REIPL_METHOD_NSS: 953 case REIPL_METHOD_NSS:
695 sprintf(buf, "IPL %s", reipl_nss_name); 954 get_ipl_string(buf, reipl_block_nss, REIPL_METHOD_NSS);
696 __cpcmd(buf, NULL, 0, NULL); 955 __cpcmd(buf, NULL, 0, NULL);
697 break; 956 break;
698 case REIPL_METHOD_DEFAULT: 957 case REIPL_METHOD_DEFAULT:
@@ -707,16 +966,36 @@ static void reipl_run(struct shutdown_trigger *trigger)
707 disabled_wait((unsigned long) __builtin_return_address(0)); 966 disabled_wait((unsigned long) __builtin_return_address(0));
708} 967}
709 968
710static void __init reipl_probe(void) 969static void reipl_block_ccw_init(struct ipl_parameter_block *ipb)
711{ 970{
712 void *buffer; 971 ipb->hdr.len = IPL_PARM_BLK_CCW_LEN;
972 ipb->hdr.version = IPL_PARM_BLOCK_VERSION;
973 ipb->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN;
974 ipb->hdr.pbt = DIAG308_IPL_TYPE_CCW;
975}
713 976
714 buffer = (void *) get_zeroed_page(GFP_KERNEL); 977static void reipl_block_ccw_fill_parms(struct ipl_parameter_block *ipb)
715 if (!buffer) 978{
716 return; 979 /* LOADPARM */
717 if (diag308(DIAG308_STORE, buffer) == DIAG308_RC_OK) 980 /* check if read scp info worked and set loadparm */
718 diag308_set_works = 1; 981 if (sclp_ipl_info.is_valid)
719 free_page((unsigned long)buffer); 982 memcpy(ipb->ipl_info.ccw.load_parm,
983 &sclp_ipl_info.loadparm, LOADPARM_LEN);
984 else
985 /* read scp info failed: set empty loadparm (EBCDIC blanks) */
986 memset(ipb->ipl_info.ccw.load_parm, 0x40, LOADPARM_LEN);
987 ipb->hdr.flags = DIAG308_FLAGS_LP_VALID;
988
989 /* VM PARM */
990 if (MACHINE_IS_VM && diag308_set_works &&
991 (ipl_block.ipl_info.ccw.vm_flags & DIAG308_VM_FLAGS_VP_VALID)) {
992
993 ipb->ipl_info.ccw.vm_flags |= DIAG308_VM_FLAGS_VP_VALID;
994 ipb->ipl_info.ccw.vm_parm_len =
995 ipl_block.ipl_info.ccw.vm_parm_len;
996 memcpy(ipb->ipl_info.ccw.vm_parm,
997 ipl_block.ipl_info.ccw.vm_parm, DIAG308_VMPARM_SIZE);
998 }
720} 999}
721 1000
722static int __init reipl_nss_init(void) 1001static int __init reipl_nss_init(void)
@@ -725,10 +1004,31 @@ static int __init reipl_nss_init(void)
725 1004
726 if (!MACHINE_IS_VM) 1005 if (!MACHINE_IS_VM)
727 return 0; 1006 return 0;
1007
1008 reipl_block_nss = (void *) get_zeroed_page(GFP_KERNEL);
1009 if (!reipl_block_nss)
1010 return -ENOMEM;
1011
1012 if (!diag308_set_works)
1013 sys_reipl_nss_vmparm_attr.attr.mode = S_IRUGO;
1014
728 rc = sysfs_create_group(&reipl_kset->kobj, &reipl_nss_attr_group); 1015 rc = sysfs_create_group(&reipl_kset->kobj, &reipl_nss_attr_group);
729 if (rc) 1016 if (rc)
730 return rc; 1017 return rc;
731 strncpy(reipl_nss_name, kernel_nss_name, NSS_NAME_SIZE + 1); 1018
1019 reipl_block_ccw_init(reipl_block_nss);
1020 if (ipl_info.type == IPL_TYPE_NSS) {
1021 memset(reipl_block_nss->ipl_info.ccw.nss_name,
1022 ' ', NSS_NAME_SIZE);
1023 memcpy(reipl_block_nss->ipl_info.ccw.nss_name,
1024 kernel_nss_name, strlen(kernel_nss_name));
1025 ASCEBC(reipl_block_nss->ipl_info.ccw.nss_name, NSS_NAME_SIZE);
1026 reipl_block_nss->ipl_info.ccw.vm_flags |=
1027 DIAG308_VM_FLAGS_NSS_VALID;
1028
1029 reipl_block_ccw_fill_parms(reipl_block_nss);
1030 }
1031
732 reipl_capabilities |= IPL_TYPE_NSS; 1032 reipl_capabilities |= IPL_TYPE_NSS;
733 return 0; 1033 return 0;
734} 1034}
@@ -740,28 +1040,27 @@ static int __init reipl_ccw_init(void)
740 reipl_block_ccw = (void *) get_zeroed_page(GFP_KERNEL); 1040 reipl_block_ccw = (void *) get_zeroed_page(GFP_KERNEL);
741 if (!reipl_block_ccw) 1041 if (!reipl_block_ccw)
742 return -ENOMEM; 1042 return -ENOMEM;
743 rc = sysfs_create_group(&reipl_kset->kobj, &reipl_ccw_attr_group); 1043
744 if (rc) { 1044 if (MACHINE_IS_VM) {
745 free_page((unsigned long)reipl_block_ccw); 1045 if (!diag308_set_works)
746 return rc; 1046 sys_reipl_ccw_vmparm_attr.attr.mode = S_IRUGO;
1047 rc = sysfs_create_group(&reipl_kset->kobj,
1048 &reipl_ccw_attr_group_vm);
1049 } else {
1050 if(!diag308_set_works)
1051 sys_reipl_ccw_loadparm_attr.attr.mode = S_IRUGO;
1052 rc = sysfs_create_group(&reipl_kset->kobj,
1053 &reipl_ccw_attr_group_lpar);
747 } 1054 }
748 reipl_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN; 1055 if (rc)
749 reipl_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION; 1056 return rc;
750 reipl_block_ccw->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN; 1057
751 reipl_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW; 1058 reipl_block_ccw_init(reipl_block_ccw);
752 reipl_block_ccw->hdr.flags = DIAG308_FLAGS_LP_VALID; 1059 if (ipl_info.type == IPL_TYPE_CCW) {
753 /* check if read scp info worked and set loadparm */
754 if (sclp_ipl_info.is_valid)
755 memcpy(reipl_block_ccw->ipl_info.ccw.load_param,
756 &sclp_ipl_info.loadparm, LOADPARM_LEN);
757 else
758 /* read scp info failed: set empty loadparm (EBCDIC blanks) */
759 memset(reipl_block_ccw->ipl_info.ccw.load_param, 0x40,
760 LOADPARM_LEN);
761 if (!MACHINE_IS_VM && !diag308_set_works)
762 sys_reipl_ccw_loadparm_attr.attr.mode = S_IRUGO;
763 if (ipl_info.type == IPL_TYPE_CCW)
764 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno; 1060 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno;
1061 reipl_block_ccw_fill_parms(reipl_block_ccw);
1062 }
1063
765 reipl_capabilities |= IPL_TYPE_CCW; 1064 reipl_capabilities |= IPL_TYPE_CCW;
766 return 0; 1065 return 0;
767} 1066}
@@ -1298,7 +1597,6 @@ static void __init shutdown_actions_init(void)
1298 1597
1299static int __init s390_ipl_init(void) 1598static int __init s390_ipl_init(void)
1300{ 1599{
1301 reipl_probe();
1302 sclp_get_ipl_info(&sclp_ipl_info); 1600 sclp_get_ipl_info(&sclp_ipl_info);
1303 shutdown_actions_init(); 1601 shutdown_actions_init();
1304 shutdown_triggers_init(); 1602 shutdown_triggers_init();
@@ -1405,6 +1703,12 @@ void __init setup_ipl(void)
1405 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb); 1703 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
1406} 1704}
1407 1705
1706void __init ipl_update_parameters(void)
1707{
1708 if (diag308(DIAG308_STORE, &ipl_block) == DIAG308_RC_OK)
1709 diag308_set_works = 1;
1710}
1711
1408void __init ipl_save_parameters(void) 1712void __init ipl_save_parameters(void)
1409{ 1713{
1410 struct cio_iplinfo iplinfo; 1714 struct cio_iplinfo iplinfo;
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index ed04d1372d5d..288ad490a6dd 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -41,10 +41,8 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
41 if (is_prohibited_opcode((kprobe_opcode_t *) p->addr)) 41 if (is_prohibited_opcode((kprobe_opcode_t *) p->addr))
42 return -EINVAL; 42 return -EINVAL;
43 43
44 if ((unsigned long)p->addr & 0x01) { 44 if ((unsigned long)p->addr & 0x01)
45 printk("Attempt to register kprobe at an unaligned address\n");
46 return -EINVAL; 45 return -EINVAL;
47 }
48 46
49 /* Use the get_insn_slot() facility for correctness */ 47 /* Use the get_insn_slot() facility for correctness */
50 if (!(p->ainsn.insn = get_insn_slot())) 48 if (!(p->ainsn.insn = get_insn_slot()))
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 3c77dd36994c..131d7ee8b416 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -52,7 +52,6 @@ void machine_kexec_cleanup(struct kimage *image)
52 52
53void machine_shutdown(void) 53void machine_shutdown(void)
54{ 54{
55 printk(KERN_INFO "kexec: machine_shutdown called\n");
56} 55}
57 56
58void machine_kexec(struct kimage *image) 57void machine_kexec(struct kimage *image)
diff --git a/arch/s390/kernel/mem_detect.c b/arch/s390/kernel/mem_detect.c
new file mode 100644
index 000000000000..18ed7abe16c5
--- /dev/null
+++ b/arch/s390/kernel/mem_detect.c
@@ -0,0 +1,100 @@
1/*
2 * Copyright IBM Corp. 2008
3 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
4 */
5
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <asm/ipl.h>
9#include <asm/sclp.h>
10#include <asm/setup.h>
11
12static int memory_fast_detect(struct mem_chunk *chunk)
13{
14 unsigned long val0 = 0;
15 unsigned long val1 = 0xc;
16 int rc = -EOPNOTSUPP;
17
18 if (ipl_flags & IPL_NSS_VALID)
19 return -EOPNOTSUPP;
20 asm volatile(
21 " diag %1,%2,0x260\n"
22 "0: lhi %0,0\n"
23 "1:\n"
24 EX_TABLE(0b,1b)
25 : "+d" (rc), "+d" (val0), "+d" (val1) : : "cc");
26
27 if (rc || val0 != val1)
28 return -EOPNOTSUPP;
29 chunk->size = val0 + 1;
30 return 0;
31}
32
33static inline int tprot(unsigned long addr)
34{
35 int rc = -EFAULT;
36
37 asm volatile(
38 " tprot 0(%1),0\n"
39 "0: ipm %0\n"
40 " srl %0,28\n"
41 "1:\n"
42 EX_TABLE(0b,1b)
43 : "+d" (rc) : "a" (addr) : "cc");
44 return rc;
45}
46
47#define ADDR2G (1ULL << 31)
48
49static void find_memory_chunks(struct mem_chunk chunk[])
50{
51 unsigned long long memsize, rnmax, rzm;
52 unsigned long addr = 0, size;
53 int i = 0, type;
54
55 rzm = sclp_get_rzm();
56 rnmax = sclp_get_rnmax();
57 memsize = rzm * rnmax;
58 if (!rzm)
59 rzm = 1ULL << 17;
60 if (sizeof(long) == 4) {
61 rzm = min(ADDR2G, rzm);
62 memsize = memsize ? min(ADDR2G, memsize) : ADDR2G;
63 }
64 do {
65 size = 0;
66 type = tprot(addr);
67 do {
68 size += rzm;
69 if (memsize && addr + size >= memsize)
70 break;
71 } while (type == tprot(addr + size));
72 if (type == CHUNK_READ_WRITE || type == CHUNK_READ_ONLY) {
73 chunk[i].addr = addr;
74 chunk[i].size = size;
75 chunk[i].type = type;
76 i++;
77 }
78 addr += size;
79 } while (addr < memsize && i < MEMORY_CHUNKS);
80}
81
82void detect_memory_layout(struct mem_chunk chunk[])
83{
84 unsigned long flags, cr0;
85
86 memset(chunk, 0, MEMORY_CHUNKS * sizeof(struct mem_chunk));
87 if (memory_fast_detect(&chunk[0]) == 0)
88 return;
89 /* Disable IRQs, DAT and low address protection so tprot does the
90 * right thing and we don't get scheduled away with low address
91 * protection disabled.
92 */
93 flags = __raw_local_irq_stnsm(0xf8);
94 __ctl_store(cr0, 0, 0);
95 __ctl_clear_bit(0, 28);
96 find_memory_chunks(chunk);
97 __ctl_load(cr0, 0, 0);
98 __raw_local_irq_ssm(flags);
99}
100EXPORT_SYMBOL(detect_memory_layout);
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 7920861109d2..85defd01d293 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -75,46 +75,19 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
75 return sf->gprs[8]; 75 return sf->gprs[8];
76} 76}
77 77
78/*
79 * Need to know about CPUs going idle?
80 */
81static ATOMIC_NOTIFIER_HEAD(idle_chain);
82DEFINE_PER_CPU(struct s390_idle_data, s390_idle); 78DEFINE_PER_CPU(struct s390_idle_data, s390_idle);
83 79
84int register_idle_notifier(struct notifier_block *nb)
85{
86 return atomic_notifier_chain_register(&idle_chain, nb);
87}
88EXPORT_SYMBOL(register_idle_notifier);
89
90int unregister_idle_notifier(struct notifier_block *nb)
91{
92 return atomic_notifier_chain_unregister(&idle_chain, nb);
93}
94EXPORT_SYMBOL(unregister_idle_notifier);
95
96static int s390_idle_enter(void) 80static int s390_idle_enter(void)
97{ 81{
98 struct s390_idle_data *idle; 82 struct s390_idle_data *idle;
99 int nr_calls = 0;
100 void *hcpu;
101 int rc;
102 83
103 hcpu = (void *)(long)smp_processor_id();
104 rc = __atomic_notifier_call_chain(&idle_chain, S390_CPU_IDLE, hcpu, -1,
105 &nr_calls);
106 if (rc == NOTIFY_BAD) {
107 nr_calls--;
108 __atomic_notifier_call_chain(&idle_chain, S390_CPU_NOT_IDLE,
109 hcpu, nr_calls, NULL);
110 return rc;
111 }
112 idle = &__get_cpu_var(s390_idle); 84 idle = &__get_cpu_var(s390_idle);
113 spin_lock(&idle->lock); 85 spin_lock(&idle->lock);
114 idle->idle_count++; 86 idle->idle_count++;
115 idle->in_idle = 1; 87 idle->in_idle = 1;
116 idle->idle_enter = get_clock(); 88 idle->idle_enter = get_clock();
117 spin_unlock(&idle->lock); 89 spin_unlock(&idle->lock);
90 vtime_stop_cpu_timer();
118 return NOTIFY_OK; 91 return NOTIFY_OK;
119} 92}
120 93
@@ -122,13 +95,12 @@ void s390_idle_leave(void)
122{ 95{
123 struct s390_idle_data *idle; 96 struct s390_idle_data *idle;
124 97
98 vtime_start_cpu_timer();
125 idle = &__get_cpu_var(s390_idle); 99 idle = &__get_cpu_var(s390_idle);
126 spin_lock(&idle->lock); 100 spin_lock(&idle->lock);
127 idle->idle_time += get_clock() - idle->idle_enter; 101 idle->idle_time += get_clock() - idle->idle_enter;
128 idle->in_idle = 0; 102 idle->in_idle = 0;
129 spin_unlock(&idle->lock); 103 spin_unlock(&idle->lock);
130 atomic_notifier_call_chain(&idle_chain, S390_CPU_NOT_IDLE,
131 (void *)(long) smp_processor_id());
132} 104}
133 105
134extern void s390_handle_mcck(void); 106extern void s390_handle_mcck(void);
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 35827b9bd4d1..2815bfe348a6 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -33,6 +33,8 @@
33#include <linux/security.h> 33#include <linux/security.h>
34#include <linux/audit.h> 34#include <linux/audit.h>
35#include <linux/signal.h> 35#include <linux/signal.h>
36#include <linux/elf.h>
37#include <linux/regset.h>
36 38
37#include <asm/segment.h> 39#include <asm/segment.h>
38#include <asm/page.h> 40#include <asm/page.h>
@@ -47,6 +49,11 @@
47#include "compat_ptrace.h" 49#include "compat_ptrace.h"
48#endif 50#endif
49 51
52enum s390_regset {
53 REGSET_GENERAL,
54 REGSET_FP,
55};
56
50static void 57static void
51FixPerRegisters(struct task_struct *task) 58FixPerRegisters(struct task_struct *task)
52{ 59{
@@ -126,24 +133,10 @@ ptrace_disable(struct task_struct *child)
126 * struct user contain pad bytes that should be read as zeroes. 133 * struct user contain pad bytes that should be read as zeroes.
127 * Lovely... 134 * Lovely...
128 */ 135 */
129static int 136static unsigned long __peek_user(struct task_struct *child, addr_t addr)
130peek_user(struct task_struct *child, addr_t addr, addr_t data)
131{ 137{
132 struct user *dummy = NULL; 138 struct user *dummy = NULL;
133 addr_t offset, tmp, mask; 139 addr_t offset, tmp;
134
135 /*
136 * Stupid gdb peeks/pokes the access registers in 64 bit with
137 * an alignment of 4. Programmers from hell...
138 */
139 mask = __ADDR_MASK;
140#ifdef CONFIG_64BIT
141 if (addr >= (addr_t) &dummy->regs.acrs &&
142 addr < (addr_t) &dummy->regs.orig_gpr2)
143 mask = 3;
144#endif
145 if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK)
146 return -EIO;
147 140
148 if (addr < (addr_t) &dummy->regs.acrs) { 141 if (addr < (addr_t) &dummy->regs.acrs) {
149 /* 142 /*
@@ -197,24 +190,18 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
197 } else 190 } else
198 tmp = 0; 191 tmp = 0;
199 192
200 return put_user(tmp, (addr_t __user *) data); 193 return tmp;
201} 194}
202 195
203/*
204 * Write a word to the user area of a process at location addr. This
205 * operation does have an additional problem compared to peek_user.
206 * Stores to the program status word and on the floating point
207 * control register needs to get checked for validity.
208 */
209static int 196static int
210poke_user(struct task_struct *child, addr_t addr, addr_t data) 197peek_user(struct task_struct *child, addr_t addr, addr_t data)
211{ 198{
212 struct user *dummy = NULL; 199 struct user *dummy = NULL;
213 addr_t offset, mask; 200 addr_t tmp, mask;
214 201
215 /* 202 /*
216 * Stupid gdb peeks/pokes the access registers in 64 bit with 203 * Stupid gdb peeks/pokes the access registers in 64 bit with
217 * an alignment of 4. Programmers from hell indeed... 204 * an alignment of 4. Programmers from hell...
218 */ 205 */
219 mask = __ADDR_MASK; 206 mask = __ADDR_MASK;
220#ifdef CONFIG_64BIT 207#ifdef CONFIG_64BIT
@@ -225,6 +212,21 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
225 if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK) 212 if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK)
226 return -EIO; 213 return -EIO;
227 214
215 tmp = __peek_user(child, addr);
216 return put_user(tmp, (addr_t __user *) data);
217}
218
219/*
220 * Write a word to the user area of a process at location addr. This
221 * operation does have an additional problem compared to peek_user.
222 * Stores to the program status word and on the floating point
223 * control register needs to get checked for validity.
224 */
225static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)
226{
227 struct user *dummy = NULL;
228 addr_t offset;
229
228 if (addr < (addr_t) &dummy->regs.acrs) { 230 if (addr < (addr_t) &dummy->regs.acrs) {
229 /* 231 /*
230 * psw and gprs are stored on the stack 232 * psw and gprs are stored on the stack
@@ -292,6 +294,28 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
292 return 0; 294 return 0;
293} 295}
294 296
297static int
298poke_user(struct task_struct *child, addr_t addr, addr_t data)
299{
300 struct user *dummy = NULL;
301 addr_t mask;
302
303 /*
304 * Stupid gdb peeks/pokes the access registers in 64 bit with
305 * an alignment of 4. Programmers from hell indeed...
306 */
307 mask = __ADDR_MASK;
308#ifdef CONFIG_64BIT
309 if (addr >= (addr_t) &dummy->regs.acrs &&
310 addr < (addr_t) &dummy->regs.orig_gpr2)
311 mask = 3;
312#endif
313 if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK)
314 return -EIO;
315
316 return __poke_user(child, addr, data);
317}
318
295long arch_ptrace(struct task_struct *child, long request, long addr, long data) 319long arch_ptrace(struct task_struct *child, long request, long addr, long data)
296{ 320{
297 ptrace_area parea; 321 ptrace_area parea;
@@ -367,18 +391,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
367/* 391/*
368 * Same as peek_user but for a 31 bit program. 392 * Same as peek_user but for a 31 bit program.
369 */ 393 */
370static int 394static u32 __peek_user_compat(struct task_struct *child, addr_t addr)
371peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
372{ 395{
373 struct user32 *dummy32 = NULL; 396 struct user32 *dummy32 = NULL;
374 per_struct32 *dummy_per32 = NULL; 397 per_struct32 *dummy_per32 = NULL;
375 addr_t offset; 398 addr_t offset;
376 __u32 tmp; 399 __u32 tmp;
377 400
378 if (!test_thread_flag(TIF_31BIT) ||
379 (addr & 3) || addr > sizeof(struct user) - 3)
380 return -EIO;
381
382 if (addr < (addr_t) &dummy32->regs.acrs) { 401 if (addr < (addr_t) &dummy32->regs.acrs) {
383 /* 402 /*
384 * psw and gprs are stored on the stack 403 * psw and gprs are stored on the stack
@@ -435,25 +454,32 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
435 } else 454 } else
436 tmp = 0; 455 tmp = 0;
437 456
457 return tmp;
458}
459
460static int peek_user_compat(struct task_struct *child,
461 addr_t addr, addr_t data)
462{
463 __u32 tmp;
464
465 if (!test_thread_flag(TIF_31BIT) ||
466 (addr & 3) || addr > sizeof(struct user) - 3)
467 return -EIO;
468
469 tmp = __peek_user_compat(child, addr);
438 return put_user(tmp, (__u32 __user *) data); 470 return put_user(tmp, (__u32 __user *) data);
439} 471}
440 472
441/* 473/*
442 * Same as poke_user but for a 31 bit program. 474 * Same as poke_user but for a 31 bit program.
443 */ 475 */
444static int 476static int __poke_user_compat(struct task_struct *child,
445poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data) 477 addr_t addr, addr_t data)
446{ 478{
447 struct user32 *dummy32 = NULL; 479 struct user32 *dummy32 = NULL;
448 per_struct32 *dummy_per32 = NULL; 480 per_struct32 *dummy_per32 = NULL;
481 __u32 tmp = (__u32) data;
449 addr_t offset; 482 addr_t offset;
450 __u32 tmp;
451
452 if (!test_thread_flag(TIF_31BIT) ||
453 (addr & 3) || addr > sizeof(struct user32) - 3)
454 return -EIO;
455
456 tmp = (__u32) data;
457 483
458 if (addr < (addr_t) &dummy32->regs.acrs) { 484 if (addr < (addr_t) &dummy32->regs.acrs) {
459 /* 485 /*
@@ -528,6 +554,16 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
528 return 0; 554 return 0;
529} 555}
530 556
557static int poke_user_compat(struct task_struct *child,
558 addr_t addr, addr_t data)
559{
560 if (!test_thread_flag(TIF_31BIT) ||
561 (addr & 3) || addr > sizeof(struct user32) - 3)
562 return -EIO;
563
564 return __poke_user_compat(child, addr, data);
565}
566
531long compat_arch_ptrace(struct task_struct *child, compat_long_t request, 567long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
532 compat_ulong_t caddr, compat_ulong_t cdata) 568 compat_ulong_t caddr, compat_ulong_t cdata)
533{ 569{
@@ -539,11 +575,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
539 switch (request) { 575 switch (request) {
540 case PTRACE_PEEKUSR: 576 case PTRACE_PEEKUSR:
541 /* read the word at location addr in the USER area. */ 577 /* read the word at location addr in the USER area. */
542 return peek_user_emu31(child, addr, data); 578 return peek_user_compat(child, addr, data);
543 579
544 case PTRACE_POKEUSR: 580 case PTRACE_POKEUSR:
545 /* write the word at location addr in the USER area */ 581 /* write the word at location addr in the USER area */
546 return poke_user_emu31(child, addr, data); 582 return poke_user_compat(child, addr, data);
547 583
548 case PTRACE_PEEKUSR_AREA: 584 case PTRACE_PEEKUSR_AREA:
549 case PTRACE_POKEUSR_AREA: 585 case PTRACE_POKEUSR_AREA:
@@ -555,13 +591,13 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
555 copied = 0; 591 copied = 0;
556 while (copied < parea.len) { 592 while (copied < parea.len) {
557 if (request == PTRACE_PEEKUSR_AREA) 593 if (request == PTRACE_PEEKUSR_AREA)
558 ret = peek_user_emu31(child, addr, data); 594 ret = peek_user_compat(child, addr, data);
559 else { 595 else {
560 __u32 utmp; 596 __u32 utmp;
561 if (get_user(utmp, 597 if (get_user(utmp,
562 (__u32 __force __user *) data)) 598 (__u32 __force __user *) data))
563 return -EFAULT; 599 return -EFAULT;
564 ret = poke_user_emu31(child, addr, utmp); 600 ret = poke_user_compat(child, addr, utmp);
565 } 601 }
566 if (ret) 602 if (ret)
567 return ret; 603 return ret;
@@ -610,3 +646,240 @@ syscall_trace(struct pt_regs *regs, int entryexit)
610 regs->gprs[2], regs->orig_gpr2, regs->gprs[3], 646 regs->gprs[2], regs->orig_gpr2, regs->gprs[3],
611 regs->gprs[4], regs->gprs[5]); 647 regs->gprs[4], regs->gprs[5]);
612} 648}
649
650/*
651 * user_regset definitions.
652 */
653
654static int s390_regs_get(struct task_struct *target,
655 const struct user_regset *regset,
656 unsigned int pos, unsigned int count,
657 void *kbuf, void __user *ubuf)
658{
659 if (target == current)
660 save_access_regs(target->thread.acrs);
661
662 if (kbuf) {
663 unsigned long *k = kbuf;
664 while (count > 0) {
665 *k++ = __peek_user(target, pos);
666 count -= sizeof(*k);
667 pos += sizeof(*k);
668 }
669 } else {
670 unsigned long __user *u = ubuf;
671 while (count > 0) {
672 if (__put_user(__peek_user(target, pos), u++))
673 return -EFAULT;
674 count -= sizeof(*u);
675 pos += sizeof(*u);
676 }
677 }
678 return 0;
679}
680
681static int s390_regs_set(struct task_struct *target,
682 const struct user_regset *regset,
683 unsigned int pos, unsigned int count,
684 const void *kbuf, const void __user *ubuf)
685{
686 int rc = 0;
687
688 if (target == current)
689 save_access_regs(target->thread.acrs);
690
691 if (kbuf) {
692 const unsigned long *k = kbuf;
693 while (count > 0 && !rc) {
694 rc = __poke_user(target, pos, *k++);
695 count -= sizeof(*k);
696 pos += sizeof(*k);
697 }
698 } else {
699 const unsigned long __user *u = ubuf;
700 while (count > 0 && !rc) {
701 unsigned long word;
702 rc = __get_user(word, u++);
703 if (rc)
704 break;
705 rc = __poke_user(target, pos, word);
706 count -= sizeof(*u);
707 pos += sizeof(*u);
708 }
709 }
710
711 if (rc == 0 && target == current)
712 restore_access_regs(target->thread.acrs);
713
714 return rc;
715}
716
717static int s390_fpregs_get(struct task_struct *target,
718 const struct user_regset *regset, unsigned int pos,
719 unsigned int count, void *kbuf, void __user *ubuf)
720{
721 if (target == current)
722 save_fp_regs(&target->thread.fp_regs);
723
724 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
725 &target->thread.fp_regs, 0, -1);
726}
727
728static int s390_fpregs_set(struct task_struct *target,
729 const struct user_regset *regset, unsigned int pos,
730 unsigned int count, const void *kbuf,
731 const void __user *ubuf)
732{
733 int rc = 0;
734
735 if (target == current)
736 save_fp_regs(&target->thread.fp_regs);
737
738 /* If setting FPC, must validate it first. */
739 if (count > 0 && pos < offsetof(s390_fp_regs, fprs)) {
740 u32 fpc[2] = { target->thread.fp_regs.fpc, 0 };
741 rc = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &fpc,
742 0, offsetof(s390_fp_regs, fprs));
743 if (rc)
744 return rc;
745 if ((fpc[0] & ~FPC_VALID_MASK) != 0 || fpc[1] != 0)
746 return -EINVAL;
747 target->thread.fp_regs.fpc = fpc[0];
748 }
749
750 if (rc == 0 && count > 0)
751 rc = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
752 target->thread.fp_regs.fprs,
753 offsetof(s390_fp_regs, fprs), -1);
754
755 if (rc == 0 && target == current)
756 restore_fp_regs(&target->thread.fp_regs);
757
758 return rc;
759}
760
761static const struct user_regset s390_regsets[] = {
762 [REGSET_GENERAL] = {
763 .core_note_type = NT_PRSTATUS,
764 .n = sizeof(s390_regs) / sizeof(long),
765 .size = sizeof(long),
766 .align = sizeof(long),
767 .get = s390_regs_get,
768 .set = s390_regs_set,
769 },
770 [REGSET_FP] = {
771 .core_note_type = NT_PRFPREG,
772 .n = sizeof(s390_fp_regs) / sizeof(long),
773 .size = sizeof(long),
774 .align = sizeof(long),
775 .get = s390_fpregs_get,
776 .set = s390_fpregs_set,
777 },
778};
779
780static const struct user_regset_view user_s390_view = {
781 .name = UTS_MACHINE,
782 .e_machine = EM_S390,
783 .regsets = s390_regsets,
784 .n = ARRAY_SIZE(s390_regsets)
785};
786
787#ifdef CONFIG_COMPAT
788static int s390_compat_regs_get(struct task_struct *target,
789 const struct user_regset *regset,
790 unsigned int pos, unsigned int count,
791 void *kbuf, void __user *ubuf)
792{
793 if (target == current)
794 save_access_regs(target->thread.acrs);
795
796 if (kbuf) {
797 compat_ulong_t *k = kbuf;
798 while (count > 0) {
799 *k++ = __peek_user_compat(target, pos);
800 count -= sizeof(*k);
801 pos += sizeof(*k);
802 }
803 } else {
804 compat_ulong_t __user *u = ubuf;
805 while (count > 0) {
806 if (__put_user(__peek_user_compat(target, pos), u++))
807 return -EFAULT;
808 count -= sizeof(*u);
809 pos += sizeof(*u);
810 }
811 }
812 return 0;
813}
814
815static int s390_compat_regs_set(struct task_struct *target,
816 const struct user_regset *regset,
817 unsigned int pos, unsigned int count,
818 const void *kbuf, const void __user *ubuf)
819{
820 int rc = 0;
821
822 if (target == current)
823 save_access_regs(target->thread.acrs);
824
825 if (kbuf) {
826 const compat_ulong_t *k = kbuf;
827 while (count > 0 && !rc) {
828 rc = __poke_user_compat(target, pos, *k++);
829 count -= sizeof(*k);
830 pos += sizeof(*k);
831 }
832 } else {
833 const compat_ulong_t __user *u = ubuf;
834 while (count > 0 && !rc) {
835 compat_ulong_t word;
836 rc = __get_user(word, u++);
837 if (rc)
838 break;
839 rc = __poke_user_compat(target, pos, word);
840 count -= sizeof(*u);
841 pos += sizeof(*u);
842 }
843 }
844
845 if (rc == 0 && target == current)
846 restore_access_regs(target->thread.acrs);
847
848 return rc;
849}
850
851static const struct user_regset s390_compat_regsets[] = {
852 [REGSET_GENERAL] = {
853 .core_note_type = NT_PRSTATUS,
854 .n = sizeof(s390_compat_regs) / sizeof(compat_long_t),
855 .size = sizeof(compat_long_t),
856 .align = sizeof(compat_long_t),
857 .get = s390_compat_regs_get,
858 .set = s390_compat_regs_set,
859 },
860 [REGSET_FP] = {
861 .core_note_type = NT_PRFPREG,
862 .n = sizeof(s390_fp_regs) / sizeof(compat_long_t),
863 .size = sizeof(compat_long_t),
864 .align = sizeof(compat_long_t),
865 .get = s390_fpregs_get,
866 .set = s390_fpregs_set,
867 },
868};
869
870static const struct user_regset_view user_s390_compat_view = {
871 .name = "s390",
872 .e_machine = EM_S390,
873 .regsets = s390_compat_regsets,
874 .n = ARRAY_SIZE(s390_compat_regsets)
875};
876#endif
877
878const struct user_regset_view *task_user_regset_view(struct task_struct *task)
879{
880#ifdef CONFIG_COMPAT
881 if (test_tsk_thread_flag(task, TIF_31BIT))
882 return &user_s390_compat_view;
883#endif
884 return &user_s390_view;
885}
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 2bc70b6e876a..b358e18273b0 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -77,7 +77,7 @@ unsigned long machine_flags;
77unsigned long elf_hwcap = 0; 77unsigned long elf_hwcap = 0;
78char elf_platform[ELF_PLATFORM_SIZE]; 78char elf_platform[ELF_PLATFORM_SIZE];
79 79
80struct mem_chunk __meminitdata memory_chunk[MEMORY_CHUNKS]; 80struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
81volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ 81volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
82static unsigned long __initdata memory_end; 82static unsigned long __initdata memory_end;
83 83
@@ -205,12 +205,6 @@ static void __init conmode_default(void)
205 SET_CONSOLE_SCLP; 205 SET_CONSOLE_SCLP;
206#endif 206#endif
207 } 207 }
208 } else if (MACHINE_IS_P390) {
209#if defined(CONFIG_TN3215_CONSOLE)
210 SET_CONSOLE_3215;
211#elif defined(CONFIG_TN3270_CONSOLE)
212 SET_CONSOLE_3270;
213#endif
214 } else { 208 } else {
215#if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE) 209#if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
216 SET_CONSOLE_SCLP; 210 SET_CONSOLE_SCLP;
@@ -221,18 +215,17 @@ static void __init conmode_default(void)
221#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) 215#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE)
222static void __init setup_zfcpdump(unsigned int console_devno) 216static void __init setup_zfcpdump(unsigned int console_devno)
223{ 217{
224 static char str[64]; 218 static char str[41];
225 219
226 if (ipl_info.type != IPL_TYPE_FCP_DUMP) 220 if (ipl_info.type != IPL_TYPE_FCP_DUMP)
227 return; 221 return;
228 if (console_devno != -1) 222 if (console_devno != -1)
229 sprintf(str, "cio_ignore=all,!0.0.%04x,!0.0.%04x", 223 sprintf(str, " cio_ignore=all,!0.0.%04x,!0.0.%04x",
230 ipl_info.data.fcp.dev_id.devno, console_devno); 224 ipl_info.data.fcp.dev_id.devno, console_devno);
231 else 225 else
232 sprintf(str, "cio_ignore=all,!0.0.%04x", 226 sprintf(str, " cio_ignore=all,!0.0.%04x",
233 ipl_info.data.fcp.dev_id.devno); 227 ipl_info.data.fcp.dev_id.devno);
234 strcat(COMMAND_LINE, " "); 228 strcat(boot_command_line, str);
235 strcat(COMMAND_LINE, str);
236 console_loglevel = 2; 229 console_loglevel = 2;
237} 230}
238#else 231#else
@@ -289,32 +282,6 @@ static int __init early_parse_mem(char *p)
289} 282}
290early_param("mem", early_parse_mem); 283early_param("mem", early_parse_mem);
291 284
292/*
293 * "ipldelay=XXX[sm]" sets ipl delay in seconds or minutes
294 */
295static int __init early_parse_ipldelay(char *p)
296{
297 unsigned long delay = 0;
298
299 delay = simple_strtoul(p, &p, 0);
300
301 switch (*p) {
302 case 's':
303 case 'S':
304 delay *= 1000000;
305 break;
306 case 'm':
307 case 'M':
308 delay *= 60 * 1000000;
309 }
310
311 /* now wait for the requested amount of time */
312 udelay(delay);
313
314 return 0;
315}
316early_param("ipldelay", early_parse_ipldelay);
317
318#ifdef CONFIG_S390_SWITCH_AMODE 285#ifdef CONFIG_S390_SWITCH_AMODE
319#ifdef CONFIG_PGSTE 286#ifdef CONFIG_PGSTE
320unsigned int switch_amode = 1; 287unsigned int switch_amode = 1;
@@ -804,11 +771,9 @@ setup_arch(char **cmdline_p)
804 printk("We are running native (64 bit mode)\n"); 771 printk("We are running native (64 bit mode)\n");
805#endif /* CONFIG_64BIT */ 772#endif /* CONFIG_64BIT */
806 773
807 /* Save unparsed command line copy for /proc/cmdline */ 774 /* Have one command line that is parsed and saved in /proc/cmdline */
808 strlcpy(boot_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); 775 /* boot_command_line has been already set up in early.c */
809 776 *cmdline_p = boot_command_line;
810 *cmdline_p = COMMAND_LINE;
811 *(*cmdline_p + COMMAND_LINE_SIZE - 1) = '\0';
812 777
813 ROOT_DEV = Root_RAM0; 778 ROOT_DEV = Root_RAM0;
814 779
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 7aec676fefd5..7418bebb547f 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -3,7 +3,7 @@
3 * Time of day based timer functions. 3 * Time of day based timer functions.
4 * 4 *
5 * S390 version 5 * S390 version
6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 6 * Copyright IBM Corp. 1999, 2008
7 * Author(s): Hartmut Penner (hp@de.ibm.com), 7 * Author(s): Hartmut Penner (hp@de.ibm.com),
8 * Martin Schwidefsky (schwidefsky@de.ibm.com), 8 * Martin Schwidefsky (schwidefsky@de.ibm.com),
9 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 9 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
@@ -31,6 +31,7 @@
31#include <linux/notifier.h> 31#include <linux/notifier.h>
32#include <linux/clocksource.h> 32#include <linux/clocksource.h>
33#include <linux/clockchips.h> 33#include <linux/clockchips.h>
34#include <linux/bootmem.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
35#include <asm/delay.h> 36#include <asm/delay.h>
36#include <asm/s390_ext.h> 37#include <asm/s390_ext.h>
@@ -162,7 +163,7 @@ void init_cpu_timer(void)
162 /* Enable clock comparator timer interrupt. */ 163 /* Enable clock comparator timer interrupt. */
163 __ctl_set_bit(0,11); 164 __ctl_set_bit(0,11);
164 165
165 /* Always allow ETR external interrupts, even without an ETR. */ 166 /* Always allow the timing alert external interrupt. */
166 __ctl_set_bit(0, 4); 167 __ctl_set_bit(0, 4);
167} 168}
168 169
@@ -170,8 +171,21 @@ static void clock_comparator_interrupt(__u16 code)
170{ 171{
171} 172}
172 173
174static void etr_timing_alert(struct etr_irq_parm *);
175static void stp_timing_alert(struct stp_irq_parm *);
176
177static void timing_alert_interrupt(__u16 code)
178{
179 if (S390_lowcore.ext_params & 0x00c40000)
180 etr_timing_alert((struct etr_irq_parm *)
181 &S390_lowcore.ext_params);
182 if (S390_lowcore.ext_params & 0x00038000)
183 stp_timing_alert((struct stp_irq_parm *)
184 &S390_lowcore.ext_params);
185}
186
173static void etr_reset(void); 187static void etr_reset(void);
174static void etr_ext_handler(__u16); 188static void stp_reset(void);
175 189
176/* 190/*
177 * Get the TOD clock running. 191 * Get the TOD clock running.
@@ -181,6 +195,7 @@ static u64 __init reset_tod_clock(void)
181 u64 time; 195 u64 time;
182 196
183 etr_reset(); 197 etr_reset();
198 stp_reset();
184 if (store_clock(&time) == 0) 199 if (store_clock(&time) == 0)
185 return time; 200 return time;
186 /* TOD clock not running. Set the clock to Unix Epoch. */ 201 /* TOD clock not running. Set the clock to Unix Epoch. */
@@ -231,8 +246,9 @@ void __init time_init(void)
231 if (clocksource_register(&clocksource_tod) != 0) 246 if (clocksource_register(&clocksource_tod) != 0)
232 panic("Could not register TOD clock source"); 247 panic("Could not register TOD clock source");
233 248
234 /* request the etr external interrupt */ 249 /* request the timing alert external interrupt */
235 if (register_early_external_interrupt(0x1406, etr_ext_handler, 250 if (register_early_external_interrupt(0x1406,
251 timing_alert_interrupt,
236 &ext_int_etr_cc) != 0) 252 &ext_int_etr_cc) != 0)
237 panic("Couldn't request external interrupt 0x1406"); 253 panic("Couldn't request external interrupt 0x1406");
238 254
@@ -245,10 +261,112 @@ void __init time_init(void)
245} 261}
246 262
247/* 263/*
264 * The time is "clock". old is what we think the time is.
265 * Adjust the value by a multiple of jiffies and add the delta to ntp.
266 * "delay" is an approximation how long the synchronization took. If
267 * the time correction is positive, then "delay" is subtracted from
268 * the time difference and only the remaining part is passed to ntp.
269 */
270static unsigned long long adjust_time(unsigned long long old,
271 unsigned long long clock,
272 unsigned long long delay)
273{
274 unsigned long long delta, ticks;
275 struct timex adjust;
276
277 if (clock > old) {
278 /* It is later than we thought. */
279 delta = ticks = clock - old;
280 delta = ticks = (delta < delay) ? 0 : delta - delay;
281 delta -= do_div(ticks, CLK_TICKS_PER_JIFFY);
282 adjust.offset = ticks * (1000000 / HZ);
283 } else {
284 /* It is earlier than we thought. */
285 delta = ticks = old - clock;
286 delta -= do_div(ticks, CLK_TICKS_PER_JIFFY);
287 delta = -delta;
288 adjust.offset = -ticks * (1000000 / HZ);
289 }
290 jiffies_timer_cc += delta;
291 if (adjust.offset != 0) {
292 printk(KERN_NOTICE "etr: time adjusted by %li micro-seconds\n",
293 adjust.offset);
294 adjust.modes = ADJ_OFFSET_SINGLESHOT;
295 do_adjtimex(&adjust);
296 }
297 return delta;
298}
299
300static DEFINE_PER_CPU(atomic_t, clock_sync_word);
301static unsigned long clock_sync_flags;
302
303#define CLOCK_SYNC_HAS_ETR 0
304#define CLOCK_SYNC_HAS_STP 1
305#define CLOCK_SYNC_ETR 2
306#define CLOCK_SYNC_STP 3
307
308/*
309 * The synchronous get_clock function. It will write the current clock
310 * value to the clock pointer and return 0 if the clock is in sync with
311 * the external time source. If the clock mode is local it will return
312 * -ENOSYS and -EAGAIN if the clock is not in sync with the external
313 * reference.
314 */
315int get_sync_clock(unsigned long long *clock)
316{
317 atomic_t *sw_ptr;
318 unsigned int sw0, sw1;
319
320 sw_ptr = &get_cpu_var(clock_sync_word);
321 sw0 = atomic_read(sw_ptr);
322 *clock = get_clock();
323 sw1 = atomic_read(sw_ptr);
324 put_cpu_var(clock_sync_sync);
325 if (sw0 == sw1 && (sw0 & 0x80000000U))
326 /* Success: time is in sync. */
327 return 0;
328 if (!test_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags) &&
329 !test_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags))
330 return -ENOSYS;
331 if (!test_bit(CLOCK_SYNC_ETR, &clock_sync_flags) &&
332 !test_bit(CLOCK_SYNC_STP, &clock_sync_flags))
333 return -EACCES;
334 return -EAGAIN;
335}
336EXPORT_SYMBOL(get_sync_clock);
337
338/*
339 * Make get_sync_clock return -EAGAIN.
340 */
341static void disable_sync_clock(void *dummy)
342{
343 atomic_t *sw_ptr = &__get_cpu_var(clock_sync_word);
344 /*
345 * Clear the in-sync bit 2^31. All get_sync_clock calls will
346 * fail until the sync bit is turned back on. In addition
347 * increase the "sequence" counter to avoid the race of an
348 * etr event and the complete recovery against get_sync_clock.
349 */
350 atomic_clear_mask(0x80000000, sw_ptr);
351 atomic_inc(sw_ptr);
352}
353
354/*
355 * Make get_sync_clock return 0 again.
356 * Needs to be called from a context disabled for preemption.
357 */
358static void enable_sync_clock(void)
359{
360 atomic_t *sw_ptr = &__get_cpu_var(clock_sync_word);
361 atomic_set_mask(0x80000000, sw_ptr);
362}
363
364/*
248 * External Time Reference (ETR) code. 365 * External Time Reference (ETR) code.
249 */ 366 */
250static int etr_port0_online; 367static int etr_port0_online;
251static int etr_port1_online; 368static int etr_port1_online;
369static int etr_steai_available;
252 370
253static int __init early_parse_etr(char *p) 371static int __init early_parse_etr(char *p)
254{ 372{
@@ -273,12 +391,6 @@ enum etr_event {
273 ETR_EVENT_UPDATE, 391 ETR_EVENT_UPDATE,
274}; 392};
275 393
276enum etr_flags {
277 ETR_FLAG_ENOSYS,
278 ETR_FLAG_EACCES,
279 ETR_FLAG_STEAI,
280};
281
282/* 394/*
283 * Valid bit combinations of the eacr register are (x = don't care): 395 * Valid bit combinations of the eacr register are (x = don't care):
284 * e0 e1 dp p0 p1 ea es sl 396 * e0 e1 dp p0 p1 ea es sl
@@ -305,74 +417,18 @@ enum etr_flags {
305 */ 417 */
306static struct etr_eacr etr_eacr; 418static struct etr_eacr etr_eacr;
307static u64 etr_tolec; /* time of last eacr update */ 419static u64 etr_tolec; /* time of last eacr update */
308static unsigned long etr_flags;
309static struct etr_aib etr_port0; 420static struct etr_aib etr_port0;
310static int etr_port0_uptodate; 421static int etr_port0_uptodate;
311static struct etr_aib etr_port1; 422static struct etr_aib etr_port1;
312static int etr_port1_uptodate; 423static int etr_port1_uptodate;
313static unsigned long etr_events; 424static unsigned long etr_events;
314static struct timer_list etr_timer; 425static struct timer_list etr_timer;
315static DEFINE_PER_CPU(atomic_t, etr_sync_word);
316 426
317static void etr_timeout(unsigned long dummy); 427static void etr_timeout(unsigned long dummy);
318static void etr_work_fn(struct work_struct *work); 428static void etr_work_fn(struct work_struct *work);
319static DECLARE_WORK(etr_work, etr_work_fn); 429static DECLARE_WORK(etr_work, etr_work_fn);
320 430
321/* 431/*
322 * The etr get_clock function. It will write the current clock value
323 * to the clock pointer and return 0 if the clock is in sync with the
324 * external time source. If the clock mode is local it will return
325 * -ENOSYS and -EAGAIN if the clock is not in sync with the external
326 * reference. This function is what ETR is all about..
327 */
328int get_sync_clock(unsigned long long *clock)
329{
330 atomic_t *sw_ptr;
331 unsigned int sw0, sw1;
332
333 sw_ptr = &get_cpu_var(etr_sync_word);
334 sw0 = atomic_read(sw_ptr);
335 *clock = get_clock();
336 sw1 = atomic_read(sw_ptr);
337 put_cpu_var(etr_sync_sync);
338 if (sw0 == sw1 && (sw0 & 0x80000000U))
339 /* Success: time is in sync. */
340 return 0;
341 if (test_bit(ETR_FLAG_ENOSYS, &etr_flags))
342 return -ENOSYS;
343 if (test_bit(ETR_FLAG_EACCES, &etr_flags))
344 return -EACCES;
345 return -EAGAIN;
346}
347EXPORT_SYMBOL(get_sync_clock);
348
349/*
350 * Make get_sync_clock return -EAGAIN.
351 */
352static void etr_disable_sync_clock(void *dummy)
353{
354 atomic_t *sw_ptr = &__get_cpu_var(etr_sync_word);
355 /*
356 * Clear the in-sync bit 2^31. All get_sync_clock calls will
357 * fail until the sync bit is turned back on. In addition
358 * increase the "sequence" counter to avoid the race of an
359 * etr event and the complete recovery against get_sync_clock.
360 */
361 atomic_clear_mask(0x80000000, sw_ptr);
362 atomic_inc(sw_ptr);
363}
364
365/*
366 * Make get_sync_clock return 0 again.
367 * Needs to be called from a context disabled for preemption.
368 */
369static void etr_enable_sync_clock(void)
370{
371 atomic_t *sw_ptr = &__get_cpu_var(etr_sync_word);
372 atomic_set_mask(0x80000000, sw_ptr);
373}
374
375/*
376 * Reset ETR attachment. 432 * Reset ETR attachment.
377 */ 433 */
378static void etr_reset(void) 434static void etr_reset(void)
@@ -381,15 +437,13 @@ static void etr_reset(void)
381 .e0 = 0, .e1 = 0, ._pad0 = 4, .dp = 0, 437 .e0 = 0, .e1 = 0, ._pad0 = 4, .dp = 0,
382 .p0 = 0, .p1 = 0, ._pad1 = 0, .ea = 0, 438 .p0 = 0, .p1 = 0, ._pad1 = 0, .ea = 0,
383 .es = 0, .sl = 0 }; 439 .es = 0, .sl = 0 };
384 if (etr_setr(&etr_eacr) == 0) 440 if (etr_setr(&etr_eacr) == 0) {
385 etr_tolec = get_clock(); 441 etr_tolec = get_clock();
386 else { 442 set_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags);
387 set_bit(ETR_FLAG_ENOSYS, &etr_flags); 443 } else if (etr_port0_online || etr_port1_online) {
388 if (etr_port0_online || etr_port1_online) { 444 printk(KERN_WARNING "Running on non ETR capable "
389 printk(KERN_WARNING "Running on non ETR capable " 445 "machine, only local mode available.\n");
390 "machine, only local mode available.\n"); 446 etr_port0_online = etr_port1_online = 0;
391 etr_port0_online = etr_port1_online = 0;
392 }
393 } 447 }
394} 448}
395 449
@@ -397,14 +451,12 @@ static int __init etr_init(void)
397{ 451{
398 struct etr_aib aib; 452 struct etr_aib aib;
399 453
400 if (test_bit(ETR_FLAG_ENOSYS, &etr_flags)) 454 if (!test_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags))
401 return 0; 455 return 0;
402 /* Check if this machine has the steai instruction. */ 456 /* Check if this machine has the steai instruction. */
403 if (etr_steai(&aib, ETR_STEAI_STEPPING_PORT) == 0) 457 if (etr_steai(&aib, ETR_STEAI_STEPPING_PORT) == 0)
404 set_bit(ETR_FLAG_STEAI, &etr_flags); 458 etr_steai_available = 1;
405 setup_timer(&etr_timer, etr_timeout, 0UL); 459 setup_timer(&etr_timer, etr_timeout, 0UL);
406 if (!etr_port0_online && !etr_port1_online)
407 set_bit(ETR_FLAG_EACCES, &etr_flags);
408 if (etr_port0_online) { 460 if (etr_port0_online) {
409 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); 461 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
410 schedule_work(&etr_work); 462 schedule_work(&etr_work);
@@ -435,7 +487,8 @@ void etr_switch_to_local(void)
435{ 487{
436 if (!etr_eacr.sl) 488 if (!etr_eacr.sl)
437 return; 489 return;
438 etr_disable_sync_clock(NULL); 490 if (test_bit(CLOCK_SYNC_ETR, &clock_sync_flags))
491 disable_sync_clock(NULL);
439 set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events); 492 set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events);
440 schedule_work(&etr_work); 493 schedule_work(&etr_work);
441} 494}
@@ -450,23 +503,21 @@ void etr_sync_check(void)
450{ 503{
451 if (!etr_eacr.es) 504 if (!etr_eacr.es)
452 return; 505 return;
453 etr_disable_sync_clock(NULL); 506 if (test_bit(CLOCK_SYNC_ETR, &clock_sync_flags))
507 disable_sync_clock(NULL);
454 set_bit(ETR_EVENT_SYNC_CHECK, &etr_events); 508 set_bit(ETR_EVENT_SYNC_CHECK, &etr_events);
455 schedule_work(&etr_work); 509 schedule_work(&etr_work);
456} 510}
457 511
458/* 512/*
459 * ETR external interrupt. There are two causes: 513 * ETR timing alert. There are two causes:
460 * 1) port state change, check the usability of the port 514 * 1) port state change, check the usability of the port
461 * 2) port alert, one of the ETR-data-validity bits (v1-v2 bits of the 515 * 2) port alert, one of the ETR-data-validity bits (v1-v2 bits of the
462 * sldr-status word) or ETR-data word 1 (edf1) or ETR-data word 3 (edf3) 516 * sldr-status word) or ETR-data word 1 (edf1) or ETR-data word 3 (edf3)
463 * or ETR-data word 4 (edf4) has changed. 517 * or ETR-data word 4 (edf4) has changed.
464 */ 518 */
465static void etr_ext_handler(__u16 code) 519static void etr_timing_alert(struct etr_irq_parm *intparm)
466{ 520{
467 struct etr_interruption_parameter *intparm =
468 (struct etr_interruption_parameter *) &S390_lowcore.ext_params;
469
470 if (intparm->pc0) 521 if (intparm->pc0)
471 /* ETR port 0 state change. */ 522 /* ETR port 0 state change. */
472 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); 523 set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
@@ -591,58 +642,23 @@ static int etr_aib_follows(struct etr_aib *a1, struct etr_aib *a2, int p)
591 return 1; 642 return 1;
592} 643}
593 644
594/* 645struct clock_sync_data {
595 * The time is "clock". old is what we think the time is.
596 * Adjust the value by a multiple of jiffies and add the delta to ntp.
597 * "delay" is an approximation how long the synchronization took. If
598 * the time correction is positive, then "delay" is subtracted from
599 * the time difference and only the remaining part is passed to ntp.
600 */
601static unsigned long long etr_adjust_time(unsigned long long old,
602 unsigned long long clock,
603 unsigned long long delay)
604{
605 unsigned long long delta, ticks;
606 struct timex adjust;
607
608 if (clock > old) {
609 /* It is later than we thought. */
610 delta = ticks = clock - old;
611 delta = ticks = (delta < delay) ? 0 : delta - delay;
612 delta -= do_div(ticks, CLK_TICKS_PER_JIFFY);
613 adjust.offset = ticks * (1000000 / HZ);
614 } else {
615 /* It is earlier than we thought. */
616 delta = ticks = old - clock;
617 delta -= do_div(ticks, CLK_TICKS_PER_JIFFY);
618 delta = -delta;
619 adjust.offset = -ticks * (1000000 / HZ);
620 }
621 jiffies_timer_cc += delta;
622 if (adjust.offset != 0) {
623 printk(KERN_NOTICE "etr: time adjusted by %li micro-seconds\n",
624 adjust.offset);
625 adjust.modes = ADJ_OFFSET_SINGLESHOT;
626 do_adjtimex(&adjust);
627 }
628 return delta;
629}
630
631static struct {
632 int in_sync; 646 int in_sync;
633 unsigned long long fixup_cc; 647 unsigned long long fixup_cc;
634} etr_sync; 648};
635 649
636static void etr_sync_cpu_start(void *dummy) 650static void clock_sync_cpu_start(void *dummy)
637{ 651{
638 etr_enable_sync_clock(); 652 struct clock_sync_data *sync = dummy;
653
654 enable_sync_clock();
639 /* 655 /*
640 * This looks like a busy wait loop but it isn't. etr_sync_cpus 656 * This looks like a busy wait loop but it isn't. etr_sync_cpus
641 * is called on all other cpus while the TOD clocks is stopped. 657 * is called on all other cpus while the TOD clocks is stopped.
642 * __udelay will stop the cpu on an enabled wait psw until the 658 * __udelay will stop the cpu on an enabled wait psw until the
643 * TOD is running again. 659 * TOD is running again.
644 */ 660 */
645 while (etr_sync.in_sync == 0) { 661 while (sync->in_sync == 0) {
646 __udelay(1); 662 __udelay(1);
647 /* 663 /*
648 * A different cpu changes *in_sync. Therefore use 664 * A different cpu changes *in_sync. Therefore use
@@ -650,17 +666,17 @@ static void etr_sync_cpu_start(void *dummy)
650 */ 666 */
651 barrier(); 667 barrier();
652 } 668 }
653 if (etr_sync.in_sync != 1) 669 if (sync->in_sync != 1)
654 /* Didn't work. Clear per-cpu in sync bit again. */ 670 /* Didn't work. Clear per-cpu in sync bit again. */
655 etr_disable_sync_clock(NULL); 671 disable_sync_clock(NULL);
656 /* 672 /*
657 * This round of TOD syncing is done. Set the clock comparator 673 * This round of TOD syncing is done. Set the clock comparator
658 * to the next tick and let the processor continue. 674 * to the next tick and let the processor continue.
659 */ 675 */
660 fixup_clock_comparator(etr_sync.fixup_cc); 676 fixup_clock_comparator(sync->fixup_cc);
661} 677}
662 678
663static void etr_sync_cpu_end(void *dummy) 679static void clock_sync_cpu_end(void *dummy)
664{ 680{
665} 681}
666 682
@@ -672,6 +688,7 @@ static void etr_sync_cpu_end(void *dummy)
672static int etr_sync_clock(struct etr_aib *aib, int port) 688static int etr_sync_clock(struct etr_aib *aib, int port)
673{ 689{
674 struct etr_aib *sync_port; 690 struct etr_aib *sync_port;
691 struct clock_sync_data etr_sync;
675 unsigned long long clock, old_clock, delay, delta; 692 unsigned long long clock, old_clock, delay, delta;
676 int follows; 693 int follows;
677 int rc; 694 int rc;
@@ -690,9 +707,9 @@ static int etr_sync_clock(struct etr_aib *aib, int port)
690 */ 707 */
691 memset(&etr_sync, 0, sizeof(etr_sync)); 708 memset(&etr_sync, 0, sizeof(etr_sync));
692 preempt_disable(); 709 preempt_disable();
693 smp_call_function(etr_sync_cpu_start, NULL, 0, 0); 710 smp_call_function(clock_sync_cpu_start, &etr_sync, 0, 0);
694 local_irq_disable(); 711 local_irq_disable();
695 etr_enable_sync_clock(); 712 enable_sync_clock();
696 713
697 /* Set clock to next OTE. */ 714 /* Set clock to next OTE. */
698 __ctl_set_bit(14, 21); 715 __ctl_set_bit(14, 21);
@@ -707,13 +724,13 @@ static int etr_sync_clock(struct etr_aib *aib, int port)
707 /* Adjust Linux timing variables. */ 724 /* Adjust Linux timing variables. */
708 delay = (unsigned long long) 725 delay = (unsigned long long)
709 (aib->edf2.etv - sync_port->edf2.etv) << 32; 726 (aib->edf2.etv - sync_port->edf2.etv) << 32;
710 delta = etr_adjust_time(old_clock, clock, delay); 727 delta = adjust_time(old_clock, clock, delay);
711 etr_sync.fixup_cc = delta; 728 etr_sync.fixup_cc = delta;
712 fixup_clock_comparator(delta); 729 fixup_clock_comparator(delta);
713 /* Verify that the clock is properly set. */ 730 /* Verify that the clock is properly set. */
714 if (!etr_aib_follows(sync_port, aib, port)) { 731 if (!etr_aib_follows(sync_port, aib, port)) {
715 /* Didn't work. */ 732 /* Didn't work. */
716 etr_disable_sync_clock(NULL); 733 disable_sync_clock(NULL);
717 etr_sync.in_sync = -EAGAIN; 734 etr_sync.in_sync = -EAGAIN;
718 rc = -EAGAIN; 735 rc = -EAGAIN;
719 } else { 736 } else {
@@ -724,12 +741,12 @@ static int etr_sync_clock(struct etr_aib *aib, int port)
724 /* Could not set the clock ?!? */ 741 /* Could not set the clock ?!? */
725 __ctl_clear_bit(0, 29); 742 __ctl_clear_bit(0, 29);
726 __ctl_clear_bit(14, 21); 743 __ctl_clear_bit(14, 21);
727 etr_disable_sync_clock(NULL); 744 disable_sync_clock(NULL);
728 etr_sync.in_sync = -EAGAIN; 745 etr_sync.in_sync = -EAGAIN;
729 rc = -EAGAIN; 746 rc = -EAGAIN;
730 } 747 }
731 local_irq_enable(); 748 local_irq_enable();
732 smp_call_function(etr_sync_cpu_end,NULL,0,0); 749 smp_call_function(clock_sync_cpu_end, NULL, 0, 0);
733 preempt_enable(); 750 preempt_enable();
734 return rc; 751 return rc;
735} 752}
@@ -832,7 +849,7 @@ static struct etr_eacr etr_handle_update(struct etr_aib *aib,
832 * Do not try to get the alternate port aib if the clock 849 * Do not try to get the alternate port aib if the clock
833 * is not in sync yet. 850 * is not in sync yet.
834 */ 851 */
835 if (!eacr.es) 852 if (!test_bit(CLOCK_SYNC_STP, &clock_sync_flags) && !eacr.es)
836 return eacr; 853 return eacr;
837 854
838 /* 855 /*
@@ -840,7 +857,7 @@ static struct etr_eacr etr_handle_update(struct etr_aib *aib,
840 * the other port immediately. If only stetr is available the 857 * the other port immediately. If only stetr is available the
841 * data-port bit toggle has to be used. 858 * data-port bit toggle has to be used.
842 */ 859 */
843 if (test_bit(ETR_FLAG_STEAI, &etr_flags)) { 860 if (etr_steai_available) {
844 if (eacr.p0 && !etr_port0_uptodate) { 861 if (eacr.p0 && !etr_port0_uptodate) {
845 etr_steai_cv(&etr_port0, ETR_STEAI_PORT_0); 862 etr_steai_cv(&etr_port0, ETR_STEAI_PORT_0);
846 etr_port0_uptodate = 1; 863 etr_port0_uptodate = 1;
@@ -909,10 +926,10 @@ static void etr_work_fn(struct work_struct *work)
909 if (!eacr.ea) { 926 if (!eacr.ea) {
910 /* Both ports offline. Reset everything. */ 927 /* Both ports offline. Reset everything. */
911 eacr.dp = eacr.es = eacr.sl = 0; 928 eacr.dp = eacr.es = eacr.sl = 0;
912 on_each_cpu(etr_disable_sync_clock, NULL, 0, 1); 929 on_each_cpu(disable_sync_clock, NULL, 0, 1);
913 del_timer_sync(&etr_timer); 930 del_timer_sync(&etr_timer);
914 etr_update_eacr(eacr); 931 etr_update_eacr(eacr);
915 set_bit(ETR_FLAG_EACCES, &etr_flags); 932 clear_bit(CLOCK_SYNC_ETR, &clock_sync_flags);
916 return; 933 return;
917 } 934 }
918 935
@@ -953,7 +970,6 @@ static void etr_work_fn(struct work_struct *work)
953 eacr.e1 = 1; 970 eacr.e1 = 1;
954 sync_port = (etr_port0_uptodate && 971 sync_port = (etr_port0_uptodate &&
955 etr_port_valid(&etr_port0, 0)) ? 0 : -1; 972 etr_port_valid(&etr_port0, 0)) ? 0 : -1;
956 clear_bit(ETR_FLAG_EACCES, &etr_flags);
957 } else if (eacr.p1 && aib.esw.psc1 == etr_lpsc_pps_mode) { 973 } else if (eacr.p1 && aib.esw.psc1 == etr_lpsc_pps_mode) {
958 eacr.sl = 0; 974 eacr.sl = 0;
959 eacr.e0 = 0; 975 eacr.e0 = 0;
@@ -962,7 +978,6 @@ static void etr_work_fn(struct work_struct *work)
962 eacr.es = 0; 978 eacr.es = 0;
963 sync_port = (etr_port1_uptodate && 979 sync_port = (etr_port1_uptodate &&
964 etr_port_valid(&etr_port1, 1)) ? 1 : -1; 980 etr_port_valid(&etr_port1, 1)) ? 1 : -1;
965 clear_bit(ETR_FLAG_EACCES, &etr_flags);
966 } else if (eacr.p0 && aib.esw.psc0 == etr_lpsc_operational_step) { 981 } else if (eacr.p0 && aib.esw.psc0 == etr_lpsc_operational_step) {
967 eacr.sl = 1; 982 eacr.sl = 1;
968 eacr.e0 = 1; 983 eacr.e0 = 1;
@@ -976,7 +991,6 @@ static void etr_work_fn(struct work_struct *work)
976 eacr.e1 = 1; 991 eacr.e1 = 1;
977 sync_port = (etr_port0_uptodate && 992 sync_port = (etr_port0_uptodate &&
978 etr_port_valid(&etr_port0, 0)) ? 0 : -1; 993 etr_port_valid(&etr_port0, 0)) ? 0 : -1;
979 clear_bit(ETR_FLAG_EACCES, &etr_flags);
980 } else if (eacr.p1 && aib.esw.psc1 == etr_lpsc_operational_step) { 994 } else if (eacr.p1 && aib.esw.psc1 == etr_lpsc_operational_step) {
981 eacr.sl = 1; 995 eacr.sl = 1;
982 eacr.e0 = 0; 996 eacr.e0 = 0;
@@ -985,19 +999,22 @@ static void etr_work_fn(struct work_struct *work)
985 eacr.es = 0; 999 eacr.es = 0;
986 sync_port = (etr_port1_uptodate && 1000 sync_port = (etr_port1_uptodate &&
987 etr_port_valid(&etr_port1, 1)) ? 1 : -1; 1001 etr_port_valid(&etr_port1, 1)) ? 1 : -1;
988 clear_bit(ETR_FLAG_EACCES, &etr_flags);
989 } else { 1002 } else {
990 /* Both ports not usable. */ 1003 /* Both ports not usable. */
991 eacr.es = eacr.sl = 0; 1004 eacr.es = eacr.sl = 0;
992 sync_port = -1; 1005 sync_port = -1;
993 set_bit(ETR_FLAG_EACCES, &etr_flags); 1006 clear_bit(CLOCK_SYNC_ETR, &clock_sync_flags);
994 } 1007 }
995 1008
1009 if (!test_bit(CLOCK_SYNC_ETR, &clock_sync_flags))
1010 eacr.es = 0;
1011
996 /* 1012 /*
997 * If the clock is in sync just update the eacr and return. 1013 * If the clock is in sync just update the eacr and return.
998 * If there is no valid sync port wait for a port update. 1014 * If there is no valid sync port wait for a port update.
999 */ 1015 */
1000 if (eacr.es || sync_port < 0) { 1016 if (test_bit(CLOCK_SYNC_STP, &clock_sync_flags) ||
1017 eacr.es || sync_port < 0) {
1001 etr_update_eacr(eacr); 1018 etr_update_eacr(eacr);
1002 etr_set_tolec_timeout(now); 1019 etr_set_tolec_timeout(now);
1003 return; 1020 return;
@@ -1018,11 +1035,13 @@ static void etr_work_fn(struct work_struct *work)
1018 * and set up a timer to try again after 0.5 seconds 1035 * and set up a timer to try again after 0.5 seconds
1019 */ 1036 */
1020 etr_update_eacr(eacr); 1037 etr_update_eacr(eacr);
1038 set_bit(CLOCK_SYNC_ETR, &clock_sync_flags);
1021 if (now < etr_tolec + (1600000 << 12) || 1039 if (now < etr_tolec + (1600000 << 12) ||
1022 etr_sync_clock(&aib, sync_port) != 0) { 1040 etr_sync_clock(&aib, sync_port) != 0) {
1023 /* Sync failed. Try again in 1/2 second. */ 1041 /* Sync failed. Try again in 1/2 second. */
1024 eacr.es = 0; 1042 eacr.es = 0;
1025 etr_update_eacr(eacr); 1043 etr_update_eacr(eacr);
1044 clear_bit(CLOCK_SYNC_ETR, &clock_sync_flags);
1026 etr_set_sync_timeout(); 1045 etr_set_sync_timeout();
1027 } else 1046 } else
1028 etr_set_tolec_timeout(now); 1047 etr_set_tolec_timeout(now);
@@ -1097,8 +1116,8 @@ static ssize_t etr_online_store(struct sys_device *dev,
1097 value = simple_strtoul(buf, NULL, 0); 1116 value = simple_strtoul(buf, NULL, 0);
1098 if (value != 0 && value != 1) 1117 if (value != 0 && value != 1)
1099 return -EINVAL; 1118 return -EINVAL;
1100 if (test_bit(ETR_FLAG_ENOSYS, &etr_flags)) 1119 if (!test_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags))
1101 return -ENOSYS; 1120 return -EOPNOTSUPP;
1102 if (dev == &etr_port0_dev) { 1121 if (dev == &etr_port0_dev) {
1103 if (etr_port0_online == value) 1122 if (etr_port0_online == value)
1104 return count; /* Nothing to do. */ 1123 return count; /* Nothing to do. */
@@ -1292,3 +1311,318 @@ out:
1292} 1311}
1293 1312
1294device_initcall(etr_init_sysfs); 1313device_initcall(etr_init_sysfs);
1314
1315/*
1316 * Server Time Protocol (STP) code.
1317 */
1318static int stp_online;
1319static struct stp_sstpi stp_info;
1320static void *stp_page;
1321
1322static void stp_work_fn(struct work_struct *work);
1323static DECLARE_WORK(stp_work, stp_work_fn);
1324
1325static int __init early_parse_stp(char *p)
1326{
1327 if (strncmp(p, "off", 3) == 0)
1328 stp_online = 0;
1329 else if (strncmp(p, "on", 2) == 0)
1330 stp_online = 1;
1331 return 0;
1332}
1333early_param("stp", early_parse_stp);
1334
1335/*
1336 * Reset STP attachment.
1337 */
1338static void stp_reset(void)
1339{
1340 int rc;
1341
1342 stp_page = alloc_bootmem_pages(PAGE_SIZE);
1343 rc = chsc_sstpc(stp_page, STP_OP_CTRL, 0x0000);
1344 if (rc == 1)
1345 set_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags);
1346 else if (stp_online) {
1347 printk(KERN_WARNING "Running on non STP capable machine.\n");
1348 free_bootmem((unsigned long) stp_page, PAGE_SIZE);
1349 stp_page = NULL;
1350 stp_online = 0;
1351 }
1352}
1353
1354static int __init stp_init(void)
1355{
1356 if (test_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags) && stp_online)
1357 schedule_work(&stp_work);
1358 return 0;
1359}
1360
1361arch_initcall(stp_init);
1362
1363/*
1364 * STP timing alert. There are three causes:
1365 * 1) timing status change
1366 * 2) link availability change
1367 * 3) time control parameter change
1368 * In all three cases we are only interested in the clock source state.
1369 * If a STP clock source is now available use it.
1370 */
1371static void stp_timing_alert(struct stp_irq_parm *intparm)
1372{
1373 if (intparm->tsc || intparm->lac || intparm->tcpc)
1374 schedule_work(&stp_work);
1375}
1376
1377/*
1378 * STP sync check machine check. This is called when the timing state
1379 * changes from the synchronized state to the unsynchronized state.
1380 * After a STP sync check the clock is not in sync. The machine check
1381 * is broadcasted to all cpus at the same time.
1382 */
1383void stp_sync_check(void)
1384{
1385 if (!test_bit(CLOCK_SYNC_STP, &clock_sync_flags))
1386 return;
1387 disable_sync_clock(NULL);
1388 schedule_work(&stp_work);
1389}
1390
1391/*
1392 * STP island condition machine check. This is called when an attached
1393 * server attempts to communicate over an STP link and the servers
1394 * have matching CTN ids and have a valid stratum-1 configuration
1395 * but the configurations do not match.
1396 */
1397void stp_island_check(void)
1398{
1399 if (!test_bit(CLOCK_SYNC_STP, &clock_sync_flags))
1400 return;
1401 disable_sync_clock(NULL);
1402 schedule_work(&stp_work);
1403}
1404
1405/*
1406 * STP tasklet. Check for the STP state and take over the clock
1407 * synchronization if the STP clock source is usable.
1408 */
1409static void stp_work_fn(struct work_struct *work)
1410{
1411 struct clock_sync_data stp_sync;
1412 unsigned long long old_clock, delta;
1413 int rc;
1414
1415 if (!stp_online) {
1416 chsc_sstpc(stp_page, STP_OP_CTRL, 0x0000);
1417 return;
1418 }
1419
1420 rc = chsc_sstpc(stp_page, STP_OP_CTRL, 0xb0e0);
1421 if (rc)
1422 return;
1423
1424 rc = chsc_sstpi(stp_page, &stp_info, sizeof(struct stp_sstpi));
1425 if (rc || stp_info.c == 0)
1426 return;
1427
1428 /*
1429 * Catch all other cpus and make them wait until we have
1430 * successfully synced the clock. smp_call_function will
1431 * return after all other cpus are in clock_sync_cpu_start.
1432 */
1433 memset(&stp_sync, 0, sizeof(stp_sync));
1434 preempt_disable();
1435 smp_call_function(clock_sync_cpu_start, &stp_sync, 0, 0);
1436 local_irq_disable();
1437 enable_sync_clock();
1438
1439 set_bit(CLOCK_SYNC_STP, &clock_sync_flags);
1440 if (test_and_clear_bit(CLOCK_SYNC_ETR, &clock_sync_flags))
1441 schedule_work(&etr_work);
1442
1443 rc = 0;
1444 if (stp_info.todoff[0] || stp_info.todoff[1] ||
1445 stp_info.todoff[2] || stp_info.todoff[3] ||
1446 stp_info.tmd != 2) {
1447 old_clock = get_clock();
1448 rc = chsc_sstpc(stp_page, STP_OP_SYNC, 0);
1449 if (rc == 0) {
1450 delta = adjust_time(old_clock, get_clock(), 0);
1451 fixup_clock_comparator(delta);
1452 rc = chsc_sstpi(stp_page, &stp_info,
1453 sizeof(struct stp_sstpi));
1454 if (rc == 0 && stp_info.tmd != 2)
1455 rc = -EAGAIN;
1456 }
1457 }
1458 if (rc) {
1459 disable_sync_clock(NULL);
1460 stp_sync.in_sync = -EAGAIN;
1461 clear_bit(CLOCK_SYNC_STP, &clock_sync_flags);
1462 if (etr_port0_online || etr_port1_online)
1463 schedule_work(&etr_work);
1464 } else
1465 stp_sync.in_sync = 1;
1466
1467 local_irq_enable();
1468 smp_call_function(clock_sync_cpu_end, NULL, 0, 0);
1469 preempt_enable();
1470}
1471
1472/*
1473 * STP class sysfs interface functions
1474 */
1475static struct sysdev_class stp_sysclass = {
1476 .name = "stp",
1477};
1478
1479static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf)
1480{
1481 if (!stp_online)
1482 return -ENODATA;
1483 return sprintf(buf, "%016llx\n",
1484 *(unsigned long long *) stp_info.ctnid);
1485}
1486
1487static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
1488
1489static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf)
1490{
1491 if (!stp_online)
1492 return -ENODATA;
1493 return sprintf(buf, "%i\n", stp_info.ctn);
1494}
1495
1496static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
1497
1498static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf)
1499{
1500 if (!stp_online || !(stp_info.vbits & 0x2000))
1501 return -ENODATA;
1502 return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto);
1503}
1504
1505static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
1506
1507static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf)
1508{
1509 if (!stp_online || !(stp_info.vbits & 0x8000))
1510 return -ENODATA;
1511 return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps);
1512}
1513
1514static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
1515
1516static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf)
1517{
1518 if (!stp_online)
1519 return -ENODATA;
1520 return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum);
1521}
1522
1523static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL);
1524
1525static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf)
1526{
1527 if (!stp_online || !(stp_info.vbits & 0x0800))
1528 return -ENODATA;
1529 return sprintf(buf, "%i\n", (int) stp_info.tto);
1530}
1531
1532static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
1533
1534static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf)
1535{
1536 if (!stp_online || !(stp_info.vbits & 0x4000))
1537 return -ENODATA;
1538 return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo);
1539}
1540
1541static SYSDEV_CLASS_ATTR(time_zone_offset, 0400,
1542 stp_time_zone_offset_show, NULL);
1543
1544static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf)
1545{
1546 if (!stp_online)
1547 return -ENODATA;
1548 return sprintf(buf, "%i\n", stp_info.tmd);
1549}
1550
1551static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
1552
1553static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf)
1554{
1555 if (!stp_online)
1556 return -ENODATA;
1557 return sprintf(buf, "%i\n", stp_info.tst);
1558}
1559
1560static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
1561
1562static ssize_t stp_online_show(struct sysdev_class *class, char *buf)
1563{
1564 return sprintf(buf, "%i\n", stp_online);
1565}
1566
1567static ssize_t stp_online_store(struct sysdev_class *class,
1568 const char *buf, size_t count)
1569{
1570 unsigned int value;
1571
1572 value = simple_strtoul(buf, NULL, 0);
1573 if (value != 0 && value != 1)
1574 return -EINVAL;
1575 if (!test_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags))
1576 return -EOPNOTSUPP;
1577 stp_online = value;
1578 schedule_work(&stp_work);
1579 return count;
1580}
1581
1582/*
1583 * Can't use SYSDEV_CLASS_ATTR because the attribute should be named
1584 * stp/online but attr_online already exists in this file ..
1585 */
1586static struct sysdev_class_attribute attr_stp_online = {
1587 .attr = { .name = "online", .mode = 0600 },
1588 .show = stp_online_show,
1589 .store = stp_online_store,
1590};
1591
1592static struct sysdev_class_attribute *stp_attributes[] = {
1593 &attr_ctn_id,
1594 &attr_ctn_type,
1595 &attr_dst_offset,
1596 &attr_leap_seconds,
1597 &attr_stp_online,
1598 &attr_stratum,
1599 &attr_time_offset,
1600 &attr_time_zone_offset,
1601 &attr_timing_mode,
1602 &attr_timing_state,
1603 NULL
1604};
1605
1606static int __init stp_init_sysfs(void)
1607{
1608 struct sysdev_class_attribute **attr;
1609 int rc;
1610
1611 rc = sysdev_class_register(&stp_sysclass);
1612 if (rc)
1613 goto out;
1614 for (attr = stp_attributes; *attr; attr++) {
1615 rc = sysdev_class_create_file(&stp_sysclass, *attr);
1616 if (rc)
1617 goto out_unreg;
1618 }
1619 return 0;
1620out_unreg:
1621 for (; attr >= stp_attributes; attr--)
1622 sysdev_class_remove_file(&stp_sysclass, *attr);
1623 sysdev_class_unregister(&stp_sysclass);
1624out:
1625 return rc;
1626}
1627
1628device_initcall(stp_init_sysfs);
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 661a07217057..212d618b0095 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -313,8 +313,6 @@ void __init s390_init_cpu_topology(void)
313 machine_has_topology_irq = 1; 313 machine_has_topology_irq = 1;
314 314
315 tl_info = alloc_bootmem_pages(PAGE_SIZE); 315 tl_info = alloc_bootmem_pages(PAGE_SIZE);
316 if (!tl_info)
317 goto error;
318 info = tl_info; 316 info = tl_info;
319 stsi(info, 15, 1, 2); 317 stsi(info, 15, 1, 2);
320 318
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index b4607155e8d0..76c1e60c92f3 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -40,7 +40,6 @@ SECTIONS
40 _etext = .; /* End of text section */ 40 _etext = .; /* End of text section */
41 41
42 NOTES :text :note 42 NOTES :text :note
43 BUG_TABLE :text
44 43
45 RODATA 44 RODATA
46 45
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index ca90ee3f930e..0fa5dc5d68e1 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -136,7 +136,7 @@ static inline void set_vtimer(__u64 expires)
136} 136}
137#endif 137#endif
138 138
139static void start_cpu_timer(void) 139void vtime_start_cpu_timer(void)
140{ 140{
141 struct vtimer_queue *vt_list; 141 struct vtimer_queue *vt_list;
142 142
@@ -150,7 +150,7 @@ static void start_cpu_timer(void)
150 set_vtimer(vt_list->idle); 150 set_vtimer(vt_list->idle);
151} 151}
152 152
153static void stop_cpu_timer(void) 153void vtime_stop_cpu_timer(void)
154{ 154{
155 struct vtimer_queue *vt_list; 155 struct vtimer_queue *vt_list;
156 156
@@ -318,8 +318,7 @@ static void internal_add_vtimer(struct vtimer_list *timer)
318 vt_list = &per_cpu(virt_cpu_timer, timer->cpu); 318 vt_list = &per_cpu(virt_cpu_timer, timer->cpu);
319 spin_lock_irqsave(&vt_list->lock, flags); 319 spin_lock_irqsave(&vt_list->lock, flags);
320 320
321 if (timer->cpu != smp_processor_id()) 321 BUG_ON(timer->cpu != smp_processor_id());
322 printk("internal_add_vtimer: BUG, running on wrong CPU");
323 322
324 /* if list is empty we only have to set the timer */ 323 /* if list is empty we only have to set the timer */
325 if (list_empty(&vt_list->list)) { 324 if (list_empty(&vt_list->list)) {
@@ -353,25 +352,12 @@ static void internal_add_vtimer(struct vtimer_list *timer)
353 put_cpu(); 352 put_cpu();
354} 353}
355 354
356static inline int prepare_vtimer(struct vtimer_list *timer) 355static inline void prepare_vtimer(struct vtimer_list *timer)
357{ 356{
358 if (!timer->function) { 357 BUG_ON(!timer->function);
359 printk("add_virt_timer: uninitialized timer\n"); 358 BUG_ON(!timer->expires || timer->expires > VTIMER_MAX_SLICE);
360 return -EINVAL; 359 BUG_ON(vtimer_pending(timer));
361 }
362
363 if (!timer->expires || timer->expires > VTIMER_MAX_SLICE) {
364 printk("add_virt_timer: invalid timer expire value!\n");
365 return -EINVAL;
366 }
367
368 if (vtimer_pending(timer)) {
369 printk("add_virt_timer: timer pending\n");
370 return -EBUSY;
371 }
372
373 timer->cpu = get_cpu(); 360 timer->cpu = get_cpu();
374 return 0;
375} 361}
376 362
377/* 363/*
@@ -382,10 +368,7 @@ void add_virt_timer(void *new)
382 struct vtimer_list *timer; 368 struct vtimer_list *timer;
383 369
384 timer = (struct vtimer_list *)new; 370 timer = (struct vtimer_list *)new;
385 371 prepare_vtimer(timer);
386 if (prepare_vtimer(timer) < 0)
387 return;
388
389 timer->interval = 0; 372 timer->interval = 0;
390 internal_add_vtimer(timer); 373 internal_add_vtimer(timer);
391} 374}
@@ -399,10 +382,7 @@ void add_virt_timer_periodic(void *new)
399 struct vtimer_list *timer; 382 struct vtimer_list *timer;
400 383
401 timer = (struct vtimer_list *)new; 384 timer = (struct vtimer_list *)new;
402 385 prepare_vtimer(timer);
403 if (prepare_vtimer(timer) < 0)
404 return;
405
406 timer->interval = timer->expires; 386 timer->interval = timer->expires;
407 internal_add_vtimer(timer); 387 internal_add_vtimer(timer);
408} 388}
@@ -423,15 +403,8 @@ int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
423 unsigned long flags; 403 unsigned long flags;
424 int cpu; 404 int cpu;
425 405
426 if (!timer->function) { 406 BUG_ON(!timer->function);
427 printk("mod_virt_timer: uninitialized timer\n"); 407 BUG_ON(!expires || expires > VTIMER_MAX_SLICE);
428 return -EINVAL;
429 }
430
431 if (!expires || expires > VTIMER_MAX_SLICE) {
432 printk("mod_virt_timer: invalid expire range\n");
433 return -EINVAL;
434 }
435 408
436 /* 409 /*
437 * This is a common optimization triggered by the 410 * This is a common optimization triggered by the
@@ -444,6 +417,9 @@ int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
444 cpu = get_cpu(); 417 cpu = get_cpu();
445 vt_list = &per_cpu(virt_cpu_timer, cpu); 418 vt_list = &per_cpu(virt_cpu_timer, cpu);
446 419
420 /* check if we run on the right CPU */
421 BUG_ON(timer->cpu != cpu);
422
447 /* disable interrupts before test if timer is pending */ 423 /* disable interrupts before test if timer is pending */
448 spin_lock_irqsave(&vt_list->lock, flags); 424 spin_lock_irqsave(&vt_list->lock, flags);
449 425
@@ -458,14 +434,6 @@ int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
458 return 0; 434 return 0;
459 } 435 }
460 436
461 /* check if we run on the right CPU */
462 if (timer->cpu != cpu) {
463 printk("mod_virt_timer: running on wrong CPU, check your code\n");
464 spin_unlock_irqrestore(&vt_list->lock, flags);
465 put_cpu();
466 return -EINVAL;
467 }
468
469 list_del_init(&timer->entry); 437 list_del_init(&timer->entry);
470 timer->expires = expires; 438 timer->expires = expires;
471 439
@@ -536,24 +504,6 @@ void init_cpu_vtimer(void)
536 504
537} 505}
538 506
539static int vtimer_idle_notify(struct notifier_block *self,
540 unsigned long action, void *hcpu)
541{
542 switch (action) {
543 case S390_CPU_IDLE:
544 stop_cpu_timer();
545 break;
546 case S390_CPU_NOT_IDLE:
547 start_cpu_timer();
548 break;
549 }
550 return NOTIFY_OK;
551}
552
553static struct notifier_block vtimer_idle_nb = {
554 .notifier_call = vtimer_idle_notify,
555};
556
557void __init vtime_init(void) 507void __init vtime_init(void)
558{ 508{
559 /* request the cpu timer external interrupt */ 509 /* request the cpu timer external interrupt */
@@ -561,9 +511,6 @@ void __init vtime_init(void)
561 &ext_int_info_timer) != 0) 511 &ext_int_info_timer) != 0)
562 panic("Couldn't request external interrupt 0x1005"); 512 panic("Couldn't request external interrupt 0x1005");
563 513
564 if (register_idle_notifier(&vtimer_idle_nb))
565 panic("Couldn't register idle notifier");
566
567 /* Enable cpu timer interrupts on the boot cpu. */ 514 /* Enable cpu timer interrupts on the boot cpu. */
568 init_cpu_vtimer(); 515 init_cpu_vtimer();
569} 516}
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 05598649b326..388cc7420055 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -202,3 +202,22 @@ void free_initrd_mem(unsigned long start, unsigned long end)
202 } 202 }
203} 203}
204#endif 204#endif
205
206#ifdef CONFIG_MEMORY_HOTPLUG
207int arch_add_memory(int nid, u64 start, u64 size)
208{
209 struct pglist_data *pgdat;
210 struct zone *zone;
211 int rc;
212
213 pgdat = NODE_DATA(nid);
214 zone = pgdat->node_zones + ZONE_NORMAL;
215 rc = vmem_add_mapping(start, size);
216 if (rc)
217 return rc;
218 rc = __add_pages(zone, PFN_DOWN(start), PFN_DOWN(size));
219 if (rc)
220 vmem_remove_mapping(start, size);
221 return rc;
222}
223#endif /* CONFIG_MEMORY_HOTPLUG */
diff --git a/arch/sh/boards/landisk/gio.c b/arch/sh/boards/landisk/gio.c
index 17025080db35..0c15b0a50b99 100644
--- a/arch/sh/boards/landisk/gio.c
+++ b/arch/sh/boards/landisk/gio.c
@@ -14,6 +14,7 @@
14 */ 14 */
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/smp_lock.h>
17#include <linux/kdev_t.h> 18#include <linux/kdev_t.h>
18#include <linux/cdev.h> 19#include <linux/cdev.h>
19#include <linux/fs.h> 20#include <linux/fs.h>
@@ -32,17 +33,20 @@ static int openCnt;
32static int gio_open(struct inode *inode, struct file *filp) 33static int gio_open(struct inode *inode, struct file *filp)
33{ 34{
34 int minor; 35 int minor;
36 int ret = -ENOENT;
35 37
38 lock_kernel();
36 minor = MINOR(inode->i_rdev); 39 minor = MINOR(inode->i_rdev);
37 if (minor < DEVCOUNT) { 40 if (minor < DEVCOUNT) {
38 if (openCnt > 0) { 41 if (openCnt > 0) {
39 return -EALREADY; 42 ret = -EALREADY;
40 } else { 43 } else {
41 openCnt++; 44 openCnt++;
42 return 0; 45 ret = 0;
43 } 46 }
44 } 47 }
45 return -ENOENT; 48 unlock_kernel();
49 return ret;
46} 50}
47 51
48static int gio_close(struct inode *inode, struct file *filp) 52static int gio_close(struct inode *inode, struct file *filp)
diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig
index f52db125432f..38f934ab50c7 100644
--- a/arch/sh/configs/landisk_defconfig
+++ b/arch/sh/configs/landisk_defconfig
@@ -226,7 +226,6 @@ CONFIG_CPU_HAS_PTEA=y
226# 226#
227CONFIG_SH_TMU=y 227CONFIG_SH_TMU=y
228CONFIG_SH_TIMER_IRQ=16 228CONFIG_SH_TIMER_IRQ=16
229# CONFIG_NO_IDLE_HZ is not set
230CONFIG_SH_PCLK_FREQ=33333333 229CONFIG_SH_PCLK_FREQ=33333333
231 230
232# 231#
diff --git a/arch/sh/configs/lboxre2_defconfig b/arch/sh/configs/lboxre2_defconfig
index 9fa66d92a4e7..b68b6cdbb78f 100644
--- a/arch/sh/configs/lboxre2_defconfig
+++ b/arch/sh/configs/lboxre2_defconfig
@@ -231,7 +231,6 @@ CONFIG_CPU_HAS_PTEA=y
231# 231#
232CONFIG_SH_TMU=y 232CONFIG_SH_TMU=y
233CONFIG_SH_TIMER_IRQ=16 233CONFIG_SH_TIMER_IRQ=16
234# CONFIG_NO_IDLE_HZ is not set
235CONFIG_SH_PCLK_FREQ=40000000 234CONFIG_SH_PCLK_FREQ=40000000
236 235
237# 236#
diff --git a/arch/sh/configs/se7705_defconfig b/arch/sh/configs/se7705_defconfig
index 84717d854867..490dcbc2ce33 100644
--- a/arch/sh/configs/se7705_defconfig
+++ b/arch/sh/configs/se7705_defconfig
@@ -239,7 +239,6 @@ CONFIG_CPU_HAS_SR_RB=y
239# 239#
240CONFIG_SH_TMU=y 240CONFIG_SH_TMU=y
241CONFIG_SH_TIMER_IRQ=16 241CONFIG_SH_TIMER_IRQ=16
242# CONFIG_NO_IDLE_HZ is not set
243CONFIG_SH_PCLK_FREQ=33333333 242CONFIG_SH_PCLK_FREQ=33333333
244 243
245# 244#
diff --git a/arch/sh/configs/se7712_defconfig b/arch/sh/configs/se7712_defconfig
index 240a1cef69aa..2dd83af988f0 100644
--- a/arch/sh/configs/se7712_defconfig
+++ b/arch/sh/configs/se7712_defconfig
@@ -236,7 +236,6 @@ CONFIG_CPU_HAS_SR_RB=y
236# 236#
237CONFIG_SH_TMU=y 237CONFIG_SH_TMU=y
238CONFIG_SH_TIMER_IRQ=16 238CONFIG_SH_TIMER_IRQ=16
239# CONFIG_NO_IDLE_HZ is not set
240CONFIG_SH_PCLK_FREQ=66666666 239CONFIG_SH_PCLK_FREQ=66666666
241 240
242# 241#
diff --git a/arch/sh/configs/se7750_defconfig b/arch/sh/configs/se7750_defconfig
index c60b6fd4fc42..167786f9a9bd 100644
--- a/arch/sh/configs/se7750_defconfig
+++ b/arch/sh/configs/se7750_defconfig
@@ -235,7 +235,6 @@ CONFIG_CPU_HAS_PTEA=y
235# 235#
236CONFIG_SH_TMU=y 236CONFIG_SH_TMU=y
237CONFIG_SH_TIMER_IRQ=16 237CONFIG_SH_TIMER_IRQ=16
238# CONFIG_NO_IDLE_HZ is not set
239CONFIG_SH_PCLK_FREQ=33333333 238CONFIG_SH_PCLK_FREQ=33333333
240 239
241# 240#
diff --git a/arch/sh/kernel/vmlinux_32.lds.S b/arch/sh/kernel/vmlinux_32.lds.S
index c7113786ecd4..7b4b82bd1156 100644
--- a/arch/sh/kernel/vmlinux_32.lds.S
+++ b/arch/sh/kernel/vmlinux_32.lds.S
@@ -44,7 +44,6 @@ SECTIONS
44 44
45 _etext = .; /* End of text section */ 45 _etext = .; /* End of text section */
46 46
47 BUG_TABLE
48 NOTES 47 NOTES
49 RO_DATA(PAGE_SIZE) 48 RO_DATA(PAGE_SIZE)
50 49
diff --git a/arch/sh/kernel/vmlinux_64.lds.S b/arch/sh/kernel/vmlinux_64.lds.S
index d1e177009a41..33fa46451406 100644
--- a/arch/sh/kernel/vmlinux_64.lds.S
+++ b/arch/sh/kernel/vmlinux_64.lds.S
@@ -65,7 +65,6 @@ SECTIONS
65 65
66 _etext = .; /* End of text section */ 66 _etext = .; /* End of text section */
67 67
68 BUG_TABLE
69 NOTES 68 NOTES
70 RO_DATA(PAGE_SIZE) 69 RO_DATA(PAGE_SIZE)
71 70
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index d06a405ca718..6707422c9847 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -10,6 +10,7 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/miscdevice.h> 12#include <linux/miscdevice.h>
13#include <linux/smp_lock.h>
13#include <linux/pm.h> 14#include <linux/pm.h>
14 15
15#include <asm/io.h> 16#include <asm/io.h>
@@ -75,6 +76,7 @@ static inline void apc_free(void)
75 76
76static int apc_open(struct inode *inode, struct file *f) 77static int apc_open(struct inode *inode, struct file *f)
77{ 78{
79 cycle_kernel_lock();
78 return 0; 80 return 0;
79} 81}
80 82
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index eb36f3b746b8..fca9246470b1 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -11,6 +11,8 @@ config SPARC
11config SPARC64 11config SPARC64
12 bool 12 bool
13 default y 13 default y
14 select HAVE_DYNAMIC_FTRACE
15 select HAVE_FTRACE
14 select HAVE_IDE 16 select HAVE_IDE
15 select HAVE_LMB 17 select HAVE_LMB
16 select HAVE_ARCH_KGDB 18 select HAVE_ARCH_KGDB
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
index 6a4d28a4076d..d6d32d178fc8 100644
--- a/arch/sparc64/Kconfig.debug
+++ b/arch/sparc64/Kconfig.debug
@@ -33,7 +33,7 @@ config DEBUG_PAGEALLOC
33 33
34config MCOUNT 34config MCOUNT
35 bool 35 bool
36 depends on STACK_DEBUG 36 depends on STACK_DEBUG || FTRACE
37 default y 37 default y
38 38
39config FRAME_POINTER 39config FRAME_POINTER
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index ec4f5ebb1ca6..418b5782096e 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -14,6 +14,7 @@ obj-y := process.o setup.o cpu.o idprom.o \
14 power.o sbus.o sparc64_ksyms.o chmc.o \ 14 power.o sbus.o sparc64_ksyms.o chmc.o \
15 visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o 15 visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o
16 16
17obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
17obj-$(CONFIG_STACKTRACE) += stacktrace.o 18obj-$(CONFIG_STACKTRACE) += stacktrace.o
18obj-$(CONFIG_PCI) += ebus.o pci_common.o \ 19obj-$(CONFIG_PCI) += ebus.o pci_common.o \
19 pci_psycho.o pci_sabre.o pci_schizo.o \ 20 pci_psycho.o pci_sabre.o pci_schizo.o \
diff --git a/arch/sparc64/kernel/ftrace.c b/arch/sparc64/kernel/ftrace.c
new file mode 100644
index 000000000000..4298d0aee713
--- /dev/null
+++ b/arch/sparc64/kernel/ftrace.c
@@ -0,0 +1,94 @@
1#include <linux/spinlock.h>
2#include <linux/hardirq.h>
3#include <linux/ftrace.h>
4#include <linux/percpu.h>
5#include <linux/init.h>
6#include <linux/list.h>
7
8#include <asm/ftrace.h>
9
10static const u32 ftrace_nop = 0x01000000;
11
12notrace unsigned char *ftrace_nop_replace(void)
13{
14 return (char *)&ftrace_nop;
15}
16
17notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
18{
19 static u32 call;
20 s32 off;
21
22 off = ((s32)addr - (s32)ip);
23 call = 0x40000000 | ((u32)off >> 2);
24
25 return (unsigned char *) &call;
26}
27
28notrace int
29ftrace_modify_code(unsigned long ip, unsigned char *old_code,
30 unsigned char *new_code)
31{
32 u32 old = *(u32 *)old_code;
33 u32 new = *(u32 *)new_code;
34 u32 replaced;
35 int faulted;
36
37 __asm__ __volatile__(
38 "1: cas [%[ip]], %[old], %[new]\n"
39 " flush %[ip]\n"
40 " mov 0, %[faulted]\n"
41 "2:\n"
42 " .section .fixup,#alloc,#execinstr\n"
43 " .align 4\n"
44 "3: sethi %%hi(2b), %[faulted]\n"
45 " jmpl %[faulted] + %%lo(2b), %%g0\n"
46 " mov 1, %[faulted]\n"
47 " .previous\n"
48 " .section __ex_table,\"a\"\n"
49 " .align 4\n"
50 " .word 1b, 3b\n"
51 " .previous\n"
52 : "=r" (replaced), [faulted] "=r" (faulted)
53 : [new] "0" (new), [old] "r" (old), [ip] "r" (ip)
54 : "memory");
55
56 if (replaced != old && replaced != new)
57 faulted = 2;
58
59 return faulted;
60}
61
62notrace int ftrace_update_ftrace_func(ftrace_func_t func)
63{
64 unsigned long ip = (unsigned long)(&ftrace_call);
65 unsigned char old[MCOUNT_INSN_SIZE], *new;
66
67 memcpy(old, &ftrace_call, MCOUNT_INSN_SIZE);
68 new = ftrace_call_replace(ip, (unsigned long)func);
69 return ftrace_modify_code(ip, old, new);
70}
71
72notrace int ftrace_mcount_set(unsigned long *data)
73{
74 unsigned long ip = (long)(&mcount_call);
75 unsigned long *addr = data;
76 unsigned char old[MCOUNT_INSN_SIZE], *new;
77
78 /*
79 * Replace the mcount stub with a pointer to the
80 * ip recorder function.
81 */
82 memcpy(old, &mcount_call, MCOUNT_INSN_SIZE);
83 new = ftrace_call_replace(ip, *addr);
84 *addr = ftrace_modify_code(ip, old, new);
85
86 return 0;
87}
88
89
90int __init ftrace_dyn_arch_init(void *data)
91{
92 ftrace_mcount_set(data);
93 return 0;
94}
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 8ac0b99f2c55..49d3ea50c247 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -53,6 +53,7 @@
53#include <asm/ns87303.h> 53#include <asm/ns87303.h>
54#include <asm/timer.h> 54#include <asm/timer.h>
55#include <asm/cpudata.h> 55#include <asm/cpudata.h>
56#include <asm/ftrace.h>
56 57
57struct poll { 58struct poll {
58 int fd; 59 int fd;
@@ -111,8 +112,7 @@ EXPORT_SYMBOL(__write_trylock);
111EXPORT_SYMBOL(smp_call_function); 112EXPORT_SYMBOL(smp_call_function);
112#endif /* CONFIG_SMP */ 113#endif /* CONFIG_SMP */
113 114
114#if defined(CONFIG_MCOUNT) 115#ifdef CONFIG_MCOUNT
115extern void _mcount(void);
116EXPORT_SYMBOL(_mcount); 116EXPORT_SYMBOL(_mcount);
117#endif 117#endif
118 118
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index e5d238970c7e..bedc4c159b1c 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -11,6 +11,7 @@
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/smp_lock.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/param.h> 16#include <linux/param.h>
16#include <linux/string.h> 17#include <linux/string.h>
@@ -1659,10 +1660,14 @@ static int mini_rtc_ioctl(struct inode *inode, struct file *file,
1659 1660
1660static int mini_rtc_open(struct inode *inode, struct file *file) 1661static int mini_rtc_open(struct inode *inode, struct file *file)
1661{ 1662{
1662 if (mini_rtc_status & RTC_IS_OPEN) 1663 lock_kernel();
1664 if (mini_rtc_status & RTC_IS_OPEN) {
1665 unlock_kernel();
1663 return -EBUSY; 1666 return -EBUSY;
1667 }
1664 1668
1665 mini_rtc_status |= RTC_IS_OPEN; 1669 mini_rtc_status |= RTC_IS_OPEN;
1670 unlock_kernel();
1666 1671
1667 return 0; 1672 return 0;
1668} 1673}
diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc64/lib/mcount.S
index 9e4534b485c7..7735a7a60533 100644
--- a/arch/sparc64/lib/mcount.S
+++ b/arch/sparc64/lib/mcount.S
@@ -28,10 +28,13 @@ ovstack:
28 .skip OVSTACKSIZE 28 .skip OVSTACKSIZE
29#endif 29#endif
30 .text 30 .text
31 .align 32 31 .align 32
32 .globl mcount, _mcount 32 .globl _mcount
33mcount: 33 .type _mcount,#function
34 .globl mcount
35 .type mcount,#function
34_mcount: 36_mcount:
37mcount:
35#ifdef CONFIG_STACK_DEBUG 38#ifdef CONFIG_STACK_DEBUG
36 /* 39 /*
37 * Check whether %sp is dangerously low. 40 * Check whether %sp is dangerously low.
@@ -55,6 +58,53 @@ _mcount:
55 or %g3, %lo(panicstring), %o0 58 or %g3, %lo(panicstring), %o0
56 call prom_halt 59 call prom_halt
57 nop 60 nop
611:
62#endif
63#ifdef CONFIG_FTRACE
64#ifdef CONFIG_DYNAMIC_FTRACE
65 mov %o7, %o0
66 .globl mcount_call
67mcount_call:
68 call ftrace_stub
69 mov %o0, %o7
70#else
71 sethi %hi(ftrace_trace_function), %g1
72 sethi %hi(ftrace_stub), %g2
73 ldx [%g1 + %lo(ftrace_trace_function)], %g1
74 or %g2, %lo(ftrace_stub), %g2
75 cmp %g1, %g2
76 be,pn %icc, 1f
77 mov %i7, %o1
78 jmpl %g1, %g0
79 mov %o7, %o0
80 /* not reached */
811:
58#endif 82#endif
591: retl 83#endif
84 retl
60 nop 85 nop
86 .size _mcount,.-_mcount
87 .size mcount,.-mcount
88
89#ifdef CONFIG_FTRACE
90 .globl ftrace_stub
91 .type ftrace_stub,#function
92ftrace_stub:
93 retl
94 nop
95 .size ftrace_stub,.-ftrace_stub
96#ifdef CONFIG_DYNAMIC_FTRACE
97 .globl ftrace_caller
98 .type ftrace_caller,#function
99ftrace_caller:
100 mov %i7, %o1
101 mov %o7, %o0
102 .globl ftrace_call
103ftrace_call:
104 call ftrace_stub
105 mov %o0, %o7
106 retl
107 nop
108 .size ftrace_caller,.-ftrace_caller
109#endif
110#endif
diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c
index a9ad4bd6d953..d332503fa1be 100644
--- a/arch/um/drivers/harddog_kern.c
+++ b/arch/um/drivers/harddog_kern.c
@@ -66,6 +66,7 @@ static int harddog_open(struct inode *inode, struct file *file)
66 int err = -EBUSY; 66 int err = -EBUSY;
67 char *sock = NULL; 67 char *sock = NULL;
68 68
69 lock_kernel();
69 spin_lock(&lock); 70 spin_lock(&lock);
70 if(timer_alive) 71 if(timer_alive)
71 goto err; 72 goto err;
@@ -82,9 +83,11 @@ static int harddog_open(struct inode *inode, struct file *file)
82 83
83 timer_alive = 1; 84 timer_alive = 1;
84 spin_unlock(&lock); 85 spin_unlock(&lock);
86 unlock_kernel();
85 return nonseekable_open(inode, file); 87 return nonseekable_open(inode, file);
86err: 88err:
87 spin_unlock(&lock); 89 spin_unlock(&lock);
90 unlock_kernel();
88 return err; 91 return err;
89} 92}
90 93
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c
index 67b2f55a602f..eb240323c40a 100644
--- a/arch/um/drivers/mmapper_kern.c
+++ b/arch/um/drivers/mmapper_kern.c
@@ -16,6 +16,7 @@
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/smp_lock.h>
19#include <asm/uaccess.h> 20#include <asm/uaccess.h>
20#include "mem_user.h" 21#include "mem_user.h"
21 22
@@ -77,6 +78,7 @@ out:
77 78
78static int mmapper_open(struct inode *inode, struct file *file) 79static int mmapper_open(struct inode *inode, struct file *file)
79{ 80{
81 cycle_kernel_lock();
80 return 0; 82 return 0;
81} 83}
82 84
diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
index 4949044773ba..6eabb7022a2d 100644
--- a/arch/um/drivers/random.c
+++ b/arch/um/drivers/random.c
@@ -7,6 +7,7 @@
7 * of the GNU General Public License, incorporated herein by reference. 7 * of the GNU General Public License, incorporated herein by reference.
8 */ 8 */
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/smp_lock.h>
10#include <linux/module.h> 11#include <linux/module.h>
11#include <linux/fs.h> 12#include <linux/fs.h>
12#include <linux/interrupt.h> 13#include <linux/interrupt.h>
@@ -33,6 +34,8 @@ static DECLARE_WAIT_QUEUE_HEAD(host_read_wait);
33 34
34static int rng_dev_open (struct inode *inode, struct file *filp) 35static int rng_dev_open (struct inode *inode, struct file *filp)
35{ 36{
37 cycle_kernel_lock();
38
36 /* enforce read-only access to this chrdev */ 39 /* enforce read-only access to this chrdev */
37 if ((filp->f_mode & FMODE_READ) == 0) 40 if ((filp->f_mode & FMODE_READ) == 0)
38 return -EINVAL; 41 return -EINVAL;
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index bf07b6f50fa1..6958d6bcaf70 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -23,6 +23,8 @@ config X86
23 select HAVE_OPROFILE 23 select HAVE_OPROFILE
24 select HAVE_KPROBES 24 select HAVE_KPROBES
25 select HAVE_KRETPROBES 25 select HAVE_KRETPROBES
26 select HAVE_DYNAMIC_FTRACE
27 select HAVE_FTRACE
26 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) 28 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
27 select HAVE_ARCH_KGDB if !X86_VOYAGER 29 select HAVE_ARCH_KGDB if !X86_VOYAGER
28 30
@@ -121,7 +123,7 @@ config ARCH_HAS_CACHE_LINE_SIZE
121 def_bool y 123 def_bool y
122 124
123config HAVE_SETUP_PER_CPU_AREA 125config HAVE_SETUP_PER_CPU_AREA
124 def_bool X86_64 || (X86_SMP && !X86_VOYAGER) 126 def_bool X86_64_SMP || (X86_SMP && !X86_VOYAGER)
125 127
126config HAVE_CPUMASK_OF_CPU_MAP 128config HAVE_CPUMASK_OF_CPU_MAP
127 def_bool X86_64_SMP 129 def_bool X86_64_SMP
@@ -181,12 +183,12 @@ config X86_64_SMP
181config X86_HT 183config X86_HT
182 bool 184 bool
183 depends on SMP 185 depends on SMP
184 depends on (X86_32 && !(X86_VISWS || X86_VOYAGER)) || X86_64 186 depends on (X86_32 && !X86_VOYAGER) || X86_64
185 default y 187 default y
186 188
187config X86_BIOS_REBOOT 189config X86_BIOS_REBOOT
188 bool 190 bool
189 depends on !X86_VISWS && !X86_VOYAGER 191 depends on !X86_VOYAGER
190 default y 192 default y
191 193
192config X86_TRAMPOLINE 194config X86_TRAMPOLINE
@@ -230,6 +232,26 @@ config SMP
230 232
231 If you don't know what to do here, say N. 233 If you don't know what to do here, say N.
232 234
235config X86_FIND_SMP_CONFIG
236 def_bool y
237 depends on X86_MPPARSE || X86_VOYAGER
238
239if ACPI
240config X86_MPPARSE
241 def_bool y
242 bool "Enable MPS table"
243 depends on X86_LOCAL_APIC
244 help
245 For old smp systems that do not have proper acpi support. Newer systems
246 (esp with 64bit cpus) with acpi support, MADT and DSDT will override it
247endif
248
249if !ACPI
250config X86_MPPARSE
251 def_bool y
252 depends on X86_LOCAL_APIC
253endif
254
233choice 255choice
234 prompt "Subarchitecture Type" 256 prompt "Subarchitecture Type"
235 default X86_PC 257 default X86_PC
@@ -251,7 +273,7 @@ config X86_ELAN
251 273
252config X86_VOYAGER 274config X86_VOYAGER
253 bool "Voyager (NCR)" 275 bool "Voyager (NCR)"
254 depends on X86_32 && (SMP || BROKEN) 276 depends on X86_32 && (SMP || BROKEN) && !PCI
255 help 277 help
256 Voyager is an MCA-based 32-way capable SMP architecture proprietary 278 Voyager is an MCA-based 32-way capable SMP architecture proprietary
257 to NCR Corp. Machine classes 345x/35xx/4100/51xx are Voyager-based. 279 to NCR Corp. Machine classes 345x/35xx/4100/51xx are Voyager-based.
@@ -261,16 +283,27 @@ config X86_VOYAGER
261 If you do not specifically know you have a Voyager based machine, 283 If you do not specifically know you have a Voyager based machine,
262 say N here, otherwise the kernel you build will not be bootable. 284 say N here, otherwise the kernel you build will not be bootable.
263 285
286config X86_GENERICARCH
287 bool "Generic architecture"
288 depends on X86_32
289 help
290 This option compiles in the NUMAQ, Summit, bigsmp, ES7000, default
291 subarchitectures. It is intended for a generic binary kernel.
292 if you select them all, kernel will probe it one by one. and will
293 fallback to default.
294
295if X86_GENERICARCH
296
264config X86_NUMAQ 297config X86_NUMAQ
265 bool "NUMAQ (IBM/Sequent)" 298 bool "NUMAQ (IBM/Sequent)"
266 depends on SMP && X86_32 299 depends on SMP && X86_32 && PCI && X86_MPPARSE
267 select NUMA 300 select NUMA
268 help 301 help
269 This option is used for getting Linux to run on a (IBM/Sequent) NUMA 302 This option is used for getting Linux to run on a NUMAQ (IBM/Sequent)
270 multiquad box. This changes the way that processors are bootstrapped, 303 NUMA multiquad box. This changes the way that processors are
271 and uses Clustered Logical APIC addressing mode instead of Flat Logical. 304 bootstrapped, and uses Clustered Logical APIC addressing mode instead
272 You will need a new lynxer.elf file to flash your firmware with - send 305 of Flat Logical. You will need a new lynxer.elf file to flash your
273 email to <Martin.Bligh@us.ibm.com>. 306 firmware with - send email to <Martin.Bligh@us.ibm.com>.
274 307
275config X86_SUMMIT 308config X86_SUMMIT
276 bool "Summit/EXA (IBM x440)" 309 bool "Summit/EXA (IBM x440)"
@@ -279,46 +312,21 @@ config X86_SUMMIT
279 This option is needed for IBM systems that use the Summit/EXA chipset. 312 This option is needed for IBM systems that use the Summit/EXA chipset.
280 In particular, it is needed for the x440. 313 In particular, it is needed for the x440.
281 314
282 If you don't have one of these computers, you should say N here. 315config X86_ES7000
283 If you want to build a NUMA kernel, you must select ACPI. 316 bool "Support for Unisys ES7000 IA32 series"
317 depends on X86_32 && SMP
318 help
319 Support for Unisys ES7000 systems. Say 'Y' here if this kernel is
320 supposed to run on an IA32-based Unisys ES7000 system.
284 321
285config X86_BIGSMP 322config X86_BIGSMP
286 bool "Support for other sub-arch SMP systems with more than 8 CPUs" 323 bool "Support for big SMP systems with more than 8 CPUs"
287 depends on X86_32 && SMP 324 depends on X86_32 && SMP
288 help 325 help
289 This option is needed for the systems that have more than 8 CPUs 326 This option is needed for the systems that have more than 8 CPUs
290 and if the system is not of any sub-arch type above. 327 and if the system is not of any sub-arch type above.
291 328
292 If you don't have such a system, you should say N here. 329endif
293
294config X86_VISWS
295 bool "SGI 320/540 (Visual Workstation)"
296 depends on X86_32
297 help
298 The SGI Visual Workstation series is an IA32-based workstation
299 based on SGI systems chips with some legacy PC hardware attached.
300
301 Say Y here to create a kernel to run on the SGI 320 or 540.
302
303 A kernel compiled for the Visual Workstation will not run on PCs
304 and vice versa. See <file:Documentation/sgi-visws.txt> for details.
305
306config X86_GENERICARCH
307 bool "Generic architecture (Summit, bigsmp, ES7000, default)"
308 depends on X86_32
309 help
310 This option compiles in the Summit, bigsmp, ES7000, default subarchitectures.
311 It is intended for a generic binary kernel.
312 If you want a NUMA kernel, select ACPI. We need SRAT for NUMA.
313
314config X86_ES7000
315 bool "Support for Unisys ES7000 IA32 series"
316 depends on X86_32 && SMP
317 help
318 Support for Unisys ES7000 systems. Say 'Y' here if this kernel is
319 supposed to run on an IA32-based Unisys ES7000 system.
320 Only choose this option if you have such a system, otherwise you
321 should say N here.
322 330
323config X86_RDC321X 331config X86_RDC321X
324 bool "RDC R-321x SoC" 332 bool "RDC R-321x SoC"
@@ -337,7 +345,7 @@ config X86_RDC321X
337config X86_VSMP 345config X86_VSMP
338 bool "Support for ScaleMP vSMP" 346 bool "Support for ScaleMP vSMP"
339 select PARAVIRT 347 select PARAVIRT
340 depends on X86_64 348 depends on X86_64 && PCI
341 help 349 help
342 Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is 350 Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is
343 supposed to run on these EM64T-based machines. Only choose this option 351 supposed to run on these EM64T-based machines. Only choose this option
@@ -345,6 +353,18 @@ config X86_VSMP
345 353
346endchoice 354endchoice
347 355
356config X86_VISWS
357 bool "SGI 320/540 (Visual Workstation)"
358 depends on X86_32 && PCI && !X86_VOYAGER && X86_MPPARSE && PCI_GODIRECT
359 help
360 The SGI Visual Workstation series is an IA32-based workstation
361 based on SGI systems chips with some legacy PC hardware attached.
362
363 Say Y here to create a kernel to run on the SGI 320 or 540.
364
365 A kernel compiled for the Visual Workstation will run on general
366 PCs as well. See <file:Documentation/sgi-visws.txt> for details.
367
348config SCHED_NO_NO_OMIT_FRAME_POINTER 368config SCHED_NO_NO_OMIT_FRAME_POINTER
349 def_bool y 369 def_bool y
350 prompt "Single-depth WCHAN output" 370 prompt "Single-depth WCHAN output"
@@ -373,7 +393,7 @@ config VMI
373 bool "VMI Guest support" 393 bool "VMI Guest support"
374 select PARAVIRT 394 select PARAVIRT
375 depends on X86_32 395 depends on X86_32
376 depends on !(X86_VISWS || X86_VOYAGER) 396 depends on !X86_VOYAGER
377 help 397 help
378 VMI provides a paravirtualized interface to the VMware ESX server 398 VMI provides a paravirtualized interface to the VMware ESX server
379 (it could be used by other hypervisors in theory too, but is not 399 (it could be used by other hypervisors in theory too, but is not
@@ -384,7 +404,7 @@ config KVM_CLOCK
384 bool "KVM paravirtualized clock" 404 bool "KVM paravirtualized clock"
385 select PARAVIRT 405 select PARAVIRT
386 select PARAVIRT_CLOCK 406 select PARAVIRT_CLOCK
387 depends on !(X86_VISWS || X86_VOYAGER) 407 depends on !X86_VOYAGER
388 help 408 help
389 Turning on this option will allow you to run a paravirtualized clock 409 Turning on this option will allow you to run a paravirtualized clock
390 when running over the KVM hypervisor. Instead of relying on a PIT 410 when running over the KVM hypervisor. Instead of relying on a PIT
@@ -395,7 +415,7 @@ config KVM_CLOCK
395config KVM_GUEST 415config KVM_GUEST
396 bool "KVM Guest support" 416 bool "KVM Guest support"
397 select PARAVIRT 417 select PARAVIRT
398 depends on !(X86_VISWS || X86_VOYAGER) 418 depends on !X86_VOYAGER
399 help 419 help
400 This option enables various optimizations for running under the KVM 420 This option enables various optimizations for running under the KVM
401 hypervisor. 421 hypervisor.
@@ -404,7 +424,7 @@ source "arch/x86/lguest/Kconfig"
404 424
405config PARAVIRT 425config PARAVIRT
406 bool "Enable paravirtualization code" 426 bool "Enable paravirtualization code"
407 depends on !(X86_VISWS || X86_VOYAGER) 427 depends on !X86_VOYAGER
408 help 428 help
409 This changes the kernel so it can modify itself when it is run 429 This changes the kernel so it can modify itself when it is run
410 under a hypervisor, potentially improving performance significantly 430 under a hypervisor, potentially improving performance significantly
@@ -417,51 +437,33 @@ config PARAVIRT_CLOCK
417 437
418endif 438endif
419 439
420config MEMTEST_BOOTPARAM 440config PARAVIRT_DEBUG
421 bool "Memtest boot parameter" 441 bool "paravirt-ops debugging"
442 depends on PARAVIRT && DEBUG_KERNEL
443 help
444 Enable to debug paravirt_ops internals. Specifically, BUG if
445 a paravirt_op is missing when it is called.
446
447config MEMTEST
448 bool "Memtest"
422 depends on X86_64 449 depends on X86_64
423 default y 450 default y
424 help 451 help
425 This option adds a kernel parameter 'memtest', which allows memtest 452 This option adds a kernel parameter 'memtest', which allows memtest
426 to be disabled at boot. If this option is selected, memtest 453 to be set.
427 functionality can be disabled with memtest=0 on the kernel 454 memtest=0, mean disabled; -- default
428 command line. The purpose of this option is to allow a single 455 memtest=1, mean do 1 test pattern;
429 kernel image to be distributed with memtest built in, but not 456 ...
430 necessarily enabled. 457 memtest=4, mean do 4 test patterns.
431
432 If you are unsure how to answer this question, answer Y. 458 If you are unsure how to answer this question, answer Y.
433 459
434config MEMTEST_BOOTPARAM_VALUE
435 int "Memtest boot parameter default value (0-4)"
436 depends on MEMTEST_BOOTPARAM
437 range 0 4
438 default 0
439 help
440 This option sets the default value for the kernel parameter
441 'memtest', which allows memtest to be disabled at boot. If this
442 option is set to 0 (zero), the memtest kernel parameter will
443 default to 0, disabling memtest at bootup. If this option is
444 set to 4, the memtest kernel parameter will default to 4,
445 enabling memtest at bootup, and use that as pattern number.
446
447 If you are unsure how to answer this question, answer 0.
448
449config ACPI_SRAT
450 def_bool y
451 depends on X86_32 && ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH)
452 select ACPI_NUMA
453
454config HAVE_ARCH_PARSE_SRAT
455 def_bool y
456 depends on ACPI_SRAT
457
458config X86_SUMMIT_NUMA 460config X86_SUMMIT_NUMA
459 def_bool y 461 def_bool y
460 depends on X86_32 && NUMA && (X86_SUMMIT || X86_GENERICARCH) 462 depends on X86_32 && NUMA && X86_GENERICARCH
461 463
462config X86_CYCLONE_TIMER 464config X86_CYCLONE_TIMER
463 def_bool y 465 def_bool y
464 depends on X86_32 && X86_SUMMIT || X86_GENERICARCH 466 depends on X86_GENERICARCH
465 467
466config ES7000_CLUSTERED_APIC 468config ES7000_CLUSTERED_APIC
467 def_bool y 469 def_bool y
@@ -549,6 +551,21 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
549 Calgary anyway, pass 'iommu=calgary' on the kernel command line. 551 Calgary anyway, pass 'iommu=calgary' on the kernel command line.
550 If unsure, say Y. 552 If unsure, say Y.
551 553
554config AMD_IOMMU
555 bool "AMD IOMMU support"
556 select SWIOTLB
557 depends on X86_64 && PCI && ACPI
558 help
559 With this option you can enable support for AMD IOMMU hardware in
560 your system. An IOMMU is a hardware component which provides
561 remapping of DMA memory accesses from devices. With an AMD IOMMU you
562 can isolate the the DMA memory of different devices and protect the
563 system from misbehaving device drivers or hardware.
564
565 You can find out if your system has an AMD IOMMU if you look into
566 your BIOS for an option to enable it or if you have an IVRS ACPI
567 table.
568
552# need this always selected by IOMMU for the VIA workaround 569# need this always selected by IOMMU for the VIA workaround
553config SWIOTLB 570config SWIOTLB
554 bool 571 bool
@@ -560,21 +577,36 @@ config SWIOTLB
560 3 GB of memory. If unsure, say Y. 577 3 GB of memory. If unsure, say Y.
561 578
562config IOMMU_HELPER 579config IOMMU_HELPER
563 def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB) 580 def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU)
581config MAXSMP
582 bool "Configure Maximum number of SMP Processors and NUMA Nodes"
583 depends on X86_64 && SMP
584 default n
585 help
586 Configure maximum number of CPUS and NUMA Nodes for this architecture.
587 If unsure, say N.
564 588
589if MAXSMP
565config NR_CPUS 590config NR_CPUS
566 int "Maximum number of CPUs (2-255)" 591 int
567 range 2 255 592 default "4096"
593endif
594
595if !MAXSMP
596config NR_CPUS
597 int "Maximum number of CPUs (2-4096)"
598 range 2 4096
568 depends on SMP 599 depends on SMP
569 default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000 600 default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
570 default "8" 601 default "8"
571 help 602 help
572 This allows you to specify the maximum number of CPUs which this 603 This allows you to specify the maximum number of CPUs which this
573 kernel will support. The maximum supported value is 255 and the 604 kernel will support. The maximum supported value is 4096 and the
574 minimum value which makes sense is 2. 605 minimum value which makes sense is 2.
575 606
576 This is purely to save memory - each supported CPU adds 607 This is purely to save memory - each supported CPU adds
577 approximately eight kilobytes to the kernel image. 608 approximately eight kilobytes to the kernel image.
609endif
578 610
579config SCHED_SMT 611config SCHED_SMT
580 bool "SMT (Hyperthreading) scheduler support" 612 bool "SMT (Hyperthreading) scheduler support"
@@ -598,7 +630,7 @@ source "kernel/Kconfig.preempt"
598 630
599config X86_UP_APIC 631config X86_UP_APIC
600 bool "Local APIC support on uniprocessors" 632 bool "Local APIC support on uniprocessors"
601 depends on X86_32 && !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH) 633 depends on X86_32 && !SMP && !(X86_VOYAGER || X86_GENERICARCH)
602 help 634 help
603 A local APIC (Advanced Programmable Interrupt Controller) is an 635 A local APIC (Advanced Programmable Interrupt Controller) is an
604 integrated interrupt controller in the CPU. If you have a single-CPU 636 integrated interrupt controller in the CPU. If you have a single-CPU
@@ -623,11 +655,11 @@ config X86_UP_IOAPIC
623 655
624config X86_LOCAL_APIC 656config X86_LOCAL_APIC
625 def_bool y 657 def_bool y
626 depends on X86_64 || (X86_32 && (X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH)) 658 depends on X86_64 || (X86_32 && (X86_UP_APIC || (SMP && !X86_VOYAGER) || X86_GENERICARCH))
627 659
628config X86_IO_APIC 660config X86_IO_APIC
629 def_bool y 661 def_bool y
630 depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH)) 662 depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !X86_VOYAGER) || X86_GENERICARCH))
631 663
632config X86_VISWS_APIC 664config X86_VISWS_APIC
633 def_bool y 665 def_bool y
@@ -681,7 +713,7 @@ config X86_MCE_NONFATAL
681 713
682config X86_MCE_P4THERMAL 714config X86_MCE_P4THERMAL
683 bool "check for P4 thermal throttling interrupt." 715 bool "check for P4 thermal throttling interrupt."
684 depends on X86_32 && X86_MCE && (X86_UP_APIC || SMP) && !X86_VISWS 716 depends on X86_32 && X86_MCE && (X86_UP_APIC || SMP)
685 help 717 help
686 Enabling this feature will cause a message to be printed when the P4 718 Enabling this feature will cause a message to be printed when the P4
687 enters thermal throttling. 719 enters thermal throttling.
@@ -911,9 +943,9 @@ config X86_PAE
911config NUMA 943config NUMA
912 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)" 944 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
913 depends on SMP 945 depends on SMP
914 depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL) 946 depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL)
915 default n if X86_PC 947 default n if X86_PC
916 default y if (X86_NUMAQ || X86_SUMMIT) 948 default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP)
917 help 949 help
918 Enable NUMA (Non Uniform Memory Access) support. 950 Enable NUMA (Non Uniform Memory Access) support.
919 The kernel will try to allocate memory used by a CPU on the 951 The kernel will try to allocate memory used by a CPU on the
@@ -965,13 +997,25 @@ config NUMA_EMU
965 into virtual nodes when booted with "numa=fake=N", where N is the 997 into virtual nodes when booted with "numa=fake=N", where N is the
966 number of nodes. This is only useful for debugging. 998 number of nodes. This is only useful for debugging.
967 999
1000if MAXSMP
1001
1002config NODES_SHIFT
1003 int
1004 default "9"
1005endif
1006
1007if !MAXSMP
968config NODES_SHIFT 1008config NODES_SHIFT
969 int "Max num nodes shift(1-9)" 1009 int "Maximum NUMA Nodes (as a power of 2)"
970 range 1 9 if X86_64 1010 range 1 9 if X86_64
971 default "6" if X86_64 1011 default "6" if X86_64
972 default "4" if X86_NUMAQ 1012 default "4" if X86_NUMAQ
973 default "3" 1013 default "3"
974 depends on NEED_MULTIPLE_NODES 1014 depends on NEED_MULTIPLE_NODES
1015 help
1016 Specify the maximum number of NUMA Nodes available on the target
1017 system. Increases memory reserved to accomodate various tables.
1018endif
975 1019
976config HAVE_ARCH_BOOTMEM_NODE 1020config HAVE_ARCH_BOOTMEM_NODE
977 def_bool y 1021 def_bool y
@@ -1090,6 +1134,40 @@ config MTRR
1090 1134
1091 See <file:Documentation/mtrr.txt> for more information. 1135 See <file:Documentation/mtrr.txt> for more information.
1092 1136
1137config MTRR_SANITIZER
1138 def_bool y
1139 prompt "MTRR cleanup support"
1140 depends on MTRR
1141 help
1142 Convert MTRR layout from continuous to discrete, so some X driver
1143 could add WB entries.
1144
1145 Say N here if you see bootup problems (boot crash, boot hang,
1146 spontaneous reboots).
1147
1148 Could be disabled with disable_mtrr_cleanup. Also mtrr_chunk_size
1149 could be used to send largest mtrr entry size for continuous block
1150 to hold holes (aka. UC entries)
1151
1152 If unsure, say Y.
1153
1154config MTRR_SANITIZER_ENABLE_DEFAULT
1155 int "MTRR cleanup enable value (0-1)"
1156 range 0 1
1157 default "0"
1158 depends on MTRR_SANITIZER
1159 help
1160 Enable mtrr cleanup default value
1161
1162config MTRR_SANITIZER_SPARE_REG_NR_DEFAULT
1163 int "MTRR cleanup spare reg num (0-7)"
1164 range 0 7
1165 default "1"
1166 depends on MTRR_SANITIZER
1167 help
1168 mtrr cleanup spare entries default, it can be changed via
1169 mtrr_spare_reg_nr=
1170
1093config X86_PAT 1171config X86_PAT
1094 bool 1172 bool
1095 prompt "x86 PAT support" 1173 prompt "x86 PAT support"
@@ -1190,7 +1268,6 @@ config KEXEC
1190 1268
1191config CRASH_DUMP 1269config CRASH_DUMP
1192 bool "kernel crash dumps (EXPERIMENTAL)" 1270 bool "kernel crash dumps (EXPERIMENTAL)"
1193 depends on EXPERIMENTAL
1194 depends on X86_64 || (X86_32 && HIGHMEM) 1271 depends on X86_64 || (X86_32 && HIGHMEM)
1195 help 1272 help
1196 Generate crash dump after being started by kexec. 1273 Generate crash dump after being started by kexec.
@@ -1339,7 +1416,7 @@ config X86_APM_BOOT
1339 1416
1340menuconfig APM 1417menuconfig APM
1341 tristate "APM (Advanced Power Management) BIOS support" 1418 tristate "APM (Advanced Power Management) BIOS support"
1342 depends on X86_32 && PM_SLEEP && !X86_VISWS 1419 depends on X86_32 && PM_SLEEP
1343 ---help--- 1420 ---help---
1344 APM is a BIOS specification for saving power using several different 1421 APM is a BIOS specification for saving power using several different
1345 techniques. This is mostly useful for battery powered laptops with 1422 techniques. This is mostly useful for battery powered laptops with
@@ -1475,8 +1552,7 @@ endmenu
1475menu "Bus options (PCI etc.)" 1552menu "Bus options (PCI etc.)"
1476 1553
1477config PCI 1554config PCI
1478 bool "PCI support" if !X86_VISWS && !X86_VSMP 1555 bool "PCI support"
1479 depends on !X86_VOYAGER
1480 default y 1556 default y
1481 select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC) 1557 select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC)
1482 help 1558 help
@@ -1487,7 +1563,7 @@ config PCI
1487 1563
1488choice 1564choice
1489 prompt "PCI access mode" 1565 prompt "PCI access mode"
1490 depends on X86_32 && PCI && !X86_VISWS 1566 depends on X86_32 && PCI
1491 default PCI_GOANY 1567 default PCI_GOANY
1492 ---help--- 1568 ---help---
1493 On PCI systems, the BIOS can be used to detect the PCI devices and 1569 On PCI systems, the BIOS can be used to detect the PCI devices and
@@ -1524,12 +1600,12 @@ endchoice
1524 1600
1525config PCI_BIOS 1601config PCI_BIOS
1526 def_bool y 1602 def_bool y
1527 depends on X86_32 && !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY) 1603 depends on X86_32 && PCI && (PCI_GOBIOS || PCI_GOANY)
1528 1604
1529# x86-64 doesn't support PCI BIOS access from long mode so always go direct. 1605# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
1530config PCI_DIRECT 1606config PCI_DIRECT
1531 def_bool y 1607 def_bool y
1532 depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC) || X86_VISWS) 1608 depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC))
1533 1609
1534config PCI_MMCONFIG 1610config PCI_MMCONFIG
1535 def_bool y 1611 def_bool y
@@ -1589,7 +1665,7 @@ if X86_32
1589 1665
1590config ISA 1666config ISA
1591 bool "ISA support" 1667 bool "ISA support"
1592 depends on !(X86_VOYAGER || X86_VISWS) 1668 depends on !X86_VOYAGER
1593 help 1669 help
1594 Find out whether you have ISA slots on your motherboard. ISA is the 1670 Find out whether you have ISA slots on your motherboard. ISA is the
1595 name of a bus system, i.e. the way the CPU talks to the other stuff 1671 name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -1616,7 +1692,7 @@ config EISA
1616source "drivers/eisa/Kconfig" 1692source "drivers/eisa/Kconfig"
1617 1693
1618config MCA 1694config MCA
1619 bool "MCA support" if !(X86_VISWS || X86_VOYAGER) 1695 bool "MCA support" if !X86_VOYAGER
1620 default y if X86_VOYAGER 1696 default y if X86_VOYAGER
1621 help 1697 help
1622 MicroChannel Architecture is found in some IBM PS/2 machines and 1698 MicroChannel Architecture is found in some IBM PS/2 machines and
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 2ad6301849a1..abff1b84ed5b 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -344,7 +344,7 @@ config X86_F00F_BUG
344 344
345config X86_WP_WORKS_OK 345config X86_WP_WORKS_OK
346 def_bool y 346 def_bool y
347 depends on X86_32 && !M386 347 depends on !M386
348 348
349config X86_INVLPG 349config X86_INVLPG
350 def_bool y 350 def_bool y
@@ -399,6 +399,10 @@ config X86_TSC
399 def_bool y 399 def_bool y
400 depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64 400 depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64
401 401
402config X86_CMPXCHG64
403 def_bool y
404 depends on X86_PAE || X86_64
405
402# this should be set for all -march=.. options where the compiler 406# this should be set for all -march=.. options where the compiler
403# generates cmov. 407# generates cmov.
404config X86_CMOV 408config X86_CMOV
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 18363374d51a..ae36bfa814e5 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -20,6 +20,14 @@ config NONPROMISC_DEVMEM
20 20
21 If in doubt, say Y. 21 If in doubt, say Y.
22 22
23config X86_VERBOSE_BOOTUP
24 bool "Enable verbose x86 bootup info messages"
25 default y
26 help
27 Enables the informational output from the decompression stage
28 (e.g. bzImage) of the boot. If you disable this you will still
29 see errors. Disable this if you want silent bootup.
30
23config EARLY_PRINTK 31config EARLY_PRINTK
24 bool "Early printk" if EMBEDDED 32 bool "Early printk" if EMBEDDED
25 default y 33 default y
@@ -60,7 +68,7 @@ config DEBUG_PAGEALLOC
60config DEBUG_PER_CPU_MAPS 68config DEBUG_PER_CPU_MAPS
61 bool "Debug access to per_cpu maps" 69 bool "Debug access to per_cpu maps"
62 depends on DEBUG_KERNEL 70 depends on DEBUG_KERNEL
63 depends on X86_64_SMP 71 depends on X86_SMP
64 default n 72 default n
65 help 73 help
66 Say Y to verify that the per_cpu map being accessed has 74 Say Y to verify that the per_cpu map being accessed has
@@ -129,15 +137,6 @@ config 4KSTACKS
129 on the VM subsystem for higher order allocations. This option 137 on the VM subsystem for higher order allocations. This option
130 will also use IRQ stacks to compensate for the reduced stackspace. 138 will also use IRQ stacks to compensate for the reduced stackspace.
131 139
132config X86_FIND_SMP_CONFIG
133 def_bool y
134 depends on X86_LOCAL_APIC || X86_VOYAGER
135 depends on X86_32
136
137config X86_MPPARSE
138 def_bool y
139 depends on (X86_32 && (X86_LOCAL_APIC && !X86_VISWS)) || X86_64
140
141config DOUBLEFAULT 140config DOUBLEFAULT
142 default y 141 default y
143 bool "Enable doublefault exception handler" if EMBEDDED 142 bool "Enable doublefault exception handler" if EMBEDDED
@@ -172,6 +171,33 @@ config IOMMU_LEAK
172 Add a simple leak tracer to the IOMMU code. This is useful when you 171 Add a simple leak tracer to the IOMMU code. This is useful when you
173 are debugging a buggy device driver that leaks IOMMU mappings. 172 are debugging a buggy device driver that leaks IOMMU mappings.
174 173
174config MMIOTRACE_HOOKS
175 bool
176
177config MMIOTRACE
178 bool "Memory mapped IO tracing"
179 depends on DEBUG_KERNEL && PCI
180 select TRACING
181 select MMIOTRACE_HOOKS
182 help
183 Mmiotrace traces Memory Mapped I/O access and is meant for
184 debugging and reverse engineering. It is called from the ioremap
185 implementation and works via page faults. Tracing is disabled by
186 default and can be enabled at run-time.
187
188 See Documentation/tracers/mmiotrace.txt.
189 If you are not helping to develop drivers, say N.
190
191config MMIOTRACE_TEST
192 tristate "Test module for mmiotrace"
193 depends on MMIOTRACE && m
194 help
195 This is a dumb module for testing mmiotrace. It is very dangerous
196 as it will write garbage to IO memory starting at a given address.
197 However, it should be safe to use on e.g. unused portion of VRAM.
198
199 Say N, unless you absolutely know what you are doing.
200
175# 201#
176# IO delay types: 202# IO delay types:
177# 203#
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 3cff3c894cf3..919ce21ea654 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -113,33 +113,11 @@ mcore-y := arch/x86/mach-default/
113mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-x86/mach-voyager 113mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-x86/mach-voyager
114mcore-$(CONFIG_X86_VOYAGER) := arch/x86/mach-voyager/ 114mcore-$(CONFIG_X86_VOYAGER) := arch/x86/mach-voyager/
115 115
116# VISWS subarch support
117mflags-$(CONFIG_X86_VISWS) := -Iinclude/asm-x86/mach-visws
118mcore-$(CONFIG_X86_VISWS) := arch/x86/mach-visws/
119
120# NUMAQ subarch support
121mflags-$(CONFIG_X86_NUMAQ) := -Iinclude/asm-x86/mach-numaq
122mcore-$(CONFIG_X86_NUMAQ) := arch/x86/mach-default/
123
124# BIGSMP subarch support
125mflags-$(CONFIG_X86_BIGSMP) := -Iinclude/asm-x86/mach-bigsmp
126mcore-$(CONFIG_X86_BIGSMP) := arch/x86/mach-default/
127
128#Summit subarch support
129mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-x86/mach-summit
130mcore-$(CONFIG_X86_SUMMIT) := arch/x86/mach-default/
131
132# generic subarchitecture 116# generic subarchitecture
133mflags-$(CONFIG_X86_GENERICARCH):= -Iinclude/asm-x86/mach-generic 117mflags-$(CONFIG_X86_GENERICARCH):= -Iinclude/asm-x86/mach-generic
134fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/ 118fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/
135mcore-$(CONFIG_X86_GENERICARCH) := arch/x86/mach-default/ 119mcore-$(CONFIG_X86_GENERICARCH) := arch/x86/mach-default/
136 120
137
138# ES7000 subarch support
139mflags-$(CONFIG_X86_ES7000) := -Iinclude/asm-x86/mach-es7000
140fcore-$(CONFIG_X86_ES7000) := arch/x86/mach-es7000/
141mcore-$(CONFIG_X86_ES7000) := arch/x86/mach-default/
142
143# RDC R-321x subarch support 121# RDC R-321x subarch support
144mflags-$(CONFIG_X86_RDC321X) := -Iinclude/asm-x86/mach-rdc321x 122mflags-$(CONFIG_X86_RDC321X) := -Iinclude/asm-x86/mach-rdc321x
145mcore-$(CONFIG_X86_RDC321X) := arch/x86/mach-default/ 123mcore-$(CONFIG_X86_RDC321X) := arch/x86/mach-default/
@@ -160,6 +138,7 @@ KBUILD_AFLAGS += $(mflags-y)
160 138
161head-y := arch/x86/kernel/head_$(BITS).o 139head-y := arch/x86/kernel/head_$(BITS).o
162head-y += arch/x86/kernel/head$(BITS).o 140head-y += arch/x86/kernel/head$(BITS).o
141head-y += arch/x86/kernel/head.o
163head-y += arch/x86/kernel/init_task.o 142head-y += arch/x86/kernel/init_task.o
164 143
165libs-y += arch/x86/lib/ 144libs-y += arch/x86/lib/
@@ -210,12 +189,12 @@ all: bzImage
210 189
211# KBUILD_IMAGE specify target image being built 190# KBUILD_IMAGE specify target image being built
212 KBUILD_IMAGE := $(boot)/bzImage 191 KBUILD_IMAGE := $(boot)/bzImage
213zImage zlilo zdisk: KBUILD_IMAGE := arch/x86/boot/zImage 192zImage zlilo zdisk: KBUILD_IMAGE := $(boot)/zImage
214 193
215zImage bzImage: vmlinux 194zImage bzImage: vmlinux
216 $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) 195 $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
217 $(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot 196 $(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot
218 $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/bzImage 197 $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/$@
219 198
220compressed: zImage 199compressed: zImage
221 200
diff --git a/arch/x86/boot/a20.c b/arch/x86/boot/a20.c
index e01aafd03bde..4063d630deff 100644
--- a/arch/x86/boot/a20.c
+++ b/arch/x86/boot/a20.c
@@ -1,7 +1,7 @@
1/* -*- linux-c -*- ------------------------------------------------------- * 1/* -*- linux-c -*- ------------------------------------------------------- *
2 * 2 *
3 * Copyright (C) 1991, 1992 Linus Torvalds 3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007 rPath, Inc. - All Rights Reserved 4 * Copyright 2007-2008 rPath, Inc. - All Rights Reserved
5 * 5 *
6 * This file is part of the Linux kernel, and is made available under 6 * This file is part of the Linux kernel, and is made available under
7 * the terms of the GNU General Public License version 2. 7 * the terms of the GNU General Public License version 2.
@@ -95,6 +95,9 @@ static void enable_a20_kbc(void)
95 95
96 outb(0xdf, 0x60); /* A20 on */ 96 outb(0xdf, 0x60); /* A20 on */
97 empty_8042(); 97 empty_8042();
98
99 outb(0xff, 0x64); /* Null command, but UHCI wants it */
100 empty_8042();
98} 101}
99 102
100static void enable_a20_fast(void) 103static void enable_a20_fast(void)
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index d8819efac81d..1d5dff4123e1 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -30,6 +30,7 @@
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/boot.h> 31#include <asm/boot.h>
32#include <asm/msr.h> 32#include <asm/msr.h>
33#include <asm/processor-flags.h>
33#include <asm/asm-offsets.h> 34#include <asm/asm-offsets.h>
34 35
35.section ".text.head" 36.section ".text.head"
@@ -109,7 +110,7 @@ startup_32:
109 110
110 /* Enable PAE mode */ 111 /* Enable PAE mode */
111 xorl %eax, %eax 112 xorl %eax, %eax
112 orl $(1 << 5), %eax 113 orl $(X86_CR4_PAE), %eax
113 movl %eax, %cr4 114 movl %eax, %cr4
114 115
115 /* 116 /*
@@ -170,7 +171,7 @@ startup_32:
170 pushl %eax 171 pushl %eax
171 172
172 /* Enter paged protected Mode, activating Long Mode */ 173 /* Enter paged protected Mode, activating Long Mode */
173 movl $0x80000001, %eax /* Enable Paging and Protected mode */ 174 movl $(X86_CR0_PG | X86_CR0_PE), %eax /* Enable Paging and Protected mode */
174 movl %eax, %cr0 175 movl %eax, %cr0
175 176
176 /* Jump from 32bit compatibility mode into 64bit mode. */ 177 /* Jump from 32bit compatibility mode into 64bit mode. */
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 90456cee47c3..bc5553b496f7 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -30,6 +30,7 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/boot.h> 32#include <asm/boot.h>
33#include <asm/bootparam.h>
33 34
34/* WARNING!! 35/* WARNING!!
35 * This code is compiled with -fPIC and it is relocated dynamically 36 * This code is compiled with -fPIC and it is relocated dynamically
@@ -187,13 +188,8 @@ static void gzip_release(void **);
187/* 188/*
188 * This is set up by the setup-routine at boot-time 189 * This is set up by the setup-routine at boot-time
189 */ 190 */
190static unsigned char *real_mode; /* Pointer to real-mode data */ 191static struct boot_params *real_mode; /* Pointer to real-mode data */
191 192static int quiet;
192#define RM_EXT_MEM_K (*(unsigned short *)(real_mode + 0x2))
193#ifndef STANDARD_MEMORY_BIOS_CALL
194#define RM_ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0))
195#endif
196#define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0))
197 193
198extern unsigned char input_data[]; 194extern unsigned char input_data[];
199extern int input_len; 195extern int input_len;
@@ -206,7 +202,8 @@ static void free(void *where);
206static void *memset(void *s, int c, unsigned n); 202static void *memset(void *s, int c, unsigned n);
207static void *memcpy(void *dest, const void *src, unsigned n); 203static void *memcpy(void *dest, const void *src, unsigned n);
208 204
209static void putstr(const char *); 205static void __putstr(int, const char *);
206#define putstr(__x) __putstr(0, __x)
210 207
211#ifdef CONFIG_X86_64 208#ifdef CONFIG_X86_64
212#define memptr long 209#define memptr long
@@ -221,10 +218,6 @@ static char *vidmem;
221static int vidport; 218static int vidport;
222static int lines, cols; 219static int lines, cols;
223 220
224#ifdef CONFIG_X86_NUMAQ
225void *xquad_portio;
226#endif
227
228#include "../../../../lib/inflate.c" 221#include "../../../../lib/inflate.c"
229 222
230static void *malloc(int size) 223static void *malloc(int size)
@@ -270,18 +263,24 @@ static void scroll(void)
270 vidmem[i] = ' '; 263 vidmem[i] = ' ';
271} 264}
272 265
273static void putstr(const char *s) 266static void __putstr(int error, const char *s)
274{ 267{
275 int x, y, pos; 268 int x, y, pos;
276 char c; 269 char c;
277 270
271#ifndef CONFIG_X86_VERBOSE_BOOTUP
272 if (!error)
273 return;
274#endif
275
278#ifdef CONFIG_X86_32 276#ifdef CONFIG_X86_32
279 if (RM_SCREEN_INFO.orig_video_mode == 0 && lines == 0 && cols == 0) 277 if (real_mode->screen_info.orig_video_mode == 0 &&
278 lines == 0 && cols == 0)
280 return; 279 return;
281#endif 280#endif
282 281
283 x = RM_SCREEN_INFO.orig_x; 282 x = real_mode->screen_info.orig_x;
284 y = RM_SCREEN_INFO.orig_y; 283 y = real_mode->screen_info.orig_y;
285 284
286 while ((c = *s++) != '\0') { 285 while ((c = *s++) != '\0') {
287 if (c == '\n') { 286 if (c == '\n') {
@@ -302,8 +301,8 @@ static void putstr(const char *s)
302 } 301 }
303 } 302 }
304 303
305 RM_SCREEN_INFO.orig_x = x; 304 real_mode->screen_info.orig_x = x;
306 RM_SCREEN_INFO.orig_y = y; 305 real_mode->screen_info.orig_y = y;
307 306
308 pos = (x + cols * y) * 2; /* Update cursor position */ 307 pos = (x + cols * y) * 2; /* Update cursor position */
309 outb(14, vidport); 308 outb(14, vidport);
@@ -366,9 +365,9 @@ static void flush_window(void)
366 365
367static void error(char *x) 366static void error(char *x)
368{ 367{
369 putstr("\n\n"); 368 __putstr(1, "\n\n");
370 putstr(x); 369 __putstr(1, x);
371 putstr("\n\n -- System halted"); 370 __putstr(1, "\n\n -- System halted");
372 371
373 while (1) 372 while (1)
374 asm("hlt"); 373 asm("hlt");
@@ -395,7 +394,8 @@ static void parse_elf(void *output)
395 return; 394 return;
396 } 395 }
397 396
398 putstr("Parsing ELF... "); 397 if (!quiet)
398 putstr("Parsing ELF... ");
399 399
400 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); 400 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
401 if (!phdrs) 401 if (!phdrs)
@@ -430,7 +430,10 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
430{ 430{
431 real_mode = rmode; 431 real_mode = rmode;
432 432
433 if (RM_SCREEN_INFO.orig_video_mode == 7) { 433 if (real_mode->hdr.loadflags & QUIET_FLAG)
434 quiet = 1;
435
436 if (real_mode->screen_info.orig_video_mode == 7) {
434 vidmem = (char *) 0xb0000; 437 vidmem = (char *) 0xb0000;
435 vidport = 0x3b4; 438 vidport = 0x3b4;
436 } else { 439 } else {
@@ -438,8 +441,8 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
438 vidport = 0x3d4; 441 vidport = 0x3d4;
439 } 442 }
440 443
441 lines = RM_SCREEN_INFO.orig_video_lines; 444 lines = real_mode->screen_info.orig_video_lines;
442 cols = RM_SCREEN_INFO.orig_video_cols; 445 cols = real_mode->screen_info.orig_video_cols;
443 446
444 window = output; /* Output buffer (Normally at 1M) */ 447 window = output; /* Output buffer (Normally at 1M) */
445 free_mem_ptr = heap; /* Heap */ 448 free_mem_ptr = heap; /* Heap */
@@ -465,9 +468,11 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
465#endif 468#endif
466 469
467 makecrc(); 470 makecrc();
468 putstr("\nDecompressing Linux... "); 471 if (!quiet)
472 putstr("\nDecompressing Linux... ");
469 gunzip(); 473 gunzip();
470 parse_elf(output); 474 parse_elf(output);
471 putstr("done.\nBooting the kernel.\n"); 475 if (!quiet)
476 putstr("done.\nBooting the kernel.\n");
472 return; 477 return;
473} 478}
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
index edaadea90aaf..a1310c52fc0c 100644
--- a/arch/x86/boot/compressed/relocs.c
+++ b/arch/x86/boot/compressed/relocs.c
@@ -10,16 +10,20 @@
10#define USE_BSD 10#define USE_BSD
11#include <endian.h> 11#include <endian.h>
12 12
13#define MAX_SHDRS 100
14#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 13#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
15static Elf32_Ehdr ehdr; 14static Elf32_Ehdr ehdr;
16static Elf32_Shdr shdr[MAX_SHDRS];
17static Elf32_Sym *symtab[MAX_SHDRS];
18static Elf32_Rel *reltab[MAX_SHDRS];
19static char *strtab[MAX_SHDRS];
20static unsigned long reloc_count, reloc_idx; 15static unsigned long reloc_count, reloc_idx;
21static unsigned long *relocs; 16static unsigned long *relocs;
22 17
18struct section {
19 Elf32_Shdr shdr;
20 struct section *link;
21 Elf32_Sym *symtab;
22 Elf32_Rel *reltab;
23 char *strtab;
24};
25static struct section *secs;
26
23/* 27/*
24 * Following symbols have been audited. There values are constant and do 28 * Following symbols have been audited. There values are constant and do
25 * not change if bzImage is loaded at a different physical address than 29 * not change if bzImage is loaded at a different physical address than
@@ -35,7 +39,7 @@ static int is_safe_abs_reloc(const char* sym_name)
35{ 39{
36 int i; 40 int i;
37 41
38 for(i = 0; i < ARRAY_SIZE(safe_abs_relocs); i++) { 42 for (i = 0; i < ARRAY_SIZE(safe_abs_relocs); i++) {
39 if (!strcmp(sym_name, safe_abs_relocs[i])) 43 if (!strcmp(sym_name, safe_abs_relocs[i]))
40 /* Match found */ 44 /* Match found */
41 return 1; 45 return 1;
@@ -137,10 +141,10 @@ static const char *sec_name(unsigned shndx)
137{ 141{
138 const char *sec_strtab; 142 const char *sec_strtab;
139 const char *name; 143 const char *name;
140 sec_strtab = strtab[ehdr.e_shstrndx]; 144 sec_strtab = secs[ehdr.e_shstrndx].strtab;
141 name = "<noname>"; 145 name = "<noname>";
142 if (shndx < ehdr.e_shnum) { 146 if (shndx < ehdr.e_shnum) {
143 name = sec_strtab + shdr[shndx].sh_name; 147 name = sec_strtab + secs[shndx].shdr.sh_name;
144 } 148 }
145 else if (shndx == SHN_ABS) { 149 else if (shndx == SHN_ABS) {
146 name = "ABSOLUTE"; 150 name = "ABSOLUTE";
@@ -159,7 +163,7 @@ static const char *sym_name(const char *sym_strtab, Elf32_Sym *sym)
159 name = sym_strtab + sym->st_name; 163 name = sym_strtab + sym->st_name;
160 } 164 }
161 else { 165 else {
162 name = sec_name(shdr[sym->st_shndx].sh_name); 166 name = sec_name(secs[sym->st_shndx].shdr.sh_name);
163 } 167 }
164 return name; 168 return name;
165} 169}
@@ -244,29 +248,34 @@ static void read_ehdr(FILE *fp)
244static void read_shdrs(FILE *fp) 248static void read_shdrs(FILE *fp)
245{ 249{
246 int i; 250 int i;
247 if (ehdr.e_shnum > MAX_SHDRS) { 251 Elf32_Shdr shdr;
248 die("%d section headers supported: %d\n", 252
249 ehdr.e_shnum, MAX_SHDRS); 253 secs = calloc(ehdr.e_shnum, sizeof(struct section));
254 if (!secs) {
255 die("Unable to allocate %d section headers\n",
256 ehdr.e_shnum);
250 } 257 }
251 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) { 258 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) {
252 die("Seek to %d failed: %s\n", 259 die("Seek to %d failed: %s\n",
253 ehdr.e_shoff, strerror(errno)); 260 ehdr.e_shoff, strerror(errno));
254 } 261 }
255 if (fread(&shdr, sizeof(shdr[0]), ehdr.e_shnum, fp) != ehdr.e_shnum) { 262 for (i = 0; i < ehdr.e_shnum; i++) {
256 die("Cannot read ELF section headers: %s\n", 263 struct section *sec = &secs[i];
257 strerror(errno)); 264 if (fread(&shdr, sizeof shdr, 1, fp) != 1)
258 } 265 die("Cannot read ELF section headers %d/%d: %s\n",
259 for(i = 0; i < ehdr.e_shnum; i++) { 266 i, ehdr.e_shnum, strerror(errno));
260 shdr[i].sh_name = elf32_to_cpu(shdr[i].sh_name); 267 sec->shdr.sh_name = elf32_to_cpu(shdr.sh_name);
261 shdr[i].sh_type = elf32_to_cpu(shdr[i].sh_type); 268 sec->shdr.sh_type = elf32_to_cpu(shdr.sh_type);
262 shdr[i].sh_flags = elf32_to_cpu(shdr[i].sh_flags); 269 sec->shdr.sh_flags = elf32_to_cpu(shdr.sh_flags);
263 shdr[i].sh_addr = elf32_to_cpu(shdr[i].sh_addr); 270 sec->shdr.sh_addr = elf32_to_cpu(shdr.sh_addr);
264 shdr[i].sh_offset = elf32_to_cpu(shdr[i].sh_offset); 271 sec->shdr.sh_offset = elf32_to_cpu(shdr.sh_offset);
265 shdr[i].sh_size = elf32_to_cpu(shdr[i].sh_size); 272 sec->shdr.sh_size = elf32_to_cpu(shdr.sh_size);
266 shdr[i].sh_link = elf32_to_cpu(shdr[i].sh_link); 273 sec->shdr.sh_link = elf32_to_cpu(shdr.sh_link);
267 shdr[i].sh_info = elf32_to_cpu(shdr[i].sh_info); 274 sec->shdr.sh_info = elf32_to_cpu(shdr.sh_info);
268 shdr[i].sh_addralign = elf32_to_cpu(shdr[i].sh_addralign); 275 sec->shdr.sh_addralign = elf32_to_cpu(shdr.sh_addralign);
269 shdr[i].sh_entsize = elf32_to_cpu(shdr[i].sh_entsize); 276 sec->shdr.sh_entsize = elf32_to_cpu(shdr.sh_entsize);
277 if (sec->shdr.sh_link < ehdr.e_shnum)
278 sec->link = &secs[sec->shdr.sh_link];
270 } 279 }
271 280
272} 281}
@@ -274,20 +283,22 @@ static void read_shdrs(FILE *fp)
274static void read_strtabs(FILE *fp) 283static void read_strtabs(FILE *fp)
275{ 284{
276 int i; 285 int i;
277 for(i = 0; i < ehdr.e_shnum; i++) { 286 for (i = 0; i < ehdr.e_shnum; i++) {
278 if (shdr[i].sh_type != SHT_STRTAB) { 287 struct section *sec = &secs[i];
288 if (sec->shdr.sh_type != SHT_STRTAB) {
279 continue; 289 continue;
280 } 290 }
281 strtab[i] = malloc(shdr[i].sh_size); 291 sec->strtab = malloc(sec->shdr.sh_size);
282 if (!strtab[i]) { 292 if (!sec->strtab) {
283 die("malloc of %d bytes for strtab failed\n", 293 die("malloc of %d bytes for strtab failed\n",
284 shdr[i].sh_size); 294 sec->shdr.sh_size);
285 } 295 }
286 if (fseek(fp, shdr[i].sh_offset, SEEK_SET) < 0) { 296 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) {
287 die("Seek to %d failed: %s\n", 297 die("Seek to %d failed: %s\n",
288 shdr[i].sh_offset, strerror(errno)); 298 sec->shdr.sh_offset, strerror(errno));
289 } 299 }
290 if (fread(strtab[i], 1, shdr[i].sh_size, fp) != shdr[i].sh_size) { 300 if (fread(sec->strtab, 1, sec->shdr.sh_size, fp)
301 != sec->shdr.sh_size) {
291 die("Cannot read symbol table: %s\n", 302 die("Cannot read symbol table: %s\n",
292 strerror(errno)); 303 strerror(errno));
293 } 304 }
@@ -297,28 +308,31 @@ static void read_strtabs(FILE *fp)
297static void read_symtabs(FILE *fp) 308static void read_symtabs(FILE *fp)
298{ 309{
299 int i,j; 310 int i,j;
300 for(i = 0; i < ehdr.e_shnum; i++) { 311 for (i = 0; i < ehdr.e_shnum; i++) {
301 if (shdr[i].sh_type != SHT_SYMTAB) { 312 struct section *sec = &secs[i];
313 if (sec->shdr.sh_type != SHT_SYMTAB) {
302 continue; 314 continue;
303 } 315 }
304 symtab[i] = malloc(shdr[i].sh_size); 316 sec->symtab = malloc(sec->shdr.sh_size);
305 if (!symtab[i]) { 317 if (!sec->symtab) {
306 die("malloc of %d bytes for symtab failed\n", 318 die("malloc of %d bytes for symtab failed\n",
307 shdr[i].sh_size); 319 sec->shdr.sh_size);
308 } 320 }
309 if (fseek(fp, shdr[i].sh_offset, SEEK_SET) < 0) { 321 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) {
310 die("Seek to %d failed: %s\n", 322 die("Seek to %d failed: %s\n",
311 shdr[i].sh_offset, strerror(errno)); 323 sec->shdr.sh_offset, strerror(errno));
312 } 324 }
313 if (fread(symtab[i], 1, shdr[i].sh_size, fp) != shdr[i].sh_size) { 325 if (fread(sec->symtab, 1, sec->shdr.sh_size, fp)
326 != sec->shdr.sh_size) {
314 die("Cannot read symbol table: %s\n", 327 die("Cannot read symbol table: %s\n",
315 strerror(errno)); 328 strerror(errno));
316 } 329 }
317 for(j = 0; j < shdr[i].sh_size/sizeof(symtab[i][0]); j++) { 330 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) {
318 symtab[i][j].st_name = elf32_to_cpu(symtab[i][j].st_name); 331 Elf32_Sym *sym = &sec->symtab[j];
319 symtab[i][j].st_value = elf32_to_cpu(symtab[i][j].st_value); 332 sym->st_name = elf32_to_cpu(sym->st_name);
320 symtab[i][j].st_size = elf32_to_cpu(symtab[i][j].st_size); 333 sym->st_value = elf32_to_cpu(sym->st_value);
321 symtab[i][j].st_shndx = elf16_to_cpu(symtab[i][j].st_shndx); 334 sym->st_size = elf32_to_cpu(sym->st_size);
335 sym->st_shndx = elf16_to_cpu(sym->st_shndx);
322 } 336 }
323 } 337 }
324} 338}
@@ -327,26 +341,29 @@ static void read_symtabs(FILE *fp)
327static void read_relocs(FILE *fp) 341static void read_relocs(FILE *fp)
328{ 342{
329 int i,j; 343 int i,j;
330 for(i = 0; i < ehdr.e_shnum; i++) { 344 for (i = 0; i < ehdr.e_shnum; i++) {
331 if (shdr[i].sh_type != SHT_REL) { 345 struct section *sec = &secs[i];
346 if (sec->shdr.sh_type != SHT_REL) {
332 continue; 347 continue;
333 } 348 }
334 reltab[i] = malloc(shdr[i].sh_size); 349 sec->reltab = malloc(sec->shdr.sh_size);
335 if (!reltab[i]) { 350 if (!sec->reltab) {
336 die("malloc of %d bytes for relocs failed\n", 351 die("malloc of %d bytes for relocs failed\n",
337 shdr[i].sh_size); 352 sec->shdr.sh_size);
338 } 353 }
339 if (fseek(fp, shdr[i].sh_offset, SEEK_SET) < 0) { 354 if (fseek(fp, sec->shdr.sh_offset, SEEK_SET) < 0) {
340 die("Seek to %d failed: %s\n", 355 die("Seek to %d failed: %s\n",
341 shdr[i].sh_offset, strerror(errno)); 356 sec->shdr.sh_offset, strerror(errno));
342 } 357 }
343 if (fread(reltab[i], 1, shdr[i].sh_size, fp) != shdr[i].sh_size) { 358 if (fread(sec->reltab, 1, sec->shdr.sh_size, fp)
359 != sec->shdr.sh_size) {
344 die("Cannot read symbol table: %s\n", 360 die("Cannot read symbol table: %s\n",
345 strerror(errno)); 361 strerror(errno));
346 } 362 }
347 for(j = 0; j < shdr[i].sh_size/sizeof(reltab[0][0]); j++) { 363 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
348 reltab[i][j].r_offset = elf32_to_cpu(reltab[i][j].r_offset); 364 Elf32_Rel *rel = &sec->reltab[j];
349 reltab[i][j].r_info = elf32_to_cpu(reltab[i][j].r_info); 365 rel->r_offset = elf32_to_cpu(rel->r_offset);
366 rel->r_info = elf32_to_cpu(rel->r_info);
350 } 367 }
351 } 368 }
352} 369}
@@ -357,19 +374,21 @@ static void print_absolute_symbols(void)
357 int i; 374 int i;
358 printf("Absolute symbols\n"); 375 printf("Absolute symbols\n");
359 printf(" Num: Value Size Type Bind Visibility Name\n"); 376 printf(" Num: Value Size Type Bind Visibility Name\n");
360 for(i = 0; i < ehdr.e_shnum; i++) { 377 for (i = 0; i < ehdr.e_shnum; i++) {
378 struct section *sec = &secs[i];
361 char *sym_strtab; 379 char *sym_strtab;
362 Elf32_Sym *sh_symtab; 380 Elf32_Sym *sh_symtab;
363 int j; 381 int j;
364 if (shdr[i].sh_type != SHT_SYMTAB) { 382
383 if (sec->shdr.sh_type != SHT_SYMTAB) {
365 continue; 384 continue;
366 } 385 }
367 sh_symtab = symtab[i]; 386 sh_symtab = sec->symtab;
368 sym_strtab = strtab[shdr[i].sh_link]; 387 sym_strtab = sec->link->strtab;
369 for(j = 0; j < shdr[i].sh_size/sizeof(symtab[0][0]); j++) { 388 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) {
370 Elf32_Sym *sym; 389 Elf32_Sym *sym;
371 const char *name; 390 const char *name;
372 sym = &symtab[i][j]; 391 sym = &sec->symtab[j];
373 name = sym_name(sym_strtab, sym); 392 name = sym_name(sym_strtab, sym);
374 if (sym->st_shndx != SHN_ABS) { 393 if (sym->st_shndx != SHN_ABS) {
375 continue; 394 continue;
@@ -389,26 +408,27 @@ static void print_absolute_relocs(void)
389{ 408{
390 int i, printed = 0; 409 int i, printed = 0;
391 410
392 for(i = 0; i < ehdr.e_shnum; i++) { 411 for (i = 0; i < ehdr.e_shnum; i++) {
412 struct section *sec = &secs[i];
413 struct section *sec_applies, *sec_symtab;
393 char *sym_strtab; 414 char *sym_strtab;
394 Elf32_Sym *sh_symtab; 415 Elf32_Sym *sh_symtab;
395 unsigned sec_applies, sec_symtab;
396 int j; 416 int j;
397 if (shdr[i].sh_type != SHT_REL) { 417 if (sec->shdr.sh_type != SHT_REL) {
398 continue; 418 continue;
399 } 419 }
400 sec_symtab = shdr[i].sh_link; 420 sec_symtab = sec->link;
401 sec_applies = shdr[i].sh_info; 421 sec_applies = &secs[sec->shdr.sh_info];
402 if (!(shdr[sec_applies].sh_flags & SHF_ALLOC)) { 422 if (!(sec_applies->shdr.sh_flags & SHF_ALLOC)) {
403 continue; 423 continue;
404 } 424 }
405 sh_symtab = symtab[sec_symtab]; 425 sh_symtab = sec_symtab->symtab;
406 sym_strtab = strtab[shdr[sec_symtab].sh_link]; 426 sym_strtab = sec_symtab->link->strtab;
407 for(j = 0; j < shdr[i].sh_size/sizeof(reltab[0][0]); j++) { 427 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
408 Elf32_Rel *rel; 428 Elf32_Rel *rel;
409 Elf32_Sym *sym; 429 Elf32_Sym *sym;
410 const char *name; 430 const char *name;
411 rel = &reltab[i][j]; 431 rel = &sec->reltab[j];
412 sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; 432 sym = &sh_symtab[ELF32_R_SYM(rel->r_info)];
413 name = sym_name(sym_strtab, sym); 433 name = sym_name(sym_strtab, sym);
414 if (sym->st_shndx != SHN_ABS) { 434 if (sym->st_shndx != SHN_ABS) {
@@ -456,26 +476,28 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
456{ 476{
457 int i; 477 int i;
458 /* Walk through the relocations */ 478 /* Walk through the relocations */
459 for(i = 0; i < ehdr.e_shnum; i++) { 479 for (i = 0; i < ehdr.e_shnum; i++) {
460 char *sym_strtab; 480 char *sym_strtab;
461 Elf32_Sym *sh_symtab; 481 Elf32_Sym *sh_symtab;
462 unsigned sec_applies, sec_symtab; 482 struct section *sec_applies, *sec_symtab;
463 int j; 483 int j;
464 if (shdr[i].sh_type != SHT_REL) { 484 struct section *sec = &secs[i];
485
486 if (sec->shdr.sh_type != SHT_REL) {
465 continue; 487 continue;
466 } 488 }
467 sec_symtab = shdr[i].sh_link; 489 sec_symtab = sec->link;
468 sec_applies = shdr[i].sh_info; 490 sec_applies = &secs[sec->shdr.sh_info];
469 if (!(shdr[sec_applies].sh_flags & SHF_ALLOC)) { 491 if (!(sec_applies->shdr.sh_flags & SHF_ALLOC)) {
470 continue; 492 continue;
471 } 493 }
472 sh_symtab = symtab[sec_symtab]; 494 sh_symtab = sec_symtab->symtab;
473 sym_strtab = strtab[shdr[sec_symtab].sh_link]; 495 sym_strtab = sec->link->strtab;
474 for(j = 0; j < shdr[i].sh_size/sizeof(reltab[0][0]); j++) { 496 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
475 Elf32_Rel *rel; 497 Elf32_Rel *rel;
476 Elf32_Sym *sym; 498 Elf32_Sym *sym;
477 unsigned r_type; 499 unsigned r_type;
478 rel = &reltab[i][j]; 500 rel = &sec->reltab[j];
479 sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; 501 sym = &sh_symtab[ELF32_R_SYM(rel->r_info)];
480 r_type = ELF32_R_TYPE(rel->r_info); 502 r_type = ELF32_R_TYPE(rel->r_info);
481 /* Don't visit relocations to absolute symbols */ 503 /* Don't visit relocations to absolute symbols */
@@ -539,7 +561,7 @@ static void emit_relocs(int as_text)
539 */ 561 */
540 printf(".section \".data.reloc\",\"a\"\n"); 562 printf(".section \".data.reloc\",\"a\"\n");
541 printf(".balign 4\n"); 563 printf(".balign 4\n");
542 for(i = 0; i < reloc_count; i++) { 564 for (i = 0; i < reloc_count; i++) {
543 printf("\t .long 0x%08lx\n", relocs[i]); 565 printf("\t .long 0x%08lx\n", relocs[i]);
544 } 566 }
545 printf("\n"); 567 printf("\n");
@@ -550,7 +572,7 @@ static void emit_relocs(int as_text)
550 /* Print a stop */ 572 /* Print a stop */
551 printf("%c%c%c%c", buf[0], buf[1], buf[2], buf[3]); 573 printf("%c%c%c%c", buf[0], buf[1], buf[2], buf[3]);
552 /* Now print each relocation */ 574 /* Now print each relocation */
553 for(i = 0; i < reloc_count; i++) { 575 for (i = 0; i < reloc_count; i++) {
554 buf[0] = (relocs[i] >> 0) & 0xff; 576 buf[0] = (relocs[i] >> 0) & 0xff;
555 buf[1] = (relocs[i] >> 8) & 0xff; 577 buf[1] = (relocs[i] >> 8) & 0xff;
556 buf[2] = (relocs[i] >> 16) & 0xff; 578 buf[2] = (relocs[i] >> 16) & 0xff;
@@ -577,7 +599,7 @@ int main(int argc, char **argv)
577 show_absolute_relocs = 0; 599 show_absolute_relocs = 0;
578 as_text = 0; 600 as_text = 0;
579 fname = NULL; 601 fname = NULL;
580 for(i = 1; i < argc; i++) { 602 for (i = 1; i < argc; i++) {
581 char *arg = argv[i]; 603 char *arg = argv[i];
582 if (*arg == '-') { 604 if (*arg == '-') {
583 if (strcmp(argv[1], "--abs-syms") == 0) { 605 if (strcmp(argv[1], "--abs-syms") == 0) {
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c
index 00e19edd852c..92d6fd73dc7d 100644
--- a/arch/x86/boot/cpu.c
+++ b/arch/x86/boot/cpu.c
@@ -28,6 +28,8 @@ static char *cpu_name(int level)
28 if (level == 64) { 28 if (level == 64) {
29 return "x86-64"; 29 return "x86-64";
30 } else { 30 } else {
31 if (level == 15)
32 level = 6;
31 sprintf(buf, "i%d86", level); 33 sprintf(buf, "i%d86", level);
32 return buf; 34 return buf;
33 } 35 }
diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
index 77569a4a3be1..2296164b54d2 100644
--- a/arch/x86/boot/main.c
+++ b/arch/x86/boot/main.c
@@ -165,6 +165,10 @@ void main(void)
165 /* Set the video mode */ 165 /* Set the video mode */
166 set_video(); 166 set_video();
167 167
168 /* Parse command line for 'quiet' and pass it to decompressor. */
169 if (cmdline_find_option_bool("quiet"))
170 boot_params.hdr.loadflags |= QUIET_FLAG;
171
168 /* Do the last things and invoke protected mode */ 172 /* Do the last things and invoke protected mode */
169 go_to_protected_mode(); 173 go_to_protected_mode();
170} 174}
diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c
index acad32eb4290..53165c97336b 100644
--- a/arch/x86/boot/memory.c
+++ b/arch/x86/boot/memory.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include "boot.h" 15#include "boot.h"
16#include <linux/kernel.h>
16 17
17#define SMAP 0x534d4150 /* ASCII "SMAP" */ 18#define SMAP 0x534d4150 /* ASCII "SMAP" */
18 19
@@ -53,7 +54,7 @@ static int detect_memory_e820(void)
53 54
54 count++; 55 count++;
55 desc++; 56 desc++;
56 } while (next && count < E820MAX); 57 } while (next && count < ARRAY_SIZE(boot_params.e820_map));
57 58
58 return boot_params.e820_entries = count; 59 return boot_params.e820_entries = count;
59} 60}
diff --git a/arch/x86/boot/pmjump.S b/arch/x86/boot/pmjump.S
index ab049d40a884..141b6e20ed31 100644
--- a/arch/x86/boot/pmjump.S
+++ b/arch/x86/boot/pmjump.S
@@ -33,6 +33,8 @@ protected_mode_jump:
33 movw %cs, %bx 33 movw %cs, %bx
34 shll $4, %ebx 34 shll $4, %ebx
35 addl %ebx, 2f 35 addl %ebx, 2f
36 jmp 1f # Short jump to serialize on 386/486
371:
36 38
37 movw $__BOOT_DS, %cx 39 movw $__BOOT_DS, %cx
38 movw $__BOOT_TSS, %di 40 movw $__BOOT_TSS, %di
@@ -40,8 +42,6 @@ protected_mode_jump:
40 movl %cr0, %edx 42 movl %cr0, %edx
41 orb $X86_CR0_PE, %dl # Protected mode 43 orb $X86_CR0_PE, %dl # Protected mode
42 movl %edx, %cr0 44 movl %edx, %cr0
43 jmp 1f # Short jump to serialize on 386/486
441:
45 45
46 # Transition to 32-bit mode 46 # Transition to 32-bit mode
47 .byte 0x66, 0xea # ljmpl opcode 47 .byte 0x66, 0xea # ljmpl opcode
diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c
index 40ecb8d7688c..b939cb476dec 100644
--- a/arch/x86/boot/video-vga.c
+++ b/arch/x86/boot/video-vga.c
@@ -259,8 +259,7 @@ static int vga_probe(void)
259 return mode_count[adapter]; 259 return mode_count[adapter];
260} 260}
261 261
262__videocard video_vga = 262__videocard video_vga = {
263{
264 .card_name = "VGA", 263 .card_name = "VGA",
265 .probe = vga_probe, 264 .probe = vga_probe,
266 .set_mode = vga_set_mode, 265 .set_mode = vga_set_mode,
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index ad7ddaaff588..9bc34e2033ec 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -1,54 +1,103 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-git14 3# Linux kernel version: 2.6.26-rc1
4# Fri Jul 20 09:53:15 2007 4# Sun May 4 19:59:02 2008
5# 5#
6# CONFIG_64BIT is not set
6CONFIG_X86_32=y 7CONFIG_X86_32=y
8# CONFIG_X86_64 is not set
9CONFIG_X86=y
10CONFIG_DEFCONFIG_LIST="arch/x86/configs/i386_defconfig"
11# CONFIG_GENERIC_LOCKBREAK is not set
7CONFIG_GENERIC_TIME=y 12CONFIG_GENERIC_TIME=y
13CONFIG_GENERIC_CMOS_UPDATE=y
8CONFIG_CLOCKSOURCE_WATCHDOG=y 14CONFIG_CLOCKSOURCE_WATCHDOG=y
9CONFIG_GENERIC_CLOCKEVENTS=y 15CONFIG_GENERIC_CLOCKEVENTS=y
10CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y 16CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
11CONFIG_LOCKDEP_SUPPORT=y 17CONFIG_LOCKDEP_SUPPORT=y
12CONFIG_STACKTRACE_SUPPORT=y 18CONFIG_STACKTRACE_SUPPORT=y
13CONFIG_SEMAPHORE_SLEEPERS=y 19CONFIG_HAVE_LATENCYTOP_SUPPORT=y
14CONFIG_X86=y 20CONFIG_FAST_CMPXCHG_LOCAL=y
15CONFIG_MMU=y 21CONFIG_MMU=y
16CONFIG_ZONE_DMA=y 22CONFIG_ZONE_DMA=y
17CONFIG_QUICKLIST=y
18CONFIG_GENERIC_ISA_DMA=y 23CONFIG_GENERIC_ISA_DMA=y
19CONFIG_GENERIC_IOMAP=y 24CONFIG_GENERIC_IOMAP=y
20CONFIG_GENERIC_BUG=y 25CONFIG_GENERIC_BUG=y
21CONFIG_GENERIC_HWEIGHT=y 26CONFIG_GENERIC_HWEIGHT=y
27# CONFIG_GENERIC_GPIO is not set
22CONFIG_ARCH_MAY_HAVE_PC_FDC=y 28CONFIG_ARCH_MAY_HAVE_PC_FDC=y
23CONFIG_DMI=y 29# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 30CONFIG_RWSEM_XCHGADD_ALGORITHM=y
31# CONFIG_ARCH_HAS_ILOG2_U32 is not set
32# CONFIG_ARCH_HAS_ILOG2_U64 is not set
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_GENERIC_CALIBRATE_DELAY=y
35# CONFIG_GENERIC_TIME_VSYSCALL is not set
36CONFIG_ARCH_HAS_CPU_RELAX=y
37CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
38CONFIG_HAVE_SETUP_PER_CPU_AREA=y
39# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set
40CONFIG_ARCH_HIBERNATION_POSSIBLE=y
41CONFIG_ARCH_SUSPEND_POSSIBLE=y
42# CONFIG_ZONE_DMA32 is not set
43CONFIG_ARCH_POPULATES_NODE_MAP=y
44# CONFIG_AUDIT_ARCH is not set
45CONFIG_ARCH_SUPPORTS_AOUT=y
46CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
47CONFIG_GENERIC_HARDIRQS=y
48CONFIG_GENERIC_IRQ_PROBE=y
49CONFIG_GENERIC_PENDING_IRQ=y
50CONFIG_X86_SMP=y
51CONFIG_X86_32_SMP=y
52CONFIG_X86_HT=y
53CONFIG_X86_BIOS_REBOOT=y
54CONFIG_X86_TRAMPOLINE=y
55CONFIG_KTIME_SCALAR=y
25 56
26# 57#
27# Code maturity level options 58# General setup
28# 59#
29CONFIG_EXPERIMENTAL=y 60CONFIG_EXPERIMENTAL=y
30CONFIG_LOCK_KERNEL=y 61CONFIG_LOCK_KERNEL=y
31CONFIG_INIT_ENV_ARG_LIMIT=32 62CONFIG_INIT_ENV_ARG_LIMIT=32
32
33#
34# General setup
35#
36CONFIG_LOCALVERSION="" 63CONFIG_LOCALVERSION=""
37CONFIG_LOCALVERSION_AUTO=y 64# CONFIG_LOCALVERSION_AUTO is not set
38CONFIG_SWAP=y 65CONFIG_SWAP=y
39CONFIG_SYSVIPC=y 66CONFIG_SYSVIPC=y
40CONFIG_SYSVIPC_SYSCTL=y 67CONFIG_SYSVIPC_SYSCTL=y
41CONFIG_POSIX_MQUEUE=y 68CONFIG_POSIX_MQUEUE=y
42# CONFIG_BSD_PROCESS_ACCT is not set 69CONFIG_BSD_PROCESS_ACCT=y
43# CONFIG_TASKSTATS is not set 70# CONFIG_BSD_PROCESS_ACCT_V3 is not set
44# CONFIG_USER_NS is not set 71CONFIG_TASKSTATS=y
45# CONFIG_AUDIT is not set 72CONFIG_TASK_DELAY_ACCT=y
46CONFIG_IKCONFIG=y 73CONFIG_TASK_XACCT=y
47CONFIG_IKCONFIG_PROC=y 74CONFIG_TASK_IO_ACCOUNTING=y
48CONFIG_LOG_BUF_SHIFT=18 75CONFIG_AUDIT=y
49# CONFIG_CPUSETS is not set 76CONFIG_AUDITSYSCALL=y
50CONFIG_SYSFS_DEPRECATED=y 77CONFIG_AUDIT_TREE=y
78# CONFIG_IKCONFIG is not set
79CONFIG_LOG_BUF_SHIFT=17
80CONFIG_CGROUPS=y
81# CONFIG_CGROUP_DEBUG is not set
82CONFIG_CGROUP_NS=y
83# CONFIG_CGROUP_DEVICE is not set
84CONFIG_CPUSETS=y
85CONFIG_GROUP_SCHED=y
86CONFIG_FAIR_GROUP_SCHED=y
87# CONFIG_RT_GROUP_SCHED is not set
88# CONFIG_USER_SCHED is not set
89CONFIG_CGROUP_SCHED=y
90CONFIG_CGROUP_CPUACCT=y
91CONFIG_RESOURCE_COUNTERS=y
92# CONFIG_CGROUP_MEM_RES_CTLR is not set
93# CONFIG_SYSFS_DEPRECATED_V2 is not set
94CONFIG_PROC_PID_CPUSET=y
51CONFIG_RELAY=y 95CONFIG_RELAY=y
96CONFIG_NAMESPACES=y
97CONFIG_UTS_NS=y
98CONFIG_IPC_NS=y
99CONFIG_USER_NS=y
100CONFIG_PID_NS=y
52CONFIG_BLK_DEV_INITRD=y 101CONFIG_BLK_DEV_INITRD=y
53CONFIG_INITRAMFS_SOURCE="" 102CONFIG_INITRAMFS_SOURCE=""
54CONFIG_CC_OPTIMIZE_FOR_SIZE=y 103CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -56,13 +105,15 @@ CONFIG_SYSCTL=y
56# CONFIG_EMBEDDED is not set 105# CONFIG_EMBEDDED is not set
57CONFIG_UID16=y 106CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y 107CONFIG_SYSCTL_SYSCALL=y
108CONFIG_SYSCTL_SYSCALL_CHECK=y
59CONFIG_KALLSYMS=y 109CONFIG_KALLSYMS=y
60CONFIG_KALLSYMS_ALL=y 110CONFIG_KALLSYMS_ALL=y
61# CONFIG_KALLSYMS_EXTRA_PASS is not set 111CONFIG_KALLSYMS_EXTRA_PASS=y
62CONFIG_HOTPLUG=y 112CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y 113CONFIG_PRINTK=y
64CONFIG_BUG=y 114CONFIG_BUG=y
65CONFIG_ELF_CORE=y 115CONFIG_ELF_CORE=y
116# CONFIG_COMPAT_BRK is not set
66CONFIG_BASE_FULL=y 117CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y 118CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y 119CONFIG_ANON_INODES=y
@@ -76,6 +127,17 @@ CONFIG_SLUB_DEBUG=y
76# CONFIG_SLAB is not set 127# CONFIG_SLAB is not set
77CONFIG_SLUB=y 128CONFIG_SLUB=y
78# CONFIG_SLOB is not set 129# CONFIG_SLOB is not set
130CONFIG_PROFILING=y
131CONFIG_MARKERS=y
132# CONFIG_OPROFILE is not set
133CONFIG_HAVE_OPROFILE=y
134CONFIG_KPROBES=y
135CONFIG_KRETPROBES=y
136CONFIG_HAVE_KPROBES=y
137CONFIG_HAVE_KRETPROBES=y
138# CONFIG_HAVE_DMA_ATTRS is not set
139CONFIG_PROC_PAGE_MONITOR=y
140CONFIG_SLABINFO=y
79CONFIG_RT_MUTEXES=y 141CONFIG_RT_MUTEXES=y
80# CONFIG_TINY_SHMEM is not set 142# CONFIG_TINY_SHMEM is not set
81CONFIG_BASE_SMALL=0 143CONFIG_BASE_SMALL=0
@@ -87,10 +149,10 @@ CONFIG_MODULE_FORCE_UNLOAD=y
87# CONFIG_KMOD is not set 149# CONFIG_KMOD is not set
88CONFIG_STOP_MACHINE=y 150CONFIG_STOP_MACHINE=y
89CONFIG_BLOCK=y 151CONFIG_BLOCK=y
90CONFIG_LBD=y 152# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set 153CONFIG_BLK_DEV_IO_TRACE=y
92# CONFIG_LSF is not set 154# CONFIG_LSF is not set
93# CONFIG_BLK_DEV_BSG is not set 155CONFIG_BLK_DEV_BSG=y
94 156
95# 157#
96# IO Schedulers 158# IO Schedulers
@@ -103,7 +165,8 @@ CONFIG_IOSCHED_CFQ=y
103# CONFIG_DEFAULT_DEADLINE is not set 165# CONFIG_DEFAULT_DEADLINE is not set
104CONFIG_DEFAULT_CFQ=y 166CONFIG_DEFAULT_CFQ=y
105# CONFIG_DEFAULT_NOOP is not set 167# CONFIG_DEFAULT_NOOP is not set
106CONFIG_DEFAULT_IOSCHED="anticipatory" 168CONFIG_DEFAULT_IOSCHED="cfq"
169CONFIG_CLASSIC_RCU=y
107 170
108# 171#
109# Processor type and features 172# Processor type and features
@@ -111,18 +174,21 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
111CONFIG_TICK_ONESHOT=y 174CONFIG_TICK_ONESHOT=y
112CONFIG_NO_HZ=y 175CONFIG_NO_HZ=y
113CONFIG_HIGH_RES_TIMERS=y 176CONFIG_HIGH_RES_TIMERS=y
177CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
114CONFIG_SMP=y 178CONFIG_SMP=y
115# CONFIG_X86_PC is not set 179CONFIG_X86_PC=y
116# CONFIG_X86_ELAN is not set 180# CONFIG_X86_ELAN is not set
117# CONFIG_X86_VOYAGER is not set 181# CONFIG_X86_VOYAGER is not set
118# CONFIG_X86_NUMAQ is not set 182# CONFIG_X86_NUMAQ is not set
119# CONFIG_X86_SUMMIT is not set 183# CONFIG_X86_SUMMIT is not set
120# CONFIG_X86_BIGSMP is not set 184# CONFIG_X86_BIGSMP is not set
121# CONFIG_X86_VISWS is not set 185# CONFIG_X86_VISWS is not set
122CONFIG_X86_GENERICARCH=y 186# CONFIG_X86_GENERICARCH is not set
123# CONFIG_X86_ES7000 is not set 187# CONFIG_X86_ES7000 is not set
124# CONFIG_PARAVIRT is not set 188# CONFIG_X86_RDC321X is not set
125CONFIG_X86_CYCLONE_TIMER=y 189# CONFIG_X86_VSMP is not set
190CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
191# CONFIG_PARAVIRT_GUEST is not set
126# CONFIG_M386 is not set 192# CONFIG_M386 is not set
127# CONFIG_M486 is not set 193# CONFIG_M486 is not set
128# CONFIG_M586 is not set 194# CONFIG_M586 is not set
@@ -130,9 +196,8 @@ CONFIG_X86_CYCLONE_TIMER=y
130# CONFIG_M586MMX is not set 196# CONFIG_M586MMX is not set
131# CONFIG_M686 is not set 197# CONFIG_M686 is not set
132# CONFIG_MPENTIUMII is not set 198# CONFIG_MPENTIUMII is not set
133CONFIG_MPENTIUMIII=y 199# CONFIG_MPENTIUMIII is not set
134# CONFIG_MPENTIUMM is not set 200# CONFIG_MPENTIUMM is not set
135# CONFIG_MCORE2 is not set
136# CONFIG_MPENTIUM4 is not set 201# CONFIG_MPENTIUM4 is not set
137# CONFIG_MK6 is not set 202# CONFIG_MK6 is not set
138# CONFIG_MK7 is not set 203# CONFIG_MK7 is not set
@@ -147,14 +212,14 @@ CONFIG_MPENTIUMIII=y
147# CONFIG_MCYRIXIII is not set 212# CONFIG_MCYRIXIII is not set
148# CONFIG_MVIAC3_2 is not set 213# CONFIG_MVIAC3_2 is not set
149# CONFIG_MVIAC7 is not set 214# CONFIG_MVIAC7 is not set
150CONFIG_X86_GENERIC=y 215# CONFIG_MPSC is not set
216CONFIG_MCORE2=y
217# CONFIG_GENERIC_CPU is not set
218# CONFIG_X86_GENERIC is not set
219CONFIG_X86_CPU=y
151CONFIG_X86_CMPXCHG=y 220CONFIG_X86_CMPXCHG=y
152CONFIG_X86_L1_CACHE_SHIFT=7 221CONFIG_X86_L1_CACHE_SHIFT=6
153CONFIG_X86_XADD=y 222CONFIG_X86_XADD=y
154CONFIG_RWSEM_XCHGADD_ALGORITHM=y
155# CONFIG_ARCH_HAS_ILOG2_U32 is not set
156# CONFIG_ARCH_HAS_ILOG2_U64 is not set
157CONFIG_GENERIC_CALIBRATE_DELAY=y
158CONFIG_X86_WP_WORKS_OK=y 223CONFIG_X86_WP_WORKS_OK=y
159CONFIG_X86_INVLPG=y 224CONFIG_X86_INVLPG=y
160CONFIG_X86_BSWAP=y 225CONFIG_X86_BSWAP=y
@@ -162,106 +227,120 @@ CONFIG_X86_POPAD_OK=y
162CONFIG_X86_GOOD_APIC=y 227CONFIG_X86_GOOD_APIC=y
163CONFIG_X86_INTEL_USERCOPY=y 228CONFIG_X86_INTEL_USERCOPY=y
164CONFIG_X86_USE_PPRO_CHECKSUM=y 229CONFIG_X86_USE_PPRO_CHECKSUM=y
230CONFIG_X86_P6_NOP=y
165CONFIG_X86_TSC=y 231CONFIG_X86_TSC=y
166CONFIG_X86_CMOV=y 232CONFIG_X86_MINIMUM_CPU_FAMILY=6
167CONFIG_X86_MINIMUM_CPU_FAMILY=4 233CONFIG_X86_DEBUGCTLMSR=y
168CONFIG_HPET_TIMER=y 234CONFIG_HPET_TIMER=y
169CONFIG_HPET_EMULATE_RTC=y 235CONFIG_HPET_EMULATE_RTC=y
170CONFIG_NR_CPUS=32 236CONFIG_DMI=y
171CONFIG_SCHED_SMT=y 237# CONFIG_IOMMU_HELPER is not set
238CONFIG_NR_CPUS=4
239# CONFIG_SCHED_SMT is not set
172CONFIG_SCHED_MC=y 240CONFIG_SCHED_MC=y
173# CONFIG_PREEMPT_NONE is not set 241# CONFIG_PREEMPT_NONE is not set
174CONFIG_PREEMPT_VOLUNTARY=y 242CONFIG_PREEMPT_VOLUNTARY=y
175# CONFIG_PREEMPT is not set 243# CONFIG_PREEMPT is not set
176CONFIG_PREEMPT_BKL=y
177CONFIG_X86_LOCAL_APIC=y 244CONFIG_X86_LOCAL_APIC=y
178CONFIG_X86_IO_APIC=y 245CONFIG_X86_IO_APIC=y
179CONFIG_X86_MCE=y 246# CONFIG_X86_MCE is not set
180CONFIG_X86_MCE_NONFATAL=y
181CONFIG_X86_MCE_P4THERMAL=y
182CONFIG_VM86=y 247CONFIG_VM86=y
183# CONFIG_TOSHIBA is not set 248# CONFIG_TOSHIBA is not set
184# CONFIG_I8K is not set 249# CONFIG_I8K is not set
185# CONFIG_X86_REBOOTFIXUPS is not set 250# CONFIG_X86_REBOOTFIXUPS is not set
186CONFIG_MICROCODE=y 251# CONFIG_MICROCODE is not set
187CONFIG_MICROCODE_OLD_INTERFACE=y
188CONFIG_X86_MSR=y 252CONFIG_X86_MSR=y
189CONFIG_X86_CPUID=y 253CONFIG_X86_CPUID=y
190
191#
192# Firmware Drivers
193#
194# CONFIG_EDD is not set
195# CONFIG_DELL_RBU is not set
196# CONFIG_DCDBAS is not set
197CONFIG_DMIID=y
198# CONFIG_NOHIGHMEM is not set 254# CONFIG_NOHIGHMEM is not set
199CONFIG_HIGHMEM4G=y 255CONFIG_HIGHMEM4G=y
200# CONFIG_HIGHMEM64G is not set 256# CONFIG_HIGHMEM64G is not set
201CONFIG_PAGE_OFFSET=0xC0000000 257CONFIG_PAGE_OFFSET=0xC0000000
202CONFIG_HIGHMEM=y 258CONFIG_HIGHMEM=y
203CONFIG_ARCH_POPULATES_NODE_MAP=y 259CONFIG_NEED_NODE_MEMMAP_SIZE=y
260CONFIG_ARCH_FLATMEM_ENABLE=y
261CONFIG_ARCH_SPARSEMEM_ENABLE=y
262CONFIG_ARCH_SELECT_MEMORY_MODEL=y
204CONFIG_SELECT_MEMORY_MODEL=y 263CONFIG_SELECT_MEMORY_MODEL=y
205CONFIG_FLATMEM_MANUAL=y 264# CONFIG_FLATMEM_MANUAL is not set
206# CONFIG_DISCONTIGMEM_MANUAL is not set 265# CONFIG_DISCONTIGMEM_MANUAL is not set
207# CONFIG_SPARSEMEM_MANUAL is not set 266CONFIG_SPARSEMEM_MANUAL=y
208CONFIG_FLATMEM=y 267CONFIG_SPARSEMEM=y
209CONFIG_FLAT_NODE_MEM_MAP=y 268CONFIG_HAVE_MEMORY_PRESENT=y
210# CONFIG_SPARSEMEM_STATIC is not set 269CONFIG_SPARSEMEM_STATIC=y
270# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
271
272#
273# Memory hotplug is currently incompatible with Software Suspend
274#
275CONFIG_PAGEFLAGS_EXTENDED=y
211CONFIG_SPLIT_PTLOCK_CPUS=4 276CONFIG_SPLIT_PTLOCK_CPUS=4
212CONFIG_RESOURCES_64BIT=y 277CONFIG_RESOURCES_64BIT=y
213CONFIG_ZONE_DMA_FLAG=1 278CONFIG_ZONE_DMA_FLAG=1
214CONFIG_BOUNCE=y 279CONFIG_BOUNCE=y
215CONFIG_NR_QUICK=1
216CONFIG_VIRT_TO_BUS=y 280CONFIG_VIRT_TO_BUS=y
217# CONFIG_HIGHPTE is not set 281# CONFIG_HIGHPTE is not set
218# CONFIG_MATH_EMULATION is not set 282# CONFIG_MATH_EMULATION is not set
219CONFIG_MTRR=y 283CONFIG_MTRR=y
220# CONFIG_EFI is not set 284# CONFIG_X86_PAT is not set
285CONFIG_EFI=y
221# CONFIG_IRQBALANCE is not set 286# CONFIG_IRQBALANCE is not set
222CONFIG_SECCOMP=y 287CONFIG_SECCOMP=y
223# CONFIG_HZ_100 is not set 288# CONFIG_HZ_100 is not set
224CONFIG_HZ_250=y 289# CONFIG_HZ_250 is not set
225# CONFIG_HZ_300 is not set 290# CONFIG_HZ_300 is not set
226# CONFIG_HZ_1000 is not set 291CONFIG_HZ_1000=y
227CONFIG_HZ=250 292CONFIG_HZ=1000
228# CONFIG_KEXEC is not set 293CONFIG_SCHED_HRTICK=y
229# CONFIG_CRASH_DUMP is not set 294CONFIG_KEXEC=y
230CONFIG_PHYSICAL_START=0x100000 295CONFIG_CRASH_DUMP=y
231# CONFIG_RELOCATABLE is not set 296CONFIG_PHYSICAL_START=0x1000000
232CONFIG_PHYSICAL_ALIGN=0x100000 297CONFIG_RELOCATABLE=y
233# CONFIG_HOTPLUG_CPU is not set 298CONFIG_PHYSICAL_ALIGN=0x200000
234CONFIG_COMPAT_VDSO=y 299CONFIG_HOTPLUG_CPU=y
300# CONFIG_COMPAT_VDSO is not set
235CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 301CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
236 302
237# 303#
238# Power management options (ACPI, APM) 304# Power management options
239# 305#
240CONFIG_PM=y 306CONFIG_PM=y
241CONFIG_PM_LEGACY=y 307CONFIG_PM_DEBUG=y
242# CONFIG_PM_DEBUG is not set 308# CONFIG_PM_VERBOSE is not set
243 309CONFIG_CAN_PM_TRACE=y
244# 310CONFIG_PM_TRACE=y
245# ACPI (Advanced Configuration and Power Interface) Support 311CONFIG_PM_TRACE_RTC=y
246# 312CONFIG_PM_SLEEP_SMP=y
313CONFIG_PM_SLEEP=y
314CONFIG_SUSPEND=y
315CONFIG_SUSPEND_FREEZER=y
316CONFIG_HIBERNATION=y
317CONFIG_PM_STD_PARTITION=""
247CONFIG_ACPI=y 318CONFIG_ACPI=y
319CONFIG_ACPI_SLEEP=y
248CONFIG_ACPI_PROCFS=y 320CONFIG_ACPI_PROCFS=y
321CONFIG_ACPI_PROCFS_POWER=y
322CONFIG_ACPI_SYSFS_POWER=y
323CONFIG_ACPI_PROC_EVENT=y
249CONFIG_ACPI_AC=y 324CONFIG_ACPI_AC=y
250CONFIG_ACPI_BATTERY=y 325CONFIG_ACPI_BATTERY=y
251CONFIG_ACPI_BUTTON=y 326CONFIG_ACPI_BUTTON=y
252CONFIG_ACPI_FAN=y 327CONFIG_ACPI_FAN=y
253# CONFIG_ACPI_DOCK is not set 328CONFIG_ACPI_DOCK=y
329# CONFIG_ACPI_BAY is not set
254CONFIG_ACPI_PROCESSOR=y 330CONFIG_ACPI_PROCESSOR=y
331CONFIG_ACPI_HOTPLUG_CPU=y
255CONFIG_ACPI_THERMAL=y 332CONFIG_ACPI_THERMAL=y
333# CONFIG_ACPI_WMI is not set
256# CONFIG_ACPI_ASUS is not set 334# CONFIG_ACPI_ASUS is not set
257# CONFIG_ACPI_TOSHIBA is not set 335# CONFIG_ACPI_TOSHIBA is not set
258CONFIG_ACPI_BLACKLIST_YEAR=2001 336# CONFIG_ACPI_CUSTOM_DSDT is not set
259CONFIG_ACPI_DEBUG=y 337CONFIG_ACPI_BLACKLIST_YEAR=0
338# CONFIG_ACPI_DEBUG is not set
260CONFIG_ACPI_EC=y 339CONFIG_ACPI_EC=y
261CONFIG_ACPI_POWER=y 340CONFIG_ACPI_POWER=y
262CONFIG_ACPI_SYSTEM=y 341CONFIG_ACPI_SYSTEM=y
263CONFIG_X86_PM_TIMER=y 342CONFIG_X86_PM_TIMER=y
264# CONFIG_ACPI_CONTAINER is not set 343CONFIG_ACPI_CONTAINER=y
265# CONFIG_ACPI_SBS is not set 344# CONFIG_ACPI_SBS is not set
266# CONFIG_APM is not set 345# CONFIG_APM is not set
267 346
@@ -271,15 +350,17 @@ CONFIG_X86_PM_TIMER=y
271CONFIG_CPU_FREQ=y 350CONFIG_CPU_FREQ=y
272CONFIG_CPU_FREQ_TABLE=y 351CONFIG_CPU_FREQ_TABLE=y
273CONFIG_CPU_FREQ_DEBUG=y 352CONFIG_CPU_FREQ_DEBUG=y
274CONFIG_CPU_FREQ_STAT=y 353# CONFIG_CPU_FREQ_STAT is not set
275# CONFIG_CPU_FREQ_STAT_DETAILS is not set 354# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
276CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 355# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
277# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 356CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
357# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
358# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
278CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 359CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
279# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 360# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
280CONFIG_CPU_FREQ_GOV_USERSPACE=y 361CONFIG_CPU_FREQ_GOV_USERSPACE=y
281CONFIG_CPU_FREQ_GOV_ONDEMAND=y 362CONFIG_CPU_FREQ_GOV_ONDEMAND=y
282CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y 363# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
283 364
284# 365#
285# CPUFreq processor drivers 366# CPUFreq processor drivers
@@ -287,8 +368,7 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
287CONFIG_X86_ACPI_CPUFREQ=y 368CONFIG_X86_ACPI_CPUFREQ=y
288# CONFIG_X86_POWERNOW_K6 is not set 369# CONFIG_X86_POWERNOW_K6 is not set
289# CONFIG_X86_POWERNOW_K7 is not set 370# CONFIG_X86_POWERNOW_K7 is not set
290CONFIG_X86_POWERNOW_K8=y 371# CONFIG_X86_POWERNOW_K8 is not set
291CONFIG_X86_POWERNOW_K8_ACPI=y
292# CONFIG_X86_GX_SUSPMOD is not set 372# CONFIG_X86_GX_SUSPMOD is not set
293# CONFIG_X86_SPEEDSTEP_CENTRINO is not set 373# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
294# CONFIG_X86_SPEEDSTEP_ICH is not set 374# CONFIG_X86_SPEEDSTEP_ICH is not set
@@ -302,43 +382,72 @@ CONFIG_X86_POWERNOW_K8_ACPI=y
302# 382#
303# shared options 383# shared options
304# 384#
305CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y 385# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
306# CONFIG_X86_SPEEDSTEP_LIB is not set 386# CONFIG_X86_SPEEDSTEP_LIB is not set
387CONFIG_CPU_IDLE=y
388CONFIG_CPU_IDLE_GOV_LADDER=y
389CONFIG_CPU_IDLE_GOV_MENU=y
307 390
308# 391#
309# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 392# Bus options (PCI etc.)
310# 393#
311CONFIG_PCI=y 394CONFIG_PCI=y
312# CONFIG_PCI_GOBIOS is not set 395# CONFIG_PCI_GOBIOS is not set
313# CONFIG_PCI_GOMMCONFIG is not set 396# CONFIG_PCI_GOMMCONFIG is not set
314# CONFIG_PCI_GODIRECT is not set 397# CONFIG_PCI_GODIRECT is not set
315CONFIG_PCI_GOANY=y 398CONFIG_PCI_GOANY=y
399# CONFIG_PCI_GOOLPC is not set
316CONFIG_PCI_BIOS=y 400CONFIG_PCI_BIOS=y
317CONFIG_PCI_DIRECT=y 401CONFIG_PCI_DIRECT=y
318CONFIG_PCI_MMCONFIG=y 402CONFIG_PCI_MMCONFIG=y
319# CONFIG_PCIEPORTBUS is not set 403CONFIG_PCI_DOMAINS=y
404CONFIG_PCIEPORTBUS=y
405# CONFIG_HOTPLUG_PCI_PCIE is not set
406CONFIG_PCIEAER=y
407# CONFIG_PCIEASPM is not set
320CONFIG_ARCH_SUPPORTS_MSI=y 408CONFIG_ARCH_SUPPORTS_MSI=y
321CONFIG_PCI_MSI=y 409CONFIG_PCI_MSI=y
410# CONFIG_PCI_LEGACY is not set
322# CONFIG_PCI_DEBUG is not set 411# CONFIG_PCI_DEBUG is not set
323# CONFIG_HT_IRQ is not set 412CONFIG_HT_IRQ=y
324CONFIG_ISA_DMA_API=y 413CONFIG_ISA_DMA_API=y
325# CONFIG_ISA is not set 414# CONFIG_ISA is not set
326# CONFIG_MCA is not set 415# CONFIG_MCA is not set
327# CONFIG_SCx200 is not set 416# CONFIG_SCx200 is not set
417# CONFIG_OLPC is not set
328CONFIG_K8_NB=y 418CONFIG_K8_NB=y
329 419CONFIG_PCCARD=y
330# 420# CONFIG_PCMCIA_DEBUG is not set
331# PCCARD (PCMCIA/CardBus) support 421CONFIG_PCMCIA=y
332# 422CONFIG_PCMCIA_LOAD_CIS=y
333# CONFIG_PCCARD is not set 423CONFIG_PCMCIA_IOCTL=y
334# CONFIG_HOTPLUG_PCI is not set 424CONFIG_CARDBUS=y
335 425
336# 426#
337# Executable file formats 427# PC-card bridges
428#
429CONFIG_YENTA=y
430CONFIG_YENTA_O2=y
431CONFIG_YENTA_RICOH=y
432CONFIG_YENTA_TI=y
433CONFIG_YENTA_ENE_TUNE=y
434CONFIG_YENTA_TOSHIBA=y
435# CONFIG_PD6729 is not set
436# CONFIG_I82092 is not set
437CONFIG_PCCARD_NONSTATIC=y
438CONFIG_HOTPLUG_PCI=y
439# CONFIG_HOTPLUG_PCI_FAKE is not set
440# CONFIG_HOTPLUG_PCI_IBM is not set
441# CONFIG_HOTPLUG_PCI_ACPI is not set
442# CONFIG_HOTPLUG_PCI_CPCI is not set
443# CONFIG_HOTPLUG_PCI_SHPC is not set
444
445#
446# Executable file formats / Emulations
338# 447#
339CONFIG_BINFMT_ELF=y 448CONFIG_BINFMT_ELF=y
340# CONFIG_BINFMT_AOUT is not set 449# CONFIG_BINFMT_AOUT is not set
341# CONFIG_BINFMT_MISC is not set 450CONFIG_BINFMT_MISC=y
342 451
343# 452#
344# Networking 453# Networking
@@ -349,59 +458,142 @@ CONFIG_NET=y
349# Networking options 458# Networking options
350# 459#
351CONFIG_PACKET=y 460CONFIG_PACKET=y
352# CONFIG_PACKET_MMAP is not set 461CONFIG_PACKET_MMAP=y
353CONFIG_UNIX=y 462CONFIG_UNIX=y
354CONFIG_XFRM=y 463CONFIG_XFRM=y
355# CONFIG_XFRM_USER is not set 464CONFIG_XFRM_USER=y
356# CONFIG_XFRM_SUB_POLICY is not set 465# CONFIG_XFRM_SUB_POLICY is not set
357# CONFIG_XFRM_MIGRATE is not set 466# CONFIG_XFRM_MIGRATE is not set
467# CONFIG_XFRM_STATISTICS is not set
358# CONFIG_NET_KEY is not set 468# CONFIG_NET_KEY is not set
359CONFIG_INET=y 469CONFIG_INET=y
360CONFIG_IP_MULTICAST=y 470CONFIG_IP_MULTICAST=y
361# CONFIG_IP_ADVANCED_ROUTER is not set 471CONFIG_IP_ADVANCED_ROUTER=y
472CONFIG_ASK_IP_FIB_HASH=y
473# CONFIG_IP_FIB_TRIE is not set
362CONFIG_IP_FIB_HASH=y 474CONFIG_IP_FIB_HASH=y
363CONFIG_IP_PNP=y 475CONFIG_IP_MULTIPLE_TABLES=y
364CONFIG_IP_PNP_DHCP=y 476CONFIG_IP_ROUTE_MULTIPATH=y
365# CONFIG_IP_PNP_BOOTP is not set 477CONFIG_IP_ROUTE_VERBOSE=y
366# CONFIG_IP_PNP_RARP is not set 478# CONFIG_IP_PNP is not set
367# CONFIG_NET_IPIP is not set 479# CONFIG_NET_IPIP is not set
368# CONFIG_NET_IPGRE is not set 480# CONFIG_NET_IPGRE is not set
369# CONFIG_IP_MROUTE is not set 481CONFIG_IP_MROUTE=y
482CONFIG_IP_PIMSM_V1=y
483CONFIG_IP_PIMSM_V2=y
370# CONFIG_ARPD is not set 484# CONFIG_ARPD is not set
371# CONFIG_SYN_COOKIES is not set 485CONFIG_SYN_COOKIES=y
372# CONFIG_INET_AH is not set 486# CONFIG_INET_AH is not set
373# CONFIG_INET_ESP is not set 487# CONFIG_INET_ESP is not set
374# CONFIG_INET_IPCOMP is not set 488# CONFIG_INET_IPCOMP is not set
375# CONFIG_INET_XFRM_TUNNEL is not set 489# CONFIG_INET_XFRM_TUNNEL is not set
376CONFIG_INET_TUNNEL=y 490CONFIG_INET_TUNNEL=y
377CONFIG_INET_XFRM_MODE_TRANSPORT=y 491# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
378CONFIG_INET_XFRM_MODE_TUNNEL=y 492# CONFIG_INET_XFRM_MODE_TUNNEL is not set
379# CONFIG_INET_XFRM_MODE_BEET is not set 493# CONFIG_INET_XFRM_MODE_BEET is not set
380CONFIG_INET_DIAG=y 494CONFIG_INET_LRO=y
381CONFIG_INET_TCP_DIAG=y 495# CONFIG_INET_DIAG is not set
382# CONFIG_TCP_CONG_ADVANCED is not set 496CONFIG_TCP_CONG_ADVANCED=y
497# CONFIG_TCP_CONG_BIC is not set
383CONFIG_TCP_CONG_CUBIC=y 498CONFIG_TCP_CONG_CUBIC=y
499# CONFIG_TCP_CONG_WESTWOOD is not set
500# CONFIG_TCP_CONG_HTCP is not set
501# CONFIG_TCP_CONG_HSTCP is not set
502# CONFIG_TCP_CONG_HYBLA is not set
503# CONFIG_TCP_CONG_VEGAS is not set
504# CONFIG_TCP_CONG_SCALABLE is not set
505# CONFIG_TCP_CONG_LP is not set
506# CONFIG_TCP_CONG_VENO is not set
507# CONFIG_TCP_CONG_YEAH is not set
508# CONFIG_TCP_CONG_ILLINOIS is not set
509# CONFIG_DEFAULT_BIC is not set
510CONFIG_DEFAULT_CUBIC=y
511# CONFIG_DEFAULT_HTCP is not set
512# CONFIG_DEFAULT_VEGAS is not set
513# CONFIG_DEFAULT_WESTWOOD is not set
514# CONFIG_DEFAULT_RENO is not set
384CONFIG_DEFAULT_TCP_CONG="cubic" 515CONFIG_DEFAULT_TCP_CONG="cubic"
385# CONFIG_TCP_MD5SIG is not set 516CONFIG_TCP_MD5SIG=y
517# CONFIG_IP_VS is not set
386CONFIG_IPV6=y 518CONFIG_IPV6=y
387# CONFIG_IPV6_PRIVACY is not set 519# CONFIG_IPV6_PRIVACY is not set
388# CONFIG_IPV6_ROUTER_PREF is not set 520# CONFIG_IPV6_ROUTER_PREF is not set
389# CONFIG_IPV6_OPTIMISTIC_DAD is not set 521# CONFIG_IPV6_OPTIMISTIC_DAD is not set
390# CONFIG_INET6_AH is not set 522CONFIG_INET6_AH=y
391# CONFIG_INET6_ESP is not set 523CONFIG_INET6_ESP=y
392# CONFIG_INET6_IPCOMP is not set 524# CONFIG_INET6_IPCOMP is not set
393# CONFIG_IPV6_MIP6 is not set 525# CONFIG_IPV6_MIP6 is not set
394# CONFIG_INET6_XFRM_TUNNEL is not set 526# CONFIG_INET6_XFRM_TUNNEL is not set
395# CONFIG_INET6_TUNNEL is not set 527# CONFIG_INET6_TUNNEL is not set
396CONFIG_INET6_XFRM_MODE_TRANSPORT=y 528CONFIG_INET6_XFRM_MODE_TRANSPORT=y
397CONFIG_INET6_XFRM_MODE_TUNNEL=y 529CONFIG_INET6_XFRM_MODE_TUNNEL=y
398# CONFIG_INET6_XFRM_MODE_BEET is not set 530CONFIG_INET6_XFRM_MODE_BEET=y
399# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 531# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
400CONFIG_IPV6_SIT=y 532CONFIG_IPV6_SIT=y
533CONFIG_IPV6_NDISC_NODETYPE=y
401# CONFIG_IPV6_TUNNEL is not set 534# CONFIG_IPV6_TUNNEL is not set
402# CONFIG_IPV6_MULTIPLE_TABLES is not set 535# CONFIG_IPV6_MULTIPLE_TABLES is not set
403# CONFIG_NETWORK_SECMARK is not set 536# CONFIG_IPV6_MROUTE is not set
404# CONFIG_NETFILTER is not set 537CONFIG_NETLABEL=y
538CONFIG_NETWORK_SECMARK=y
539CONFIG_NETFILTER=y
540# CONFIG_NETFILTER_DEBUG is not set
541# CONFIG_NETFILTER_ADVANCED is not set
542
543#
544# Core Netfilter Configuration
545#
546CONFIG_NETFILTER_NETLINK=y
547CONFIG_NETFILTER_NETLINK_LOG=y
548CONFIG_NF_CONNTRACK=y
549CONFIG_NF_CONNTRACK_SECMARK=y
550CONFIG_NF_CONNTRACK_FTP=y
551CONFIG_NF_CONNTRACK_IRC=y
552CONFIG_NF_CONNTRACK_SIP=y
553CONFIG_NF_CT_NETLINK=y
554CONFIG_NETFILTER_XTABLES=y
555CONFIG_NETFILTER_XT_TARGET_MARK=y
556CONFIG_NETFILTER_XT_TARGET_NFLOG=y
557CONFIG_NETFILTER_XT_TARGET_SECMARK=y
558CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
559CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
560CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
561CONFIG_NETFILTER_XT_MATCH_MARK=y
562CONFIG_NETFILTER_XT_MATCH_POLICY=y
563CONFIG_NETFILTER_XT_MATCH_STATE=y
564
565#
566# IP: Netfilter Configuration
567#
568CONFIG_NF_CONNTRACK_IPV4=y
569CONFIG_NF_CONNTRACK_PROC_COMPAT=y
570CONFIG_IP_NF_IPTABLES=y
571CONFIG_IP_NF_FILTER=y
572CONFIG_IP_NF_TARGET_REJECT=y
573CONFIG_IP_NF_TARGET_LOG=y
574CONFIG_IP_NF_TARGET_ULOG=y
575CONFIG_NF_NAT=y
576CONFIG_NF_NAT_NEEDED=y
577CONFIG_IP_NF_TARGET_MASQUERADE=y
578CONFIG_NF_NAT_FTP=y
579CONFIG_NF_NAT_IRC=y
580# CONFIG_NF_NAT_TFTP is not set
581# CONFIG_NF_NAT_AMANDA is not set
582# CONFIG_NF_NAT_PPTP is not set
583# CONFIG_NF_NAT_H323 is not set
584CONFIG_NF_NAT_SIP=y
585CONFIG_IP_NF_MANGLE=y
586
587#
588# IPv6: Netfilter Configuration
589#
590CONFIG_NF_CONNTRACK_IPV6=y
591CONFIG_IP6_NF_IPTABLES=y
592CONFIG_IP6_NF_MATCH_IPV6HEADER=y
593CONFIG_IP6_NF_FILTER=y
594CONFIG_IP6_NF_TARGET_LOG=y
595CONFIG_IP6_NF_TARGET_REJECT=y
596CONFIG_IP6_NF_MANGLE=y
405# CONFIG_IP_DCCP is not set 597# CONFIG_IP_DCCP is not set
406# CONFIG_IP_SCTP is not set 598# CONFIG_IP_SCTP is not set
407# CONFIG_TIPC is not set 599# CONFIG_TIPC is not set
@@ -409,6 +601,7 @@ CONFIG_IPV6_SIT=y
409# CONFIG_BRIDGE is not set 601# CONFIG_BRIDGE is not set
410# CONFIG_VLAN_8021Q is not set 602# CONFIG_VLAN_8021Q is not set
411# CONFIG_DECNET is not set 603# CONFIG_DECNET is not set
604CONFIG_LLC=y
412# CONFIG_LLC2 is not set 605# CONFIG_LLC2 is not set
413# CONFIG_IPX is not set 606# CONFIG_IPX is not set
414# CONFIG_ATALK is not set 607# CONFIG_ATALK is not set
@@ -416,28 +609,99 @@ CONFIG_IPV6_SIT=y
416# CONFIG_LAPB is not set 609# CONFIG_LAPB is not set
417# CONFIG_ECONET is not set 610# CONFIG_ECONET is not set
418# CONFIG_WAN_ROUTER is not set 611# CONFIG_WAN_ROUTER is not set
419 612CONFIG_NET_SCHED=y
420# 613
421# QoS and/or fair queueing 614#
422# 615# Queueing/Scheduling
423# CONFIG_NET_SCHED is not set 616#
617# CONFIG_NET_SCH_CBQ is not set
618# CONFIG_NET_SCH_HTB is not set
619# CONFIG_NET_SCH_HFSC is not set
620# CONFIG_NET_SCH_PRIO is not set
621# CONFIG_NET_SCH_RR is not set
622# CONFIG_NET_SCH_RED is not set
623# CONFIG_NET_SCH_SFQ is not set
624# CONFIG_NET_SCH_TEQL is not set
625# CONFIG_NET_SCH_TBF is not set
626# CONFIG_NET_SCH_GRED is not set
627# CONFIG_NET_SCH_DSMARK is not set
628# CONFIG_NET_SCH_NETEM is not set
629# CONFIG_NET_SCH_INGRESS is not set
630
631#
632# Classification
633#
634CONFIG_NET_CLS=y
635# CONFIG_NET_CLS_BASIC is not set
636# CONFIG_NET_CLS_TCINDEX is not set
637# CONFIG_NET_CLS_ROUTE4 is not set
638# CONFIG_NET_CLS_FW is not set
639# CONFIG_NET_CLS_U32 is not set
640# CONFIG_NET_CLS_RSVP is not set
641# CONFIG_NET_CLS_RSVP6 is not set
642# CONFIG_NET_CLS_FLOW is not set
643CONFIG_NET_EMATCH=y
644CONFIG_NET_EMATCH_STACK=32
645# CONFIG_NET_EMATCH_CMP is not set
646# CONFIG_NET_EMATCH_NBYTE is not set
647# CONFIG_NET_EMATCH_U32 is not set
648# CONFIG_NET_EMATCH_META is not set
649# CONFIG_NET_EMATCH_TEXT is not set
650CONFIG_NET_CLS_ACT=y
651# CONFIG_NET_ACT_POLICE is not set
652# CONFIG_NET_ACT_GACT is not set
653# CONFIG_NET_ACT_MIRRED is not set
654# CONFIG_NET_ACT_IPT is not set
655# CONFIG_NET_ACT_NAT is not set
656# CONFIG_NET_ACT_PEDIT is not set
657# CONFIG_NET_ACT_SIMP is not set
658CONFIG_NET_SCH_FIFO=y
424 659
425# 660#
426# Network testing 661# Network testing
427# 662#
428# CONFIG_NET_PKTGEN is not set 663# CONFIG_NET_PKTGEN is not set
429# CONFIG_NET_TCPPROBE is not set 664# CONFIG_NET_TCPPROBE is not set
430# CONFIG_HAMRADIO is not set 665CONFIG_HAMRADIO=y
666
667#
668# Packet Radio protocols
669#
670# CONFIG_AX25 is not set
671# CONFIG_CAN is not set
431# CONFIG_IRDA is not set 672# CONFIG_IRDA is not set
432# CONFIG_BT is not set 673# CONFIG_BT is not set
433# CONFIG_AF_RXRPC is not set 674# CONFIG_AF_RXRPC is not set
675CONFIG_FIB_RULES=y
434 676
435# 677#
436# Wireless 678# Wireless
437# 679#
438# CONFIG_CFG80211 is not set 680CONFIG_CFG80211=y
439# CONFIG_WIRELESS_EXT is not set 681CONFIG_NL80211=y
440# CONFIG_MAC80211 is not set 682CONFIG_WIRELESS_EXT=y
683CONFIG_MAC80211=y
684
685#
686# Rate control algorithm selection
687#
688CONFIG_MAC80211_RC_DEFAULT_PID=y
689# CONFIG_MAC80211_RC_DEFAULT_NONE is not set
690
691#
692# Selecting 'y' for an algorithm will
693#
694
695#
696# build the algorithm into mac80211.
697#
698CONFIG_MAC80211_RC_DEFAULT="pid"
699CONFIG_MAC80211_RC_PID=y
700# CONFIG_MAC80211_MESH is not set
701CONFIG_MAC80211_LEDS=y
702# CONFIG_MAC80211_DEBUGFS is not set
703# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
704# CONFIG_MAC80211_DEBUG is not set
441# CONFIG_IEEE80211 is not set 705# CONFIG_IEEE80211 is not set
442# CONFIG_RFKILL is not set 706# CONFIG_RFKILL is not set
443# CONFIG_NET_9P is not set 707# CONFIG_NET_9P is not set
@@ -449,13 +713,15 @@ CONFIG_IPV6_SIT=y
449# 713#
450# Generic Driver Options 714# Generic Driver Options
451# 715#
716CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
452CONFIG_STANDALONE=y 717CONFIG_STANDALONE=y
453CONFIG_PREVENT_FIRMWARE_BUILD=y 718CONFIG_PREVENT_FIRMWARE_BUILD=y
454CONFIG_FW_LOADER=y 719CONFIG_FW_LOADER=y
455# CONFIG_DEBUG_DRIVER is not set 720# CONFIG_DEBUG_DRIVER is not set
456# CONFIG_DEBUG_DEVRES is not set 721CONFIG_DEBUG_DEVRES=y
457# CONFIG_SYS_HYPERVISOR is not set 722# CONFIG_SYS_HYPERVISOR is not set
458# CONFIG_CONNECTOR is not set 723CONFIG_CONNECTOR=y
724CONFIG_PROC_EVENTS=y
459# CONFIG_MTD is not set 725# CONFIG_MTD is not set
460# CONFIG_PARPORT is not set 726# CONFIG_PARPORT is not set
461CONFIG_PNP=y 727CONFIG_PNP=y
@@ -466,7 +732,7 @@ CONFIG_PNP=y
466# 732#
467CONFIG_PNPACPI=y 733CONFIG_PNPACPI=y
468CONFIG_BLK_DEV=y 734CONFIG_BLK_DEV=y
469CONFIG_BLK_DEV_FD=y 735# CONFIG_BLK_DEV_FD is not set
470# CONFIG_BLK_CPQ_DA is not set 736# CONFIG_BLK_CPQ_DA is not set
471# CONFIG_BLK_CPQ_CISS_DA is not set 737# CONFIG_BLK_CPQ_CISS_DA is not set
472# CONFIG_BLK_DEV_DAC960 is not set 738# CONFIG_BLK_DEV_DAC960 is not set
@@ -479,8 +745,8 @@ CONFIG_BLK_DEV_LOOP=y
479# CONFIG_BLK_DEV_UB is not set 745# CONFIG_BLK_DEV_UB is not set
480CONFIG_BLK_DEV_RAM=y 746CONFIG_BLK_DEV_RAM=y
481CONFIG_BLK_DEV_RAM_COUNT=16 747CONFIG_BLK_DEV_RAM_COUNT=16
482CONFIG_BLK_DEV_RAM_SIZE=4096 748CONFIG_BLK_DEV_RAM_SIZE=16384
483CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 749# CONFIG_BLK_DEV_XIP is not set
484# CONFIG_CDROM_PKTCDVD is not set 750# CONFIG_CDROM_PKTCDVD is not set
485# CONFIG_ATA_OVER_ETH is not set 751# CONFIG_ATA_OVER_ETH is not set
486CONFIG_MISC_DEVICES=y 752CONFIG_MISC_DEVICES=y
@@ -489,73 +755,17 @@ CONFIG_MISC_DEVICES=y
489# CONFIG_EEPROM_93CX6 is not set 755# CONFIG_EEPROM_93CX6 is not set
490# CONFIG_SGI_IOC4 is not set 756# CONFIG_SGI_IOC4 is not set
491# CONFIG_TIFM_CORE is not set 757# CONFIG_TIFM_CORE is not set
758# CONFIG_ACER_WMI is not set
759# CONFIG_ASUS_LAPTOP is not set
760# CONFIG_FUJITSU_LAPTOP is not set
761# CONFIG_TC1100_WMI is not set
762# CONFIG_MSI_LAPTOP is not set
492# CONFIG_SONY_LAPTOP is not set 763# CONFIG_SONY_LAPTOP is not set
493# CONFIG_THINKPAD_ACPI is not set 764# CONFIG_THINKPAD_ACPI is not set
494CONFIG_IDE=y 765# CONFIG_INTEL_MENLOW is not set
495CONFIG_BLK_DEV_IDE=y 766# CONFIG_ENCLOSURE_SERVICES is not set
496 767CONFIG_HAVE_IDE=y
497# 768# CONFIG_IDE is not set
498# Please see Documentation/ide.txt for help/info on IDE drives
499#
500# CONFIG_BLK_DEV_IDE_SATA is not set
501# CONFIG_BLK_DEV_HD_IDE is not set
502CONFIG_BLK_DEV_IDEDISK=y
503CONFIG_IDEDISK_MULTI_MODE=y
504CONFIG_BLK_DEV_IDECD=y
505# CONFIG_BLK_DEV_IDETAPE is not set
506# CONFIG_BLK_DEV_IDEFLOPPY is not set
507# CONFIG_BLK_DEV_IDESCSI is not set
508CONFIG_BLK_DEV_IDEACPI=y
509# CONFIG_IDE_TASK_IOCTL is not set
510CONFIG_IDE_PROC_FS=y
511
512#
513# IDE chipset support/bugfixes
514#
515CONFIG_IDE_GENERIC=y
516# CONFIG_BLK_DEV_CMD640 is not set
517# CONFIG_BLK_DEV_IDEPNP is not set
518CONFIG_BLK_DEV_IDEPCI=y
519# CONFIG_IDEPCI_SHARE_IRQ is not set
520CONFIG_IDEPCI_PCIBUS_ORDER=y
521# CONFIG_BLK_DEV_OFFBOARD is not set
522# CONFIG_BLK_DEV_GENERIC is not set
523# CONFIG_BLK_DEV_OPTI621 is not set
524# CONFIG_BLK_DEV_RZ1000 is not set
525CONFIG_BLK_DEV_IDEDMA_PCI=y
526# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
527# CONFIG_IDEDMA_ONLYDISK is not set
528# CONFIG_BLK_DEV_AEC62XX is not set
529# CONFIG_BLK_DEV_ALI15X3 is not set
530CONFIG_BLK_DEV_AMD74XX=y
531# CONFIG_BLK_DEV_ATIIXP is not set
532# CONFIG_BLK_DEV_CMD64X is not set
533# CONFIG_BLK_DEV_TRIFLEX is not set
534# CONFIG_BLK_DEV_CY82C693 is not set
535# CONFIG_BLK_DEV_CS5520 is not set
536# CONFIG_BLK_DEV_CS5530 is not set
537# CONFIG_BLK_DEV_CS5535 is not set
538# CONFIG_BLK_DEV_HPT34X is not set
539# CONFIG_BLK_DEV_HPT366 is not set
540# CONFIG_BLK_DEV_JMICRON is not set
541# CONFIG_BLK_DEV_SC1200 is not set
542CONFIG_BLK_DEV_PIIX=y
543# CONFIG_BLK_DEV_IT8213 is not set
544# CONFIG_BLK_DEV_IT821X is not set
545# CONFIG_BLK_DEV_NS87415 is not set
546# CONFIG_BLK_DEV_PDC202XX_OLD is not set
547# CONFIG_BLK_DEV_PDC202XX_NEW is not set
548# CONFIG_BLK_DEV_SVWKS is not set
549# CONFIG_BLK_DEV_SIIMAGE is not set
550# CONFIG_BLK_DEV_SIS5513 is not set
551# CONFIG_BLK_DEV_SLC90E66 is not set
552# CONFIG_BLK_DEV_TRM290 is not set
553# CONFIG_BLK_DEV_VIA82CXXX is not set
554# CONFIG_BLK_DEV_TC86C001 is not set
555# CONFIG_IDE_ARM is not set
556CONFIG_BLK_DEV_IDEDMA=y
557# CONFIG_IDEDMA_IVB is not set
558# CONFIG_BLK_DEV_HD is not set
559 769
560# 770#
561# SCSI device support 771# SCSI device support
@@ -564,8 +774,8 @@ CONFIG_BLK_DEV_IDEDMA=y
564CONFIG_SCSI=y 774CONFIG_SCSI=y
565CONFIG_SCSI_DMA=y 775CONFIG_SCSI_DMA=y
566# CONFIG_SCSI_TGT is not set 776# CONFIG_SCSI_TGT is not set
567CONFIG_SCSI_NETLINK=y 777# CONFIG_SCSI_NETLINK is not set
568# CONFIG_SCSI_PROC_FS is not set 778CONFIG_SCSI_PROC_FS=y
569 779
570# 780#
571# SCSI support type (disk, tape, CD-ROM) 781# SCSI support type (disk, tape, CD-ROM)
@@ -574,7 +784,7 @@ CONFIG_BLK_DEV_SD=y
574# CONFIG_CHR_DEV_ST is not set 784# CONFIG_CHR_DEV_ST is not set
575# CONFIG_CHR_DEV_OSST is not set 785# CONFIG_CHR_DEV_OSST is not set
576CONFIG_BLK_DEV_SR=y 786CONFIG_BLK_DEV_SR=y
577# CONFIG_BLK_DEV_SR_VENDOR is not set 787CONFIG_BLK_DEV_SR_VENDOR=y
578CONFIG_CHR_DEV_SG=y 788CONFIG_CHR_DEV_SG=y
579# CONFIG_CHR_DEV_SCH is not set 789# CONFIG_CHR_DEV_SCH is not set
580 790
@@ -582,7 +792,7 @@ CONFIG_CHR_DEV_SG=y
582# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 792# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
583# 793#
584# CONFIG_SCSI_MULTI_LUN is not set 794# CONFIG_SCSI_MULTI_LUN is not set
585# CONFIG_SCSI_CONSTANTS is not set 795CONFIG_SCSI_CONSTANTS=y
586# CONFIG_SCSI_LOGGING is not set 796# CONFIG_SCSI_LOGGING is not set
587# CONFIG_SCSI_SCAN_ASYNC is not set 797# CONFIG_SCSI_SCAN_ASYNC is not set
588CONFIG_SCSI_WAIT_SCAN=m 798CONFIG_SCSI_WAIT_SCAN=m
@@ -591,81 +801,37 @@ CONFIG_SCSI_WAIT_SCAN=m
591# SCSI Transports 801# SCSI Transports
592# 802#
593CONFIG_SCSI_SPI_ATTRS=y 803CONFIG_SCSI_SPI_ATTRS=y
594CONFIG_SCSI_FC_ATTRS=y 804# CONFIG_SCSI_FC_ATTRS is not set
595# CONFIG_SCSI_ISCSI_ATTRS is not set 805# CONFIG_SCSI_ISCSI_ATTRS is not set
596# CONFIG_SCSI_SAS_ATTRS is not set 806# CONFIG_SCSI_SAS_ATTRS is not set
597# CONFIG_SCSI_SAS_LIBSAS is not set 807# CONFIG_SCSI_SAS_LIBSAS is not set
598 808# CONFIG_SCSI_SRP_ATTRS is not set
599# 809# CONFIG_SCSI_LOWLEVEL is not set
600# SCSI low-level drivers 810# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
601#
602# CONFIG_ISCSI_TCP is not set
603CONFIG_BLK_DEV_3W_XXXX_RAID=y
604# CONFIG_SCSI_3W_9XXX is not set
605# CONFIG_SCSI_ACARD is not set
606# CONFIG_SCSI_AACRAID is not set
607CONFIG_SCSI_AIC7XXX=y
608CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
609CONFIG_AIC7XXX_RESET_DELAY_MS=5000
610CONFIG_AIC7XXX_DEBUG_ENABLE=y
611CONFIG_AIC7XXX_DEBUG_MASK=0
612CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
613# CONFIG_SCSI_AIC7XXX_OLD is not set
614CONFIG_SCSI_AIC79XX=y
615CONFIG_AIC79XX_CMDS_PER_DEVICE=32
616CONFIG_AIC79XX_RESET_DELAY_MS=4000
617# CONFIG_AIC79XX_DEBUG_ENABLE is not set
618CONFIG_AIC79XX_DEBUG_MASK=0
619# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
620# CONFIG_SCSI_AIC94XX is not set
621# CONFIG_SCSI_DPT_I2O is not set
622# CONFIG_SCSI_ADVANSYS is not set
623# CONFIG_SCSI_ARCMSR is not set
624# CONFIG_MEGARAID_NEWGEN is not set
625# CONFIG_MEGARAID_LEGACY is not set
626# CONFIG_MEGARAID_SAS is not set
627# CONFIG_SCSI_HPTIOP is not set
628# CONFIG_SCSI_BUSLOGIC is not set
629# CONFIG_SCSI_DMX3191D is not set
630# CONFIG_SCSI_EATA is not set
631# CONFIG_SCSI_FUTURE_DOMAIN is not set
632# CONFIG_SCSI_GDTH is not set
633# CONFIG_SCSI_IPS is not set
634# CONFIG_SCSI_INITIO is not set
635# CONFIG_SCSI_INIA100 is not set
636# CONFIG_SCSI_STEX is not set
637# CONFIG_SCSI_SYM53C8XX_2 is not set
638# CONFIG_SCSI_IPR is not set
639# CONFIG_SCSI_QLOGIC_1280 is not set
640# CONFIG_SCSI_QLA_FC is not set
641# CONFIG_SCSI_QLA_ISCSI is not set
642# CONFIG_SCSI_LPFC is not set
643# CONFIG_SCSI_DC395x is not set
644# CONFIG_SCSI_DC390T is not set
645# CONFIG_SCSI_NSP32 is not set
646# CONFIG_SCSI_DEBUG is not set
647# CONFIG_SCSI_SRP is not set
648CONFIG_ATA=y 811CONFIG_ATA=y
649# CONFIG_ATA_NONSTANDARD is not set 812# CONFIG_ATA_NONSTANDARD is not set
650CONFIG_ATA_ACPI=y 813CONFIG_ATA_ACPI=y
814CONFIG_SATA_PMP=y
651CONFIG_SATA_AHCI=y 815CONFIG_SATA_AHCI=y
652CONFIG_SATA_SVW=y 816# CONFIG_SATA_SIL24 is not set
817CONFIG_ATA_SFF=y
818# CONFIG_SATA_SVW is not set
653CONFIG_ATA_PIIX=y 819CONFIG_ATA_PIIX=y
654# CONFIG_SATA_MV is not set 820# CONFIG_SATA_MV is not set
655CONFIG_SATA_NV=y 821# CONFIG_SATA_NV is not set
656# CONFIG_PDC_ADMA is not set 822# CONFIG_PDC_ADMA is not set
657# CONFIG_SATA_QSTOR is not set 823# CONFIG_SATA_QSTOR is not set
658# CONFIG_SATA_PROMISE is not set 824# CONFIG_SATA_PROMISE is not set
659# CONFIG_SATA_SX4 is not set 825# CONFIG_SATA_SX4 is not set
660CONFIG_SATA_SIL=y 826# CONFIG_SATA_SIL is not set
661# CONFIG_SATA_SIL24 is not set
662# CONFIG_SATA_SIS is not set 827# CONFIG_SATA_SIS is not set
663# CONFIG_SATA_ULI is not set 828# CONFIG_SATA_ULI is not set
664CONFIG_SATA_VIA=y 829# CONFIG_SATA_VIA is not set
665# CONFIG_SATA_VITESSE is not set 830# CONFIG_SATA_VITESSE is not set
666# CONFIG_SATA_INIC162X is not set 831# CONFIG_SATA_INIC162X is not set
832# CONFIG_PATA_ACPI is not set
667# CONFIG_PATA_ALI is not set 833# CONFIG_PATA_ALI is not set
668# CONFIG_PATA_AMD is not set 834CONFIG_PATA_AMD=y
669# CONFIG_PATA_ARTOP is not set 835# CONFIG_PATA_ARTOP is not set
670# CONFIG_PATA_ATIIXP is not set 836# CONFIG_PATA_ATIIXP is not set
671# CONFIG_PATA_CMD640_PCI is not set 837# CONFIG_PATA_CMD640_PCI is not set
@@ -673,6 +839,7 @@ CONFIG_SATA_VIA=y
673# CONFIG_PATA_CS5520 is not set 839# CONFIG_PATA_CS5520 is not set
674# CONFIG_PATA_CS5530 is not set 840# CONFIG_PATA_CS5530 is not set
675# CONFIG_PATA_CS5535 is not set 841# CONFIG_PATA_CS5535 is not set
842# CONFIG_PATA_CS5536 is not set
676# CONFIG_PATA_CYPRESS is not set 843# CONFIG_PATA_CYPRESS is not set
677# CONFIG_PATA_EFAR is not set 844# CONFIG_PATA_EFAR is not set
678# CONFIG_ATA_GENERIC is not set 845# CONFIG_ATA_GENERIC is not set
@@ -686,11 +853,14 @@ CONFIG_SATA_VIA=y
686# CONFIG_PATA_TRIFLEX is not set 853# CONFIG_PATA_TRIFLEX is not set
687# CONFIG_PATA_MARVELL is not set 854# CONFIG_PATA_MARVELL is not set
688# CONFIG_PATA_MPIIX is not set 855# CONFIG_PATA_MPIIX is not set
689# CONFIG_PATA_OLDPIIX is not set 856CONFIG_PATA_OLDPIIX=y
690# CONFIG_PATA_NETCELL is not set 857# CONFIG_PATA_NETCELL is not set
858# CONFIG_PATA_NINJA32 is not set
691# CONFIG_PATA_NS87410 is not set 859# CONFIG_PATA_NS87410 is not set
860# CONFIG_PATA_NS87415 is not set
692# CONFIG_PATA_OPTI is not set 861# CONFIG_PATA_OPTI is not set
693# CONFIG_PATA_OPTIDMA is not set 862# CONFIG_PATA_OPTIDMA is not set
863# CONFIG_PATA_PCMCIA is not set
694# CONFIG_PATA_PDC_OLD is not set 864# CONFIG_PATA_PDC_OLD is not set
695# CONFIG_PATA_RADISYS is not set 865# CONFIG_PATA_RADISYS is not set
696# CONFIG_PATA_RZ1000 is not set 866# CONFIG_PATA_RZ1000 is not set
@@ -702,65 +872,42 @@ CONFIG_SATA_VIA=y
702# CONFIG_PATA_VIA is not set 872# CONFIG_PATA_VIA is not set
703# CONFIG_PATA_WINBOND is not set 873# CONFIG_PATA_WINBOND is not set
704CONFIG_MD=y 874CONFIG_MD=y
705# CONFIG_BLK_DEV_MD is not set 875CONFIG_BLK_DEV_MD=y
876# CONFIG_MD_LINEAR is not set
877# CONFIG_MD_RAID0 is not set
878# CONFIG_MD_RAID1 is not set
879# CONFIG_MD_RAID10 is not set
880# CONFIG_MD_RAID456 is not set
881# CONFIG_MD_MULTIPATH is not set
882# CONFIG_MD_FAULTY is not set
706CONFIG_BLK_DEV_DM=y 883CONFIG_BLK_DEV_DM=y
707# CONFIG_DM_DEBUG is not set 884# CONFIG_DM_DEBUG is not set
708# CONFIG_DM_CRYPT is not set 885# CONFIG_DM_CRYPT is not set
709# CONFIG_DM_SNAPSHOT is not set 886# CONFIG_DM_SNAPSHOT is not set
710# CONFIG_DM_MIRROR is not set 887CONFIG_DM_MIRROR=y
711# CONFIG_DM_ZERO is not set 888CONFIG_DM_ZERO=y
712# CONFIG_DM_MULTIPATH is not set 889# CONFIG_DM_MULTIPATH is not set
713# CONFIG_DM_DELAY is not set 890# CONFIG_DM_DELAY is not set
714 891# CONFIG_DM_UEVENT is not set
715# 892# CONFIG_FUSION is not set
716# Fusion MPT device support
717#
718CONFIG_FUSION=y
719CONFIG_FUSION_SPI=y
720# CONFIG_FUSION_FC is not set
721# CONFIG_FUSION_SAS is not set
722CONFIG_FUSION_MAX_SGE=128
723# CONFIG_FUSION_CTL is not set
724 893
725# 894#
726# IEEE 1394 (FireWire) support 895# IEEE 1394 (FireWire) support
727# 896#
728# CONFIG_FIREWIRE is not set 897# CONFIG_FIREWIRE is not set
729CONFIG_IEEE1394=y 898# CONFIG_IEEE1394 is not set
730
731#
732# Subsystem Options
733#
734# CONFIG_IEEE1394_VERBOSEDEBUG is not set
735
736#
737# Controllers
738#
739
740#
741# Texas Instruments PCILynx requires I2C
742#
743CONFIG_IEEE1394_OHCI1394=y
744
745#
746# Protocols
747#
748# CONFIG_IEEE1394_VIDEO1394 is not set
749# CONFIG_IEEE1394_SBP2 is not set
750# CONFIG_IEEE1394_ETH1394_ROM_ENTRY is not set
751# CONFIG_IEEE1394_ETH1394 is not set
752# CONFIG_IEEE1394_DV1394 is not set
753CONFIG_IEEE1394_RAWIO=y
754# CONFIG_I2O is not set 899# CONFIG_I2O is not set
755CONFIG_MACINTOSH_DRIVERS=y 900CONFIG_MACINTOSH_DRIVERS=y
756# CONFIG_MAC_EMUMOUSEBTN is not set 901CONFIG_MAC_EMUMOUSEBTN=y
757CONFIG_NETDEVICES=y 902CONFIG_NETDEVICES=y
758CONFIG_NETDEVICES_MULTIQUEUE=y 903# CONFIG_NETDEVICES_MULTIQUEUE is not set
904# CONFIG_IFB is not set
759# CONFIG_DUMMY is not set 905# CONFIG_DUMMY is not set
760# CONFIG_BONDING is not set 906# CONFIG_BONDING is not set
761# CONFIG_MACVLAN is not set 907# CONFIG_MACVLAN is not set
762# CONFIG_EQUALIZER is not set 908# CONFIG_EQUALIZER is not set
763# CONFIG_TUN is not set 909# CONFIG_TUN is not set
910# CONFIG_VETH is not set
764# CONFIG_NET_SB1000 is not set 911# CONFIG_NET_SB1000 is not set
765# CONFIG_ARCNET is not set 912# CONFIG_ARCNET is not set
766# CONFIG_PHYLIB is not set 913# CONFIG_PHYLIB is not set
@@ -770,38 +917,40 @@ CONFIG_MII=y
770# CONFIG_SUNGEM is not set 917# CONFIG_SUNGEM is not set
771# CONFIG_CASSINI is not set 918# CONFIG_CASSINI is not set
772CONFIG_NET_VENDOR_3COM=y 919CONFIG_NET_VENDOR_3COM=y
773CONFIG_VORTEX=y 920# CONFIG_VORTEX is not set
774# CONFIG_TYPHOON is not set 921# CONFIG_TYPHOON is not set
775CONFIG_NET_TULIP=y 922CONFIG_NET_TULIP=y
776# CONFIG_DE2104X is not set 923# CONFIG_DE2104X is not set
777CONFIG_TULIP=y 924# CONFIG_TULIP is not set
778# CONFIG_TULIP_MWI is not set
779# CONFIG_TULIP_MMIO is not set
780# CONFIG_TULIP_NAPI is not set
781# CONFIG_DE4X5 is not set 925# CONFIG_DE4X5 is not set
782# CONFIG_WINBOND_840 is not set 926# CONFIG_WINBOND_840 is not set
783# CONFIG_DM9102 is not set 927# CONFIG_DM9102 is not set
784# CONFIG_ULI526X is not set 928# CONFIG_ULI526X is not set
929# CONFIG_PCMCIA_XIRCOM is not set
785# CONFIG_HP100 is not set 930# CONFIG_HP100 is not set
931# CONFIG_IBM_NEW_EMAC_ZMII is not set
932# CONFIG_IBM_NEW_EMAC_RGMII is not set
933# CONFIG_IBM_NEW_EMAC_TAH is not set
934# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
786CONFIG_NET_PCI=y 935CONFIG_NET_PCI=y
787# CONFIG_PCNET32 is not set 936# CONFIG_PCNET32 is not set
788# CONFIG_AMD8111_ETH is not set 937# CONFIG_AMD8111_ETH is not set
789# CONFIG_ADAPTEC_STARFIRE is not set 938# CONFIG_ADAPTEC_STARFIRE is not set
790CONFIG_B44=y 939# CONFIG_B44 is not set
791CONFIG_FORCEDETH=y 940CONFIG_FORCEDETH=y
792# CONFIG_FORCEDETH_NAPI is not set 941# CONFIG_FORCEDETH_NAPI is not set
793# CONFIG_DGRS is not set
794# CONFIG_EEPRO100 is not set 942# CONFIG_EEPRO100 is not set
795CONFIG_E100=y 943CONFIG_E100=y
796# CONFIG_FEALNX is not set 944# CONFIG_FEALNX is not set
797# CONFIG_NATSEMI is not set 945# CONFIG_NATSEMI is not set
798# CONFIG_NE2K_PCI is not set 946# CONFIG_NE2K_PCI is not set
799CONFIG_8139CP=y 947# CONFIG_8139CP is not set
800CONFIG_8139TOO=y 948CONFIG_8139TOO=y
801# CONFIG_8139TOO_PIO is not set 949CONFIG_8139TOO_PIO=y
802# CONFIG_8139TOO_TUNE_TWISTER is not set 950# CONFIG_8139TOO_TUNE_TWISTER is not set
803# CONFIG_8139TOO_8129 is not set 951# CONFIG_8139TOO_8129 is not set
804# CONFIG_8139_OLD_RX_RESET is not set 952# CONFIG_8139_OLD_RX_RESET is not set
953# CONFIG_R6040 is not set
805# CONFIG_SIS900 is not set 954# CONFIG_SIS900 is not set
806# CONFIG_EPIC100 is not set 955# CONFIG_EPIC100 is not set
807# CONFIG_SUNDANCE is not set 956# CONFIG_SUNDANCE is not set
@@ -814,34 +963,75 @@ CONFIG_NETDEV_1000=y
814CONFIG_E1000=y 963CONFIG_E1000=y
815# CONFIG_E1000_NAPI is not set 964# CONFIG_E1000_NAPI is not set
816# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 965# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
966# CONFIG_E1000E is not set
967# CONFIG_E1000E_ENABLED is not set
968# CONFIG_IP1000 is not set
969# CONFIG_IGB is not set
817# CONFIG_NS83820 is not set 970# CONFIG_NS83820 is not set
818# CONFIG_HAMACHI is not set 971# CONFIG_HAMACHI is not set
819# CONFIG_YELLOWFIN is not set 972# CONFIG_YELLOWFIN is not set
820CONFIG_R8169=y 973# CONFIG_R8169 is not set
821# CONFIG_R8169_NAPI is not set
822# CONFIG_SIS190 is not set 974# CONFIG_SIS190 is not set
823# CONFIG_SKGE is not set 975# CONFIG_SKGE is not set
824CONFIG_SKY2=y 976CONFIG_SKY2=y
977# CONFIG_SKY2_DEBUG is not set
825# CONFIG_VIA_VELOCITY is not set 978# CONFIG_VIA_VELOCITY is not set
826CONFIG_TIGON3=y 979CONFIG_TIGON3=y
827CONFIG_BNX2=y 980# CONFIG_BNX2 is not set
828# CONFIG_QLA3XXX is not set 981# CONFIG_QLA3XXX is not set
829# CONFIG_ATL1 is not set 982# CONFIG_ATL1 is not set
830CONFIG_NETDEV_10000=y 983CONFIG_NETDEV_10000=y
831# CONFIG_CHELSIO_T1 is not set 984# CONFIG_CHELSIO_T1 is not set
832# CONFIG_CHELSIO_T3 is not set 985# CONFIG_CHELSIO_T3 is not set
986# CONFIG_IXGBE is not set
833# CONFIG_IXGB is not set 987# CONFIG_IXGB is not set
834# CONFIG_S2IO is not set 988# CONFIG_S2IO is not set
835# CONFIG_MYRI10GE is not set 989# CONFIG_MYRI10GE is not set
836# CONFIG_NETXEN_NIC is not set 990# CONFIG_NETXEN_NIC is not set
991# CONFIG_NIU is not set
837# CONFIG_MLX4_CORE is not set 992# CONFIG_MLX4_CORE is not set
838# CONFIG_TR is not set 993# CONFIG_TEHUTI is not set
994# CONFIG_BNX2X is not set
995# CONFIG_SFC is not set
996CONFIG_TR=y
997# CONFIG_IBMOL is not set
998# CONFIG_IBMLS is not set
999# CONFIG_3C359 is not set
1000# CONFIG_TMS380TR is not set
839 1001
840# 1002#
841# Wireless LAN 1003# Wireless LAN
842# 1004#
843# CONFIG_WLAN_PRE80211 is not set 1005# CONFIG_WLAN_PRE80211 is not set
844# CONFIG_WLAN_80211 is not set 1006CONFIG_WLAN_80211=y
1007# CONFIG_PCMCIA_RAYCS is not set
1008# CONFIG_IPW2100 is not set
1009# CONFIG_IPW2200 is not set
1010# CONFIG_LIBERTAS is not set
1011# CONFIG_AIRO is not set
1012# CONFIG_HERMES is not set
1013# CONFIG_ATMEL is not set
1014# CONFIG_AIRO_CS is not set
1015# CONFIG_PCMCIA_WL3501 is not set
1016# CONFIG_PRISM54 is not set
1017# CONFIG_USB_ZD1201 is not set
1018# CONFIG_USB_NET_RNDIS_WLAN is not set
1019# CONFIG_RTL8180 is not set
1020# CONFIG_RTL8187 is not set
1021# CONFIG_ADM8211 is not set
1022# CONFIG_P54_COMMON is not set
1023CONFIG_ATH5K=y
1024# CONFIG_ATH5K_DEBUG is not set
1025# CONFIG_IWLWIFI is not set
1026# CONFIG_IWLCORE is not set
1027# CONFIG_IWLWIFI_LEDS is not set
1028# CONFIG_IWL4965 is not set
1029# CONFIG_IWL3945 is not set
1030# CONFIG_HOSTAP is not set
1031# CONFIG_B43 is not set
1032# CONFIG_B43LEGACY is not set
1033# CONFIG_ZD1211RW is not set
1034# CONFIG_RT2X00 is not set
845 1035
846# 1036#
847# USB Network Adapters 1037# USB Network Adapters
@@ -850,16 +1040,27 @@ CONFIG_NETDEV_10000=y
850# CONFIG_USB_KAWETH is not set 1040# CONFIG_USB_KAWETH is not set
851# CONFIG_USB_PEGASUS is not set 1041# CONFIG_USB_PEGASUS is not set
852# CONFIG_USB_RTL8150 is not set 1042# CONFIG_USB_RTL8150 is not set
853# CONFIG_USB_USBNET_MII is not set
854# CONFIG_USB_USBNET is not set 1043# CONFIG_USB_USBNET is not set
1044CONFIG_NET_PCMCIA=y
1045# CONFIG_PCMCIA_3C589 is not set
1046# CONFIG_PCMCIA_3C574 is not set
1047# CONFIG_PCMCIA_FMVJ18X is not set
1048# CONFIG_PCMCIA_PCNET is not set
1049# CONFIG_PCMCIA_NMCLAN is not set
1050# CONFIG_PCMCIA_SMC91C92 is not set
1051# CONFIG_PCMCIA_XIRC2PS is not set
1052# CONFIG_PCMCIA_AXNET is not set
1053# CONFIG_PCMCIA_IBMTR is not set
855# CONFIG_WAN is not set 1054# CONFIG_WAN is not set
856# CONFIG_FDDI is not set 1055CONFIG_FDDI=y
1056# CONFIG_DEFXX is not set
1057# CONFIG_SKFP is not set
857# CONFIG_HIPPI is not set 1058# CONFIG_HIPPI is not set
858# CONFIG_PPP is not set 1059# CONFIG_PPP is not set
859# CONFIG_SLIP is not set 1060# CONFIG_SLIP is not set
860# CONFIG_NET_FC is not set 1061# CONFIG_NET_FC is not set
861# CONFIG_SHAPER is not set
862CONFIG_NETCONSOLE=y 1062CONFIG_NETCONSOLE=y
1063# CONFIG_NETCONSOLE_DYNAMIC is not set
863CONFIG_NETPOLL=y 1064CONFIG_NETPOLL=y
864# CONFIG_NETPOLL_TRAP is not set 1065# CONFIG_NETPOLL_TRAP is not set
865CONFIG_NET_POLL_CONTROLLER=y 1066CONFIG_NET_POLL_CONTROLLER=y
@@ -870,18 +1071,17 @@ CONFIG_NET_POLL_CONTROLLER=y
870# Input device support 1071# Input device support
871# 1072#
872CONFIG_INPUT=y 1073CONFIG_INPUT=y
873# CONFIG_INPUT_FF_MEMLESS is not set 1074CONFIG_INPUT_FF_MEMLESS=y
874# CONFIG_INPUT_POLLDEV is not set 1075CONFIG_INPUT_POLLDEV=y
875 1076
876# 1077#
877# Userland interfaces 1078# Userland interfaces
878# 1079#
879CONFIG_INPUT_MOUSEDEV=y 1080CONFIG_INPUT_MOUSEDEV=y
880CONFIG_INPUT_MOUSEDEV_PSAUX=y 1081# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
881CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 1082CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
882CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 1083CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
883# CONFIG_INPUT_JOYDEV is not set 1084# CONFIG_INPUT_JOYDEV is not set
884# CONFIG_INPUT_TSDEV is not set
885CONFIG_INPUT_EVDEV=y 1085CONFIG_INPUT_EVDEV=y
886# CONFIG_INPUT_EVBUG is not set 1086# CONFIG_INPUT_EVBUG is not set
887 1087
@@ -906,17 +1106,63 @@ CONFIG_MOUSE_PS2_TRACKPOINT=y
906# CONFIG_MOUSE_SERIAL is not set 1106# CONFIG_MOUSE_SERIAL is not set
907# CONFIG_MOUSE_APPLETOUCH is not set 1107# CONFIG_MOUSE_APPLETOUCH is not set
908# CONFIG_MOUSE_VSXXXAA is not set 1108# CONFIG_MOUSE_VSXXXAA is not set
909# CONFIG_INPUT_JOYSTICK is not set 1109CONFIG_INPUT_JOYSTICK=y
910# CONFIG_INPUT_TABLET is not set 1110# CONFIG_JOYSTICK_ANALOG is not set
911# CONFIG_INPUT_TOUCHSCREEN is not set 1111# CONFIG_JOYSTICK_A3D is not set
912# CONFIG_INPUT_MISC is not set 1112# CONFIG_JOYSTICK_ADI is not set
1113# CONFIG_JOYSTICK_COBRA is not set
1114# CONFIG_JOYSTICK_GF2K is not set
1115# CONFIG_JOYSTICK_GRIP is not set
1116# CONFIG_JOYSTICK_GRIP_MP is not set
1117# CONFIG_JOYSTICK_GUILLEMOT is not set
1118# CONFIG_JOYSTICK_INTERACT is not set
1119# CONFIG_JOYSTICK_SIDEWINDER is not set
1120# CONFIG_JOYSTICK_TMDC is not set
1121# CONFIG_JOYSTICK_IFORCE is not set
1122# CONFIG_JOYSTICK_WARRIOR is not set
1123# CONFIG_JOYSTICK_MAGELLAN is not set
1124# CONFIG_JOYSTICK_SPACEORB is not set
1125# CONFIG_JOYSTICK_SPACEBALL is not set
1126# CONFIG_JOYSTICK_STINGER is not set
1127# CONFIG_JOYSTICK_TWIDJOY is not set
1128# CONFIG_JOYSTICK_ZHENHUA is not set
1129# CONFIG_JOYSTICK_JOYDUMP is not set
1130# CONFIG_JOYSTICK_XPAD is not set
1131CONFIG_INPUT_TABLET=y
1132# CONFIG_TABLET_USB_ACECAD is not set
1133# CONFIG_TABLET_USB_AIPTEK is not set
1134# CONFIG_TABLET_USB_GTCO is not set
1135# CONFIG_TABLET_USB_KBTAB is not set
1136# CONFIG_TABLET_USB_WACOM is not set
1137CONFIG_INPUT_TOUCHSCREEN=y
1138# CONFIG_TOUCHSCREEN_FUJITSU is not set
1139# CONFIG_TOUCHSCREEN_GUNZE is not set
1140# CONFIG_TOUCHSCREEN_ELO is not set
1141# CONFIG_TOUCHSCREEN_MTOUCH is not set
1142# CONFIG_TOUCHSCREEN_MK712 is not set
1143# CONFIG_TOUCHSCREEN_PENMOUNT is not set
1144# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
1145# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
1146# CONFIG_TOUCHSCREEN_UCB1400 is not set
1147# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
1148CONFIG_INPUT_MISC=y
1149# CONFIG_INPUT_PCSPKR is not set
1150# CONFIG_INPUT_APANEL is not set
1151# CONFIG_INPUT_WISTRON_BTNS is not set
1152# CONFIG_INPUT_ATLAS_BTNS is not set
1153# CONFIG_INPUT_ATI_REMOTE is not set
1154# CONFIG_INPUT_ATI_REMOTE2 is not set
1155# CONFIG_INPUT_KEYSPAN_REMOTE is not set
1156# CONFIG_INPUT_POWERMATE is not set
1157# CONFIG_INPUT_YEALINK is not set
1158# CONFIG_INPUT_UINPUT is not set
913 1159
914# 1160#
915# Hardware I/O ports 1161# Hardware I/O ports
916# 1162#
917CONFIG_SERIO=y 1163CONFIG_SERIO=y
918CONFIG_SERIO_I8042=y 1164CONFIG_SERIO_I8042=y
919# CONFIG_SERIO_SERPORT is not set 1165CONFIG_SERIO_SERPORT=y
920# CONFIG_SERIO_CT82C710 is not set 1166# CONFIG_SERIO_CT82C710 is not set
921# CONFIG_SERIO_PCIPS2 is not set 1167# CONFIG_SERIO_PCIPS2 is not set
922CONFIG_SERIO_LIBPS2=y 1168CONFIG_SERIO_LIBPS2=y
@@ -929,8 +1175,26 @@ CONFIG_SERIO_LIBPS2=y
929CONFIG_VT=y 1175CONFIG_VT=y
930CONFIG_VT_CONSOLE=y 1176CONFIG_VT_CONSOLE=y
931CONFIG_HW_CONSOLE=y 1177CONFIG_HW_CONSOLE=y
932# CONFIG_VT_HW_CONSOLE_BINDING is not set 1178CONFIG_VT_HW_CONSOLE_BINDING=y
933# CONFIG_SERIAL_NONSTANDARD is not set 1179CONFIG_DEVKMEM=y
1180CONFIG_SERIAL_NONSTANDARD=y
1181# CONFIG_COMPUTONE is not set
1182# CONFIG_ROCKETPORT is not set
1183# CONFIG_CYCLADES is not set
1184# CONFIG_DIGIEPCA is not set
1185# CONFIG_MOXA_INTELLIO is not set
1186# CONFIG_MOXA_SMARTIO is not set
1187# CONFIG_ISI is not set
1188# CONFIG_SYNCLINK is not set
1189# CONFIG_SYNCLINKMP is not set
1190# CONFIG_SYNCLINK_GT is not set
1191# CONFIG_N_HDLC is not set
1192# CONFIG_RISCOM8 is not set
1193# CONFIG_SPECIALIX is not set
1194# CONFIG_SX is not set
1195# CONFIG_RIO is not set
1196# CONFIG_STALDRV is not set
1197# CONFIG_NOZOMI is not set
934 1198
935# 1199#
936# Serial drivers 1200# Serial drivers
@@ -940,9 +1204,14 @@ CONFIG_SERIAL_8250_CONSOLE=y
940CONFIG_FIX_EARLYCON_MEM=y 1204CONFIG_FIX_EARLYCON_MEM=y
941CONFIG_SERIAL_8250_PCI=y 1205CONFIG_SERIAL_8250_PCI=y
942CONFIG_SERIAL_8250_PNP=y 1206CONFIG_SERIAL_8250_PNP=y
943CONFIG_SERIAL_8250_NR_UARTS=4 1207# CONFIG_SERIAL_8250_CS is not set
1208CONFIG_SERIAL_8250_NR_UARTS=32
944CONFIG_SERIAL_8250_RUNTIME_UARTS=4 1209CONFIG_SERIAL_8250_RUNTIME_UARTS=4
945# CONFIG_SERIAL_8250_EXTENDED is not set 1210CONFIG_SERIAL_8250_EXTENDED=y
1211CONFIG_SERIAL_8250_MANY_PORTS=y
1212CONFIG_SERIAL_8250_SHARE_IRQ=y
1213CONFIG_SERIAL_8250_DETECT_IRQ=y
1214CONFIG_SERIAL_8250_RSA=y
946 1215
947# 1216#
948# Non-8250 serial port support 1217# Non-8250 serial port support
@@ -951,89 +1220,275 @@ CONFIG_SERIAL_CORE=y
951CONFIG_SERIAL_CORE_CONSOLE=y 1220CONFIG_SERIAL_CORE_CONSOLE=y
952# CONFIG_SERIAL_JSM is not set 1221# CONFIG_SERIAL_JSM is not set
953CONFIG_UNIX98_PTYS=y 1222CONFIG_UNIX98_PTYS=y
954CONFIG_LEGACY_PTYS=y 1223# CONFIG_LEGACY_PTYS is not set
955CONFIG_LEGACY_PTY_COUNT=256
956# CONFIG_IPMI_HANDLER is not set 1224# CONFIG_IPMI_HANDLER is not set
957# CONFIG_WATCHDOG is not set
958CONFIG_HW_RANDOM=y 1225CONFIG_HW_RANDOM=y
959CONFIG_HW_RANDOM_INTEL=y 1226# CONFIG_HW_RANDOM_INTEL is not set
960CONFIG_HW_RANDOM_AMD=y 1227# CONFIG_HW_RANDOM_AMD is not set
961CONFIG_HW_RANDOM_GEODE=y 1228CONFIG_HW_RANDOM_GEODE=y
962CONFIG_HW_RANDOM_VIA=y 1229CONFIG_HW_RANDOM_VIA=y
963# CONFIG_NVRAM is not set 1230CONFIG_NVRAM=y
964CONFIG_RTC=y
965# CONFIG_R3964 is not set 1231# CONFIG_R3964 is not set
966# CONFIG_APPLICOM is not set 1232# CONFIG_APPLICOM is not set
967# CONFIG_SONYPI is not set 1233# CONFIG_SONYPI is not set
968CONFIG_AGP=y 1234
969# CONFIG_AGP_ALI is not set 1235#
970# CONFIG_AGP_ATI is not set 1236# PCMCIA character devices
971# CONFIG_AGP_AMD is not set 1237#
972CONFIG_AGP_AMD64=y 1238# CONFIG_SYNCLINK_CS is not set
973CONFIG_AGP_INTEL=y 1239# CONFIG_CARDMAN_4000 is not set
974# CONFIG_AGP_NVIDIA is not set 1240# CONFIG_CARDMAN_4040 is not set
975# CONFIG_AGP_SIS is not set 1241# CONFIG_IPWIRELESS is not set
976# CONFIG_AGP_SWORKS is not set
977# CONFIG_AGP_VIA is not set
978# CONFIG_AGP_EFFICEON is not set
979# CONFIG_DRM is not set
980# CONFIG_MWAVE is not set 1242# CONFIG_MWAVE is not set
981# CONFIG_PC8736x_GPIO is not set 1243# CONFIG_PC8736x_GPIO is not set
982# CONFIG_NSC_GPIO is not set 1244# CONFIG_NSC_GPIO is not set
983# CONFIG_CS5535_GPIO is not set 1245# CONFIG_CS5535_GPIO is not set
984CONFIG_RAW_DRIVER=y 1246# CONFIG_RAW_DRIVER is not set
985CONFIG_MAX_RAW_DEVS=256
986CONFIG_HPET=y 1247CONFIG_HPET=y
987# CONFIG_HPET_RTC_IRQ is not set 1248# CONFIG_HPET_RTC_IRQ is not set
988CONFIG_HPET_MMAP=y 1249# CONFIG_HPET_MMAP is not set
989# CONFIG_HANGCHECK_TIMER is not set 1250# CONFIG_HANGCHECK_TIMER is not set
990# CONFIG_TCG_TPM is not set 1251# CONFIG_TCG_TPM is not set
991# CONFIG_TELCLOCK is not set 1252# CONFIG_TELCLOCK is not set
992CONFIG_DEVPORT=y 1253CONFIG_DEVPORT=y
993# CONFIG_I2C is not set 1254CONFIG_I2C=y
994 1255CONFIG_I2C_BOARDINFO=y
995# 1256# CONFIG_I2C_CHARDEV is not set
996# SPI support 1257
997# 1258#
1259# I2C Hardware Bus support
1260#
1261# CONFIG_I2C_ALI1535 is not set
1262# CONFIG_I2C_ALI1563 is not set
1263# CONFIG_I2C_ALI15X3 is not set
1264# CONFIG_I2C_AMD756 is not set
1265# CONFIG_I2C_AMD8111 is not set
1266CONFIG_I2C_I801=y
1267# CONFIG_I2C_I810 is not set
1268# CONFIG_I2C_PIIX4 is not set
1269# CONFIG_I2C_NFORCE2 is not set
1270# CONFIG_I2C_OCORES is not set
1271# CONFIG_I2C_PARPORT_LIGHT is not set
1272# CONFIG_I2C_PROSAVAGE is not set
1273# CONFIG_I2C_SAVAGE4 is not set
1274# CONFIG_I2C_SIMTEC is not set
1275# CONFIG_SCx200_ACB is not set
1276# CONFIG_I2C_SIS5595 is not set
1277# CONFIG_I2C_SIS630 is not set
1278# CONFIG_I2C_SIS96X is not set
1279# CONFIG_I2C_TAOS_EVM is not set
1280# CONFIG_I2C_STUB is not set
1281# CONFIG_I2C_TINY_USB is not set
1282# CONFIG_I2C_VIA is not set
1283# CONFIG_I2C_VIAPRO is not set
1284# CONFIG_I2C_VOODOO3 is not set
1285# CONFIG_I2C_PCA_PLATFORM is not set
1286
1287#
1288# Miscellaneous I2C Chip support
1289#
1290# CONFIG_DS1682 is not set
1291# CONFIG_SENSORS_EEPROM is not set
1292# CONFIG_SENSORS_PCF8574 is not set
1293# CONFIG_PCF8575 is not set
1294# CONFIG_SENSORS_PCF8591 is not set
1295# CONFIG_SENSORS_MAX6875 is not set
1296# CONFIG_SENSORS_TSL2550 is not set
1297# CONFIG_I2C_DEBUG_CORE is not set
1298# CONFIG_I2C_DEBUG_ALGO is not set
1299# CONFIG_I2C_DEBUG_BUS is not set
1300# CONFIG_I2C_DEBUG_CHIP is not set
998# CONFIG_SPI is not set 1301# CONFIG_SPI is not set
999# CONFIG_SPI_MASTER is not set
1000# CONFIG_W1 is not set 1302# CONFIG_W1 is not set
1001# CONFIG_POWER_SUPPLY is not set 1303CONFIG_POWER_SUPPLY=y
1304# CONFIG_POWER_SUPPLY_DEBUG is not set
1305# CONFIG_PDA_POWER is not set
1306# CONFIG_BATTERY_DS2760 is not set
1002# CONFIG_HWMON is not set 1307# CONFIG_HWMON is not set
1308CONFIG_THERMAL=y
1309CONFIG_WATCHDOG=y
1310# CONFIG_WATCHDOG_NOWAYOUT is not set
1311
1312#
1313# Watchdog Device Drivers
1314#
1315# CONFIG_SOFT_WATCHDOG is not set
1316# CONFIG_ACQUIRE_WDT is not set
1317# CONFIG_ADVANTECH_WDT is not set
1318# CONFIG_ALIM1535_WDT is not set
1319# CONFIG_ALIM7101_WDT is not set
1320# CONFIG_SC520_WDT is not set
1321# CONFIG_EUROTECH_WDT is not set
1322# CONFIG_IB700_WDT is not set
1323# CONFIG_IBMASR is not set
1324# CONFIG_WAFER_WDT is not set
1325# CONFIG_I6300ESB_WDT is not set
1326# CONFIG_ITCO_WDT is not set
1327# CONFIG_IT8712F_WDT is not set
1328# CONFIG_HP_WATCHDOG is not set
1329# CONFIG_SC1200_WDT is not set
1330# CONFIG_PC87413_WDT is not set
1331# CONFIG_60XX_WDT is not set
1332# CONFIG_SBC8360_WDT is not set
1333# CONFIG_SBC7240_WDT is not set
1334# CONFIG_CPU5_WDT is not set
1335# CONFIG_SMSC37B787_WDT is not set
1336# CONFIG_W83627HF_WDT is not set
1337# CONFIG_W83697HF_WDT is not set
1338# CONFIG_W83877F_WDT is not set
1339# CONFIG_W83977F_WDT is not set
1340# CONFIG_MACHZ_WDT is not set
1341# CONFIG_SBC_EPX_C3_WATCHDOG is not set
1342
1343#
1344# PCI-based Watchdog Cards
1345#
1346# CONFIG_PCIPCWATCHDOG is not set
1347# CONFIG_WDTPCI is not set
1348
1349#
1350# USB-based Watchdog Cards
1351#
1352# CONFIG_USBPCWATCHDOG is not set
1353
1354#
1355# Sonics Silicon Backplane
1356#
1357CONFIG_SSB_POSSIBLE=y
1358# CONFIG_SSB is not set
1003 1359
1004# 1360#
1005# Multifunction device drivers 1361# Multifunction device drivers
1006# 1362#
1007# CONFIG_MFD_SM501 is not set 1363# CONFIG_MFD_SM501 is not set
1364# CONFIG_HTC_PASIC3 is not set
1008 1365
1009# 1366#
1010# Multimedia devices 1367# Multimedia devices
1011# 1368#
1369
1370#
1371# Multimedia core support
1372#
1012# CONFIG_VIDEO_DEV is not set 1373# CONFIG_VIDEO_DEV is not set
1013# CONFIG_DVB_CORE is not set 1374# CONFIG_DVB_CORE is not set
1375
1376#
1377# Multimedia drivers
1378#
1014CONFIG_DAB=y 1379CONFIG_DAB=y
1015# CONFIG_USB_DABUSB is not set 1380# CONFIG_USB_DABUSB is not set
1016 1381
1017# 1382#
1018# Graphics support 1383# Graphics support
1019# 1384#
1020# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1385CONFIG_AGP=y
1386# CONFIG_AGP_ALI is not set
1387# CONFIG_AGP_ATI is not set
1388# CONFIG_AGP_AMD is not set
1389CONFIG_AGP_AMD64=y
1390CONFIG_AGP_INTEL=y
1391# CONFIG_AGP_NVIDIA is not set
1392# CONFIG_AGP_SIS is not set
1393# CONFIG_AGP_SWORKS is not set
1394# CONFIG_AGP_VIA is not set
1395# CONFIG_AGP_EFFICEON is not set
1396CONFIG_DRM=y
1397# CONFIG_DRM_TDFX is not set
1398# CONFIG_DRM_R128 is not set
1399# CONFIG_DRM_RADEON is not set
1400# CONFIG_DRM_I810 is not set
1401# CONFIG_DRM_I830 is not set
1402CONFIG_DRM_I915=y
1403# CONFIG_DRM_MGA is not set
1404# CONFIG_DRM_SIS is not set
1405# CONFIG_DRM_VIA is not set
1406# CONFIG_DRM_SAVAGE is not set
1407# CONFIG_VGASTATE is not set
1408# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1409CONFIG_FB=y
1410# CONFIG_FIRMWARE_EDID is not set
1411# CONFIG_FB_DDC is not set
1412CONFIG_FB_CFB_FILLRECT=y
1413CONFIG_FB_CFB_COPYAREA=y
1414CONFIG_FB_CFB_IMAGEBLIT=y
1415# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1416# CONFIG_FB_SYS_FILLRECT is not set
1417# CONFIG_FB_SYS_COPYAREA is not set
1418# CONFIG_FB_SYS_IMAGEBLIT is not set
1419# CONFIG_FB_FOREIGN_ENDIAN is not set
1420# CONFIG_FB_SYS_FOPS is not set
1421CONFIG_FB_DEFERRED_IO=y
1422# CONFIG_FB_SVGALIB is not set
1423# CONFIG_FB_MACMODES is not set
1424# CONFIG_FB_BACKLIGHT is not set
1425CONFIG_FB_MODE_HELPERS=y
1426CONFIG_FB_TILEBLITTING=y
1427
1428#
1429# Frame buffer hardware drivers
1430#
1431# CONFIG_FB_CIRRUS is not set
1432# CONFIG_FB_PM2 is not set
1433# CONFIG_FB_CYBER2000 is not set
1434# CONFIG_FB_ARC is not set
1435# CONFIG_FB_ASILIANT is not set
1436# CONFIG_FB_IMSTT is not set
1437# CONFIG_FB_VGA16 is not set
1438# CONFIG_FB_UVESA is not set
1439# CONFIG_FB_VESA is not set
1440CONFIG_FB_EFI=y
1441# CONFIG_FB_IMAC is not set
1442# CONFIG_FB_N411 is not set
1443# CONFIG_FB_HGA is not set
1444# CONFIG_FB_S1D13XXX is not set
1445# CONFIG_FB_NVIDIA is not set
1446# CONFIG_FB_RIVA is not set
1447# CONFIG_FB_I810 is not set
1448# CONFIG_FB_LE80578 is not set
1449# CONFIG_FB_INTEL is not set
1450# CONFIG_FB_MATROX is not set
1451# CONFIG_FB_RADEON is not set
1452# CONFIG_FB_ATY128 is not set
1453# CONFIG_FB_ATY is not set
1454# CONFIG_FB_S3 is not set
1455# CONFIG_FB_SAVAGE is not set
1456# CONFIG_FB_SIS is not set
1457# CONFIG_FB_NEOMAGIC is not set
1458# CONFIG_FB_KYRO is not set
1459# CONFIG_FB_3DFX is not set
1460# CONFIG_FB_VOODOO1 is not set
1461# CONFIG_FB_VT8623 is not set
1462# CONFIG_FB_CYBLA is not set
1463# CONFIG_FB_TRIDENT is not set
1464# CONFIG_FB_ARK is not set
1465# CONFIG_FB_PM3 is not set
1466# CONFIG_FB_GEODE is not set
1467# CONFIG_FB_VIRTUAL is not set
1468CONFIG_BACKLIGHT_LCD_SUPPORT=y
1469# CONFIG_LCD_CLASS_DEVICE is not set
1470CONFIG_BACKLIGHT_CLASS_DEVICE=y
1471# CONFIG_BACKLIGHT_CORGI is not set
1472# CONFIG_BACKLIGHT_PROGEAR is not set
1021 1473
1022# 1474#
1023# Display device support 1475# Display device support
1024# 1476#
1025# CONFIG_DISPLAY_SUPPORT is not set 1477# CONFIG_DISPLAY_SUPPORT is not set
1026# CONFIG_VGASTATE is not set
1027# CONFIG_FB is not set
1028 1478
1029# 1479#
1030# Console display driver support 1480# Console display driver support
1031# 1481#
1032CONFIG_VGA_CONSOLE=y 1482CONFIG_VGA_CONSOLE=y
1033CONFIG_VGACON_SOFT_SCROLLBACK=y 1483CONFIG_VGACON_SOFT_SCROLLBACK=y
1034CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=128 1484CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
1035CONFIG_VIDEO_SELECT=y 1485CONFIG_VIDEO_SELECT=y
1036CONFIG_DUMMY_CONSOLE=y 1486CONFIG_DUMMY_CONSOLE=y
1487# CONFIG_FRAMEBUFFER_CONSOLE is not set
1488CONFIG_LOGO=y
1489# CONFIG_LOGO_LINUX_MONO is not set
1490# CONFIG_LOGO_LINUX_VGA16 is not set
1491CONFIG_LOGO_LINUX_CLUT224=y
1037 1492
1038# 1493#
1039# Sound 1494# Sound
@@ -1043,33 +1498,167 @@ CONFIG_SOUND=y
1043# 1498#
1044# Advanced Linux Sound Architecture 1499# Advanced Linux Sound Architecture
1045# 1500#
1046# CONFIG_SND is not set 1501CONFIG_SND=y
1502CONFIG_SND_TIMER=y
1503CONFIG_SND_PCM=y
1504CONFIG_SND_HWDEP=y
1505CONFIG_SND_SEQUENCER=y
1506CONFIG_SND_SEQ_DUMMY=y
1507CONFIG_SND_OSSEMUL=y
1508CONFIG_SND_MIXER_OSS=y
1509CONFIG_SND_PCM_OSS=y
1510CONFIG_SND_PCM_OSS_PLUGINS=y
1511CONFIG_SND_SEQUENCER_OSS=y
1512CONFIG_SND_DYNAMIC_MINORS=y
1513CONFIG_SND_SUPPORT_OLD_API=y
1514CONFIG_SND_VERBOSE_PROCFS=y
1515# CONFIG_SND_VERBOSE_PRINTK is not set
1516# CONFIG_SND_DEBUG is not set
1517CONFIG_SND_VMASTER=y
1518
1519#
1520# Generic devices
1521#
1522# CONFIG_SND_PCSP is not set
1523# CONFIG_SND_DUMMY is not set
1524# CONFIG_SND_VIRMIDI is not set
1525# CONFIG_SND_MTPAV is not set
1526# CONFIG_SND_SERIAL_U16550 is not set
1527# CONFIG_SND_MPU401 is not set
1528
1529#
1530# PCI devices
1531#
1532# CONFIG_SND_AD1889 is not set
1533# CONFIG_SND_ALS300 is not set
1534# CONFIG_SND_ALS4000 is not set
1535# CONFIG_SND_ALI5451 is not set
1536# CONFIG_SND_ATIIXP is not set
1537# CONFIG_SND_ATIIXP_MODEM is not set
1538# CONFIG_SND_AU8810 is not set
1539# CONFIG_SND_AU8820 is not set
1540# CONFIG_SND_AU8830 is not set
1541# CONFIG_SND_AW2 is not set
1542# CONFIG_SND_AZT3328 is not set
1543# CONFIG_SND_BT87X is not set
1544# CONFIG_SND_CA0106 is not set
1545# CONFIG_SND_CMIPCI is not set
1546# CONFIG_SND_OXYGEN is not set
1547# CONFIG_SND_CS4281 is not set
1548# CONFIG_SND_CS46XX is not set
1549# CONFIG_SND_CS5530 is not set
1550# CONFIG_SND_CS5535AUDIO is not set
1551# CONFIG_SND_DARLA20 is not set
1552# CONFIG_SND_GINA20 is not set
1553# CONFIG_SND_LAYLA20 is not set
1554# CONFIG_SND_DARLA24 is not set
1555# CONFIG_SND_GINA24 is not set
1556# CONFIG_SND_LAYLA24 is not set
1557# CONFIG_SND_MONA is not set
1558# CONFIG_SND_MIA is not set
1559# CONFIG_SND_ECHO3G is not set
1560# CONFIG_SND_INDIGO is not set
1561# CONFIG_SND_INDIGOIO is not set
1562# CONFIG_SND_INDIGODJ is not set
1563# CONFIG_SND_EMU10K1 is not set
1564# CONFIG_SND_EMU10K1X is not set
1565# CONFIG_SND_ENS1370 is not set
1566# CONFIG_SND_ENS1371 is not set
1567# CONFIG_SND_ES1938 is not set
1568# CONFIG_SND_ES1968 is not set
1569# CONFIG_SND_FM801 is not set
1570CONFIG_SND_HDA_INTEL=y
1571CONFIG_SND_HDA_HWDEP=y
1572CONFIG_SND_HDA_CODEC_REALTEK=y
1573CONFIG_SND_HDA_CODEC_ANALOG=y
1574CONFIG_SND_HDA_CODEC_SIGMATEL=y
1575CONFIG_SND_HDA_CODEC_VIA=y
1576CONFIG_SND_HDA_CODEC_ATIHDMI=y
1577CONFIG_SND_HDA_CODEC_CONEXANT=y
1578CONFIG_SND_HDA_CODEC_CMEDIA=y
1579CONFIG_SND_HDA_CODEC_SI3054=y
1580CONFIG_SND_HDA_GENERIC=y
1581# CONFIG_SND_HDA_POWER_SAVE is not set
1582# CONFIG_SND_HDSP is not set
1583# CONFIG_SND_HDSPM is not set
1584# CONFIG_SND_HIFIER is not set
1585# CONFIG_SND_ICE1712 is not set
1586# CONFIG_SND_ICE1724 is not set
1587# CONFIG_SND_INTEL8X0 is not set
1588# CONFIG_SND_INTEL8X0M is not set
1589# CONFIG_SND_KORG1212 is not set
1590# CONFIG_SND_MAESTRO3 is not set
1591# CONFIG_SND_MIXART is not set
1592# CONFIG_SND_NM256 is not set
1593# CONFIG_SND_PCXHR is not set
1594# CONFIG_SND_RIPTIDE is not set
1595# CONFIG_SND_RME32 is not set
1596# CONFIG_SND_RME96 is not set
1597# CONFIG_SND_RME9652 is not set
1598# CONFIG_SND_SIS7019 is not set
1599# CONFIG_SND_SONICVIBES is not set
1600# CONFIG_SND_TRIDENT is not set
1601# CONFIG_SND_VIA82XX is not set
1602# CONFIG_SND_VIA82XX_MODEM is not set
1603# CONFIG_SND_VIRTUOSO is not set
1604# CONFIG_SND_VX222 is not set
1605# CONFIG_SND_YMFPCI is not set
1606
1607#
1608# USB devices
1609#
1610# CONFIG_SND_USB_AUDIO is not set
1611# CONFIG_SND_USB_USX2Y is not set
1612# CONFIG_SND_USB_CAIAQ is not set
1613
1614#
1615# PCMCIA devices
1616#
1617# CONFIG_SND_VXPOCKET is not set
1618# CONFIG_SND_PDAUDIOCF is not set
1619
1620#
1621# System on Chip audio support
1622#
1623# CONFIG_SND_SOC is not set
1624
1625#
1626# ALSA SoC audio for Freescale SOCs
1627#
1628
1629#
1630# SoC Audio for the Texas Instruments OMAP
1631#
1047 1632
1048# 1633#
1049# Open Sound System 1634# Open Sound System
1050# 1635#
1051CONFIG_SOUND_PRIME=y 1636# CONFIG_SOUND_PRIME is not set
1052# CONFIG_SOUND_TRIDENT is not set
1053# CONFIG_SOUND_MSNDCLAS is not set
1054# CONFIG_SOUND_MSNDPIN is not set
1055# CONFIG_SOUND_OSS is not set
1056CONFIG_HID_SUPPORT=y 1637CONFIG_HID_SUPPORT=y
1057CONFIG_HID=y 1638CONFIG_HID=y
1058# CONFIG_HID_DEBUG is not set 1639CONFIG_HID_DEBUG=y
1640CONFIG_HIDRAW=y
1059 1641
1060# 1642#
1061# USB Input Devices 1643# USB Input Devices
1062# 1644#
1063CONFIG_USB_HID=y 1645CONFIG_USB_HID=y
1064# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1646CONFIG_USB_HIDINPUT_POWERBOOK=y
1065# CONFIG_HID_FF is not set 1647CONFIG_HID_FF=y
1066# CONFIG_USB_HIDDEV is not set 1648CONFIG_HID_PID=y
1649CONFIG_LOGITECH_FF=y
1650# CONFIG_LOGIRUMBLEPAD2_FF is not set
1651CONFIG_PANTHERLORD_FF=y
1652CONFIG_THRUSTMASTER_FF=y
1653CONFIG_ZEROPLUS_FF=y
1654CONFIG_USB_HIDDEV=y
1067CONFIG_USB_SUPPORT=y 1655CONFIG_USB_SUPPORT=y
1068CONFIG_USB_ARCH_HAS_HCD=y 1656CONFIG_USB_ARCH_HAS_HCD=y
1069CONFIG_USB_ARCH_HAS_OHCI=y 1657CONFIG_USB_ARCH_HAS_OHCI=y
1070CONFIG_USB_ARCH_HAS_EHCI=y 1658CONFIG_USB_ARCH_HAS_EHCI=y
1071CONFIG_USB=y 1659CONFIG_USB=y
1072# CONFIG_USB_DEBUG is not set 1660CONFIG_USB_DEBUG=y
1661CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
1073 1662
1074# 1663#
1075# Miscellaneous USB options 1664# Miscellaneous USB options
@@ -1077,18 +1666,18 @@ CONFIG_USB=y
1077CONFIG_USB_DEVICEFS=y 1666CONFIG_USB_DEVICEFS=y
1078# CONFIG_USB_DEVICE_CLASS is not set 1667# CONFIG_USB_DEVICE_CLASS is not set
1079# CONFIG_USB_DYNAMIC_MINORS is not set 1668# CONFIG_USB_DYNAMIC_MINORS is not set
1080# CONFIG_USB_SUSPEND is not set 1669CONFIG_USB_SUSPEND=y
1081# CONFIG_USB_PERSIST is not set
1082# CONFIG_USB_OTG is not set 1670# CONFIG_USB_OTG is not set
1083 1671
1084# 1672#
1085# USB Host Controller Drivers 1673# USB Host Controller Drivers
1086# 1674#
1675# CONFIG_USB_C67X00_HCD is not set
1087CONFIG_USB_EHCI_HCD=y 1676CONFIG_USB_EHCI_HCD=y
1088# CONFIG_USB_EHCI_SPLIT_ISO is not set
1089# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1677# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1090# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1678# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1091# CONFIG_USB_ISP116X_HCD is not set 1679# CONFIG_USB_ISP116X_HCD is not set
1680# CONFIG_USB_ISP1760_HCD is not set
1092CONFIG_USB_OHCI_HCD=y 1681CONFIG_USB_OHCI_HCD=y
1093# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1682# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1094# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1683# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1121,8 +1710,10 @@ CONFIG_USB_STORAGE=y
1121# CONFIG_USB_STORAGE_SDDR55 is not set 1710# CONFIG_USB_STORAGE_SDDR55 is not set
1122# CONFIG_USB_STORAGE_JUMPSHOT is not set 1711# CONFIG_USB_STORAGE_JUMPSHOT is not set
1123# CONFIG_USB_STORAGE_ALAUDA is not set 1712# CONFIG_USB_STORAGE_ALAUDA is not set
1713# CONFIG_USB_STORAGE_ONETOUCH is not set
1124# CONFIG_USB_STORAGE_KARMA is not set 1714# CONFIG_USB_STORAGE_KARMA is not set
1125# CONFIG_USB_LIBUSUAL is not set 1715# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1716CONFIG_USB_LIBUSUAL=y
1126 1717
1127# 1718#
1128# USB Imaging devices 1719# USB Imaging devices
@@ -1134,10 +1725,6 @@ CONFIG_USB_MON=y
1134# 1725#
1135# USB port drivers 1726# USB port drivers
1136# 1727#
1137
1138#
1139# USB Serial Converter support
1140#
1141# CONFIG_USB_SERIAL is not set 1728# CONFIG_USB_SERIAL is not set
1142 1729
1143# 1730#
@@ -1163,90 +1750,125 @@ CONFIG_USB_MON=y
1163# CONFIG_USB_TRANCEVIBRATOR is not set 1750# CONFIG_USB_TRANCEVIBRATOR is not set
1164# CONFIG_USB_IOWARRIOR is not set 1751# CONFIG_USB_IOWARRIOR is not set
1165# CONFIG_USB_TEST is not set 1752# CONFIG_USB_TEST is not set
1753# CONFIG_USB_GADGET is not set
1754# CONFIG_MMC is not set
1755# CONFIG_MEMSTICK is not set
1756CONFIG_NEW_LEDS=y
1757CONFIG_LEDS_CLASS=y
1166 1758
1167# 1759#
1168# USB DSL modem support 1760# LED drivers
1169# 1761#
1762# CONFIG_LEDS_CLEVO_MAIL is not set
1170 1763
1171# 1764#
1172# USB Gadget Support 1765# LED Triggers
1173# 1766#
1174# CONFIG_USB_GADGET is not set 1767CONFIG_LEDS_TRIGGERS=y
1175# CONFIG_MMC is not set 1768# CONFIG_LEDS_TRIGGER_TIMER is not set
1769# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
1770# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
1771# CONFIG_ACCESSIBILITY is not set
1772# CONFIG_INFINIBAND is not set
1773CONFIG_EDAC=y
1176 1774
1177# 1775#
1178# LED devices 1776# Reporting subsystems
1179# 1777#
1180# CONFIG_NEW_LEDS is not set 1778# CONFIG_EDAC_DEBUG is not set
1779# CONFIG_EDAC_MM_EDAC is not set
1780CONFIG_RTC_LIB=y
1781CONFIG_RTC_CLASS=y
1782# CONFIG_RTC_HCTOSYS is not set
1783# CONFIG_RTC_DEBUG is not set
1181 1784
1182# 1785#
1183# LED drivers 1786# RTC interfaces
1184# 1787#
1788CONFIG_RTC_INTF_SYSFS=y
1789CONFIG_RTC_INTF_PROC=y
1790CONFIG_RTC_INTF_DEV=y
1791# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1792# CONFIG_RTC_DRV_TEST is not set
1185 1793
1186# 1794#
1187# LED Triggers 1795# I2C RTC drivers
1188# 1796#
1189# CONFIG_INFINIBAND is not set 1797# CONFIG_RTC_DRV_DS1307 is not set
1190# CONFIG_EDAC is not set 1798# CONFIG_RTC_DRV_DS1374 is not set
1799# CONFIG_RTC_DRV_DS1672 is not set
1800# CONFIG_RTC_DRV_MAX6900 is not set
1801# CONFIG_RTC_DRV_RS5C372 is not set
1802# CONFIG_RTC_DRV_ISL1208 is not set
1803# CONFIG_RTC_DRV_X1205 is not set
1804# CONFIG_RTC_DRV_PCF8563 is not set
1805# CONFIG_RTC_DRV_PCF8583 is not set
1806# CONFIG_RTC_DRV_M41T80 is not set
1807# CONFIG_RTC_DRV_S35390A is not set
1191 1808
1192# 1809#
1193# Real Time Clock 1810# SPI RTC drivers
1194# 1811#
1195# CONFIG_RTC_CLASS is not set
1196 1812
1197# 1813#
1198# DMA Engine support 1814# Platform RTC drivers
1199# 1815#
1200# CONFIG_DMA_ENGINE is not set 1816CONFIG_RTC_DRV_CMOS=y
1817# CONFIG_RTC_DRV_DS1511 is not set
1818# CONFIG_RTC_DRV_DS1553 is not set
1819# CONFIG_RTC_DRV_DS1742 is not set
1820# CONFIG_RTC_DRV_STK17TA8 is not set
1821# CONFIG_RTC_DRV_M48T86 is not set
1822# CONFIG_RTC_DRV_M48T59 is not set
1823# CONFIG_RTC_DRV_V3020 is not set
1201 1824
1202# 1825#
1203# DMA Clients 1826# on-CPU RTC drivers
1204# 1827#
1828CONFIG_DMADEVICES=y
1205 1829
1206# 1830#
1207# DMA Devices 1831# DMA Devices
1208# 1832#
1209CONFIG_VIRTUALIZATION=y 1833# CONFIG_INTEL_IOATDMA is not set
1210# CONFIG_KVM is not set 1834# CONFIG_UIO is not set
1211 1835
1212# 1836#
1213# Userspace I/O 1837# Firmware Drivers
1214# 1838#
1215# CONFIG_UIO is not set 1839# CONFIG_EDD is not set
1840CONFIG_EFI_VARS=y
1841# CONFIG_DELL_RBU is not set
1842# CONFIG_DCDBAS is not set
1843CONFIG_DMIID=y
1844# CONFIG_ISCSI_IBFT_FIND is not set
1216 1845
1217# 1846#
1218# File systems 1847# File systems
1219# 1848#
1220CONFIG_EXT2_FS=y 1849# CONFIG_EXT2_FS is not set
1221CONFIG_EXT2_FS_XATTR=y
1222CONFIG_EXT2_FS_POSIX_ACL=y
1223# CONFIG_EXT2_FS_SECURITY is not set
1224# CONFIG_EXT2_FS_XIP is not set
1225CONFIG_EXT3_FS=y 1850CONFIG_EXT3_FS=y
1226CONFIG_EXT3_FS_XATTR=y 1851CONFIG_EXT3_FS_XATTR=y
1227CONFIG_EXT3_FS_POSIX_ACL=y 1852CONFIG_EXT3_FS_POSIX_ACL=y
1228# CONFIG_EXT3_FS_SECURITY is not set 1853CONFIG_EXT3_FS_SECURITY=y
1229# CONFIG_EXT4DEV_FS is not set 1854# CONFIG_EXT4DEV_FS is not set
1230CONFIG_JBD=y 1855CONFIG_JBD=y
1231# CONFIG_JBD_DEBUG is not set 1856# CONFIG_JBD_DEBUG is not set
1232CONFIG_FS_MBCACHE=y 1857CONFIG_FS_MBCACHE=y
1233CONFIG_REISERFS_FS=y 1858# CONFIG_REISERFS_FS is not set
1234# CONFIG_REISERFS_CHECK is not set
1235# CONFIG_REISERFS_PROC_INFO is not set
1236CONFIG_REISERFS_FS_XATTR=y
1237CONFIG_REISERFS_FS_POSIX_ACL=y
1238# CONFIG_REISERFS_FS_SECURITY is not set
1239# CONFIG_JFS_FS is not set 1859# CONFIG_JFS_FS is not set
1240CONFIG_FS_POSIX_ACL=y 1860CONFIG_FS_POSIX_ACL=y
1241# CONFIG_XFS_FS is not set 1861# CONFIG_XFS_FS is not set
1242# CONFIG_GFS2_FS is not set
1243# CONFIG_OCFS2_FS is not set 1862# CONFIG_OCFS2_FS is not set
1244# CONFIG_MINIX_FS is not set 1863CONFIG_DNOTIFY=y
1245# CONFIG_ROMFS_FS is not set
1246CONFIG_INOTIFY=y 1864CONFIG_INOTIFY=y
1247CONFIG_INOTIFY_USER=y 1865CONFIG_INOTIFY_USER=y
1248# CONFIG_QUOTA is not set 1866CONFIG_QUOTA=y
1249CONFIG_DNOTIFY=y 1867CONFIG_QUOTA_NETLINK_INTERFACE=y
1868# CONFIG_PRINT_QUOTA_WARNING is not set
1869# CONFIG_QFMT_V1 is not set
1870CONFIG_QFMT_V2=y
1871CONFIG_QUOTACTL=y
1250# CONFIG_AUTOFS_FS is not set 1872# CONFIG_AUTOFS_FS is not set
1251CONFIG_AUTOFS4_FS=y 1873CONFIG_AUTOFS4_FS=y
1252# CONFIG_FUSE_FS is not set 1874# CONFIG_FUSE_FS is not set
@@ -1256,8 +1878,8 @@ CONFIG_GENERIC_ACL=y
1256# CD-ROM/DVD Filesystems 1878# CD-ROM/DVD Filesystems
1257# 1879#
1258CONFIG_ISO9660_FS=y 1880CONFIG_ISO9660_FS=y
1259# CONFIG_JOLIET is not set 1881CONFIG_JOLIET=y
1260# CONFIG_ZISOFS is not set 1882CONFIG_ZISOFS=y
1261# CONFIG_UDF_FS is not set 1883# CONFIG_UDF_FS is not set
1262 1884
1263# 1885#
@@ -1275,13 +1897,13 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1275# 1897#
1276CONFIG_PROC_FS=y 1898CONFIG_PROC_FS=y
1277CONFIG_PROC_KCORE=y 1899CONFIG_PROC_KCORE=y
1900CONFIG_PROC_VMCORE=y
1278CONFIG_PROC_SYSCTL=y 1901CONFIG_PROC_SYSCTL=y
1279CONFIG_SYSFS=y 1902CONFIG_SYSFS=y
1280CONFIG_TMPFS=y 1903CONFIG_TMPFS=y
1281CONFIG_TMPFS_POSIX_ACL=y 1904CONFIG_TMPFS_POSIX_ACL=y
1282CONFIG_HUGETLBFS=y 1905CONFIG_HUGETLBFS=y
1283CONFIG_HUGETLB_PAGE=y 1906CONFIG_HUGETLB_PAGE=y
1284CONFIG_RAMFS=y
1285# CONFIG_CONFIGFS_FS is not set 1907# CONFIG_CONFIGFS_FS is not set
1286 1908
1287# 1909#
@@ -1289,6 +1911,7 @@ CONFIG_RAMFS=y
1289# 1911#
1290# CONFIG_ADFS_FS is not set 1912# CONFIG_ADFS_FS is not set
1291# CONFIG_AFFS_FS is not set 1913# CONFIG_AFFS_FS is not set
1914# CONFIG_ECRYPT_FS is not set
1292# CONFIG_HFS_FS is not set 1915# CONFIG_HFS_FS is not set
1293# CONFIG_HFSPLUS_FS is not set 1916# CONFIG_HFSPLUS_FS is not set
1294# CONFIG_BEFS_FS is not set 1917# CONFIG_BEFS_FS is not set
@@ -1296,33 +1919,15 @@ CONFIG_RAMFS=y
1296# CONFIG_EFS_FS is not set 1919# CONFIG_EFS_FS is not set
1297# CONFIG_CRAMFS is not set 1920# CONFIG_CRAMFS is not set
1298# CONFIG_VXFS_FS is not set 1921# CONFIG_VXFS_FS is not set
1922# CONFIG_MINIX_FS is not set
1299# CONFIG_HPFS_FS is not set 1923# CONFIG_HPFS_FS is not set
1300# CONFIG_QNX4FS_FS is not set 1924# CONFIG_QNX4FS_FS is not set
1925# CONFIG_ROMFS_FS is not set
1301# CONFIG_SYSV_FS is not set 1926# CONFIG_SYSV_FS is not set
1302# CONFIG_UFS_FS is not set 1927# CONFIG_UFS_FS is not set
1303 1928CONFIG_NETWORK_FILESYSTEMS=y
1304# 1929# CONFIG_NFS_FS is not set
1305# Network File Systems 1930# CONFIG_NFSD is not set
1306#
1307CONFIG_NFS_FS=y
1308CONFIG_NFS_V3=y
1309# CONFIG_NFS_V3_ACL is not set
1310# CONFIG_NFS_V4 is not set
1311# CONFIG_NFS_DIRECTIO is not set
1312CONFIG_NFSD=y
1313CONFIG_NFSD_V3=y
1314# CONFIG_NFSD_V3_ACL is not set
1315# CONFIG_NFSD_V4 is not set
1316CONFIG_NFSD_TCP=y
1317CONFIG_ROOT_NFS=y
1318CONFIG_LOCKD=y
1319CONFIG_LOCKD_V4=y
1320CONFIG_EXPORTFS=y
1321CONFIG_NFS_COMMON=y
1322CONFIG_SUNRPC=y
1323# CONFIG_SUNRPC_BIND34 is not set
1324# CONFIG_RPCSEC_GSS_KRB5 is not set
1325# CONFIG_RPCSEC_GSS_SPKM3 is not set
1326# CONFIG_SMB_FS is not set 1931# CONFIG_SMB_FS is not set
1327# CONFIG_CIFS is not set 1932# CONFIG_CIFS is not set
1328# CONFIG_NCP_FS is not set 1933# CONFIG_NCP_FS is not set
@@ -1332,14 +1937,26 @@ CONFIG_SUNRPC=y
1332# 1937#
1333# Partition Types 1938# Partition Types
1334# 1939#
1335# CONFIG_PARTITION_ADVANCED is not set 1940CONFIG_PARTITION_ADVANCED=y
1941# CONFIG_ACORN_PARTITION is not set
1942CONFIG_OSF_PARTITION=y
1943CONFIG_AMIGA_PARTITION=y
1944# CONFIG_ATARI_PARTITION is not set
1945CONFIG_MAC_PARTITION=y
1336CONFIG_MSDOS_PARTITION=y 1946CONFIG_MSDOS_PARTITION=y
1337 1947CONFIG_BSD_DISKLABEL=y
1338# 1948CONFIG_MINIX_SUBPARTITION=y
1339# Native Language Support 1949CONFIG_SOLARIS_X86_PARTITION=y
1340# 1950CONFIG_UNIXWARE_DISKLABEL=y
1951# CONFIG_LDM_PARTITION is not set
1952CONFIG_SGI_PARTITION=y
1953# CONFIG_ULTRIX_PARTITION is not set
1954CONFIG_SUN_PARTITION=y
1955CONFIG_KARMA_PARTITION=y
1956CONFIG_EFI_PARTITION=y
1957# CONFIG_SYSV68_PARTITION is not set
1341CONFIG_NLS=y 1958CONFIG_NLS=y
1342CONFIG_NLS_DEFAULT="iso8859-1" 1959CONFIG_NLS_DEFAULT="utf8"
1343CONFIG_NLS_CODEPAGE_437=y 1960CONFIG_NLS_CODEPAGE_437=y
1344# CONFIG_NLS_CODEPAGE_737 is not set 1961# CONFIG_NLS_CODEPAGE_737 is not set
1345# CONFIG_NLS_CODEPAGE_775 is not set 1962# CONFIG_NLS_CODEPAGE_775 is not set
@@ -1374,37 +1991,33 @@ CONFIG_NLS_ISO8859_1=y
1374# CONFIG_NLS_ISO8859_9 is not set 1991# CONFIG_NLS_ISO8859_9 is not set
1375# CONFIG_NLS_ISO8859_13 is not set 1992# CONFIG_NLS_ISO8859_13 is not set
1376# CONFIG_NLS_ISO8859_14 is not set 1993# CONFIG_NLS_ISO8859_14 is not set
1377CONFIG_NLS_ISO8859_15=y 1994# CONFIG_NLS_ISO8859_15 is not set
1378# CONFIG_NLS_KOI8_R is not set 1995# CONFIG_NLS_KOI8_R is not set
1379# CONFIG_NLS_KOI8_U is not set 1996# CONFIG_NLS_KOI8_U is not set
1380CONFIG_NLS_UTF8=y 1997CONFIG_NLS_UTF8=y
1381
1382#
1383# Distributed Lock Manager
1384#
1385# CONFIG_DLM is not set 1998# CONFIG_DLM is not set
1386CONFIG_INSTRUMENTATION=y
1387CONFIG_PROFILING=y
1388CONFIG_OPROFILE=y
1389CONFIG_KPROBES=y
1390 1999
1391# 2000#
1392# Kernel hacking 2001# Kernel hacking
1393# 2002#
1394CONFIG_TRACE_IRQFLAGS_SUPPORT=y 2003CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1395# CONFIG_PRINTK_TIME is not set 2004# CONFIG_PRINTK_TIME is not set
2005# CONFIG_ENABLE_WARN_DEPRECATED is not set
1396# CONFIG_ENABLE_MUST_CHECK is not set 2006# CONFIG_ENABLE_MUST_CHECK is not set
2007CONFIG_FRAME_WARN=2048
1397CONFIG_MAGIC_SYSRQ=y 2008CONFIG_MAGIC_SYSRQ=y
1398CONFIG_UNUSED_SYMBOLS=y 2009# CONFIG_UNUSED_SYMBOLS is not set
1399# CONFIG_DEBUG_FS is not set 2010CONFIG_DEBUG_FS=y
1400# CONFIG_HEADERS_CHECK is not set 2011# CONFIG_HEADERS_CHECK is not set
1401CONFIG_DEBUG_KERNEL=y 2012CONFIG_DEBUG_KERNEL=y
1402# CONFIG_DEBUG_SHIRQ is not set 2013# CONFIG_DEBUG_SHIRQ is not set
1403CONFIG_DETECT_SOFTLOCKUP=y 2014# CONFIG_DETECT_SOFTLOCKUP is not set
1404# CONFIG_SCHED_DEBUG is not set 2015# CONFIG_SCHED_DEBUG is not set
1405# CONFIG_SCHEDSTATS is not set 2016CONFIG_SCHEDSTATS=y
1406CONFIG_TIMER_STATS=y 2017CONFIG_TIMER_STATS=y
2018# CONFIG_DEBUG_OBJECTS is not set
1407# CONFIG_SLUB_DEBUG_ON is not set 2019# CONFIG_SLUB_DEBUG_ON is not set
2020# CONFIG_SLUB_STATS is not set
1408# CONFIG_DEBUG_RT_MUTEXES is not set 2021# CONFIG_DEBUG_RT_MUTEXES is not set
1409# CONFIG_RT_MUTEX_TESTER is not set 2022# CONFIG_RT_MUTEX_TESTER is not set
1410# CONFIG_DEBUG_SPINLOCK is not set 2023# CONFIG_DEBUG_SPINLOCK is not set
@@ -1419,48 +2032,174 @@ CONFIG_TIMER_STATS=y
1419CONFIG_DEBUG_BUGVERBOSE=y 2032CONFIG_DEBUG_BUGVERBOSE=y
1420# CONFIG_DEBUG_INFO is not set 2033# CONFIG_DEBUG_INFO is not set
1421# CONFIG_DEBUG_VM is not set 2034# CONFIG_DEBUG_VM is not set
2035# CONFIG_DEBUG_WRITECOUNT is not set
1422# CONFIG_DEBUG_LIST is not set 2036# CONFIG_DEBUG_LIST is not set
1423# CONFIG_FRAME_POINTER is not set 2037# CONFIG_DEBUG_SG is not set
1424CONFIG_OPTIMIZE_INLINING=y 2038CONFIG_FRAME_POINTER=y
2039# CONFIG_BOOT_PRINTK_DELAY is not set
1425# CONFIG_RCU_TORTURE_TEST is not set 2040# CONFIG_RCU_TORTURE_TEST is not set
2041# CONFIG_KPROBES_SANITY_TEST is not set
2042# CONFIG_BACKTRACE_SELF_TEST is not set
1426# CONFIG_LKDTM is not set 2043# CONFIG_LKDTM is not set
1427# CONFIG_FAULT_INJECTION is not set 2044# CONFIG_FAULT_INJECTION is not set
2045# CONFIG_LATENCYTOP is not set
2046CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
2047# CONFIG_SAMPLES is not set
2048# CONFIG_KGDB is not set
2049CONFIG_HAVE_ARCH_KGDB=y
2050# CONFIG_NONPROMISC_DEVMEM is not set
1428CONFIG_EARLY_PRINTK=y 2051CONFIG_EARLY_PRINTK=y
1429CONFIG_DEBUG_STACKOVERFLOW=y 2052CONFIG_DEBUG_STACKOVERFLOW=y
1430# CONFIG_DEBUG_STACK_USAGE is not set 2053CONFIG_DEBUG_STACK_USAGE=y
1431# CONFIG_DEBUG_RODATA is not set 2054# CONFIG_DEBUG_PAGEALLOC is not set
2055# CONFIG_X86_PTDUMP is not set
2056CONFIG_DEBUG_RODATA=y
2057# CONFIG_DEBUG_RODATA_TEST is not set
2058CONFIG_DEBUG_NX_TEST=m
1432# CONFIG_4KSTACKS is not set 2059# CONFIG_4KSTACKS is not set
1433CONFIG_X86_FIND_SMP_CONFIG=y 2060CONFIG_X86_FIND_SMP_CONFIG=y
1434CONFIG_X86_MPPARSE=y 2061CONFIG_X86_MPPARSE=y
1435CONFIG_DOUBLEFAULT=y 2062CONFIG_DOUBLEFAULT=y
2063CONFIG_IO_DELAY_TYPE_0X80=0
2064CONFIG_IO_DELAY_TYPE_0XED=1
2065CONFIG_IO_DELAY_TYPE_UDELAY=2
2066CONFIG_IO_DELAY_TYPE_NONE=3
2067CONFIG_IO_DELAY_0X80=y
2068# CONFIG_IO_DELAY_0XED is not set
2069# CONFIG_IO_DELAY_UDELAY is not set
2070# CONFIG_IO_DELAY_NONE is not set
2071CONFIG_DEFAULT_IO_DELAY_TYPE=0
2072CONFIG_DEBUG_BOOT_PARAMS=y
2073# CONFIG_CPA_DEBUG is not set
1436 2074
1437# 2075#
1438# Security options 2076# Security options
1439# 2077#
1440# CONFIG_KEYS is not set 2078CONFIG_KEYS=y
1441# CONFIG_SECURITY is not set 2079CONFIG_KEYS_DEBUG_PROC_KEYS=y
1442# CONFIG_CRYPTO is not set 2080CONFIG_SECURITY=y
2081CONFIG_SECURITY_NETWORK=y
2082# CONFIG_SECURITY_NETWORK_XFRM is not set
2083CONFIG_SECURITY_CAPABILITIES=y
2084CONFIG_SECURITY_FILE_CAPABILITIES=y
2085# CONFIG_SECURITY_ROOTPLUG is not set
2086CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=65536
2087CONFIG_SECURITY_SELINUX=y
2088CONFIG_SECURITY_SELINUX_BOOTPARAM=y
2089CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
2090CONFIG_SECURITY_SELINUX_DISABLE=y
2091CONFIG_SECURITY_SELINUX_DEVELOP=y
2092CONFIG_SECURITY_SELINUX_AVC_STATS=y
2093CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
2094# CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT is not set
2095# CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX is not set
2096# CONFIG_SECURITY_SMACK is not set
2097CONFIG_CRYPTO=y
2098
2099#
2100# Crypto core or helper
2101#
2102CONFIG_CRYPTO_ALGAPI=y
2103CONFIG_CRYPTO_AEAD=y
2104CONFIG_CRYPTO_BLKCIPHER=y
2105CONFIG_CRYPTO_HASH=y
2106CONFIG_CRYPTO_MANAGER=y
2107# CONFIG_CRYPTO_GF128MUL is not set
2108# CONFIG_CRYPTO_NULL is not set
2109# CONFIG_CRYPTO_CRYPTD is not set
2110CONFIG_CRYPTO_AUTHENC=y
2111# CONFIG_CRYPTO_TEST is not set
2112
2113#
2114# Authenticated Encryption with Associated Data
2115#
2116# CONFIG_CRYPTO_CCM is not set
2117# CONFIG_CRYPTO_GCM is not set
2118# CONFIG_CRYPTO_SEQIV is not set
2119
2120#
2121# Block modes
2122#
2123CONFIG_CRYPTO_CBC=y
2124# CONFIG_CRYPTO_CTR is not set
2125# CONFIG_CRYPTO_CTS is not set
2126CONFIG_CRYPTO_ECB=y
2127# CONFIG_CRYPTO_LRW is not set
2128# CONFIG_CRYPTO_PCBC is not set
2129# CONFIG_CRYPTO_XTS is not set
2130
2131#
2132# Hash modes
2133#
2134CONFIG_CRYPTO_HMAC=y
2135# CONFIG_CRYPTO_XCBC is not set
2136
2137#
2138# Digest
2139#
2140# CONFIG_CRYPTO_CRC32C is not set
2141# CONFIG_CRYPTO_MD4 is not set
2142CONFIG_CRYPTO_MD5=y
2143# CONFIG_CRYPTO_MICHAEL_MIC is not set
2144CONFIG_CRYPTO_SHA1=y
2145# CONFIG_CRYPTO_SHA256 is not set
2146# CONFIG_CRYPTO_SHA512 is not set
2147# CONFIG_CRYPTO_TGR192 is not set
2148# CONFIG_CRYPTO_WP512 is not set
2149
2150#
2151# Ciphers
2152#
2153CONFIG_CRYPTO_AES=y
2154# CONFIG_CRYPTO_AES_586 is not set
2155# CONFIG_CRYPTO_ANUBIS is not set
2156CONFIG_CRYPTO_ARC4=y
2157# CONFIG_CRYPTO_BLOWFISH is not set
2158# CONFIG_CRYPTO_CAMELLIA is not set
2159# CONFIG_CRYPTO_CAST5 is not set
2160# CONFIG_CRYPTO_CAST6 is not set
2161CONFIG_CRYPTO_DES=y
2162# CONFIG_CRYPTO_FCRYPT is not set
2163# CONFIG_CRYPTO_KHAZAD is not set
2164# CONFIG_CRYPTO_SALSA20 is not set
2165# CONFIG_CRYPTO_SALSA20_586 is not set
2166# CONFIG_CRYPTO_SEED is not set
2167# CONFIG_CRYPTO_SERPENT is not set
2168# CONFIG_CRYPTO_TEA is not set
2169# CONFIG_CRYPTO_TWOFISH is not set
2170# CONFIG_CRYPTO_TWOFISH_586 is not set
2171
2172#
2173# Compression
2174#
2175# CONFIG_CRYPTO_DEFLATE is not set
2176# CONFIG_CRYPTO_LZO is not set
2177CONFIG_CRYPTO_HW=y
2178# CONFIG_CRYPTO_DEV_PADLOCK is not set
2179# CONFIG_CRYPTO_DEV_GEODE is not set
2180# CONFIG_CRYPTO_DEV_HIFN_795X is not set
2181CONFIG_HAVE_KVM=y
2182CONFIG_VIRTUALIZATION=y
2183# CONFIG_KVM is not set
2184# CONFIG_LGUEST is not set
2185# CONFIG_VIRTIO_PCI is not set
2186# CONFIG_VIRTIO_BALLOON is not set
1443 2187
1444# 2188#
1445# Library routines 2189# Library routines
1446# 2190#
1447CONFIG_BITREVERSE=y 2191CONFIG_BITREVERSE=y
2192CONFIG_GENERIC_FIND_FIRST_BIT=y
2193CONFIG_GENERIC_FIND_NEXT_BIT=y
1448# CONFIG_CRC_CCITT is not set 2194# CONFIG_CRC_CCITT is not set
1449# CONFIG_CRC16 is not set 2195# CONFIG_CRC16 is not set
1450# CONFIG_CRC_ITU_T is not set 2196# CONFIG_CRC_ITU_T is not set
1451CONFIG_CRC32=y 2197CONFIG_CRC32=y
1452# CONFIG_CRC7 is not set 2198# CONFIG_CRC7 is not set
1453# CONFIG_LIBCRC32C is not set 2199# CONFIG_LIBCRC32C is not set
2200CONFIG_AUDIT_GENERIC=y
1454CONFIG_ZLIB_INFLATE=y 2201CONFIG_ZLIB_INFLATE=y
1455CONFIG_PLIST=y 2202CONFIG_PLIST=y
1456CONFIG_HAS_IOMEM=y 2203CONFIG_HAS_IOMEM=y
1457CONFIG_HAS_IOPORT=y 2204CONFIG_HAS_IOPORT=y
1458CONFIG_HAS_DMA=y 2205CONFIG_HAS_DMA=y
1459CONFIG_GENERIC_HARDIRQS=y
1460CONFIG_GENERIC_IRQ_PROBE=y
1461CONFIG_GENERIC_PENDING_IRQ=y
1462CONFIG_X86_SMP=y
1463CONFIG_X86_HT=y
1464CONFIG_X86_BIOS_REBOOT=y
1465CONFIG_X86_TRAMPOLINE=y
1466CONFIG_KTIME_SCALAR=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index 2d6f5b2809d2..ae5124e064d4 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -1,64 +1,103 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-git14 3# Linux kernel version: 2.6.26-rc1
4# Fri Jul 20 09:53:15 2007 4# Sun May 4 19:59:57 2008
5# 5#
6CONFIG_X86_64=y
7CONFIG_64BIT=y 6CONFIG_64BIT=y
7# CONFIG_X86_32 is not set
8CONFIG_X86_64=y
8CONFIG_X86=y 9CONFIG_X86=y
10CONFIG_DEFCONFIG_LIST="arch/x86/configs/x86_64_defconfig"
11# CONFIG_GENERIC_LOCKBREAK is not set
9CONFIG_GENERIC_TIME=y 12CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_TIME_VSYSCALL=y
11CONFIG_GENERIC_CMOS_UPDATE=y 13CONFIG_GENERIC_CMOS_UPDATE=y
12CONFIG_ZONE_DMA32=y 14CONFIG_CLOCKSOURCE_WATCHDOG=y
15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
13CONFIG_LOCKDEP_SUPPORT=y 17CONFIG_LOCKDEP_SUPPORT=y
14CONFIG_STACKTRACE_SUPPORT=y 18CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_SEMAPHORE_SLEEPERS=y 19CONFIG_HAVE_LATENCYTOP_SUPPORT=y
20CONFIG_FAST_CMPXCHG_LOCAL=y
16CONFIG_MMU=y 21CONFIG_MMU=y
17CONFIG_ZONE_DMA=y 22CONFIG_ZONE_DMA=y
18CONFIG_QUICKLIST=y
19CONFIG_NR_QUICK=2
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21CONFIG_GENERIC_HWEIGHT=y
22CONFIG_GENERIC_CALIBRATE_DELAY=y
23CONFIG_X86_CMPXCHG=y
24CONFIG_EARLY_PRINTK=y
25CONFIG_GENERIC_ISA_DMA=y 23CONFIG_GENERIC_ISA_DMA=y
26CONFIG_GENERIC_IOMAP=y 24CONFIG_GENERIC_IOMAP=y
27CONFIG_ARCH_MAY_HAVE_PC_FDC=y
28CONFIG_ARCH_POPULATES_NODE_MAP=y
29CONFIG_DMI=y
30CONFIG_AUDIT_ARCH=y
31CONFIG_GENERIC_BUG=y 25CONFIG_GENERIC_BUG=y
26CONFIG_GENERIC_HWEIGHT=y
27# CONFIG_GENERIC_GPIO is not set
28CONFIG_ARCH_MAY_HAVE_PC_FDC=y
29CONFIG_RWSEM_GENERIC_SPINLOCK=y
30# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
32# CONFIG_ARCH_HAS_ILOG2_U32 is not set 31# CONFIG_ARCH_HAS_ILOG2_U32 is not set
33# CONFIG_ARCH_HAS_ILOG2_U64 is not set 32# CONFIG_ARCH_HAS_ILOG2_U64 is not set
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_GENERIC_CALIBRATE_DELAY=y
35CONFIG_GENERIC_TIME_VSYSCALL=y
36CONFIG_ARCH_HAS_CPU_RELAX=y
37CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
38CONFIG_HAVE_SETUP_PER_CPU_AREA=y
39CONFIG_HAVE_CPUMASK_OF_CPU_MAP=y
40CONFIG_ARCH_HIBERNATION_POSSIBLE=y
41CONFIG_ARCH_SUSPEND_POSSIBLE=y
42CONFIG_ZONE_DMA32=y
43CONFIG_ARCH_POPULATES_NODE_MAP=y
44CONFIG_AUDIT_ARCH=y
45CONFIG_ARCH_SUPPORTS_AOUT=y
46CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
47CONFIG_GENERIC_HARDIRQS=y
48CONFIG_GENERIC_IRQ_PROBE=y
49CONFIG_GENERIC_PENDING_IRQ=y
50CONFIG_X86_SMP=y
51CONFIG_X86_64_SMP=y
52CONFIG_X86_HT=y
53CONFIG_X86_BIOS_REBOOT=y
54CONFIG_X86_TRAMPOLINE=y
55# CONFIG_KTIME_SCALAR is not set
35 56
36# 57#
37# Code maturity level options 58# General setup
38# 59#
39CONFIG_EXPERIMENTAL=y 60CONFIG_EXPERIMENTAL=y
40CONFIG_LOCK_KERNEL=y 61CONFIG_LOCK_KERNEL=y
41CONFIG_INIT_ENV_ARG_LIMIT=32 62CONFIG_INIT_ENV_ARG_LIMIT=32
42
43#
44# General setup
45#
46CONFIG_LOCALVERSION="" 63CONFIG_LOCALVERSION=""
47CONFIG_LOCALVERSION_AUTO=y 64# CONFIG_LOCALVERSION_AUTO is not set
48CONFIG_SWAP=y 65CONFIG_SWAP=y
49CONFIG_SYSVIPC=y 66CONFIG_SYSVIPC=y
50CONFIG_SYSVIPC_SYSCTL=y 67CONFIG_SYSVIPC_SYSCTL=y
51CONFIG_POSIX_MQUEUE=y 68CONFIG_POSIX_MQUEUE=y
52# CONFIG_BSD_PROCESS_ACCT is not set 69CONFIG_BSD_PROCESS_ACCT=y
53# CONFIG_TASKSTATS is not set 70# CONFIG_BSD_PROCESS_ACCT_V3 is not set
54# CONFIG_USER_NS is not set 71CONFIG_TASKSTATS=y
55# CONFIG_AUDIT is not set 72CONFIG_TASK_DELAY_ACCT=y
56CONFIG_IKCONFIG=y 73CONFIG_TASK_XACCT=y
57CONFIG_IKCONFIG_PROC=y 74CONFIG_TASK_IO_ACCOUNTING=y
58CONFIG_LOG_BUF_SHIFT=18 75CONFIG_AUDIT=y
59# CONFIG_CPUSETS is not set 76CONFIG_AUDITSYSCALL=y
60CONFIG_SYSFS_DEPRECATED=y 77CONFIG_AUDIT_TREE=y
78# CONFIG_IKCONFIG is not set
79CONFIG_LOG_BUF_SHIFT=17
80CONFIG_CGROUPS=y
81# CONFIG_CGROUP_DEBUG is not set
82CONFIG_CGROUP_NS=y
83# CONFIG_CGROUP_DEVICE is not set
84CONFIG_CPUSETS=y
85CONFIG_GROUP_SCHED=y
86CONFIG_FAIR_GROUP_SCHED=y
87# CONFIG_RT_GROUP_SCHED is not set
88# CONFIG_USER_SCHED is not set
89CONFIG_CGROUP_SCHED=y
90CONFIG_CGROUP_CPUACCT=y
91CONFIG_RESOURCE_COUNTERS=y
92# CONFIG_CGROUP_MEM_RES_CTLR is not set
93# CONFIG_SYSFS_DEPRECATED_V2 is not set
94CONFIG_PROC_PID_CPUSET=y
61CONFIG_RELAY=y 95CONFIG_RELAY=y
96CONFIG_NAMESPACES=y
97CONFIG_UTS_NS=y
98CONFIG_IPC_NS=y
99CONFIG_USER_NS=y
100CONFIG_PID_NS=y
62CONFIG_BLK_DEV_INITRD=y 101CONFIG_BLK_DEV_INITRD=y
63CONFIG_INITRAMFS_SOURCE="" 102CONFIG_INITRAMFS_SOURCE=""
64CONFIG_CC_OPTIMIZE_FOR_SIZE=y 103CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -66,13 +105,15 @@ CONFIG_SYSCTL=y
66# CONFIG_EMBEDDED is not set 105# CONFIG_EMBEDDED is not set
67CONFIG_UID16=y 106CONFIG_UID16=y
68CONFIG_SYSCTL_SYSCALL=y 107CONFIG_SYSCTL_SYSCALL=y
108CONFIG_SYSCTL_SYSCALL_CHECK=y
69CONFIG_KALLSYMS=y 109CONFIG_KALLSYMS=y
70CONFIG_KALLSYMS_ALL=y 110CONFIG_KALLSYMS_ALL=y
71# CONFIG_KALLSYMS_EXTRA_PASS is not set 111CONFIG_KALLSYMS_EXTRA_PASS=y
72CONFIG_HOTPLUG=y 112CONFIG_HOTPLUG=y
73CONFIG_PRINTK=y 113CONFIG_PRINTK=y
74CONFIG_BUG=y 114CONFIG_BUG=y
75CONFIG_ELF_CORE=y 115CONFIG_ELF_CORE=y
116# CONFIG_COMPAT_BRK is not set
76CONFIG_BASE_FULL=y 117CONFIG_BASE_FULL=y
77CONFIG_FUTEX=y 118CONFIG_FUTEX=y
78CONFIG_ANON_INODES=y 119CONFIG_ANON_INODES=y
@@ -82,9 +123,21 @@ CONFIG_TIMERFD=y
82CONFIG_EVENTFD=y 123CONFIG_EVENTFD=y
83CONFIG_SHMEM=y 124CONFIG_SHMEM=y
84CONFIG_VM_EVENT_COUNTERS=y 125CONFIG_VM_EVENT_COUNTERS=y
85CONFIG_SLAB=y 126CONFIG_SLUB_DEBUG=y
86# CONFIG_SLUB is not set 127# CONFIG_SLAB is not set
128CONFIG_SLUB=y
87# CONFIG_SLOB is not set 129# CONFIG_SLOB is not set
130CONFIG_PROFILING=y
131CONFIG_MARKERS=y
132# CONFIG_OPROFILE is not set
133CONFIG_HAVE_OPROFILE=y
134CONFIG_KPROBES=y
135CONFIG_KRETPROBES=y
136CONFIG_HAVE_KPROBES=y
137CONFIG_HAVE_KRETPROBES=y
138# CONFIG_HAVE_DMA_ATTRS is not set
139CONFIG_PROC_PAGE_MONITOR=y
140CONFIG_SLABINFO=y
88CONFIG_RT_MUTEXES=y 141CONFIG_RT_MUTEXES=y
89# CONFIG_TINY_SHMEM is not set 142# CONFIG_TINY_SHMEM is not set
90CONFIG_BASE_SMALL=0 143CONFIG_BASE_SMALL=0
@@ -96,14 +149,15 @@ CONFIG_MODULE_FORCE_UNLOAD=y
96# CONFIG_KMOD is not set 149# CONFIG_KMOD is not set
97CONFIG_STOP_MACHINE=y 150CONFIG_STOP_MACHINE=y
98CONFIG_BLOCK=y 151CONFIG_BLOCK=y
99# CONFIG_BLK_DEV_IO_TRACE is not set 152CONFIG_BLK_DEV_IO_TRACE=y
100# CONFIG_BLK_DEV_BSG is not set 153CONFIG_BLK_DEV_BSG=y
154CONFIG_BLOCK_COMPAT=y
101 155
102# 156#
103# IO Schedulers 157# IO Schedulers
104# 158#
105CONFIG_IOSCHED_NOOP=y 159CONFIG_IOSCHED_NOOP=y
106# CONFIG_IOSCHED_AS is not set 160CONFIG_IOSCHED_AS=y
107CONFIG_IOSCHED_DEADLINE=y 161CONFIG_IOSCHED_DEADLINE=y
108CONFIG_IOSCHED_CFQ=y 162CONFIG_IOSCHED_CFQ=y
109# CONFIG_DEFAULT_AS is not set 163# CONFIG_DEFAULT_AS is not set
@@ -111,107 +165,177 @@ CONFIG_IOSCHED_CFQ=y
111CONFIG_DEFAULT_CFQ=y 165CONFIG_DEFAULT_CFQ=y
112# CONFIG_DEFAULT_NOOP is not set 166# CONFIG_DEFAULT_NOOP is not set
113CONFIG_DEFAULT_IOSCHED="cfq" 167CONFIG_DEFAULT_IOSCHED="cfq"
168CONFIG_CLASSIC_RCU=y
114 169
115# 170#
116# Processor type and features 171# Processor type and features
117# 172#
173CONFIG_TICK_ONESHOT=y
174CONFIG_NO_HZ=y
175CONFIG_HIGH_RES_TIMERS=y
176CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
177CONFIG_SMP=y
118CONFIG_X86_PC=y 178CONFIG_X86_PC=y
179# CONFIG_X86_ELAN is not set
180# CONFIG_X86_VOYAGER is not set
181# CONFIG_X86_NUMAQ is not set
182# CONFIG_X86_SUMMIT is not set
183# CONFIG_X86_BIGSMP is not set
184# CONFIG_X86_VISWS is not set
185# CONFIG_X86_GENERICARCH is not set
186# CONFIG_X86_ES7000 is not set
187# CONFIG_X86_RDC321X is not set
119# CONFIG_X86_VSMP is not set 188# CONFIG_X86_VSMP is not set
189# CONFIG_PARAVIRT_GUEST is not set
190CONFIG_MEMTEST_BOOTPARAM=y
191CONFIG_MEMTEST_BOOTPARAM_VALUE=0
192# CONFIG_M386 is not set
193# CONFIG_M486 is not set
194# CONFIG_M586 is not set
195# CONFIG_M586TSC is not set
196# CONFIG_M586MMX is not set
197# CONFIG_M686 is not set
198# CONFIG_MPENTIUMII is not set
199# CONFIG_MPENTIUMIII is not set
200# CONFIG_MPENTIUMM is not set
201# CONFIG_MPENTIUM4 is not set
202# CONFIG_MK6 is not set
203# CONFIG_MK7 is not set
120# CONFIG_MK8 is not set 204# CONFIG_MK8 is not set
205# CONFIG_MCRUSOE is not set
206# CONFIG_MEFFICEON is not set
207# CONFIG_MWINCHIPC6 is not set
208# CONFIG_MWINCHIP2 is not set
209# CONFIG_MWINCHIP3D is not set
210# CONFIG_MGEODEGX1 is not set
211# CONFIG_MGEODE_LX is not set
212# CONFIG_MCYRIXIII is not set
213# CONFIG_MVIAC3_2 is not set
214# CONFIG_MVIAC7 is not set
121# CONFIG_MPSC is not set 215# CONFIG_MPSC is not set
122# CONFIG_MCORE2 is not set 216CONFIG_MCORE2=y
123CONFIG_GENERIC_CPU=y 217# CONFIG_GENERIC_CPU is not set
124CONFIG_X86_L1_CACHE_BYTES=128 218CONFIG_X86_CPU=y
125CONFIG_X86_L1_CACHE_SHIFT=7 219CONFIG_X86_L1_CACHE_BYTES=64
126CONFIG_X86_INTERNODE_CACHE_BYTES=128 220CONFIG_X86_INTERNODE_CACHE_BYTES=64
127CONFIG_X86_TSC=y 221CONFIG_X86_CMPXCHG=y
222CONFIG_X86_L1_CACHE_SHIFT=6
128CONFIG_X86_GOOD_APIC=y 223CONFIG_X86_GOOD_APIC=y
129# CONFIG_MICROCODE is not set 224CONFIG_X86_INTEL_USERCOPY=y
130CONFIG_X86_MSR=y 225CONFIG_X86_USE_PPRO_CHECKSUM=y
131CONFIG_X86_CPUID=y 226CONFIG_X86_P6_NOP=y
132CONFIG_X86_HT=y 227CONFIG_X86_TSC=y
133CONFIG_X86_IO_APIC=y 228CONFIG_X86_CMOV=y
134CONFIG_X86_LOCAL_APIC=y 229CONFIG_X86_MINIMUM_CPU_FAMILY=64
135CONFIG_MTRR=y 230CONFIG_X86_DEBUGCTLMSR=y
136CONFIG_SMP=y 231CONFIG_HPET_TIMER=y
137CONFIG_SCHED_SMT=y 232CONFIG_HPET_EMULATE_RTC=y
233CONFIG_DMI=y
234CONFIG_GART_IOMMU=y
235CONFIG_CALGARY_IOMMU=y
236CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y
237CONFIG_SWIOTLB=y
238CONFIG_IOMMU_HELPER=y
239CONFIG_NR_CPUS=4
240# CONFIG_SCHED_SMT is not set
138CONFIG_SCHED_MC=y 241CONFIG_SCHED_MC=y
139# CONFIG_PREEMPT_NONE is not set 242# CONFIG_PREEMPT_NONE is not set
140CONFIG_PREEMPT_VOLUNTARY=y 243CONFIG_PREEMPT_VOLUNTARY=y
141# CONFIG_PREEMPT is not set 244# CONFIG_PREEMPT is not set
142CONFIG_PREEMPT_BKL=y 245CONFIG_X86_LOCAL_APIC=y
246CONFIG_X86_IO_APIC=y
247# CONFIG_X86_MCE is not set
248# CONFIG_I8K is not set
249# CONFIG_MICROCODE is not set
250CONFIG_X86_MSR=y
251CONFIG_X86_CPUID=y
143CONFIG_NUMA=y 252CONFIG_NUMA=y
144CONFIG_K8_NUMA=y 253CONFIG_K8_NUMA=y
145CONFIG_NODES_SHIFT=6
146CONFIG_X86_64_ACPI_NUMA=y 254CONFIG_X86_64_ACPI_NUMA=y
147CONFIG_NUMA_EMU=y 255CONFIG_NODES_SPAN_OTHER_NODES=y
256# CONFIG_NUMA_EMU is not set
257CONFIG_NODES_SHIFT=6
258CONFIG_ARCH_SPARSEMEM_DEFAULT=y
259CONFIG_ARCH_SPARSEMEM_ENABLE=y
260CONFIG_ARCH_SELECT_MEMORY_MODEL=y
261CONFIG_SELECT_MEMORY_MODEL=y
262# CONFIG_FLATMEM_MANUAL is not set
263# CONFIG_DISCONTIGMEM_MANUAL is not set
264CONFIG_SPARSEMEM_MANUAL=y
265CONFIG_SPARSEMEM=y
148CONFIG_NEED_MULTIPLE_NODES=y 266CONFIG_NEED_MULTIPLE_NODES=y
267CONFIG_HAVE_MEMORY_PRESENT=y
149# CONFIG_SPARSEMEM_STATIC is not set 268# CONFIG_SPARSEMEM_STATIC is not set
269CONFIG_SPARSEMEM_EXTREME=y
270CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
271CONFIG_SPARSEMEM_VMEMMAP=y
272
273#
274# Memory hotplug is currently incompatible with Software Suspend
275#
276CONFIG_PAGEFLAGS_EXTENDED=y
150CONFIG_SPLIT_PTLOCK_CPUS=4 277CONFIG_SPLIT_PTLOCK_CPUS=4
151CONFIG_MIGRATION=y 278CONFIG_MIGRATION=y
152CONFIG_RESOURCES_64BIT=y 279CONFIG_RESOURCES_64BIT=y
153CONFIG_ZONE_DMA_FLAG=1 280CONFIG_ZONE_DMA_FLAG=1
154CONFIG_BOUNCE=y 281CONFIG_BOUNCE=y
155CONFIG_VIRT_TO_BUS=y 282CONFIG_VIRT_TO_BUS=y
156CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 283CONFIG_MTRR=y
157CONFIG_OUT_OF_LINE_PFN_TO_PAGE=y 284# CONFIG_X86_PAT is not set
158CONFIG_NR_CPUS=32 285CONFIG_EFI=y
159CONFIG_PHYSICAL_ALIGN=0x200000
160CONFIG_HOTPLUG_CPU=y
161CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
162CONFIG_HPET_TIMER=y
163CONFIG_HPET_EMULATE_RTC=y
164CONFIG_GART_IOMMU=y
165# CONFIG_CALGARY_IOMMU is not set
166CONFIG_SWIOTLB=y
167CONFIG_X86_MCE=y
168CONFIG_X86_MCE_INTEL=y
169CONFIG_X86_MCE_AMD=y
170# CONFIG_KEXEC is not set
171# CONFIG_CRASH_DUMP is not set
172# CONFIG_RELOCATABLE is not set
173CONFIG_PHYSICAL_START=0x200000
174CONFIG_SECCOMP=y 286CONFIG_SECCOMP=y
175# CONFIG_CC_STACKPROTECTOR is not set
176# CONFIG_HZ_100 is not set 287# CONFIG_HZ_100 is not set
177CONFIG_HZ_250=y 288# CONFIG_HZ_250 is not set
178# CONFIG_HZ_300 is not set 289# CONFIG_HZ_300 is not set
179# CONFIG_HZ_1000 is not set 290CONFIG_HZ_1000=y
180CONFIG_HZ=250 291CONFIG_HZ=1000
181CONFIG_K8_NB=y 292CONFIG_SCHED_HRTICK=y
182CONFIG_GENERIC_HARDIRQS=y 293CONFIG_KEXEC=y
183CONFIG_GENERIC_IRQ_PROBE=y 294CONFIG_CRASH_DUMP=y
184CONFIG_ISA_DMA_API=y 295CONFIG_PHYSICAL_START=0x1000000
185CONFIG_GENERIC_PENDING_IRQ=y 296CONFIG_RELOCATABLE=y
297CONFIG_PHYSICAL_ALIGN=0x200000
298CONFIG_HOTPLUG_CPU=y
299# CONFIG_COMPAT_VDSO is not set
300CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
301CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
186 302
187# 303#
188# Power management options 304# Power management options
189# 305#
306CONFIG_ARCH_HIBERNATION_HEADER=y
190CONFIG_PM=y 307CONFIG_PM=y
191# CONFIG_PM_LEGACY is not set 308CONFIG_PM_DEBUG=y
192# CONFIG_PM_DEBUG is not set 309# CONFIG_PM_VERBOSE is not set
310CONFIG_CAN_PM_TRACE=y
311CONFIG_PM_TRACE=y
312CONFIG_PM_TRACE_RTC=y
313CONFIG_PM_SLEEP_SMP=y
314CONFIG_PM_SLEEP=y
315CONFIG_SUSPEND=y
316CONFIG_SUSPEND_FREEZER=y
193CONFIG_HIBERNATION=y 317CONFIG_HIBERNATION=y
194CONFIG_PM_STD_PARTITION="" 318CONFIG_PM_STD_PARTITION=""
195
196#
197# ACPI (Advanced Configuration and Power Interface) Support
198#
199CONFIG_ACPI=y 319CONFIG_ACPI=y
200CONFIG_ACPI_SLEEP=y 320CONFIG_ACPI_SLEEP=y
201CONFIG_ACPI_SLEEP_PROC_FS=y
202CONFIG_ACPI_SLEEP_PROC_SLEEP=y
203CONFIG_ACPI_PROCFS=y 321CONFIG_ACPI_PROCFS=y
322CONFIG_ACPI_PROCFS_POWER=y
323CONFIG_ACPI_SYSFS_POWER=y
324CONFIG_ACPI_PROC_EVENT=y
204CONFIG_ACPI_AC=y 325CONFIG_ACPI_AC=y
205CONFIG_ACPI_BATTERY=y 326CONFIG_ACPI_BATTERY=y
206CONFIG_ACPI_BUTTON=y 327CONFIG_ACPI_BUTTON=y
207CONFIG_ACPI_FAN=y 328CONFIG_ACPI_FAN=y
208# CONFIG_ACPI_DOCK is not set 329CONFIG_ACPI_DOCK=y
330# CONFIG_ACPI_BAY is not set
209CONFIG_ACPI_PROCESSOR=y 331CONFIG_ACPI_PROCESSOR=y
210CONFIG_ACPI_HOTPLUG_CPU=y 332CONFIG_ACPI_HOTPLUG_CPU=y
211CONFIG_ACPI_THERMAL=y 333CONFIG_ACPI_THERMAL=y
212CONFIG_ACPI_NUMA=y 334CONFIG_ACPI_NUMA=y
335# CONFIG_ACPI_WMI is not set
213# CONFIG_ACPI_ASUS is not set 336# CONFIG_ACPI_ASUS is not set
214# CONFIG_ACPI_TOSHIBA is not set 337# CONFIG_ACPI_TOSHIBA is not set
338# CONFIG_ACPI_CUSTOM_DSDT is not set
215CONFIG_ACPI_BLACKLIST_YEAR=0 339CONFIG_ACPI_BLACKLIST_YEAR=0
216# CONFIG_ACPI_DEBUG is not set 340# CONFIG_ACPI_DEBUG is not set
217CONFIG_ACPI_EC=y 341CONFIG_ACPI_EC=y
@@ -227,29 +351,34 @@ CONFIG_ACPI_CONTAINER=y
227CONFIG_CPU_FREQ=y 351CONFIG_CPU_FREQ=y
228CONFIG_CPU_FREQ_TABLE=y 352CONFIG_CPU_FREQ_TABLE=y
229CONFIG_CPU_FREQ_DEBUG=y 353CONFIG_CPU_FREQ_DEBUG=y
230CONFIG_CPU_FREQ_STAT=y 354# CONFIG_CPU_FREQ_STAT is not set
231# CONFIG_CPU_FREQ_STAT_DETAILS is not set 355# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
232CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 356# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
233# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 357CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
358# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
359# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
234CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 360CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
235# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 361# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
236CONFIG_CPU_FREQ_GOV_USERSPACE=y 362CONFIG_CPU_FREQ_GOV_USERSPACE=y
237CONFIG_CPU_FREQ_GOV_ONDEMAND=y 363CONFIG_CPU_FREQ_GOV_ONDEMAND=y
238CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y 364# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
239 365
240# 366#
241# CPUFreq processor drivers 367# CPUFreq processor drivers
242# 368#
243CONFIG_X86_POWERNOW_K8=y
244CONFIG_X86_POWERNOW_K8_ACPI=y
245# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
246CONFIG_X86_ACPI_CPUFREQ=y 369CONFIG_X86_ACPI_CPUFREQ=y
370# CONFIG_X86_POWERNOW_K8 is not set
371# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
372# CONFIG_X86_P4_CLOCKMOD is not set
247 373
248# 374#
249# shared options 375# shared options
250# 376#
251CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y 377# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
252# CONFIG_X86_SPEEDSTEP_LIB is not set 378# CONFIG_X86_SPEEDSTEP_LIB is not set
379CONFIG_CPU_IDLE=y
380CONFIG_CPU_IDLE_GOV_LADDER=y
381CONFIG_CPU_IDLE_GOV_MENU=y
253 382
254# 383#
255# Bus options (PCI etc.) 384# Bus options (PCI etc.)
@@ -257,27 +386,56 @@ CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y
257CONFIG_PCI=y 386CONFIG_PCI=y
258CONFIG_PCI_DIRECT=y 387CONFIG_PCI_DIRECT=y
259CONFIG_PCI_MMCONFIG=y 388CONFIG_PCI_MMCONFIG=y
389CONFIG_PCI_DOMAINS=y
390CONFIG_DMAR=y
391CONFIG_DMAR_GFX_WA=y
392CONFIG_DMAR_FLOPPY_WA=y
260CONFIG_PCIEPORTBUS=y 393CONFIG_PCIEPORTBUS=y
394# CONFIG_HOTPLUG_PCI_PCIE is not set
261CONFIG_PCIEAER=y 395CONFIG_PCIEAER=y
396# CONFIG_PCIEASPM is not set
262CONFIG_ARCH_SUPPORTS_MSI=y 397CONFIG_ARCH_SUPPORTS_MSI=y
263CONFIG_PCI_MSI=y 398CONFIG_PCI_MSI=y
399# CONFIG_PCI_LEGACY is not set
264# CONFIG_PCI_DEBUG is not set 400# CONFIG_PCI_DEBUG is not set
265# CONFIG_HT_IRQ is not set 401CONFIG_HT_IRQ=y
266 402CONFIG_ISA_DMA_API=y
267# 403CONFIG_K8_NB=y
268# PCCARD (PCMCIA/CardBus) support 404CONFIG_PCCARD=y
269# 405# CONFIG_PCMCIA_DEBUG is not set
270# CONFIG_PCCARD is not set 406CONFIG_PCMCIA=y
271# CONFIG_HOTPLUG_PCI is not set 407CONFIG_PCMCIA_LOAD_CIS=y
408CONFIG_PCMCIA_IOCTL=y
409CONFIG_CARDBUS=y
410
411#
412# PC-card bridges
413#
414CONFIG_YENTA=y
415CONFIG_YENTA_O2=y
416CONFIG_YENTA_RICOH=y
417CONFIG_YENTA_TI=y
418CONFIG_YENTA_ENE_TUNE=y
419CONFIG_YENTA_TOSHIBA=y
420# CONFIG_PD6729 is not set
421# CONFIG_I82092 is not set
422CONFIG_PCCARD_NONSTATIC=y
423CONFIG_HOTPLUG_PCI=y
424# CONFIG_HOTPLUG_PCI_FAKE is not set
425# CONFIG_HOTPLUG_PCI_ACPI is not set
426# CONFIG_HOTPLUG_PCI_CPCI is not set
427# CONFIG_HOTPLUG_PCI_SHPC is not set
272 428
273# 429#
274# Executable file formats / Emulations 430# Executable file formats / Emulations
275# 431#
276CONFIG_BINFMT_ELF=y 432CONFIG_BINFMT_ELF=y
277# CONFIG_BINFMT_MISC is not set 433CONFIG_COMPAT_BINFMT_ELF=y
434CONFIG_BINFMT_MISC=y
278CONFIG_IA32_EMULATION=y 435CONFIG_IA32_EMULATION=y
279CONFIG_IA32_AOUT=y 436# CONFIG_IA32_AOUT is not set
280CONFIG_COMPAT=y 437CONFIG_COMPAT=y
438CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
281CONFIG_SYSVIPC_COMPAT=y 439CONFIG_SYSVIPC_COMPAT=y
282 440
283# 441#
@@ -289,22 +447,31 @@ CONFIG_NET=y
289# Networking options 447# Networking options
290# 448#
291CONFIG_PACKET=y 449CONFIG_PACKET=y
292# CONFIG_PACKET_MMAP is not set 450CONFIG_PACKET_MMAP=y
293CONFIG_UNIX=y 451CONFIG_UNIX=y
452CONFIG_XFRM=y
453CONFIG_XFRM_USER=y
454# CONFIG_XFRM_SUB_POLICY is not set
455# CONFIG_XFRM_MIGRATE is not set
456# CONFIG_XFRM_STATISTICS is not set
294# CONFIG_NET_KEY is not set 457# CONFIG_NET_KEY is not set
295CONFIG_INET=y 458CONFIG_INET=y
296CONFIG_IP_MULTICAST=y 459CONFIG_IP_MULTICAST=y
297# CONFIG_IP_ADVANCED_ROUTER is not set 460CONFIG_IP_ADVANCED_ROUTER=y
461CONFIG_ASK_IP_FIB_HASH=y
462# CONFIG_IP_FIB_TRIE is not set
298CONFIG_IP_FIB_HASH=y 463CONFIG_IP_FIB_HASH=y
299CONFIG_IP_PNP=y 464CONFIG_IP_MULTIPLE_TABLES=y
300CONFIG_IP_PNP_DHCP=y 465CONFIG_IP_ROUTE_MULTIPATH=y
301# CONFIG_IP_PNP_BOOTP is not set 466CONFIG_IP_ROUTE_VERBOSE=y
302# CONFIG_IP_PNP_RARP is not set 467# CONFIG_IP_PNP is not set
303# CONFIG_NET_IPIP is not set 468# CONFIG_NET_IPIP is not set
304# CONFIG_NET_IPGRE is not set 469# CONFIG_NET_IPGRE is not set
305# CONFIG_IP_MROUTE is not set 470CONFIG_IP_MROUTE=y
471CONFIG_IP_PIMSM_V1=y
472CONFIG_IP_PIMSM_V2=y
306# CONFIG_ARPD is not set 473# CONFIG_ARPD is not set
307# CONFIG_SYN_COOKIES is not set 474CONFIG_SYN_COOKIES=y
308# CONFIG_INET_AH is not set 475# CONFIG_INET_AH is not set
309# CONFIG_INET_ESP is not set 476# CONFIG_INET_ESP is not set
310# CONFIG_INET_IPCOMP is not set 477# CONFIG_INET_IPCOMP is not set
@@ -313,31 +480,109 @@ CONFIG_INET_TUNNEL=y
313# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 480# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
314# CONFIG_INET_XFRM_MODE_TUNNEL is not set 481# CONFIG_INET_XFRM_MODE_TUNNEL is not set
315# CONFIG_INET_XFRM_MODE_BEET is not set 482# CONFIG_INET_XFRM_MODE_BEET is not set
316CONFIG_INET_DIAG=y 483CONFIG_INET_LRO=y
317CONFIG_INET_TCP_DIAG=y 484# CONFIG_INET_DIAG is not set
318# CONFIG_TCP_CONG_ADVANCED is not set 485CONFIG_TCP_CONG_ADVANCED=y
486# CONFIG_TCP_CONG_BIC is not set
319CONFIG_TCP_CONG_CUBIC=y 487CONFIG_TCP_CONG_CUBIC=y
488# CONFIG_TCP_CONG_WESTWOOD is not set
489# CONFIG_TCP_CONG_HTCP is not set
490# CONFIG_TCP_CONG_HSTCP is not set
491# CONFIG_TCP_CONG_HYBLA is not set
492# CONFIG_TCP_CONG_VEGAS is not set
493# CONFIG_TCP_CONG_SCALABLE is not set
494# CONFIG_TCP_CONG_LP is not set
495# CONFIG_TCP_CONG_VENO is not set
496# CONFIG_TCP_CONG_YEAH is not set
497# CONFIG_TCP_CONG_ILLINOIS is not set
498# CONFIG_DEFAULT_BIC is not set
499CONFIG_DEFAULT_CUBIC=y
500# CONFIG_DEFAULT_HTCP is not set
501# CONFIG_DEFAULT_VEGAS is not set
502# CONFIG_DEFAULT_WESTWOOD is not set
503# CONFIG_DEFAULT_RENO is not set
320CONFIG_DEFAULT_TCP_CONG="cubic" 504CONFIG_DEFAULT_TCP_CONG="cubic"
321# CONFIG_TCP_MD5SIG is not set 505CONFIG_TCP_MD5SIG=y
506# CONFIG_IP_VS is not set
322CONFIG_IPV6=y 507CONFIG_IPV6=y
323# CONFIG_IPV6_PRIVACY is not set 508# CONFIG_IPV6_PRIVACY is not set
324# CONFIG_IPV6_ROUTER_PREF is not set 509# CONFIG_IPV6_ROUTER_PREF is not set
325# CONFIG_IPV6_OPTIMISTIC_DAD is not set 510# CONFIG_IPV6_OPTIMISTIC_DAD is not set
326# CONFIG_INET6_AH is not set 511CONFIG_INET6_AH=y
327# CONFIG_INET6_ESP is not set 512CONFIG_INET6_ESP=y
328# CONFIG_INET6_IPCOMP is not set 513# CONFIG_INET6_IPCOMP is not set
329# CONFIG_IPV6_MIP6 is not set 514# CONFIG_IPV6_MIP6 is not set
330# CONFIG_INET6_XFRM_TUNNEL is not set 515# CONFIG_INET6_XFRM_TUNNEL is not set
331# CONFIG_INET6_TUNNEL is not set 516# CONFIG_INET6_TUNNEL is not set
332# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set 517CONFIG_INET6_XFRM_MODE_TRANSPORT=y
333# CONFIG_INET6_XFRM_MODE_TUNNEL is not set 518CONFIG_INET6_XFRM_MODE_TUNNEL=y
334# CONFIG_INET6_XFRM_MODE_BEET is not set 519CONFIG_INET6_XFRM_MODE_BEET=y
335# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 520# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
336CONFIG_IPV6_SIT=y 521CONFIG_IPV6_SIT=y
522CONFIG_IPV6_NDISC_NODETYPE=y
337# CONFIG_IPV6_TUNNEL is not set 523# CONFIG_IPV6_TUNNEL is not set
338# CONFIG_IPV6_MULTIPLE_TABLES is not set 524# CONFIG_IPV6_MULTIPLE_TABLES is not set
339# CONFIG_NETWORK_SECMARK is not set 525# CONFIG_IPV6_MROUTE is not set
340# CONFIG_NETFILTER is not set 526CONFIG_NETLABEL=y
527CONFIG_NETWORK_SECMARK=y
528CONFIG_NETFILTER=y
529# CONFIG_NETFILTER_DEBUG is not set
530# CONFIG_NETFILTER_ADVANCED is not set
531
532#
533# Core Netfilter Configuration
534#
535CONFIG_NETFILTER_NETLINK=y
536CONFIG_NETFILTER_NETLINK_LOG=y
537CONFIG_NF_CONNTRACK=y
538CONFIG_NF_CONNTRACK_SECMARK=y
539CONFIG_NF_CONNTRACK_FTP=y
540CONFIG_NF_CONNTRACK_IRC=y
541CONFIG_NF_CONNTRACK_SIP=y
542CONFIG_NF_CT_NETLINK=y
543CONFIG_NETFILTER_XTABLES=y
544CONFIG_NETFILTER_XT_TARGET_MARK=y
545CONFIG_NETFILTER_XT_TARGET_NFLOG=y
546CONFIG_NETFILTER_XT_TARGET_SECMARK=y
547CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
548CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
549CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
550CONFIG_NETFILTER_XT_MATCH_MARK=y
551CONFIG_NETFILTER_XT_MATCH_POLICY=y
552CONFIG_NETFILTER_XT_MATCH_STATE=y
553
554#
555# IP: Netfilter Configuration
556#
557CONFIG_NF_CONNTRACK_IPV4=y
558CONFIG_NF_CONNTRACK_PROC_COMPAT=y
559CONFIG_IP_NF_IPTABLES=y
560CONFIG_IP_NF_FILTER=y
561CONFIG_IP_NF_TARGET_REJECT=y
562CONFIG_IP_NF_TARGET_LOG=y
563CONFIG_IP_NF_TARGET_ULOG=y
564CONFIG_NF_NAT=y
565CONFIG_NF_NAT_NEEDED=y
566CONFIG_IP_NF_TARGET_MASQUERADE=y
567CONFIG_NF_NAT_FTP=y
568CONFIG_NF_NAT_IRC=y
569# CONFIG_NF_NAT_TFTP is not set
570# CONFIG_NF_NAT_AMANDA is not set
571# CONFIG_NF_NAT_PPTP is not set
572# CONFIG_NF_NAT_H323 is not set
573CONFIG_NF_NAT_SIP=y
574CONFIG_IP_NF_MANGLE=y
575
576#
577# IPv6: Netfilter Configuration
578#
579CONFIG_NF_CONNTRACK_IPV6=y
580CONFIG_IP6_NF_IPTABLES=y
581CONFIG_IP6_NF_MATCH_IPV6HEADER=y
582CONFIG_IP6_NF_FILTER=y
583CONFIG_IP6_NF_TARGET_LOG=y
584CONFIG_IP6_NF_TARGET_REJECT=y
585CONFIG_IP6_NF_MANGLE=y
341# CONFIG_IP_DCCP is not set 586# CONFIG_IP_DCCP is not set
342# CONFIG_IP_SCTP is not set 587# CONFIG_IP_SCTP is not set
343# CONFIG_TIPC is not set 588# CONFIG_TIPC is not set
@@ -345,6 +590,7 @@ CONFIG_IPV6_SIT=y
345# CONFIG_BRIDGE is not set 590# CONFIG_BRIDGE is not set
346# CONFIG_VLAN_8021Q is not set 591# CONFIG_VLAN_8021Q is not set
347# CONFIG_DECNET is not set 592# CONFIG_DECNET is not set
593CONFIG_LLC=y
348# CONFIG_LLC2 is not set 594# CONFIG_LLC2 is not set
349# CONFIG_IPX is not set 595# CONFIG_IPX is not set
350# CONFIG_ATALK is not set 596# CONFIG_ATALK is not set
@@ -352,28 +598,99 @@ CONFIG_IPV6_SIT=y
352# CONFIG_LAPB is not set 598# CONFIG_LAPB is not set
353# CONFIG_ECONET is not set 599# CONFIG_ECONET is not set
354# CONFIG_WAN_ROUTER is not set 600# CONFIG_WAN_ROUTER is not set
355 601CONFIG_NET_SCHED=y
356# 602
357# QoS and/or fair queueing 603#
358# 604# Queueing/Scheduling
359# CONFIG_NET_SCHED is not set 605#
606# CONFIG_NET_SCH_CBQ is not set
607# CONFIG_NET_SCH_HTB is not set
608# CONFIG_NET_SCH_HFSC is not set
609# CONFIG_NET_SCH_PRIO is not set
610# CONFIG_NET_SCH_RR is not set
611# CONFIG_NET_SCH_RED is not set
612# CONFIG_NET_SCH_SFQ is not set
613# CONFIG_NET_SCH_TEQL is not set
614# CONFIG_NET_SCH_TBF is not set
615# CONFIG_NET_SCH_GRED is not set
616# CONFIG_NET_SCH_DSMARK is not set
617# CONFIG_NET_SCH_NETEM is not set
618# CONFIG_NET_SCH_INGRESS is not set
619
620#
621# Classification
622#
623CONFIG_NET_CLS=y
624# CONFIG_NET_CLS_BASIC is not set
625# CONFIG_NET_CLS_TCINDEX is not set
626# CONFIG_NET_CLS_ROUTE4 is not set
627# CONFIG_NET_CLS_FW is not set
628# CONFIG_NET_CLS_U32 is not set
629# CONFIG_NET_CLS_RSVP is not set
630# CONFIG_NET_CLS_RSVP6 is not set
631# CONFIG_NET_CLS_FLOW is not set
632CONFIG_NET_EMATCH=y
633CONFIG_NET_EMATCH_STACK=32
634# CONFIG_NET_EMATCH_CMP is not set
635# CONFIG_NET_EMATCH_NBYTE is not set
636# CONFIG_NET_EMATCH_U32 is not set
637# CONFIG_NET_EMATCH_META is not set
638# CONFIG_NET_EMATCH_TEXT is not set
639CONFIG_NET_CLS_ACT=y
640# CONFIG_NET_ACT_POLICE is not set
641# CONFIG_NET_ACT_GACT is not set
642# CONFIG_NET_ACT_MIRRED is not set
643# CONFIG_NET_ACT_IPT is not set
644# CONFIG_NET_ACT_NAT is not set
645# CONFIG_NET_ACT_PEDIT is not set
646# CONFIG_NET_ACT_SIMP is not set
647CONFIG_NET_SCH_FIFO=y
360 648
361# 649#
362# Network testing 650# Network testing
363# 651#
364# CONFIG_NET_PKTGEN is not set 652# CONFIG_NET_PKTGEN is not set
365# CONFIG_NET_TCPPROBE is not set 653# CONFIG_NET_TCPPROBE is not set
366# CONFIG_HAMRADIO is not set 654CONFIG_HAMRADIO=y
655
656#
657# Packet Radio protocols
658#
659# CONFIG_AX25 is not set
660# CONFIG_CAN is not set
367# CONFIG_IRDA is not set 661# CONFIG_IRDA is not set
368# CONFIG_BT is not set 662# CONFIG_BT is not set
369# CONFIG_AF_RXRPC is not set 663# CONFIG_AF_RXRPC is not set
664CONFIG_FIB_RULES=y
370 665
371# 666#
372# Wireless 667# Wireless
373# 668#
374# CONFIG_CFG80211 is not set 669CONFIG_CFG80211=y
375# CONFIG_WIRELESS_EXT is not set 670CONFIG_NL80211=y
376# CONFIG_MAC80211 is not set 671CONFIG_WIRELESS_EXT=y
672CONFIG_MAC80211=y
673
674#
675# Rate control algorithm selection
676#
677CONFIG_MAC80211_RC_DEFAULT_PID=y
678# CONFIG_MAC80211_RC_DEFAULT_NONE is not set
679
680#
681# Selecting 'y' for an algorithm will
682#
683
684#
685# build the algorithm into mac80211.
686#
687CONFIG_MAC80211_RC_DEFAULT="pid"
688CONFIG_MAC80211_RC_PID=y
689# CONFIG_MAC80211_MESH is not set
690CONFIG_MAC80211_LEDS=y
691# CONFIG_MAC80211_DEBUGFS is not set
692# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
693# CONFIG_MAC80211_DEBUG is not set
377# CONFIG_IEEE80211 is not set 694# CONFIG_IEEE80211 is not set
378# CONFIG_RFKILL is not set 695# CONFIG_RFKILL is not set
379# CONFIG_NET_9P is not set 696# CONFIG_NET_9P is not set
@@ -385,13 +702,15 @@ CONFIG_IPV6_SIT=y
385# 702#
386# Generic Driver Options 703# Generic Driver Options
387# 704#
705CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
388CONFIG_STANDALONE=y 706CONFIG_STANDALONE=y
389CONFIG_PREVENT_FIRMWARE_BUILD=y 707CONFIG_PREVENT_FIRMWARE_BUILD=y
390CONFIG_FW_LOADER=y 708CONFIG_FW_LOADER=y
391# CONFIG_DEBUG_DRIVER is not set 709# CONFIG_DEBUG_DRIVER is not set
392# CONFIG_DEBUG_DEVRES is not set 710CONFIG_DEBUG_DEVRES=y
393# CONFIG_SYS_HYPERVISOR is not set 711# CONFIG_SYS_HYPERVISOR is not set
394# CONFIG_CONNECTOR is not set 712CONFIG_CONNECTOR=y
713CONFIG_PROC_EVENTS=y
395# CONFIG_MTD is not set 714# CONFIG_MTD is not set
396# CONFIG_PARPORT is not set 715# CONFIG_PARPORT is not set
397CONFIG_PNP=y 716CONFIG_PNP=y
@@ -402,7 +721,7 @@ CONFIG_PNP=y
402# 721#
403CONFIG_PNPACPI=y 722CONFIG_PNPACPI=y
404CONFIG_BLK_DEV=y 723CONFIG_BLK_DEV=y
405CONFIG_BLK_DEV_FD=y 724# CONFIG_BLK_DEV_FD is not set
406# CONFIG_BLK_CPQ_DA is not set 725# CONFIG_BLK_CPQ_DA is not set
407# CONFIG_BLK_CPQ_CISS_DA is not set 726# CONFIG_BLK_CPQ_CISS_DA is not set
408# CONFIG_BLK_DEV_DAC960 is not set 727# CONFIG_BLK_DEV_DAC960 is not set
@@ -415,8 +734,8 @@ CONFIG_BLK_DEV_LOOP=y
415# CONFIG_BLK_DEV_UB is not set 734# CONFIG_BLK_DEV_UB is not set
416CONFIG_BLK_DEV_RAM=y 735CONFIG_BLK_DEV_RAM=y
417CONFIG_BLK_DEV_RAM_COUNT=16 736CONFIG_BLK_DEV_RAM_COUNT=16
418CONFIG_BLK_DEV_RAM_SIZE=4096 737CONFIG_BLK_DEV_RAM_SIZE=16384
419CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 738# CONFIG_BLK_DEV_XIP is not set
420# CONFIG_CDROM_PKTCDVD is not set 739# CONFIG_CDROM_PKTCDVD is not set
421# CONFIG_ATA_OVER_ETH is not set 740# CONFIG_ATA_OVER_ETH is not set
422CONFIG_MISC_DEVICES=y 741CONFIG_MISC_DEVICES=y
@@ -425,72 +744,16 @@ CONFIG_MISC_DEVICES=y
425# CONFIG_EEPROM_93CX6 is not set 744# CONFIG_EEPROM_93CX6 is not set
426# CONFIG_SGI_IOC4 is not set 745# CONFIG_SGI_IOC4 is not set
427# CONFIG_TIFM_CORE is not set 746# CONFIG_TIFM_CORE is not set
747# CONFIG_ACER_WMI is not set
748# CONFIG_ASUS_LAPTOP is not set
749# CONFIG_FUJITSU_LAPTOP is not set
750# CONFIG_MSI_LAPTOP is not set
428# CONFIG_SONY_LAPTOP is not set 751# CONFIG_SONY_LAPTOP is not set
429# CONFIG_THINKPAD_ACPI is not set 752# CONFIG_THINKPAD_ACPI is not set
430CONFIG_IDE=y 753# CONFIG_INTEL_MENLOW is not set
431CONFIG_BLK_DEV_IDE=y 754# CONFIG_ENCLOSURE_SERVICES is not set
432 755CONFIG_HAVE_IDE=y
433# 756# CONFIG_IDE is not set
434# Please see Documentation/ide.txt for help/info on IDE drives
435#
436# CONFIG_BLK_DEV_IDE_SATA is not set
437# CONFIG_BLK_DEV_HD_IDE is not set
438CONFIG_BLK_DEV_IDEDISK=y
439CONFIG_IDEDISK_MULTI_MODE=y
440CONFIG_BLK_DEV_IDECD=y
441# CONFIG_BLK_DEV_IDETAPE is not set
442# CONFIG_BLK_DEV_IDEFLOPPY is not set
443# CONFIG_BLK_DEV_IDESCSI is not set
444CONFIG_BLK_DEV_IDEACPI=y
445# CONFIG_IDE_TASK_IOCTL is not set
446CONFIG_IDE_PROC_FS=y
447
448#
449# IDE chipset support/bugfixes
450#
451CONFIG_IDE_GENERIC=y
452# CONFIG_BLK_DEV_CMD640 is not set
453# CONFIG_BLK_DEV_IDEPNP is not set
454CONFIG_BLK_DEV_IDEPCI=y
455# CONFIG_IDEPCI_SHARE_IRQ is not set
456CONFIG_IDEPCI_PCIBUS_ORDER=y
457# CONFIG_BLK_DEV_OFFBOARD is not set
458# CONFIG_BLK_DEV_GENERIC is not set
459# CONFIG_BLK_DEV_OPTI621 is not set
460# CONFIG_BLK_DEV_RZ1000 is not set
461CONFIG_BLK_DEV_IDEDMA_PCI=y
462# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
463# CONFIG_IDEDMA_ONLYDISK is not set
464# CONFIG_BLK_DEV_AEC62XX is not set
465# CONFIG_BLK_DEV_ALI15X3 is not set
466CONFIG_BLK_DEV_AMD74XX=y
467CONFIG_BLK_DEV_ATIIXP=y
468# CONFIG_BLK_DEV_CMD64X is not set
469# CONFIG_BLK_DEV_TRIFLEX is not set
470# CONFIG_BLK_DEV_CY82C693 is not set
471# CONFIG_BLK_DEV_CS5520 is not set
472# CONFIG_BLK_DEV_CS5530 is not set
473# CONFIG_BLK_DEV_HPT34X is not set
474# CONFIG_BLK_DEV_HPT366 is not set
475# CONFIG_BLK_DEV_JMICRON is not set
476# CONFIG_BLK_DEV_SC1200 is not set
477CONFIG_BLK_DEV_PIIX=y
478# CONFIG_BLK_DEV_IT8213 is not set
479# CONFIG_BLK_DEV_IT821X is not set
480# CONFIG_BLK_DEV_NS87415 is not set
481# CONFIG_BLK_DEV_PDC202XX_OLD is not set
482CONFIG_BLK_DEV_PDC202XX_NEW=y
483# CONFIG_BLK_DEV_SVWKS is not set
484# CONFIG_BLK_DEV_SIIMAGE is not set
485# CONFIG_BLK_DEV_SIS5513 is not set
486# CONFIG_BLK_DEV_SLC90E66 is not set
487# CONFIG_BLK_DEV_TRM290 is not set
488# CONFIG_BLK_DEV_VIA82CXXX is not set
489# CONFIG_BLK_DEV_TC86C001 is not set
490# CONFIG_IDE_ARM is not set
491CONFIG_BLK_DEV_IDEDMA=y
492# CONFIG_IDEDMA_IVB is not set
493# CONFIG_BLK_DEV_HD is not set
494 757
495# 758#
496# SCSI device support 759# SCSI device support
@@ -499,8 +762,8 @@ CONFIG_BLK_DEV_IDEDMA=y
499CONFIG_SCSI=y 762CONFIG_SCSI=y
500CONFIG_SCSI_DMA=y 763CONFIG_SCSI_DMA=y
501# CONFIG_SCSI_TGT is not set 764# CONFIG_SCSI_TGT is not set
502CONFIG_SCSI_NETLINK=y 765# CONFIG_SCSI_NETLINK is not set
503# CONFIG_SCSI_PROC_FS is not set 766CONFIG_SCSI_PROC_FS=y
504 767
505# 768#
506# SCSI support type (disk, tape, CD-ROM) 769# SCSI support type (disk, tape, CD-ROM)
@@ -509,7 +772,7 @@ CONFIG_BLK_DEV_SD=y
509# CONFIG_CHR_DEV_ST is not set 772# CONFIG_CHR_DEV_ST is not set
510# CONFIG_CHR_DEV_OSST is not set 773# CONFIG_CHR_DEV_OSST is not set
511CONFIG_BLK_DEV_SR=y 774CONFIG_BLK_DEV_SR=y
512# CONFIG_BLK_DEV_SR_VENDOR is not set 775CONFIG_BLK_DEV_SR_VENDOR=y
513CONFIG_CHR_DEV_SG=y 776CONFIG_CHR_DEV_SG=y
514# CONFIG_CHR_DEV_SCH is not set 777# CONFIG_CHR_DEV_SCH is not set
515 778
@@ -526,73 +789,37 @@ CONFIG_SCSI_WAIT_SCAN=m
526# SCSI Transports 789# SCSI Transports
527# 790#
528CONFIG_SCSI_SPI_ATTRS=y 791CONFIG_SCSI_SPI_ATTRS=y
529CONFIG_SCSI_FC_ATTRS=y 792# CONFIG_SCSI_FC_ATTRS is not set
530# CONFIG_SCSI_ISCSI_ATTRS is not set 793# CONFIG_SCSI_ISCSI_ATTRS is not set
531CONFIG_SCSI_SAS_ATTRS=y 794# CONFIG_SCSI_SAS_ATTRS is not set
532# CONFIG_SCSI_SAS_LIBSAS is not set 795# CONFIG_SCSI_SAS_LIBSAS is not set
533 796# CONFIG_SCSI_SRP_ATTRS is not set
534# 797# CONFIG_SCSI_LOWLEVEL is not set
535# SCSI low-level drivers 798# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
536#
537# CONFIG_ISCSI_TCP is not set
538# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
539# CONFIG_SCSI_3W_9XXX is not set
540# CONFIG_SCSI_ACARD is not set
541# CONFIG_SCSI_AACRAID is not set
542# CONFIG_SCSI_AIC7XXX is not set
543# CONFIG_SCSI_AIC7XXX_OLD is not set
544CONFIG_SCSI_AIC79XX=y
545CONFIG_AIC79XX_CMDS_PER_DEVICE=32
546CONFIG_AIC79XX_RESET_DELAY_MS=4000
547# CONFIG_AIC79XX_DEBUG_ENABLE is not set
548CONFIG_AIC79XX_DEBUG_MASK=0
549# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
550# CONFIG_SCSI_AIC94XX is not set
551# CONFIG_SCSI_ARCMSR is not set
552# CONFIG_MEGARAID_NEWGEN is not set
553# CONFIG_MEGARAID_LEGACY is not set
554# CONFIG_MEGARAID_SAS is not set
555# CONFIG_SCSI_HPTIOP is not set
556# CONFIG_SCSI_BUSLOGIC is not set
557# CONFIG_SCSI_DMX3191D is not set
558# CONFIG_SCSI_EATA is not set
559# CONFIG_SCSI_FUTURE_DOMAIN is not set
560# CONFIG_SCSI_GDTH is not set
561# CONFIG_SCSI_IPS is not set
562# CONFIG_SCSI_INITIO is not set
563# CONFIG_SCSI_INIA100 is not set
564# CONFIG_SCSI_STEX is not set
565# CONFIG_SCSI_SYM53C8XX_2 is not set
566# CONFIG_SCSI_IPR is not set
567# CONFIG_SCSI_QLOGIC_1280 is not set
568# CONFIG_SCSI_QLA_FC is not set
569# CONFIG_SCSI_QLA_ISCSI is not set
570# CONFIG_SCSI_LPFC is not set
571# CONFIG_SCSI_DC395x is not set
572# CONFIG_SCSI_DC390T is not set
573# CONFIG_SCSI_DEBUG is not set
574# CONFIG_SCSI_SRP is not set
575CONFIG_ATA=y 799CONFIG_ATA=y
576# CONFIG_ATA_NONSTANDARD is not set 800# CONFIG_ATA_NONSTANDARD is not set
577CONFIG_ATA_ACPI=y 801CONFIG_ATA_ACPI=y
802CONFIG_SATA_PMP=y
578CONFIG_SATA_AHCI=y 803CONFIG_SATA_AHCI=y
579CONFIG_SATA_SVW=y 804# CONFIG_SATA_SIL24 is not set
805CONFIG_ATA_SFF=y
806# CONFIG_SATA_SVW is not set
580CONFIG_ATA_PIIX=y 807CONFIG_ATA_PIIX=y
581# CONFIG_SATA_MV is not set 808# CONFIG_SATA_MV is not set
582CONFIG_SATA_NV=y 809# CONFIG_SATA_NV is not set
583# CONFIG_PDC_ADMA is not set 810# CONFIG_PDC_ADMA is not set
584# CONFIG_SATA_QSTOR is not set 811# CONFIG_SATA_QSTOR is not set
585# CONFIG_SATA_PROMISE is not set 812# CONFIG_SATA_PROMISE is not set
586# CONFIG_SATA_SX4 is not set 813# CONFIG_SATA_SX4 is not set
587CONFIG_SATA_SIL=y 814# CONFIG_SATA_SIL is not set
588# CONFIG_SATA_SIL24 is not set
589# CONFIG_SATA_SIS is not set 815# CONFIG_SATA_SIS is not set
590# CONFIG_SATA_ULI is not set 816# CONFIG_SATA_ULI is not set
591CONFIG_SATA_VIA=y 817# CONFIG_SATA_VIA is not set
592# CONFIG_SATA_VITESSE is not set 818# CONFIG_SATA_VITESSE is not set
593# CONFIG_SATA_INIC162X is not set 819# CONFIG_SATA_INIC162X is not set
820# CONFIG_PATA_ACPI is not set
594# CONFIG_PATA_ALI is not set 821# CONFIG_PATA_ALI is not set
595# CONFIG_PATA_AMD is not set 822CONFIG_PATA_AMD=y
596# CONFIG_PATA_ARTOP is not set 823# CONFIG_PATA_ARTOP is not set
597# CONFIG_PATA_ATIIXP is not set 824# CONFIG_PATA_ATIIXP is not set
598# CONFIG_PATA_CMD640_PCI is not set 825# CONFIG_PATA_CMD640_PCI is not set
@@ -612,11 +839,14 @@ CONFIG_SATA_VIA=y
612# CONFIG_PATA_TRIFLEX is not set 839# CONFIG_PATA_TRIFLEX is not set
613# CONFIG_PATA_MARVELL is not set 840# CONFIG_PATA_MARVELL is not set
614# CONFIG_PATA_MPIIX is not set 841# CONFIG_PATA_MPIIX is not set
615# CONFIG_PATA_OLDPIIX is not set 842CONFIG_PATA_OLDPIIX=y
616# CONFIG_PATA_NETCELL is not set 843# CONFIG_PATA_NETCELL is not set
844# CONFIG_PATA_NINJA32 is not set
617# CONFIG_PATA_NS87410 is not set 845# CONFIG_PATA_NS87410 is not set
846# CONFIG_PATA_NS87415 is not set
618# CONFIG_PATA_OPTI is not set 847# CONFIG_PATA_OPTI is not set
619# CONFIG_PATA_OPTIDMA is not set 848# CONFIG_PATA_OPTIDMA is not set
849# CONFIG_PATA_PCMCIA is not set
620# CONFIG_PATA_PDC_OLD is not set 850# CONFIG_PATA_PDC_OLD is not set
621# CONFIG_PATA_RADISYS is not set 851# CONFIG_PATA_RADISYS is not set
622# CONFIG_PATA_RZ1000 is not set 852# CONFIG_PATA_RZ1000 is not set
@@ -628,65 +858,42 @@ CONFIG_SATA_VIA=y
628# CONFIG_PATA_VIA is not set 858# CONFIG_PATA_VIA is not set
629# CONFIG_PATA_WINBOND is not set 859# CONFIG_PATA_WINBOND is not set
630CONFIG_MD=y 860CONFIG_MD=y
631# CONFIG_BLK_DEV_MD is not set 861CONFIG_BLK_DEV_MD=y
862# CONFIG_MD_LINEAR is not set
863# CONFIG_MD_RAID0 is not set
864# CONFIG_MD_RAID1 is not set
865# CONFIG_MD_RAID10 is not set
866# CONFIG_MD_RAID456 is not set
867# CONFIG_MD_MULTIPATH is not set
868# CONFIG_MD_FAULTY is not set
632CONFIG_BLK_DEV_DM=y 869CONFIG_BLK_DEV_DM=y
633# CONFIG_DM_DEBUG is not set 870# CONFIG_DM_DEBUG is not set
634# CONFIG_DM_CRYPT is not set 871# CONFIG_DM_CRYPT is not set
635# CONFIG_DM_SNAPSHOT is not set 872# CONFIG_DM_SNAPSHOT is not set
636# CONFIG_DM_MIRROR is not set 873CONFIG_DM_MIRROR=y
637# CONFIG_DM_ZERO is not set 874CONFIG_DM_ZERO=y
638# CONFIG_DM_MULTIPATH is not set 875# CONFIG_DM_MULTIPATH is not set
639# CONFIG_DM_DELAY is not set 876# CONFIG_DM_DELAY is not set
640 877# CONFIG_DM_UEVENT is not set
641# 878# CONFIG_FUSION is not set
642# Fusion MPT device support
643#
644CONFIG_FUSION=y
645CONFIG_FUSION_SPI=y
646# CONFIG_FUSION_FC is not set
647# CONFIG_FUSION_SAS is not set
648CONFIG_FUSION_MAX_SGE=128
649# CONFIG_FUSION_CTL is not set
650 879
651# 880#
652# IEEE 1394 (FireWire) support 881# IEEE 1394 (FireWire) support
653# 882#
654# CONFIG_FIREWIRE is not set 883# CONFIG_FIREWIRE is not set
655CONFIG_IEEE1394=y 884# CONFIG_IEEE1394 is not set
656
657#
658# Subsystem Options
659#
660# CONFIG_IEEE1394_VERBOSEDEBUG is not set
661
662#
663# Controllers
664#
665
666#
667# Texas Instruments PCILynx requires I2C
668#
669CONFIG_IEEE1394_OHCI1394=y
670
671#
672# Protocols
673#
674# CONFIG_IEEE1394_VIDEO1394 is not set
675# CONFIG_IEEE1394_SBP2 is not set
676# CONFIG_IEEE1394_ETH1394_ROM_ENTRY is not set
677# CONFIG_IEEE1394_ETH1394 is not set
678# CONFIG_IEEE1394_DV1394 is not set
679CONFIG_IEEE1394_RAWIO=y
680# CONFIG_I2O is not set 885# CONFIG_I2O is not set
681CONFIG_MACINTOSH_DRIVERS=y 886CONFIG_MACINTOSH_DRIVERS=y
682# CONFIG_MAC_EMUMOUSEBTN is not set 887CONFIG_MAC_EMUMOUSEBTN=y
683CONFIG_NETDEVICES=y 888CONFIG_NETDEVICES=y
684CONFIG_NETDEVICES_MULTIQUEUE=y 889# CONFIG_NETDEVICES_MULTIQUEUE is not set
890# CONFIG_IFB is not set
685# CONFIG_DUMMY is not set 891# CONFIG_DUMMY is not set
686# CONFIG_BONDING is not set 892# CONFIG_BONDING is not set
687# CONFIG_MACVLAN is not set 893# CONFIG_MACVLAN is not set
688# CONFIG_EQUALIZER is not set 894# CONFIG_EQUALIZER is not set
689CONFIG_TUN=y 895# CONFIG_TUN is not set
896# CONFIG_VETH is not set
690# CONFIG_NET_SB1000 is not set 897# CONFIG_NET_SB1000 is not set
691# CONFIG_ARCNET is not set 898# CONFIG_ARCNET is not set
692# CONFIG_PHYLIB is not set 899# CONFIG_PHYLIB is not set
@@ -696,39 +903,40 @@ CONFIG_MII=y
696# CONFIG_SUNGEM is not set 903# CONFIG_SUNGEM is not set
697# CONFIG_CASSINI is not set 904# CONFIG_CASSINI is not set
698CONFIG_NET_VENDOR_3COM=y 905CONFIG_NET_VENDOR_3COM=y
699CONFIG_VORTEX=y 906# CONFIG_VORTEX is not set
700# CONFIG_TYPHOON is not set 907# CONFIG_TYPHOON is not set
701CONFIG_NET_TULIP=y 908CONFIG_NET_TULIP=y
702# CONFIG_DE2104X is not set 909# CONFIG_DE2104X is not set
703CONFIG_TULIP=y 910# CONFIG_TULIP is not set
704# CONFIG_TULIP_MWI is not set
705# CONFIG_TULIP_MMIO is not set
706# CONFIG_TULIP_NAPI is not set
707# CONFIG_DE4X5 is not set 911# CONFIG_DE4X5 is not set
708# CONFIG_WINBOND_840 is not set 912# CONFIG_WINBOND_840 is not set
709# CONFIG_DM9102 is not set 913# CONFIG_DM9102 is not set
710# CONFIG_ULI526X is not set 914# CONFIG_ULI526X is not set
915# CONFIG_PCMCIA_XIRCOM is not set
711# CONFIG_HP100 is not set 916# CONFIG_HP100 is not set
917# CONFIG_IBM_NEW_EMAC_ZMII is not set
918# CONFIG_IBM_NEW_EMAC_RGMII is not set
919# CONFIG_IBM_NEW_EMAC_TAH is not set
920# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
712CONFIG_NET_PCI=y 921CONFIG_NET_PCI=y
713# CONFIG_PCNET32 is not set 922# CONFIG_PCNET32 is not set
714CONFIG_AMD8111_ETH=y 923# CONFIG_AMD8111_ETH is not set
715# CONFIG_AMD8111E_NAPI is not set
716# CONFIG_ADAPTEC_STARFIRE is not set 924# CONFIG_ADAPTEC_STARFIRE is not set
717CONFIG_B44=y 925# CONFIG_B44 is not set
718CONFIG_FORCEDETH=y 926CONFIG_FORCEDETH=y
719# CONFIG_FORCEDETH_NAPI is not set 927# CONFIG_FORCEDETH_NAPI is not set
720# CONFIG_DGRS is not set
721# CONFIG_EEPRO100 is not set 928# CONFIG_EEPRO100 is not set
722CONFIG_E100=y 929CONFIG_E100=y
723# CONFIG_FEALNX is not set 930# CONFIG_FEALNX is not set
724# CONFIG_NATSEMI is not set 931# CONFIG_NATSEMI is not set
725# CONFIG_NE2K_PCI is not set 932# CONFIG_NE2K_PCI is not set
726CONFIG_8139CP=y 933# CONFIG_8139CP is not set
727CONFIG_8139TOO=y 934CONFIG_8139TOO=y
728# CONFIG_8139TOO_PIO is not set 935CONFIG_8139TOO_PIO=y
729# CONFIG_8139TOO_TUNE_TWISTER is not set 936# CONFIG_8139TOO_TUNE_TWISTER is not set
730# CONFIG_8139TOO_8129 is not set 937# CONFIG_8139TOO_8129 is not set
731# CONFIG_8139_OLD_RX_RESET is not set 938# CONFIG_8139_OLD_RX_RESET is not set
939# CONFIG_R6040 is not set
732# CONFIG_SIS900 is not set 940# CONFIG_SIS900 is not set
733# CONFIG_EPIC100 is not set 941# CONFIG_EPIC100 is not set
734# CONFIG_SUNDANCE is not set 942# CONFIG_SUNDANCE is not set
@@ -740,34 +948,74 @@ CONFIG_NETDEV_1000=y
740CONFIG_E1000=y 948CONFIG_E1000=y
741# CONFIG_E1000_NAPI is not set 949# CONFIG_E1000_NAPI is not set
742# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 950# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
951# CONFIG_E1000E is not set
952# CONFIG_E1000E_ENABLED is not set
953# CONFIG_IP1000 is not set
954# CONFIG_IGB is not set
743# CONFIG_NS83820 is not set 955# CONFIG_NS83820 is not set
744# CONFIG_HAMACHI is not set 956# CONFIG_HAMACHI is not set
745# CONFIG_YELLOWFIN is not set 957# CONFIG_YELLOWFIN is not set
746# CONFIG_R8169 is not set 958# CONFIG_R8169 is not set
747# CONFIG_SIS190 is not set 959# CONFIG_SIS190 is not set
748# CONFIG_SKGE is not set 960# CONFIG_SKGE is not set
749# CONFIG_SKY2 is not set 961CONFIG_SKY2=y
962# CONFIG_SKY2_DEBUG is not set
750# CONFIG_VIA_VELOCITY is not set 963# CONFIG_VIA_VELOCITY is not set
751CONFIG_TIGON3=y 964CONFIG_TIGON3=y
752CONFIG_BNX2=y 965# CONFIG_BNX2 is not set
753# CONFIG_QLA3XXX is not set 966# CONFIG_QLA3XXX is not set
754# CONFIG_ATL1 is not set 967# CONFIG_ATL1 is not set
755CONFIG_NETDEV_10000=y 968CONFIG_NETDEV_10000=y
756# CONFIG_CHELSIO_T1 is not set 969# CONFIG_CHELSIO_T1 is not set
757# CONFIG_CHELSIO_T3 is not set 970# CONFIG_CHELSIO_T3 is not set
971# CONFIG_IXGBE is not set
758# CONFIG_IXGB is not set 972# CONFIG_IXGB is not set
759CONFIG_S2IO=m 973# CONFIG_S2IO is not set
760# CONFIG_S2IO_NAPI is not set
761# CONFIG_MYRI10GE is not set 974# CONFIG_MYRI10GE is not set
762# CONFIG_NETXEN_NIC is not set 975# CONFIG_NETXEN_NIC is not set
976# CONFIG_NIU is not set
763# CONFIG_MLX4_CORE is not set 977# CONFIG_MLX4_CORE is not set
764# CONFIG_TR is not set 978# CONFIG_TEHUTI is not set
979# CONFIG_BNX2X is not set
980# CONFIG_SFC is not set
981CONFIG_TR=y
982# CONFIG_IBMOL is not set
983# CONFIG_3C359 is not set
984# CONFIG_TMS380TR is not set
765 985
766# 986#
767# Wireless LAN 987# Wireless LAN
768# 988#
769# CONFIG_WLAN_PRE80211 is not set 989# CONFIG_WLAN_PRE80211 is not set
770# CONFIG_WLAN_80211 is not set 990CONFIG_WLAN_80211=y
991# CONFIG_PCMCIA_RAYCS is not set
992# CONFIG_IPW2100 is not set
993# CONFIG_IPW2200 is not set
994# CONFIG_LIBERTAS is not set
995# CONFIG_AIRO is not set
996# CONFIG_HERMES is not set
997# CONFIG_ATMEL is not set
998# CONFIG_AIRO_CS is not set
999# CONFIG_PCMCIA_WL3501 is not set
1000# CONFIG_PRISM54 is not set
1001# CONFIG_USB_ZD1201 is not set
1002# CONFIG_USB_NET_RNDIS_WLAN is not set
1003# CONFIG_RTL8180 is not set
1004# CONFIG_RTL8187 is not set
1005# CONFIG_ADM8211 is not set
1006# CONFIG_P54_COMMON is not set
1007CONFIG_ATH5K=y
1008# CONFIG_ATH5K_DEBUG is not set
1009# CONFIG_IWLWIFI is not set
1010# CONFIG_IWLCORE is not set
1011# CONFIG_IWLWIFI_LEDS is not set
1012# CONFIG_IWL4965 is not set
1013# CONFIG_IWL3945 is not set
1014# CONFIG_HOSTAP is not set
1015# CONFIG_B43 is not set
1016# CONFIG_B43LEGACY is not set
1017# CONFIG_ZD1211RW is not set
1018# CONFIG_RT2X00 is not set
771 1019
772# 1020#
773# USB Network Adapters 1021# USB Network Adapters
@@ -776,16 +1024,26 @@ CONFIG_S2IO=m
776# CONFIG_USB_KAWETH is not set 1024# CONFIG_USB_KAWETH is not set
777# CONFIG_USB_PEGASUS is not set 1025# CONFIG_USB_PEGASUS is not set
778# CONFIG_USB_RTL8150 is not set 1026# CONFIG_USB_RTL8150 is not set
779# CONFIG_USB_USBNET_MII is not set
780# CONFIG_USB_USBNET is not set 1027# CONFIG_USB_USBNET is not set
1028CONFIG_NET_PCMCIA=y
1029# CONFIG_PCMCIA_3C589 is not set
1030# CONFIG_PCMCIA_3C574 is not set
1031# CONFIG_PCMCIA_FMVJ18X is not set
1032# CONFIG_PCMCIA_PCNET is not set
1033# CONFIG_PCMCIA_NMCLAN is not set
1034# CONFIG_PCMCIA_SMC91C92 is not set
1035# CONFIG_PCMCIA_XIRC2PS is not set
1036# CONFIG_PCMCIA_AXNET is not set
781# CONFIG_WAN is not set 1037# CONFIG_WAN is not set
782# CONFIG_FDDI is not set 1038CONFIG_FDDI=y
1039# CONFIG_DEFXX is not set
1040# CONFIG_SKFP is not set
783# CONFIG_HIPPI is not set 1041# CONFIG_HIPPI is not set
784# CONFIG_PPP is not set 1042# CONFIG_PPP is not set
785# CONFIG_SLIP is not set 1043# CONFIG_SLIP is not set
786# CONFIG_NET_FC is not set 1044# CONFIG_NET_FC is not set
787# CONFIG_SHAPER is not set
788CONFIG_NETCONSOLE=y 1045CONFIG_NETCONSOLE=y
1046# CONFIG_NETCONSOLE_DYNAMIC is not set
789CONFIG_NETPOLL=y 1047CONFIG_NETPOLL=y
790# CONFIG_NETPOLL_TRAP is not set 1048# CONFIG_NETPOLL_TRAP is not set
791CONFIG_NET_POLL_CONTROLLER=y 1049CONFIG_NET_POLL_CONTROLLER=y
@@ -796,18 +1054,17 @@ CONFIG_NET_POLL_CONTROLLER=y
796# Input device support 1054# Input device support
797# 1055#
798CONFIG_INPUT=y 1056CONFIG_INPUT=y
799# CONFIG_INPUT_FF_MEMLESS is not set 1057CONFIG_INPUT_FF_MEMLESS=y
800# CONFIG_INPUT_POLLDEV is not set 1058CONFIG_INPUT_POLLDEV=y
801 1059
802# 1060#
803# Userland interfaces 1061# Userland interfaces
804# 1062#
805CONFIG_INPUT_MOUSEDEV=y 1063CONFIG_INPUT_MOUSEDEV=y
806CONFIG_INPUT_MOUSEDEV_PSAUX=y 1064# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
807CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 1065CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
808CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 1066CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
809# CONFIG_INPUT_JOYDEV is not set 1067# CONFIG_INPUT_JOYDEV is not set
810# CONFIG_INPUT_TSDEV is not set
811CONFIG_INPUT_EVDEV=y 1068CONFIG_INPUT_EVDEV=y
812# CONFIG_INPUT_EVBUG is not set 1069# CONFIG_INPUT_EVBUG is not set
813 1070
@@ -832,17 +1089,62 @@ CONFIG_MOUSE_PS2_TRACKPOINT=y
832# CONFIG_MOUSE_SERIAL is not set 1089# CONFIG_MOUSE_SERIAL is not set
833# CONFIG_MOUSE_APPLETOUCH is not set 1090# CONFIG_MOUSE_APPLETOUCH is not set
834# CONFIG_MOUSE_VSXXXAA is not set 1091# CONFIG_MOUSE_VSXXXAA is not set
835# CONFIG_INPUT_JOYSTICK is not set 1092CONFIG_INPUT_JOYSTICK=y
836# CONFIG_INPUT_TABLET is not set 1093# CONFIG_JOYSTICK_ANALOG is not set
837# CONFIG_INPUT_TOUCHSCREEN is not set 1094# CONFIG_JOYSTICK_A3D is not set
838# CONFIG_INPUT_MISC is not set 1095# CONFIG_JOYSTICK_ADI is not set
1096# CONFIG_JOYSTICK_COBRA is not set
1097# CONFIG_JOYSTICK_GF2K is not set
1098# CONFIG_JOYSTICK_GRIP is not set
1099# CONFIG_JOYSTICK_GRIP_MP is not set
1100# CONFIG_JOYSTICK_GUILLEMOT is not set
1101# CONFIG_JOYSTICK_INTERACT is not set
1102# CONFIG_JOYSTICK_SIDEWINDER is not set
1103# CONFIG_JOYSTICK_TMDC is not set
1104# CONFIG_JOYSTICK_IFORCE is not set
1105# CONFIG_JOYSTICK_WARRIOR is not set
1106# CONFIG_JOYSTICK_MAGELLAN is not set
1107# CONFIG_JOYSTICK_SPACEORB is not set
1108# CONFIG_JOYSTICK_SPACEBALL is not set
1109# CONFIG_JOYSTICK_STINGER is not set
1110# CONFIG_JOYSTICK_TWIDJOY is not set
1111# CONFIG_JOYSTICK_ZHENHUA is not set
1112# CONFIG_JOYSTICK_JOYDUMP is not set
1113# CONFIG_JOYSTICK_XPAD is not set
1114CONFIG_INPUT_TABLET=y
1115# CONFIG_TABLET_USB_ACECAD is not set
1116# CONFIG_TABLET_USB_AIPTEK is not set
1117# CONFIG_TABLET_USB_GTCO is not set
1118# CONFIG_TABLET_USB_KBTAB is not set
1119# CONFIG_TABLET_USB_WACOM is not set
1120CONFIG_INPUT_TOUCHSCREEN=y
1121# CONFIG_TOUCHSCREEN_FUJITSU is not set
1122# CONFIG_TOUCHSCREEN_GUNZE is not set
1123# CONFIG_TOUCHSCREEN_ELO is not set
1124# CONFIG_TOUCHSCREEN_MTOUCH is not set
1125# CONFIG_TOUCHSCREEN_MK712 is not set
1126# CONFIG_TOUCHSCREEN_PENMOUNT is not set
1127# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
1128# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
1129# CONFIG_TOUCHSCREEN_UCB1400 is not set
1130# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
1131CONFIG_INPUT_MISC=y
1132# CONFIG_INPUT_PCSPKR is not set
1133# CONFIG_INPUT_APANEL is not set
1134# CONFIG_INPUT_ATLAS_BTNS is not set
1135# CONFIG_INPUT_ATI_REMOTE is not set
1136# CONFIG_INPUT_ATI_REMOTE2 is not set
1137# CONFIG_INPUT_KEYSPAN_REMOTE is not set
1138# CONFIG_INPUT_POWERMATE is not set
1139# CONFIG_INPUT_YEALINK is not set
1140# CONFIG_INPUT_UINPUT is not set
839 1141
840# 1142#
841# Hardware I/O ports 1143# Hardware I/O ports
842# 1144#
843CONFIG_SERIO=y 1145CONFIG_SERIO=y
844CONFIG_SERIO_I8042=y 1146CONFIG_SERIO_I8042=y
845# CONFIG_SERIO_SERPORT is not set 1147CONFIG_SERIO_SERPORT=y
846# CONFIG_SERIO_CT82C710 is not set 1148# CONFIG_SERIO_CT82C710 is not set
847# CONFIG_SERIO_PCIPS2 is not set 1149# CONFIG_SERIO_PCIPS2 is not set
848CONFIG_SERIO_LIBPS2=y 1150CONFIG_SERIO_LIBPS2=y
@@ -855,8 +1157,26 @@ CONFIG_SERIO_LIBPS2=y
855CONFIG_VT=y 1157CONFIG_VT=y
856CONFIG_VT_CONSOLE=y 1158CONFIG_VT_CONSOLE=y
857CONFIG_HW_CONSOLE=y 1159CONFIG_HW_CONSOLE=y
858# CONFIG_VT_HW_CONSOLE_BINDING is not set 1160CONFIG_VT_HW_CONSOLE_BINDING=y
859# CONFIG_SERIAL_NONSTANDARD is not set 1161CONFIG_DEVKMEM=y
1162CONFIG_SERIAL_NONSTANDARD=y
1163# CONFIG_COMPUTONE is not set
1164# CONFIG_ROCKETPORT is not set
1165# CONFIG_CYCLADES is not set
1166# CONFIG_DIGIEPCA is not set
1167# CONFIG_MOXA_INTELLIO is not set
1168# CONFIG_MOXA_SMARTIO is not set
1169# CONFIG_ISI is not set
1170# CONFIG_SYNCLINK is not set
1171# CONFIG_SYNCLINKMP is not set
1172# CONFIG_SYNCLINK_GT is not set
1173# CONFIG_N_HDLC is not set
1174# CONFIG_RISCOM8 is not set
1175# CONFIG_SPECIALIX is not set
1176# CONFIG_SX is not set
1177# CONFIG_RIO is not set
1178# CONFIG_STALDRV is not set
1179# CONFIG_NOZOMI is not set
860 1180
861# 1181#
862# Serial drivers 1182# Serial drivers
@@ -866,9 +1186,14 @@ CONFIG_SERIAL_8250_CONSOLE=y
866CONFIG_FIX_EARLYCON_MEM=y 1186CONFIG_FIX_EARLYCON_MEM=y
867CONFIG_SERIAL_8250_PCI=y 1187CONFIG_SERIAL_8250_PCI=y
868CONFIG_SERIAL_8250_PNP=y 1188CONFIG_SERIAL_8250_PNP=y
869CONFIG_SERIAL_8250_NR_UARTS=4 1189# CONFIG_SERIAL_8250_CS is not set
1190CONFIG_SERIAL_8250_NR_UARTS=32
870CONFIG_SERIAL_8250_RUNTIME_UARTS=4 1191CONFIG_SERIAL_8250_RUNTIME_UARTS=4
871# CONFIG_SERIAL_8250_EXTENDED is not set 1192CONFIG_SERIAL_8250_EXTENDED=y
1193CONFIG_SERIAL_8250_MANY_PORTS=y
1194CONFIG_SERIAL_8250_SHARE_IRQ=y
1195CONFIG_SERIAL_8250_DETECT_IRQ=y
1196CONFIG_SERIAL_8250_RSA=y
872 1197
873# 1198#
874# Non-8250 serial port support 1199# Non-8250 serial port support
@@ -877,78 +1202,260 @@ CONFIG_SERIAL_CORE=y
877CONFIG_SERIAL_CORE_CONSOLE=y 1202CONFIG_SERIAL_CORE_CONSOLE=y
878# CONFIG_SERIAL_JSM is not set 1203# CONFIG_SERIAL_JSM is not set
879CONFIG_UNIX98_PTYS=y 1204CONFIG_UNIX98_PTYS=y
880CONFIG_LEGACY_PTYS=y 1205# CONFIG_LEGACY_PTYS is not set
881CONFIG_LEGACY_PTY_COUNT=256
882# CONFIG_IPMI_HANDLER is not set 1206# CONFIG_IPMI_HANDLER is not set
883# CONFIG_WATCHDOG is not set
884CONFIG_HW_RANDOM=y 1207CONFIG_HW_RANDOM=y
885CONFIG_HW_RANDOM_INTEL=y 1208# CONFIG_HW_RANDOM_INTEL is not set
886CONFIG_HW_RANDOM_AMD=y 1209# CONFIG_HW_RANDOM_AMD is not set
887# CONFIG_NVRAM is not set 1210CONFIG_NVRAM=y
888CONFIG_RTC=y
889# CONFIG_R3964 is not set 1211# CONFIG_R3964 is not set
890# CONFIG_APPLICOM is not set 1212# CONFIG_APPLICOM is not set
891CONFIG_AGP=y 1213
892CONFIG_AGP_AMD64=y 1214#
893CONFIG_AGP_INTEL=y 1215# PCMCIA character devices
894# CONFIG_AGP_SIS is not set 1216#
895# CONFIG_AGP_VIA is not set 1217# CONFIG_SYNCLINK_CS is not set
896# CONFIG_DRM is not set 1218# CONFIG_CARDMAN_4000 is not set
1219# CONFIG_CARDMAN_4040 is not set
1220# CONFIG_IPWIRELESS is not set
897# CONFIG_MWAVE is not set 1221# CONFIG_MWAVE is not set
898# CONFIG_PC8736x_GPIO is not set 1222# CONFIG_PC8736x_GPIO is not set
899CONFIG_RAW_DRIVER=y 1223# CONFIG_RAW_DRIVER is not set
900CONFIG_MAX_RAW_DEVS=256
901CONFIG_HPET=y 1224CONFIG_HPET=y
902# CONFIG_HPET_RTC_IRQ is not set 1225# CONFIG_HPET_RTC_IRQ is not set
903CONFIG_HPET_MMAP=y 1226# CONFIG_HPET_MMAP is not set
904# CONFIG_HANGCHECK_TIMER is not set 1227# CONFIG_HANGCHECK_TIMER is not set
905# CONFIG_TCG_TPM is not set 1228# CONFIG_TCG_TPM is not set
906# CONFIG_TELCLOCK is not set 1229# CONFIG_TELCLOCK is not set
907CONFIG_DEVPORT=y 1230CONFIG_DEVPORT=y
908# CONFIG_I2C is not set 1231CONFIG_I2C=y
909 1232CONFIG_I2C_BOARDINFO=y
910# 1233# CONFIG_I2C_CHARDEV is not set
911# SPI support 1234
912# 1235#
1236# I2C Hardware Bus support
1237#
1238# CONFIG_I2C_ALI1535 is not set
1239# CONFIG_I2C_ALI1563 is not set
1240# CONFIG_I2C_ALI15X3 is not set
1241# CONFIG_I2C_AMD756 is not set
1242# CONFIG_I2C_AMD8111 is not set
1243CONFIG_I2C_I801=y
1244# CONFIG_I2C_I810 is not set
1245# CONFIG_I2C_PIIX4 is not set
1246# CONFIG_I2C_NFORCE2 is not set
1247# CONFIG_I2C_OCORES is not set
1248# CONFIG_I2C_PARPORT_LIGHT is not set
1249# CONFIG_I2C_PROSAVAGE is not set
1250# CONFIG_I2C_SAVAGE4 is not set
1251# CONFIG_I2C_SIMTEC is not set
1252# CONFIG_I2C_SIS5595 is not set
1253# CONFIG_I2C_SIS630 is not set
1254# CONFIG_I2C_SIS96X is not set
1255# CONFIG_I2C_TAOS_EVM is not set
1256# CONFIG_I2C_STUB is not set
1257# CONFIG_I2C_TINY_USB is not set
1258# CONFIG_I2C_VIA is not set
1259# CONFIG_I2C_VIAPRO is not set
1260# CONFIG_I2C_VOODOO3 is not set
1261# CONFIG_I2C_PCA_PLATFORM is not set
1262
1263#
1264# Miscellaneous I2C Chip support
1265#
1266# CONFIG_DS1682 is not set
1267# CONFIG_SENSORS_EEPROM is not set
1268# CONFIG_SENSORS_PCF8574 is not set
1269# CONFIG_PCF8575 is not set
1270# CONFIG_SENSORS_PCF8591 is not set
1271# CONFIG_SENSORS_MAX6875 is not set
1272# CONFIG_SENSORS_TSL2550 is not set
1273# CONFIG_I2C_DEBUG_CORE is not set
1274# CONFIG_I2C_DEBUG_ALGO is not set
1275# CONFIG_I2C_DEBUG_BUS is not set
1276# CONFIG_I2C_DEBUG_CHIP is not set
913# CONFIG_SPI is not set 1277# CONFIG_SPI is not set
914# CONFIG_SPI_MASTER is not set
915# CONFIG_W1 is not set 1278# CONFIG_W1 is not set
916# CONFIG_POWER_SUPPLY is not set 1279CONFIG_POWER_SUPPLY=y
1280# CONFIG_POWER_SUPPLY_DEBUG is not set
1281# CONFIG_PDA_POWER is not set
1282# CONFIG_BATTERY_DS2760 is not set
917# CONFIG_HWMON is not set 1283# CONFIG_HWMON is not set
1284CONFIG_THERMAL=y
1285CONFIG_WATCHDOG=y
1286# CONFIG_WATCHDOG_NOWAYOUT is not set
1287
1288#
1289# Watchdog Device Drivers
1290#
1291# CONFIG_SOFT_WATCHDOG is not set
1292# CONFIG_ACQUIRE_WDT is not set
1293# CONFIG_ADVANTECH_WDT is not set
1294# CONFIG_ALIM1535_WDT is not set
1295# CONFIG_ALIM7101_WDT is not set
1296# CONFIG_SC520_WDT is not set
1297# CONFIG_EUROTECH_WDT is not set
1298# CONFIG_IB700_WDT is not set
1299# CONFIG_IBMASR is not set
1300# CONFIG_WAFER_WDT is not set
1301# CONFIG_I6300ESB_WDT is not set
1302# CONFIG_ITCO_WDT is not set
1303# CONFIG_IT8712F_WDT is not set
1304# CONFIG_HP_WATCHDOG is not set
1305# CONFIG_SC1200_WDT is not set
1306# CONFIG_PC87413_WDT is not set
1307# CONFIG_60XX_WDT is not set
1308# CONFIG_SBC8360_WDT is not set
1309# CONFIG_CPU5_WDT is not set
1310# CONFIG_SMSC37B787_WDT is not set
1311# CONFIG_W83627HF_WDT is not set
1312# CONFIG_W83697HF_WDT is not set
1313# CONFIG_W83877F_WDT is not set
1314# CONFIG_W83977F_WDT is not set
1315# CONFIG_MACHZ_WDT is not set
1316# CONFIG_SBC_EPX_C3_WATCHDOG is not set
1317
1318#
1319# PCI-based Watchdog Cards
1320#
1321# CONFIG_PCIPCWATCHDOG is not set
1322# CONFIG_WDTPCI is not set
1323
1324#
1325# USB-based Watchdog Cards
1326#
1327# CONFIG_USBPCWATCHDOG is not set
1328
1329#
1330# Sonics Silicon Backplane
1331#
1332CONFIG_SSB_POSSIBLE=y
1333# CONFIG_SSB is not set
918 1334
919# 1335#
920# Multifunction device drivers 1336# Multifunction device drivers
921# 1337#
922# CONFIG_MFD_SM501 is not set 1338# CONFIG_MFD_SM501 is not set
1339# CONFIG_HTC_PASIC3 is not set
923 1340
924# 1341#
925# Multimedia devices 1342# Multimedia devices
926# 1343#
1344
1345#
1346# Multimedia core support
1347#
927# CONFIG_VIDEO_DEV is not set 1348# CONFIG_VIDEO_DEV is not set
928# CONFIG_DVB_CORE is not set 1349# CONFIG_DVB_CORE is not set
1350
1351#
1352# Multimedia drivers
1353#
929CONFIG_DAB=y 1354CONFIG_DAB=y
930# CONFIG_USB_DABUSB is not set 1355# CONFIG_USB_DABUSB is not set
931 1356
932# 1357#
933# Graphics support 1358# Graphics support
934# 1359#
935# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1360CONFIG_AGP=y
1361CONFIG_AGP_AMD64=y
1362CONFIG_AGP_INTEL=y
1363# CONFIG_AGP_SIS is not set
1364# CONFIG_AGP_VIA is not set
1365CONFIG_DRM=y
1366# CONFIG_DRM_TDFX is not set
1367# CONFIG_DRM_R128 is not set
1368# CONFIG_DRM_RADEON is not set
1369# CONFIG_DRM_I810 is not set
1370# CONFIG_DRM_I830 is not set
1371CONFIG_DRM_I915=y
1372# CONFIG_DRM_MGA is not set
1373# CONFIG_DRM_SIS is not set
1374# CONFIG_DRM_VIA is not set
1375# CONFIG_DRM_SAVAGE is not set
1376# CONFIG_VGASTATE is not set
1377# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1378CONFIG_FB=y
1379# CONFIG_FIRMWARE_EDID is not set
1380# CONFIG_FB_DDC is not set
1381CONFIG_FB_CFB_FILLRECT=y
1382CONFIG_FB_CFB_COPYAREA=y
1383CONFIG_FB_CFB_IMAGEBLIT=y
1384# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1385# CONFIG_FB_SYS_FILLRECT is not set
1386# CONFIG_FB_SYS_COPYAREA is not set
1387# CONFIG_FB_SYS_IMAGEBLIT is not set
1388# CONFIG_FB_FOREIGN_ENDIAN is not set
1389# CONFIG_FB_SYS_FOPS is not set
1390CONFIG_FB_DEFERRED_IO=y
1391# CONFIG_FB_SVGALIB is not set
1392# CONFIG_FB_MACMODES is not set
1393# CONFIG_FB_BACKLIGHT is not set
1394CONFIG_FB_MODE_HELPERS=y
1395CONFIG_FB_TILEBLITTING=y
1396
1397#
1398# Frame buffer hardware drivers
1399#
1400# CONFIG_FB_CIRRUS is not set
1401# CONFIG_FB_PM2 is not set
1402# CONFIG_FB_CYBER2000 is not set
1403# CONFIG_FB_ARC is not set
1404# CONFIG_FB_ASILIANT is not set
1405# CONFIG_FB_IMSTT is not set
1406# CONFIG_FB_VGA16 is not set
1407# CONFIG_FB_UVESA is not set
1408# CONFIG_FB_VESA is not set
1409CONFIG_FB_EFI=y
1410# CONFIG_FB_IMAC is not set
1411# CONFIG_FB_N411 is not set
1412# CONFIG_FB_HGA is not set
1413# CONFIG_FB_S1D13XXX is not set
1414# CONFIG_FB_NVIDIA is not set
1415# CONFIG_FB_RIVA is not set
1416# CONFIG_FB_LE80578 is not set
1417# CONFIG_FB_INTEL is not set
1418# CONFIG_FB_MATROX is not set
1419# CONFIG_FB_RADEON is not set
1420# CONFIG_FB_ATY128 is not set
1421# CONFIG_FB_ATY is not set
1422# CONFIG_FB_S3 is not set
1423# CONFIG_FB_SAVAGE is not set
1424# CONFIG_FB_SIS is not set
1425# CONFIG_FB_NEOMAGIC is not set
1426# CONFIG_FB_KYRO is not set
1427# CONFIG_FB_3DFX is not set
1428# CONFIG_FB_VOODOO1 is not set
1429# CONFIG_FB_VT8623 is not set
1430# CONFIG_FB_TRIDENT is not set
1431# CONFIG_FB_ARK is not set
1432# CONFIG_FB_PM3 is not set
1433# CONFIG_FB_GEODE is not set
1434# CONFIG_FB_VIRTUAL is not set
1435CONFIG_BACKLIGHT_LCD_SUPPORT=y
1436# CONFIG_LCD_CLASS_DEVICE is not set
1437CONFIG_BACKLIGHT_CLASS_DEVICE=y
1438# CONFIG_BACKLIGHT_CORGI is not set
1439# CONFIG_BACKLIGHT_PROGEAR is not set
936 1440
937# 1441#
938# Display device support 1442# Display device support
939# 1443#
940# CONFIG_DISPLAY_SUPPORT is not set 1444# CONFIG_DISPLAY_SUPPORT is not set
941# CONFIG_VGASTATE is not set
942# CONFIG_FB is not set
943 1445
944# 1446#
945# Console display driver support 1447# Console display driver support
946# 1448#
947CONFIG_VGA_CONSOLE=y 1449CONFIG_VGA_CONSOLE=y
948CONFIG_VGACON_SOFT_SCROLLBACK=y 1450CONFIG_VGACON_SOFT_SCROLLBACK=y
949CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=256 1451CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
950CONFIG_VIDEO_SELECT=y 1452CONFIG_VIDEO_SELECT=y
951CONFIG_DUMMY_CONSOLE=y 1453CONFIG_DUMMY_CONSOLE=y
1454# CONFIG_FRAMEBUFFER_CONSOLE is not set
1455CONFIG_LOGO=y
1456# CONFIG_LOGO_LINUX_MONO is not set
1457# CONFIG_LOGO_LINUX_VGA16 is not set
1458CONFIG_LOGO_LINUX_CLUT224=y
952 1459
953# 1460#
954# Sound 1461# Sound
@@ -958,33 +1465,165 @@ CONFIG_SOUND=y
958# 1465#
959# Advanced Linux Sound Architecture 1466# Advanced Linux Sound Architecture
960# 1467#
961# CONFIG_SND is not set 1468CONFIG_SND=y
1469CONFIG_SND_TIMER=y
1470CONFIG_SND_PCM=y
1471CONFIG_SND_HWDEP=y
1472CONFIG_SND_SEQUENCER=y
1473CONFIG_SND_SEQ_DUMMY=y
1474CONFIG_SND_OSSEMUL=y
1475CONFIG_SND_MIXER_OSS=y
1476CONFIG_SND_PCM_OSS=y
1477CONFIG_SND_PCM_OSS_PLUGINS=y
1478CONFIG_SND_SEQUENCER_OSS=y
1479CONFIG_SND_DYNAMIC_MINORS=y
1480CONFIG_SND_SUPPORT_OLD_API=y
1481CONFIG_SND_VERBOSE_PROCFS=y
1482# CONFIG_SND_VERBOSE_PRINTK is not set
1483# CONFIG_SND_DEBUG is not set
1484CONFIG_SND_VMASTER=y
1485
1486#
1487# Generic devices
1488#
1489# CONFIG_SND_PCSP is not set
1490# CONFIG_SND_DUMMY is not set
1491# CONFIG_SND_VIRMIDI is not set
1492# CONFIG_SND_MTPAV is not set
1493# CONFIG_SND_SERIAL_U16550 is not set
1494# CONFIG_SND_MPU401 is not set
1495
1496#
1497# PCI devices
1498#
1499# CONFIG_SND_AD1889 is not set
1500# CONFIG_SND_ALS300 is not set
1501# CONFIG_SND_ALS4000 is not set
1502# CONFIG_SND_ALI5451 is not set
1503# CONFIG_SND_ATIIXP is not set
1504# CONFIG_SND_ATIIXP_MODEM is not set
1505# CONFIG_SND_AU8810 is not set
1506# CONFIG_SND_AU8820 is not set
1507# CONFIG_SND_AU8830 is not set
1508# CONFIG_SND_AW2 is not set
1509# CONFIG_SND_AZT3328 is not set
1510# CONFIG_SND_BT87X is not set
1511# CONFIG_SND_CA0106 is not set
1512# CONFIG_SND_CMIPCI is not set
1513# CONFIG_SND_OXYGEN is not set
1514# CONFIG_SND_CS4281 is not set
1515# CONFIG_SND_CS46XX is not set
1516# CONFIG_SND_CS5530 is not set
1517# CONFIG_SND_DARLA20 is not set
1518# CONFIG_SND_GINA20 is not set
1519# CONFIG_SND_LAYLA20 is not set
1520# CONFIG_SND_DARLA24 is not set
1521# CONFIG_SND_GINA24 is not set
1522# CONFIG_SND_LAYLA24 is not set
1523# CONFIG_SND_MONA is not set
1524# CONFIG_SND_MIA is not set
1525# CONFIG_SND_ECHO3G is not set
1526# CONFIG_SND_INDIGO is not set
1527# CONFIG_SND_INDIGOIO is not set
1528# CONFIG_SND_INDIGODJ is not set
1529# CONFIG_SND_EMU10K1 is not set
1530# CONFIG_SND_EMU10K1X is not set
1531# CONFIG_SND_ENS1370 is not set
1532# CONFIG_SND_ENS1371 is not set
1533# CONFIG_SND_ES1938 is not set
1534# CONFIG_SND_ES1968 is not set
1535# CONFIG_SND_FM801 is not set
1536CONFIG_SND_HDA_INTEL=y
1537CONFIG_SND_HDA_HWDEP=y
1538CONFIG_SND_HDA_CODEC_REALTEK=y
1539CONFIG_SND_HDA_CODEC_ANALOG=y
1540CONFIG_SND_HDA_CODEC_SIGMATEL=y
1541CONFIG_SND_HDA_CODEC_VIA=y
1542CONFIG_SND_HDA_CODEC_ATIHDMI=y
1543CONFIG_SND_HDA_CODEC_CONEXANT=y
1544CONFIG_SND_HDA_CODEC_CMEDIA=y
1545CONFIG_SND_HDA_CODEC_SI3054=y
1546CONFIG_SND_HDA_GENERIC=y
1547# CONFIG_SND_HDA_POWER_SAVE is not set
1548# CONFIG_SND_HDSP is not set
1549# CONFIG_SND_HDSPM is not set
1550# CONFIG_SND_HIFIER is not set
1551# CONFIG_SND_ICE1712 is not set
1552# CONFIG_SND_ICE1724 is not set
1553# CONFIG_SND_INTEL8X0 is not set
1554# CONFIG_SND_INTEL8X0M is not set
1555# CONFIG_SND_KORG1212 is not set
1556# CONFIG_SND_MAESTRO3 is not set
1557# CONFIG_SND_MIXART is not set
1558# CONFIG_SND_NM256 is not set
1559# CONFIG_SND_PCXHR is not set
1560# CONFIG_SND_RIPTIDE is not set
1561# CONFIG_SND_RME32 is not set
1562# CONFIG_SND_RME96 is not set
1563# CONFIG_SND_RME9652 is not set
1564# CONFIG_SND_SONICVIBES is not set
1565# CONFIG_SND_TRIDENT is not set
1566# CONFIG_SND_VIA82XX is not set
1567# CONFIG_SND_VIA82XX_MODEM is not set
1568# CONFIG_SND_VIRTUOSO is not set
1569# CONFIG_SND_VX222 is not set
1570# CONFIG_SND_YMFPCI is not set
1571
1572#
1573# USB devices
1574#
1575# CONFIG_SND_USB_AUDIO is not set
1576# CONFIG_SND_USB_USX2Y is not set
1577# CONFIG_SND_USB_CAIAQ is not set
1578
1579#
1580# PCMCIA devices
1581#
1582# CONFIG_SND_VXPOCKET is not set
1583# CONFIG_SND_PDAUDIOCF is not set
1584
1585#
1586# System on Chip audio support
1587#
1588# CONFIG_SND_SOC is not set
1589
1590#
1591# ALSA SoC audio for Freescale SOCs
1592#
1593
1594#
1595# SoC Audio for the Texas Instruments OMAP
1596#
962 1597
963# 1598#
964# Open Sound System 1599# Open Sound System
965# 1600#
966CONFIG_SOUND_PRIME=y 1601# CONFIG_SOUND_PRIME is not set
967# CONFIG_SOUND_TRIDENT is not set
968# CONFIG_SOUND_MSNDCLAS is not set
969# CONFIG_SOUND_MSNDPIN is not set
970# CONFIG_SOUND_OSS is not set
971CONFIG_HID_SUPPORT=y 1602CONFIG_HID_SUPPORT=y
972CONFIG_HID=y 1603CONFIG_HID=y
973# CONFIG_HID_DEBUG is not set 1604CONFIG_HID_DEBUG=y
1605CONFIG_HIDRAW=y
974 1606
975# 1607#
976# USB Input Devices 1608# USB Input Devices
977# 1609#
978CONFIG_USB_HID=y 1610CONFIG_USB_HID=y
979# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1611CONFIG_USB_HIDINPUT_POWERBOOK=y
980# CONFIG_HID_FF is not set 1612CONFIG_HID_FF=y
981# CONFIG_USB_HIDDEV is not set 1613CONFIG_HID_PID=y
1614CONFIG_LOGITECH_FF=y
1615# CONFIG_LOGIRUMBLEPAD2_FF is not set
1616CONFIG_PANTHERLORD_FF=y
1617CONFIG_THRUSTMASTER_FF=y
1618CONFIG_ZEROPLUS_FF=y
1619CONFIG_USB_HIDDEV=y
982CONFIG_USB_SUPPORT=y 1620CONFIG_USB_SUPPORT=y
983CONFIG_USB_ARCH_HAS_HCD=y 1621CONFIG_USB_ARCH_HAS_HCD=y
984CONFIG_USB_ARCH_HAS_OHCI=y 1622CONFIG_USB_ARCH_HAS_OHCI=y
985CONFIG_USB_ARCH_HAS_EHCI=y 1623CONFIG_USB_ARCH_HAS_EHCI=y
986CONFIG_USB=y 1624CONFIG_USB=y
987# CONFIG_USB_DEBUG is not set 1625CONFIG_USB_DEBUG=y
1626CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
988 1627
989# 1628#
990# Miscellaneous USB options 1629# Miscellaneous USB options
@@ -992,18 +1631,18 @@ CONFIG_USB=y
992CONFIG_USB_DEVICEFS=y 1631CONFIG_USB_DEVICEFS=y
993# CONFIG_USB_DEVICE_CLASS is not set 1632# CONFIG_USB_DEVICE_CLASS is not set
994# CONFIG_USB_DYNAMIC_MINORS is not set 1633# CONFIG_USB_DYNAMIC_MINORS is not set
995# CONFIG_USB_SUSPEND is not set 1634CONFIG_USB_SUSPEND=y
996# CONFIG_USB_PERSIST is not set
997# CONFIG_USB_OTG is not set 1635# CONFIG_USB_OTG is not set
998 1636
999# 1637#
1000# USB Host Controller Drivers 1638# USB Host Controller Drivers
1001# 1639#
1640# CONFIG_USB_C67X00_HCD is not set
1002CONFIG_USB_EHCI_HCD=y 1641CONFIG_USB_EHCI_HCD=y
1003# CONFIG_USB_EHCI_SPLIT_ISO is not set
1004# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1642# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1005# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1643# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1006# CONFIG_USB_ISP116X_HCD is not set 1644# CONFIG_USB_ISP116X_HCD is not set
1645# CONFIG_USB_ISP1760_HCD is not set
1007CONFIG_USB_OHCI_HCD=y 1646CONFIG_USB_OHCI_HCD=y
1008# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1647# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1009# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1648# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1036,8 +1675,10 @@ CONFIG_USB_STORAGE=y
1036# CONFIG_USB_STORAGE_SDDR55 is not set 1675# CONFIG_USB_STORAGE_SDDR55 is not set
1037# CONFIG_USB_STORAGE_JUMPSHOT is not set 1676# CONFIG_USB_STORAGE_JUMPSHOT is not set
1038# CONFIG_USB_STORAGE_ALAUDA is not set 1677# CONFIG_USB_STORAGE_ALAUDA is not set
1678# CONFIG_USB_STORAGE_ONETOUCH is not set
1039# CONFIG_USB_STORAGE_KARMA is not set 1679# CONFIG_USB_STORAGE_KARMA is not set
1040# CONFIG_USB_LIBUSUAL is not set 1680# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1681CONFIG_USB_LIBUSUAL=y
1041 1682
1042# 1683#
1043# USB Imaging devices 1684# USB Imaging devices
@@ -1049,10 +1690,6 @@ CONFIG_USB_MON=y
1049# 1690#
1050# USB port drivers 1691# USB port drivers
1051# 1692#
1052
1053#
1054# USB Serial Converter support
1055#
1056# CONFIG_USB_SERIAL is not set 1693# CONFIG_USB_SERIAL is not set
1057 1694
1058# 1695#
@@ -1078,98 +1715,126 @@ CONFIG_USB_MON=y
1078# CONFIG_USB_TRANCEVIBRATOR is not set 1715# CONFIG_USB_TRANCEVIBRATOR is not set
1079# CONFIG_USB_IOWARRIOR is not set 1716# CONFIG_USB_IOWARRIOR is not set
1080# CONFIG_USB_TEST is not set 1717# CONFIG_USB_TEST is not set
1718# CONFIG_USB_GADGET is not set
1719# CONFIG_MMC is not set
1720# CONFIG_MEMSTICK is not set
1721CONFIG_NEW_LEDS=y
1722CONFIG_LEDS_CLASS=y
1081 1723
1082# 1724#
1083# USB DSL modem support 1725# LED drivers
1084# 1726#
1727# CONFIG_LEDS_CLEVO_MAIL is not set
1085 1728
1086# 1729#
1087# USB Gadget Support 1730# LED Triggers
1088# 1731#
1089# CONFIG_USB_GADGET is not set 1732CONFIG_LEDS_TRIGGERS=y
1090# CONFIG_MMC is not set 1733# CONFIG_LEDS_TRIGGER_TIMER is not set
1734# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
1735# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
1736# CONFIG_ACCESSIBILITY is not set
1737# CONFIG_INFINIBAND is not set
1738CONFIG_EDAC=y
1091 1739
1092# 1740#
1093# LED devices 1741# Reporting subsystems
1094# 1742#
1095# CONFIG_NEW_LEDS is not set 1743# CONFIG_EDAC_DEBUG is not set
1744# CONFIG_EDAC_MM_EDAC is not set
1745CONFIG_RTC_LIB=y
1746CONFIG_RTC_CLASS=y
1747# CONFIG_RTC_HCTOSYS is not set
1748# CONFIG_RTC_DEBUG is not set
1096 1749
1097# 1750#
1098# LED drivers 1751# RTC interfaces
1099# 1752#
1753CONFIG_RTC_INTF_SYSFS=y
1754CONFIG_RTC_INTF_PROC=y
1755CONFIG_RTC_INTF_DEV=y
1756# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1757# CONFIG_RTC_DRV_TEST is not set
1100 1758
1101# 1759#
1102# LED Triggers 1760# I2C RTC drivers
1103# 1761#
1104# CONFIG_INFINIBAND is not set 1762# CONFIG_RTC_DRV_DS1307 is not set
1105# CONFIG_EDAC is not set 1763# CONFIG_RTC_DRV_DS1374 is not set
1764# CONFIG_RTC_DRV_DS1672 is not set
1765# CONFIG_RTC_DRV_MAX6900 is not set
1766# CONFIG_RTC_DRV_RS5C372 is not set
1767# CONFIG_RTC_DRV_ISL1208 is not set
1768# CONFIG_RTC_DRV_X1205 is not set
1769# CONFIG_RTC_DRV_PCF8563 is not set
1770# CONFIG_RTC_DRV_PCF8583 is not set
1771# CONFIG_RTC_DRV_M41T80 is not set
1772# CONFIG_RTC_DRV_S35390A is not set
1106 1773
1107# 1774#
1108# Real Time Clock 1775# SPI RTC drivers
1109# 1776#
1110# CONFIG_RTC_CLASS is not set
1111 1777
1112# 1778#
1113# DMA Engine support 1779# Platform RTC drivers
1114# 1780#
1115# CONFIG_DMA_ENGINE is not set 1781CONFIG_RTC_DRV_CMOS=y
1782# CONFIG_RTC_DRV_DS1511 is not set
1783# CONFIG_RTC_DRV_DS1553 is not set
1784# CONFIG_RTC_DRV_DS1742 is not set
1785# CONFIG_RTC_DRV_STK17TA8 is not set
1786# CONFIG_RTC_DRV_M48T86 is not set
1787# CONFIG_RTC_DRV_M48T59 is not set
1788# CONFIG_RTC_DRV_V3020 is not set
1116 1789
1117# 1790#
1118# DMA Clients 1791# on-CPU RTC drivers
1119# 1792#
1793CONFIG_DMADEVICES=y
1120 1794
1121# 1795#
1122# DMA Devices 1796# DMA Devices
1123# 1797#
1124CONFIG_VIRTUALIZATION=y 1798# CONFIG_INTEL_IOATDMA is not set
1125# CONFIG_KVM is not set
1126
1127#
1128# Userspace I/O
1129#
1130# CONFIG_UIO is not set 1799# CONFIG_UIO is not set
1131 1800
1132# 1801#
1133# Firmware Drivers 1802# Firmware Drivers
1134# 1803#
1135# CONFIG_EDD is not set 1804# CONFIG_EDD is not set
1805CONFIG_EFI_VARS=y
1136# CONFIG_DELL_RBU is not set 1806# CONFIG_DELL_RBU is not set
1137# CONFIG_DCDBAS is not set 1807# CONFIG_DCDBAS is not set
1138CONFIG_DMIID=y 1808CONFIG_DMIID=y
1809# CONFIG_ISCSI_IBFT_FIND is not set
1139 1810
1140# 1811#
1141# File systems 1812# File systems
1142# 1813#
1143CONFIG_EXT2_FS=y 1814# CONFIG_EXT2_FS is not set
1144CONFIG_EXT2_FS_XATTR=y
1145CONFIG_EXT2_FS_POSIX_ACL=y
1146# CONFIG_EXT2_FS_SECURITY is not set
1147# CONFIG_EXT2_FS_XIP is not set
1148CONFIG_EXT3_FS=y 1815CONFIG_EXT3_FS=y
1149CONFIG_EXT3_FS_XATTR=y 1816CONFIG_EXT3_FS_XATTR=y
1150CONFIG_EXT3_FS_POSIX_ACL=y 1817CONFIG_EXT3_FS_POSIX_ACL=y
1151# CONFIG_EXT3_FS_SECURITY is not set 1818CONFIG_EXT3_FS_SECURITY=y
1152# CONFIG_EXT4DEV_FS is not set 1819# CONFIG_EXT4DEV_FS is not set
1153CONFIG_JBD=y 1820CONFIG_JBD=y
1154# CONFIG_JBD_DEBUG is not set 1821# CONFIG_JBD_DEBUG is not set
1155CONFIG_FS_MBCACHE=y 1822CONFIG_FS_MBCACHE=y
1156CONFIG_REISERFS_FS=y 1823# CONFIG_REISERFS_FS is not set
1157# CONFIG_REISERFS_CHECK is not set
1158# CONFIG_REISERFS_PROC_INFO is not set
1159CONFIG_REISERFS_FS_XATTR=y
1160CONFIG_REISERFS_FS_POSIX_ACL=y
1161# CONFIG_REISERFS_FS_SECURITY is not set
1162# CONFIG_JFS_FS is not set 1824# CONFIG_JFS_FS is not set
1163CONFIG_FS_POSIX_ACL=y 1825CONFIG_FS_POSIX_ACL=y
1164# CONFIG_XFS_FS is not set 1826# CONFIG_XFS_FS is not set
1165# CONFIG_GFS2_FS is not set 1827# CONFIG_GFS2_FS is not set
1166# CONFIG_OCFS2_FS is not set 1828# CONFIG_OCFS2_FS is not set
1167# CONFIG_MINIX_FS is not set 1829CONFIG_DNOTIFY=y
1168# CONFIG_ROMFS_FS is not set
1169CONFIG_INOTIFY=y 1830CONFIG_INOTIFY=y
1170CONFIG_INOTIFY_USER=y 1831CONFIG_INOTIFY_USER=y
1171# CONFIG_QUOTA is not set 1832CONFIG_QUOTA=y
1172CONFIG_DNOTIFY=y 1833CONFIG_QUOTA_NETLINK_INTERFACE=y
1834# CONFIG_PRINT_QUOTA_WARNING is not set
1835# CONFIG_QFMT_V1 is not set
1836CONFIG_QFMT_V2=y
1837CONFIG_QUOTACTL=y
1173# CONFIG_AUTOFS_FS is not set 1838# CONFIG_AUTOFS_FS is not set
1174CONFIG_AUTOFS4_FS=y 1839CONFIG_AUTOFS4_FS=y
1175# CONFIG_FUSE_FS is not set 1840# CONFIG_FUSE_FS is not set
@@ -1180,7 +1845,7 @@ CONFIG_GENERIC_ACL=y
1180# 1845#
1181CONFIG_ISO9660_FS=y 1846CONFIG_ISO9660_FS=y
1182CONFIG_JOLIET=y 1847CONFIG_JOLIET=y
1183# CONFIG_ZISOFS is not set 1848CONFIG_ZISOFS=y
1184# CONFIG_UDF_FS is not set 1849# CONFIG_UDF_FS is not set
1185 1850
1186# 1851#
@@ -1198,13 +1863,13 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1198# 1863#
1199CONFIG_PROC_FS=y 1864CONFIG_PROC_FS=y
1200CONFIG_PROC_KCORE=y 1865CONFIG_PROC_KCORE=y
1866CONFIG_PROC_VMCORE=y
1201CONFIG_PROC_SYSCTL=y 1867CONFIG_PROC_SYSCTL=y
1202CONFIG_SYSFS=y 1868CONFIG_SYSFS=y
1203CONFIG_TMPFS=y 1869CONFIG_TMPFS=y
1204CONFIG_TMPFS_POSIX_ACL=y 1870CONFIG_TMPFS_POSIX_ACL=y
1205CONFIG_HUGETLBFS=y 1871CONFIG_HUGETLBFS=y
1206CONFIG_HUGETLB_PAGE=y 1872CONFIG_HUGETLB_PAGE=y
1207CONFIG_RAMFS=y
1208# CONFIG_CONFIGFS_FS is not set 1873# CONFIG_CONFIGFS_FS is not set
1209 1874
1210# 1875#
@@ -1212,6 +1877,7 @@ CONFIG_RAMFS=y
1212# 1877#
1213# CONFIG_ADFS_FS is not set 1878# CONFIG_ADFS_FS is not set
1214# CONFIG_AFFS_FS is not set 1879# CONFIG_AFFS_FS is not set
1880# CONFIG_ECRYPT_FS is not set
1215# CONFIG_HFS_FS is not set 1881# CONFIG_HFS_FS is not set
1216# CONFIG_HFSPLUS_FS is not set 1882# CONFIG_HFSPLUS_FS is not set
1217# CONFIG_BEFS_FS is not set 1883# CONFIG_BEFS_FS is not set
@@ -1219,33 +1885,15 @@ CONFIG_RAMFS=y
1219# CONFIG_EFS_FS is not set 1885# CONFIG_EFS_FS is not set
1220# CONFIG_CRAMFS is not set 1886# CONFIG_CRAMFS is not set
1221# CONFIG_VXFS_FS is not set 1887# CONFIG_VXFS_FS is not set
1888# CONFIG_MINIX_FS is not set
1222# CONFIG_HPFS_FS is not set 1889# CONFIG_HPFS_FS is not set
1223# CONFIG_QNX4FS_FS is not set 1890# CONFIG_QNX4FS_FS is not set
1891# CONFIG_ROMFS_FS is not set
1224# CONFIG_SYSV_FS is not set 1892# CONFIG_SYSV_FS is not set
1225# CONFIG_UFS_FS is not set 1893# CONFIG_UFS_FS is not set
1226 1894CONFIG_NETWORK_FILESYSTEMS=y
1227# 1895# CONFIG_NFS_FS is not set
1228# Network File Systems 1896# CONFIG_NFSD is not set
1229#
1230CONFIG_NFS_FS=y
1231CONFIG_NFS_V3=y
1232# CONFIG_NFS_V3_ACL is not set
1233# CONFIG_NFS_V4 is not set
1234# CONFIG_NFS_DIRECTIO is not set
1235CONFIG_NFSD=y
1236CONFIG_NFSD_V3=y
1237# CONFIG_NFSD_V3_ACL is not set
1238# CONFIG_NFSD_V4 is not set
1239CONFIG_NFSD_TCP=y
1240CONFIG_ROOT_NFS=y
1241CONFIG_LOCKD=y
1242CONFIG_LOCKD_V4=y
1243CONFIG_EXPORTFS=y
1244CONFIG_NFS_COMMON=y
1245CONFIG_SUNRPC=y
1246# CONFIG_SUNRPC_BIND34 is not set
1247# CONFIG_RPCSEC_GSS_KRB5 is not set
1248# CONFIG_RPCSEC_GSS_SPKM3 is not set
1249# CONFIG_SMB_FS is not set 1897# CONFIG_SMB_FS is not set
1250# CONFIG_CIFS is not set 1898# CONFIG_CIFS is not set
1251# CONFIG_NCP_FS is not set 1899# CONFIG_NCP_FS is not set
@@ -1255,14 +1903,26 @@ CONFIG_SUNRPC=y
1255# 1903#
1256# Partition Types 1904# Partition Types
1257# 1905#
1258# CONFIG_PARTITION_ADVANCED is not set 1906CONFIG_PARTITION_ADVANCED=y
1907# CONFIG_ACORN_PARTITION is not set
1908CONFIG_OSF_PARTITION=y
1909CONFIG_AMIGA_PARTITION=y
1910# CONFIG_ATARI_PARTITION is not set
1911CONFIG_MAC_PARTITION=y
1259CONFIG_MSDOS_PARTITION=y 1912CONFIG_MSDOS_PARTITION=y
1260 1913CONFIG_BSD_DISKLABEL=y
1261# 1914CONFIG_MINIX_SUBPARTITION=y
1262# Native Language Support 1915CONFIG_SOLARIS_X86_PARTITION=y
1263# 1916CONFIG_UNIXWARE_DISKLABEL=y
1917# CONFIG_LDM_PARTITION is not set
1918CONFIG_SGI_PARTITION=y
1919# CONFIG_ULTRIX_PARTITION is not set
1920CONFIG_SUN_PARTITION=y
1921CONFIG_KARMA_PARTITION=y
1922CONFIG_EFI_PARTITION=y
1923# CONFIG_SYSV68_PARTITION is not set
1264CONFIG_NLS=y 1924CONFIG_NLS=y
1265CONFIG_NLS_DEFAULT="iso8859-1" 1925CONFIG_NLS_DEFAULT="utf8"
1266CONFIG_NLS_CODEPAGE_437=y 1926CONFIG_NLS_CODEPAGE_437=y
1267# CONFIG_NLS_CODEPAGE_737 is not set 1927# CONFIG_NLS_CODEPAGE_737 is not set
1268# CONFIG_NLS_CODEPAGE_775 is not set 1928# CONFIG_NLS_CODEPAGE_775 is not set
@@ -1297,40 +1957,33 @@ CONFIG_NLS_ISO8859_1=y
1297# CONFIG_NLS_ISO8859_9 is not set 1957# CONFIG_NLS_ISO8859_9 is not set
1298# CONFIG_NLS_ISO8859_13 is not set 1958# CONFIG_NLS_ISO8859_13 is not set
1299# CONFIG_NLS_ISO8859_14 is not set 1959# CONFIG_NLS_ISO8859_14 is not set
1300CONFIG_NLS_ISO8859_15=y 1960# CONFIG_NLS_ISO8859_15 is not set
1301# CONFIG_NLS_KOI8_R is not set 1961# CONFIG_NLS_KOI8_R is not set
1302# CONFIG_NLS_KOI8_U is not set 1962# CONFIG_NLS_KOI8_U is not set
1303CONFIG_NLS_UTF8=y 1963CONFIG_NLS_UTF8=y
1304
1305#
1306# Distributed Lock Manager
1307#
1308# CONFIG_DLM is not set 1964# CONFIG_DLM is not set
1309 1965
1310# 1966#
1311# Instrumentation Support
1312#
1313CONFIG_PROFILING=y
1314CONFIG_OPROFILE=y
1315CONFIG_KPROBES=y
1316
1317#
1318# Kernel hacking 1967# Kernel hacking
1319# 1968#
1320CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1969CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1321# CONFIG_PRINTK_TIME is not set 1970# CONFIG_PRINTK_TIME is not set
1971# CONFIG_ENABLE_WARN_DEPRECATED is not set
1322# CONFIG_ENABLE_MUST_CHECK is not set 1972# CONFIG_ENABLE_MUST_CHECK is not set
1973CONFIG_FRAME_WARN=2048
1323CONFIG_MAGIC_SYSRQ=y 1974CONFIG_MAGIC_SYSRQ=y
1324CONFIG_UNUSED_SYMBOLS=y 1975# CONFIG_UNUSED_SYMBOLS is not set
1325CONFIG_DEBUG_FS=y 1976CONFIG_DEBUG_FS=y
1326# CONFIG_HEADERS_CHECK is not set 1977# CONFIG_HEADERS_CHECK is not set
1327CONFIG_DEBUG_KERNEL=y 1978CONFIG_DEBUG_KERNEL=y
1328# CONFIG_DEBUG_SHIRQ is not set 1979# CONFIG_DEBUG_SHIRQ is not set
1329CONFIG_DETECT_SOFTLOCKUP=y 1980# CONFIG_DETECT_SOFTLOCKUP is not set
1330# CONFIG_SCHED_DEBUG is not set 1981# CONFIG_SCHED_DEBUG is not set
1331# CONFIG_SCHEDSTATS is not set 1982CONFIG_SCHEDSTATS=y
1332CONFIG_TIMER_STATS=y 1983CONFIG_TIMER_STATS=y
1333# CONFIG_DEBUG_SLAB is not set 1984# CONFIG_DEBUG_OBJECTS is not set
1985# CONFIG_SLUB_DEBUG_ON is not set
1986# CONFIG_SLUB_STATS is not set
1334# CONFIG_DEBUG_RT_MUTEXES is not set 1987# CONFIG_DEBUG_RT_MUTEXES is not set
1335# CONFIG_RT_MUTEX_TESTER is not set 1988# CONFIG_RT_MUTEX_TESTER is not set
1336# CONFIG_DEBUG_SPINLOCK is not set 1989# CONFIG_DEBUG_SPINLOCK is not set
@@ -1344,28 +1997,162 @@ CONFIG_TIMER_STATS=y
1344CONFIG_DEBUG_BUGVERBOSE=y 1997CONFIG_DEBUG_BUGVERBOSE=y
1345# CONFIG_DEBUG_INFO is not set 1998# CONFIG_DEBUG_INFO is not set
1346# CONFIG_DEBUG_VM is not set 1999# CONFIG_DEBUG_VM is not set
2000# CONFIG_DEBUG_WRITECOUNT is not set
1347# CONFIG_DEBUG_LIST is not set 2001# CONFIG_DEBUG_LIST is not set
1348# CONFIG_FRAME_POINTER is not set 2002# CONFIG_DEBUG_SG is not set
1349CONFIG_OPTIMIZE_INLINING=y 2003CONFIG_FRAME_POINTER=y
2004# CONFIG_BOOT_PRINTK_DELAY is not set
1350# CONFIG_RCU_TORTURE_TEST is not set 2005# CONFIG_RCU_TORTURE_TEST is not set
2006# CONFIG_KPROBES_SANITY_TEST is not set
2007# CONFIG_BACKTRACE_SELF_TEST is not set
1351# CONFIG_LKDTM is not set 2008# CONFIG_LKDTM is not set
1352# CONFIG_FAULT_INJECTION is not set 2009# CONFIG_FAULT_INJECTION is not set
1353# CONFIG_DEBUG_RODATA is not set 2010# CONFIG_LATENCYTOP is not set
1354# CONFIG_IOMMU_DEBUG is not set 2011CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
2012# CONFIG_SAMPLES is not set
2013# CONFIG_KGDB is not set
2014CONFIG_HAVE_ARCH_KGDB=y
2015# CONFIG_NONPROMISC_DEVMEM is not set
2016CONFIG_EARLY_PRINTK=y
1355CONFIG_DEBUG_STACKOVERFLOW=y 2017CONFIG_DEBUG_STACKOVERFLOW=y
1356# CONFIG_DEBUG_STACK_USAGE is not set 2018CONFIG_DEBUG_STACK_USAGE=y
2019# CONFIG_DEBUG_PAGEALLOC is not set
2020# CONFIG_DEBUG_PER_CPU_MAPS is not set
2021# CONFIG_X86_PTDUMP is not set
2022CONFIG_DEBUG_RODATA=y
2023# CONFIG_DIRECT_GBPAGES is not set
2024# CONFIG_DEBUG_RODATA_TEST is not set
2025CONFIG_DEBUG_NX_TEST=m
2026CONFIG_X86_MPPARSE=y
2027# CONFIG_IOMMU_DEBUG is not set
2028CONFIG_IO_DELAY_TYPE_0X80=0
2029CONFIG_IO_DELAY_TYPE_0XED=1
2030CONFIG_IO_DELAY_TYPE_UDELAY=2
2031CONFIG_IO_DELAY_TYPE_NONE=3
2032CONFIG_IO_DELAY_0X80=y
2033# CONFIG_IO_DELAY_0XED is not set
2034# CONFIG_IO_DELAY_UDELAY is not set
2035# CONFIG_IO_DELAY_NONE is not set
2036CONFIG_DEFAULT_IO_DELAY_TYPE=0
2037CONFIG_DEBUG_BOOT_PARAMS=y
2038# CONFIG_CPA_DEBUG is not set
1357 2039
1358# 2040#
1359# Security options 2041# Security options
1360# 2042#
1361# CONFIG_KEYS is not set 2043CONFIG_KEYS=y
1362# CONFIG_SECURITY is not set 2044CONFIG_KEYS_DEBUG_PROC_KEYS=y
1363# CONFIG_CRYPTO is not set 2045CONFIG_SECURITY=y
2046CONFIG_SECURITY_NETWORK=y
2047# CONFIG_SECURITY_NETWORK_XFRM is not set
2048CONFIG_SECURITY_CAPABILITIES=y
2049CONFIG_SECURITY_FILE_CAPABILITIES=y
2050# CONFIG_SECURITY_ROOTPLUG is not set
2051CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=65536
2052CONFIG_SECURITY_SELINUX=y
2053CONFIG_SECURITY_SELINUX_BOOTPARAM=y
2054CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
2055CONFIG_SECURITY_SELINUX_DISABLE=y
2056CONFIG_SECURITY_SELINUX_DEVELOP=y
2057CONFIG_SECURITY_SELINUX_AVC_STATS=y
2058CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
2059# CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT is not set
2060# CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX is not set
2061# CONFIG_SECURITY_SMACK is not set
2062CONFIG_CRYPTO=y
2063
2064#
2065# Crypto core or helper
2066#
2067CONFIG_CRYPTO_ALGAPI=y
2068CONFIG_CRYPTO_AEAD=y
2069CONFIG_CRYPTO_BLKCIPHER=y
2070CONFIG_CRYPTO_HASH=y
2071CONFIG_CRYPTO_MANAGER=y
2072# CONFIG_CRYPTO_GF128MUL is not set
2073# CONFIG_CRYPTO_NULL is not set
2074# CONFIG_CRYPTO_CRYPTD is not set
2075CONFIG_CRYPTO_AUTHENC=y
2076# CONFIG_CRYPTO_TEST is not set
2077
2078#
2079# Authenticated Encryption with Associated Data
2080#
2081# CONFIG_CRYPTO_CCM is not set
2082# CONFIG_CRYPTO_GCM is not set
2083# CONFIG_CRYPTO_SEQIV is not set
2084
2085#
2086# Block modes
2087#
2088CONFIG_CRYPTO_CBC=y
2089# CONFIG_CRYPTO_CTR is not set
2090# CONFIG_CRYPTO_CTS is not set
2091CONFIG_CRYPTO_ECB=y
2092# CONFIG_CRYPTO_LRW is not set
2093# CONFIG_CRYPTO_PCBC is not set
2094# CONFIG_CRYPTO_XTS is not set
2095
2096#
2097# Hash modes
2098#
2099CONFIG_CRYPTO_HMAC=y
2100# CONFIG_CRYPTO_XCBC is not set
2101
2102#
2103# Digest
2104#
2105# CONFIG_CRYPTO_CRC32C is not set
2106# CONFIG_CRYPTO_MD4 is not set
2107CONFIG_CRYPTO_MD5=y
2108# CONFIG_CRYPTO_MICHAEL_MIC is not set
2109CONFIG_CRYPTO_SHA1=y
2110# CONFIG_CRYPTO_SHA256 is not set
2111# CONFIG_CRYPTO_SHA512 is not set
2112# CONFIG_CRYPTO_TGR192 is not set
2113# CONFIG_CRYPTO_WP512 is not set
2114
2115#
2116# Ciphers
2117#
2118CONFIG_CRYPTO_AES=y
2119# CONFIG_CRYPTO_AES_X86_64 is not set
2120# CONFIG_CRYPTO_ANUBIS is not set
2121CONFIG_CRYPTO_ARC4=y
2122# CONFIG_CRYPTO_BLOWFISH is not set
2123# CONFIG_CRYPTO_CAMELLIA is not set
2124# CONFIG_CRYPTO_CAST5 is not set
2125# CONFIG_CRYPTO_CAST6 is not set
2126CONFIG_CRYPTO_DES=y
2127# CONFIG_CRYPTO_FCRYPT is not set
2128# CONFIG_CRYPTO_KHAZAD is not set
2129# CONFIG_CRYPTO_SALSA20 is not set
2130# CONFIG_CRYPTO_SALSA20_X86_64 is not set
2131# CONFIG_CRYPTO_SEED is not set
2132# CONFIG_CRYPTO_SERPENT is not set
2133# CONFIG_CRYPTO_TEA is not set
2134# CONFIG_CRYPTO_TWOFISH is not set
2135# CONFIG_CRYPTO_TWOFISH_X86_64 is not set
2136
2137#
2138# Compression
2139#
2140# CONFIG_CRYPTO_DEFLATE is not set
2141# CONFIG_CRYPTO_LZO is not set
2142CONFIG_CRYPTO_HW=y
2143# CONFIG_CRYPTO_DEV_HIFN_795X is not set
2144CONFIG_HAVE_KVM=y
2145CONFIG_VIRTUALIZATION=y
2146# CONFIG_KVM is not set
2147# CONFIG_VIRTIO_PCI is not set
2148# CONFIG_VIRTIO_BALLOON is not set
1364 2149
1365# 2150#
1366# Library routines 2151# Library routines
1367# 2152#
1368CONFIG_BITREVERSE=y 2153CONFIG_BITREVERSE=y
2154CONFIG_GENERIC_FIND_FIRST_BIT=y
2155CONFIG_GENERIC_FIND_NEXT_BIT=y
1369# CONFIG_CRC_CCITT is not set 2156# CONFIG_CRC_CCITT is not set
1370# CONFIG_CRC16 is not set 2157# CONFIG_CRC16 is not set
1371# CONFIG_CRC_ITU_T is not set 2158# CONFIG_CRC_ITU_T is not set
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index b5e329da166c..20371d0635e4 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -61,6 +61,19 @@
61 CFI_UNDEFINED r15 61 CFI_UNDEFINED r15
62 .endm 62 .endm
63 63
64#ifdef CONFIG_PARAVIRT
65ENTRY(native_usergs_sysret32)
66 swapgs
67 sysretl
68ENDPROC(native_usergs_sysret32)
69
70ENTRY(native_irq_enable_sysexit)
71 swapgs
72 sti
73 sysexit
74ENDPROC(native_irq_enable_sysexit)
75#endif
76
64/* 77/*
65 * 32bit SYSENTER instruction entry. 78 * 32bit SYSENTER instruction entry.
66 * 79 *
@@ -85,14 +98,14 @@ ENTRY(ia32_sysenter_target)
85 CFI_SIGNAL_FRAME 98 CFI_SIGNAL_FRAME
86 CFI_DEF_CFA rsp,0 99 CFI_DEF_CFA rsp,0
87 CFI_REGISTER rsp,rbp 100 CFI_REGISTER rsp,rbp
88 swapgs 101 SWAPGS_UNSAFE_STACK
89 movq %gs:pda_kernelstack, %rsp 102 movq %gs:pda_kernelstack, %rsp
90 addq $(PDA_STACKOFFSET),%rsp 103 addq $(PDA_STACKOFFSET),%rsp
91 /* 104 /*
92 * No need to follow this irqs on/off section: the syscall 105 * No need to follow this irqs on/off section: the syscall
93 * disabled irqs, here we enable it straight after entry: 106 * disabled irqs, here we enable it straight after entry:
94 */ 107 */
95 sti 108 ENABLE_INTERRUPTS(CLBR_NONE)
96 movl %ebp,%ebp /* zero extension */ 109 movl %ebp,%ebp /* zero extension */
97 pushq $__USER32_DS 110 pushq $__USER32_DS
98 CFI_ADJUST_CFA_OFFSET 8 111 CFI_ADJUST_CFA_OFFSET 8
@@ -103,7 +116,7 @@ ENTRY(ia32_sysenter_target)
103 pushfq 116 pushfq
104 CFI_ADJUST_CFA_OFFSET 8 117 CFI_ADJUST_CFA_OFFSET 8
105 /*CFI_REL_OFFSET rflags,0*/ 118 /*CFI_REL_OFFSET rflags,0*/
106 movl 8*3-THREAD_SIZE+threadinfo_sysenter_return(%rsp), %r10d 119 movl 8*3-THREAD_SIZE+TI_sysenter_return(%rsp), %r10d
107 CFI_REGISTER rip,r10 120 CFI_REGISTER rip,r10
108 pushq $__USER32_CS 121 pushq $__USER32_CS
109 CFI_ADJUST_CFA_OFFSET 8 122 CFI_ADJUST_CFA_OFFSET 8
@@ -123,8 +136,9 @@ ENTRY(ia32_sysenter_target)
123 .quad 1b,ia32_badarg 136 .quad 1b,ia32_badarg
124 .previous 137 .previous
125 GET_THREAD_INFO(%r10) 138 GET_THREAD_INFO(%r10)
126 orl $TS_COMPAT,threadinfo_status(%r10) 139 orl $TS_COMPAT,TI_status(%r10)
127 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 140 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP), \
141 TI_flags(%r10)
128 CFI_REMEMBER_STATE 142 CFI_REMEMBER_STATE
129 jnz sysenter_tracesys 143 jnz sysenter_tracesys
130sysenter_do_call: 144sysenter_do_call:
@@ -134,11 +148,11 @@ sysenter_do_call:
134 call *ia32_sys_call_table(,%rax,8) 148 call *ia32_sys_call_table(,%rax,8)
135 movq %rax,RAX-ARGOFFSET(%rsp) 149 movq %rax,RAX-ARGOFFSET(%rsp)
136 GET_THREAD_INFO(%r10) 150 GET_THREAD_INFO(%r10)
137 cli 151 DISABLE_INTERRUPTS(CLBR_NONE)
138 TRACE_IRQS_OFF 152 TRACE_IRQS_OFF
139 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) 153 testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
140 jnz int_ret_from_sys_call 154 jnz int_ret_from_sys_call
141 andl $~TS_COMPAT,threadinfo_status(%r10) 155 andl $~TS_COMPAT,TI_status(%r10)
142 /* clear IF, that popfq doesn't enable interrupts early */ 156 /* clear IF, that popfq doesn't enable interrupts early */
143 andl $~0x200,EFLAGS-R11(%rsp) 157 andl $~0x200,EFLAGS-R11(%rsp)
144 movl RIP-R11(%rsp),%edx /* User %eip */ 158 movl RIP-R11(%rsp),%edx /* User %eip */
@@ -151,10 +165,7 @@ sysenter_do_call:
151 CFI_ADJUST_CFA_OFFSET -8 165 CFI_ADJUST_CFA_OFFSET -8
152 CFI_REGISTER rsp,rcx 166 CFI_REGISTER rsp,rcx
153 TRACE_IRQS_ON 167 TRACE_IRQS_ON
154 swapgs 168 ENABLE_INTERRUPTS_SYSEXIT32
155 sti /* sti only takes effect after the next instruction */
156 /* sysexit */
157 .byte 0xf, 0x35
158 169
159sysenter_tracesys: 170sysenter_tracesys:
160 CFI_RESTORE_STATE 171 CFI_RESTORE_STATE
@@ -200,7 +211,7 @@ ENTRY(ia32_cstar_target)
200 CFI_DEF_CFA rsp,PDA_STACKOFFSET 211 CFI_DEF_CFA rsp,PDA_STACKOFFSET
201 CFI_REGISTER rip,rcx 212 CFI_REGISTER rip,rcx
202 /*CFI_REGISTER rflags,r11*/ 213 /*CFI_REGISTER rflags,r11*/
203 swapgs 214 SWAPGS_UNSAFE_STACK
204 movl %esp,%r8d 215 movl %esp,%r8d
205 CFI_REGISTER rsp,r8 216 CFI_REGISTER rsp,r8
206 movq %gs:pda_kernelstack,%rsp 217 movq %gs:pda_kernelstack,%rsp
@@ -208,7 +219,7 @@ ENTRY(ia32_cstar_target)
208 * No need to follow this irqs on/off section: the syscall 219 * No need to follow this irqs on/off section: the syscall
209 * disabled irqs and here we enable it straight after entry: 220 * disabled irqs and here we enable it straight after entry:
210 */ 221 */
211 sti 222 ENABLE_INTERRUPTS(CLBR_NONE)
212 SAVE_ARGS 8,1,1 223 SAVE_ARGS 8,1,1
213 movl %eax,%eax /* zero extension */ 224 movl %eax,%eax /* zero extension */
214 movq %rax,ORIG_RAX-ARGOFFSET(%rsp) 225 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
@@ -230,8 +241,9 @@ ENTRY(ia32_cstar_target)
230 .quad 1b,ia32_badarg 241 .quad 1b,ia32_badarg
231 .previous 242 .previous
232 GET_THREAD_INFO(%r10) 243 GET_THREAD_INFO(%r10)
233 orl $TS_COMPAT,threadinfo_status(%r10) 244 orl $TS_COMPAT,TI_status(%r10)
234 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 245 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP), \
246 TI_flags(%r10)
235 CFI_REMEMBER_STATE 247 CFI_REMEMBER_STATE
236 jnz cstar_tracesys 248 jnz cstar_tracesys
237cstar_do_call: 249cstar_do_call:
@@ -241,11 +253,11 @@ cstar_do_call:
241 call *ia32_sys_call_table(,%rax,8) 253 call *ia32_sys_call_table(,%rax,8)
242 movq %rax,RAX-ARGOFFSET(%rsp) 254 movq %rax,RAX-ARGOFFSET(%rsp)
243 GET_THREAD_INFO(%r10) 255 GET_THREAD_INFO(%r10)
244 cli 256 DISABLE_INTERRUPTS(CLBR_NONE)
245 TRACE_IRQS_OFF 257 TRACE_IRQS_OFF
246 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) 258 testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
247 jnz int_ret_from_sys_call 259 jnz int_ret_from_sys_call
248 andl $~TS_COMPAT,threadinfo_status(%r10) 260 andl $~TS_COMPAT,TI_status(%r10)
249 RESTORE_ARGS 1,-ARG_SKIP,1,1,1 261 RESTORE_ARGS 1,-ARG_SKIP,1,1,1
250 movl RIP-ARGOFFSET(%rsp),%ecx 262 movl RIP-ARGOFFSET(%rsp),%ecx
251 CFI_REGISTER rip,rcx 263 CFI_REGISTER rip,rcx
@@ -254,8 +266,7 @@ cstar_do_call:
254 TRACE_IRQS_ON 266 TRACE_IRQS_ON
255 movl RSP-ARGOFFSET(%rsp),%esp 267 movl RSP-ARGOFFSET(%rsp),%esp
256 CFI_RESTORE rsp 268 CFI_RESTORE rsp
257 swapgs 269 USERGS_SYSRET32
258 sysretl
259 270
260cstar_tracesys: 271cstar_tracesys:
261 CFI_RESTORE_STATE 272 CFI_RESTORE_STATE
@@ -310,12 +321,12 @@ ENTRY(ia32_syscall)
310 /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/ 321 /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/
311 /*CFI_REL_OFFSET cs,CS-RIP*/ 322 /*CFI_REL_OFFSET cs,CS-RIP*/
312 CFI_REL_OFFSET rip,RIP-RIP 323 CFI_REL_OFFSET rip,RIP-RIP
313 swapgs 324 SWAPGS
314 /* 325 /*
315 * No need to follow this irqs on/off section: the syscall 326 * No need to follow this irqs on/off section: the syscall
316 * disabled irqs and here we enable it straight after entry: 327 * disabled irqs and here we enable it straight after entry:
317 */ 328 */
318 sti 329 ENABLE_INTERRUPTS(CLBR_NONE)
319 movl %eax,%eax 330 movl %eax,%eax
320 pushq %rax 331 pushq %rax
321 CFI_ADJUST_CFA_OFFSET 8 332 CFI_ADJUST_CFA_OFFSET 8
@@ -324,8 +335,9 @@ ENTRY(ia32_syscall)
324 this could be a problem. */ 335 this could be a problem. */
325 SAVE_ARGS 0,0,1 336 SAVE_ARGS 0,0,1
326 GET_THREAD_INFO(%r10) 337 GET_THREAD_INFO(%r10)
327 orl $TS_COMPAT,threadinfo_status(%r10) 338 orl $TS_COMPAT,TI_status(%r10)
328 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 339 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP), \
340 TI_flags(%r10)
329 jnz ia32_tracesys 341 jnz ia32_tracesys
330ia32_do_syscall: 342ia32_do_syscall:
331 cmpl $(IA32_NR_syscalls-1),%eax 343 cmpl $(IA32_NR_syscalls-1),%eax
@@ -370,13 +382,11 @@ quiet_ni_syscall:
370 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi 382 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi
371 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi 383 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi
372 PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx 384 PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx
373 PTREGSCALL stub32_sigsuspend, sys32_sigsuspend, %rcx
374 PTREGSCALL stub32_execve, sys32_execve, %rcx 385 PTREGSCALL stub32_execve, sys32_execve, %rcx
375 PTREGSCALL stub32_fork, sys_fork, %rdi 386 PTREGSCALL stub32_fork, sys_fork, %rdi
376 PTREGSCALL stub32_clone, sys32_clone, %rdx 387 PTREGSCALL stub32_clone, sys32_clone, %rdx
377 PTREGSCALL stub32_vfork, sys_vfork, %rdi 388 PTREGSCALL stub32_vfork, sys_vfork, %rdi
378 PTREGSCALL stub32_iopl, sys_iopl, %rsi 389 PTREGSCALL stub32_iopl, sys_iopl, %rsi
379 PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx
380 390
381ENTRY(ia32_ptregs_common) 391ENTRY(ia32_ptregs_common)
382 popq %r11 392 popq %r11
@@ -476,7 +486,7 @@ ia32_sys_call_table:
476 .quad sys_ssetmask 486 .quad sys_ssetmask
477 .quad sys_setreuid16 /* 70 */ 487 .quad sys_setreuid16 /* 70 */
478 .quad sys_setregid16 488 .quad sys_setregid16
479 .quad stub32_sigsuspend 489 .quad sys32_sigsuspend
480 .quad compat_sys_sigpending 490 .quad compat_sys_sigpending
481 .quad sys_sethostname 491 .quad sys_sethostname
482 .quad compat_sys_setrlimit /* 75 */ 492 .quad compat_sys_setrlimit /* 75 */
@@ -583,7 +593,7 @@ ia32_sys_call_table:
583 .quad sys32_rt_sigpending 593 .quad sys32_rt_sigpending
584 .quad compat_sys_rt_sigtimedwait 594 .quad compat_sys_rt_sigtimedwait
585 .quad sys32_rt_sigqueueinfo 595 .quad sys32_rt_sigqueueinfo
586 .quad stub32_rt_sigsuspend 596 .quad sys_rt_sigsuspend
587 .quad sys32_pread /* 180 */ 597 .quad sys32_pread /* 180 */
588 .quad sys32_pwrite 598 .quad sys32_pwrite
589 .quad sys_chown16 599 .quad sys_chown16
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 77807d4769c9..5112c84f5421 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -2,10 +2,17 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5extra-y := head_$(BITS).o head$(BITS).o init_task.o vmlinux.lds 5extra-y := head_$(BITS).o head$(BITS).o head.o init_task.o vmlinux.lds
6 6
7CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) 7CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
8 8
9ifdef CONFIG_FTRACE
10# Do not profile debug utilities
11CFLAGS_REMOVE_tsc_64.o = -pg
12CFLAGS_REMOVE_tsc_32.o = -pg
13CFLAGS_REMOVE_rtc.o = -pg
14endif
15
9# 16#
10# vsyscalls (which work on the user stack) should have 17# vsyscalls (which work on the user stack) should have
11# no stack-protector checks: 18# no stack-protector checks:
@@ -13,20 +20,21 @@ CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
13nostackp := $(call cc-option, -fno-stack-protector) 20nostackp := $(call cc-option, -fno-stack-protector)
14CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp) 21CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp)
15CFLAGS_hpet.o := $(nostackp) 22CFLAGS_hpet.o := $(nostackp)
16CFLAGS_tsc_64.o := $(nostackp) 23CFLAGS_tsc.o := $(nostackp)
17 24
18obj-y := process_$(BITS).o signal_$(BITS).o entry_$(BITS).o 25obj-y := process_$(BITS).o signal_$(BITS).o entry_$(BITS).o
19obj-y += traps_$(BITS).o irq_$(BITS).o 26obj-y += traps_$(BITS).o irq_$(BITS).o
20obj-y += time_$(BITS).o ioport.o ldt.o 27obj-y += time_$(BITS).o ioport.o ldt.o
21obj-y += setup_$(BITS).o i8259_$(BITS).o setup.o 28obj-y += setup.o i8259.o irqinit_$(BITS).o setup_percpu.o
29obj-$(CONFIG_X86_VISWS) += visws_quirks.o
30obj-$(CONFIG_X86_32) += probe_roms_32.o
22obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o 31obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o
23obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o 32obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o
24obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o setup64.o 33obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o
25obj-y += bootflag.o e820_$(BITS).o 34obj-y += bootflag.o e820.o
26obj-y += pci-dma.o quirks.o i8237.o topology.o kdebugfs.o 35obj-y += pci-dma.o quirks.o i8237.o topology.o kdebugfs.o
27obj-y += alternative.o i8253.o pci-nommu.o 36obj-y += alternative.o i8253.o pci-nommu.o
28obj-$(CONFIG_X86_64) += bugs_64.o 37obj-y += tsc.o io_delay.o rtc.o
29obj-y += tsc_$(BITS).o io_delay.o rtc.o
30 38
31obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o 39obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o
32obj-y += process.o 40obj-y += process.o
@@ -53,9 +61,10 @@ obj-$(CONFIG_X86_32_SMP) += smpcommon.o
53obj-$(CONFIG_X86_64_SMP) += tsc_sync.o smpcommon.o 61obj-$(CONFIG_X86_64_SMP) += tsc_sync.o smpcommon.o
54obj-$(CONFIG_X86_TRAMPOLINE) += trampoline_$(BITS).o 62obj-$(CONFIG_X86_TRAMPOLINE) += trampoline_$(BITS).o
55obj-$(CONFIG_X86_MPPARSE) += mpparse.o 63obj-$(CONFIG_X86_MPPARSE) += mpparse.o
56obj-$(CONFIG_X86_LOCAL_APIC) += apic_$(BITS).o nmi_$(BITS).o 64obj-$(CONFIG_X86_LOCAL_APIC) += apic_$(BITS).o nmi.o
57obj-$(CONFIG_X86_IO_APIC) += io_apic_$(BITS).o 65obj-$(CONFIG_X86_IO_APIC) += io_apic_$(BITS).o
58obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o 66obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o
67obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
59obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o 68obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o
60obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o 69obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
61obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o 70obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
@@ -64,7 +73,6 @@ obj-$(CONFIG_X86_SUMMIT_NUMA) += summit_32.o
64obj-y += vsmp_64.o 73obj-y += vsmp_64.o
65obj-$(CONFIG_KPROBES) += kprobes.o 74obj-$(CONFIG_KPROBES) += kprobes.o
66obj-$(CONFIG_MODULES) += module_$(BITS).o 75obj-$(CONFIG_MODULES) += module_$(BITS).o
67obj-$(CONFIG_ACPI_SRAT) += srat_32.o
68obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o 76obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
69obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o 77obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o
70obj-$(CONFIG_KGDB) += kgdb.o 78obj-$(CONFIG_KGDB) += kgdb.o
@@ -94,12 +102,13 @@ obj-$(CONFIG_OLPC) += olpc.o
94### 102###
95# 64 bit specific files 103# 64 bit specific files
96ifeq ($(CONFIG_X86_64),y) 104ifeq ($(CONFIG_X86_64),y)
97 obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o 105 obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o
98 obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o 106 obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o
99 obj-$(CONFIG_AUDIT) += audit_64.o 107 obj-$(CONFIG_AUDIT) += audit_64.o
100 108
101 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o 109 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o
102 obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o 110 obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
111 obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o
103 obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o 112 obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
104 113
105 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o 114 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 33c5216fd3e1..f489d7a9be92 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -37,6 +37,7 @@
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
38#include <asm/io_apic.h> 38#include <asm/io_apic.h>
39#include <asm/apic.h> 39#include <asm/apic.h>
40#include <asm/genapic.h>
40#include <asm/io.h> 41#include <asm/io.h>
41#include <asm/mpspec.h> 42#include <asm/mpspec.h>
42#include <asm/smp.h> 43#include <asm/smp.h>
@@ -106,21 +107,6 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
106 */ 107 */
107enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; 108enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
108 109
109#ifdef CONFIG_X86_64
110
111/* rely on all ACPI tables being in the direct mapping */
112char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
113{
114 if (!phys_addr || !size)
115 return NULL;
116
117 if (phys_addr+size <= (max_pfn_mapped << PAGE_SHIFT) + PAGE_SIZE)
118 return __va(phys_addr);
119
120 return NULL;
121}
122
123#else
124 110
125/* 111/*
126 * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END, 112 * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
@@ -139,11 +125,15 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size)
139 unsigned long base, offset, mapped_size; 125 unsigned long base, offset, mapped_size;
140 int idx; 126 int idx;
141 127
142 if (phys + size < 8 * 1024 * 1024) 128 if (!phys || !size)
129 return NULL;
130
131 if (phys+size <= (max_low_pfn_mapped << PAGE_SHIFT))
143 return __va(phys); 132 return __va(phys);
144 133
145 offset = phys & (PAGE_SIZE - 1); 134 offset = phys & (PAGE_SIZE - 1);
146 mapped_size = PAGE_SIZE - offset; 135 mapped_size = PAGE_SIZE - offset;
136 clear_fixmap(FIX_ACPI_END);
147 set_fixmap(FIX_ACPI_END, phys); 137 set_fixmap(FIX_ACPI_END, phys);
148 base = fix_to_virt(FIX_ACPI_END); 138 base = fix_to_virt(FIX_ACPI_END);
149 139
@@ -155,13 +145,13 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size)
155 if (--idx < FIX_ACPI_BEGIN) 145 if (--idx < FIX_ACPI_BEGIN)
156 return NULL; /* cannot handle this */ 146 return NULL; /* cannot handle this */
157 phys += PAGE_SIZE; 147 phys += PAGE_SIZE;
148 clear_fixmap(idx);
158 set_fixmap(idx, phys); 149 set_fixmap(idx, phys);
159 mapped_size += PAGE_SIZE; 150 mapped_size += PAGE_SIZE;
160 } 151 }
161 152
162 return ((unsigned char *)base + offset); 153 return ((unsigned char *)base + offset);
163} 154}
164#endif
165 155
166#ifdef CONFIG_PCI_MMCONFIG 156#ifdef CONFIG_PCI_MMCONFIG
167/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ 157/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */
@@ -338,8 +328,6 @@ acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long e
338 328
339#ifdef CONFIG_X86_IO_APIC 329#ifdef CONFIG_X86_IO_APIC
340 330
341struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS];
342
343static int __init 331static int __init
344acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) 332acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
345{ 333{
@@ -514,8 +502,6 @@ int acpi_register_gsi(u32 gsi, int triggering, int polarity)
514 * Make sure all (legacy) PCI IRQs are set as level-triggered. 502 * Make sure all (legacy) PCI IRQs are set as level-triggered.
515 */ 503 */
516 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { 504 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
517 extern void eisa_set_level_irq(unsigned int irq);
518
519 if (triggering == ACPI_LEVEL_SENSITIVE) 505 if (triggering == ACPI_LEVEL_SENSITIVE)
520 eisa_set_level_irq(gsi); 506 eisa_set_level_irq(gsi);
521 } 507 }
@@ -860,6 +846,364 @@ static int __init acpi_parse_madt_lapic_entries(void)
860#endif /* CONFIG_X86_LOCAL_APIC */ 846#endif /* CONFIG_X86_LOCAL_APIC */
861 847
862#ifdef CONFIG_X86_IO_APIC 848#ifdef CONFIG_X86_IO_APIC
849#define MP_ISA_BUS 0
850
851#ifdef CONFIG_X86_ES7000
852extern int es7000_plat;
853#endif
854
855static struct {
856 int apic_id;
857 int gsi_base;
858 int gsi_end;
859 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1);
860} mp_ioapic_routing[MAX_IO_APICS];
861
862static int mp_find_ioapic(int gsi)
863{
864 int i = 0;
865
866 /* Find the IOAPIC that manages this GSI. */
867 for (i = 0; i < nr_ioapics; i++) {
868 if ((gsi >= mp_ioapic_routing[i].gsi_base)
869 && (gsi <= mp_ioapic_routing[i].gsi_end))
870 return i;
871 }
872
873 printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi);
874 return -1;
875}
876
877static u8 __init uniq_ioapic_id(u8 id)
878{
879#ifdef CONFIG_X86_32
880 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
881 !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
882 return io_apic_get_unique_id(nr_ioapics, id);
883 else
884 return id;
885#else
886 int i;
887 DECLARE_BITMAP(used, 256);
888 bitmap_zero(used, 256);
889 for (i = 0; i < nr_ioapics; i++) {
890 struct mp_config_ioapic *ia = &mp_ioapics[i];
891 __set_bit(ia->mp_apicid, used);
892 }
893 if (!test_bit(id, used))
894 return id;
895 return find_first_zero_bit(used, 256);
896#endif
897}
898
899static int bad_ioapic(unsigned long address)
900{
901 if (nr_ioapics >= MAX_IO_APICS) {
902 printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
903 "(found %d)\n", MAX_IO_APICS, nr_ioapics);
904 panic("Recompile kernel with bigger MAX_IO_APICS!\n");
905 }
906 if (!address) {
907 printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address"
908 " found in table, skipping!\n");
909 return 1;
910 }
911 return 0;
912}
913
914void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
915{
916 int idx = 0;
917
918 if (bad_ioapic(address))
919 return;
920
921 idx = nr_ioapics;
922
923 mp_ioapics[idx].mp_type = MP_IOAPIC;
924 mp_ioapics[idx].mp_flags = MPC_APIC_USABLE;
925 mp_ioapics[idx].mp_apicaddr = address;
926
927 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
928 mp_ioapics[idx].mp_apicid = uniq_ioapic_id(id);
929#ifdef CONFIG_X86_32
930 mp_ioapics[idx].mp_apicver = io_apic_get_version(idx);
931#else
932 mp_ioapics[idx].mp_apicver = 0;
933#endif
934 /*
935 * Build basic GSI lookup table to facilitate gsi->io_apic lookups
936 * and to prevent reprogramming of IOAPIC pins (PCI GSIs).
937 */
938 mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mp_apicid;
939 mp_ioapic_routing[idx].gsi_base = gsi_base;
940 mp_ioapic_routing[idx].gsi_end = gsi_base +
941 io_apic_get_redir_entries(idx);
942
943 printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, "
944 "GSI %d-%d\n", idx, mp_ioapics[idx].mp_apicid,
945 mp_ioapics[idx].mp_apicver, mp_ioapics[idx].mp_apicaddr,
946 mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end);
947
948 nr_ioapics++;
949}
950
951static void assign_to_mp_irq(struct mp_config_intsrc *m,
952 struct mp_config_intsrc *mp_irq)
953{
954 memcpy(mp_irq, m, sizeof(struct mp_config_intsrc));
955}
956
957static int mp_irq_cmp(struct mp_config_intsrc *mp_irq,
958 struct mp_config_intsrc *m)
959{
960 return memcmp(mp_irq, m, sizeof(struct mp_config_intsrc));
961}
962
963static void save_mp_irq(struct mp_config_intsrc *m)
964{
965 int i;
966
967 for (i = 0; i < mp_irq_entries; i++) {
968 if (!mp_irq_cmp(&mp_irqs[i], m))
969 return;
970 }
971
972 assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]);
973 if (++mp_irq_entries == MAX_IRQ_SOURCES)
974 panic("Max # of irq sources exceeded!!\n");
975}
976
977void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
978{
979 int ioapic;
980 int pin;
981 struct mp_config_intsrc mp_irq;
982
983 /*
984 * Convert 'gsi' to 'ioapic.pin'.
985 */
986 ioapic = mp_find_ioapic(gsi);
987 if (ioapic < 0)
988 return;
989 pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
990
991 /*
992 * TBD: This check is for faulty timer entries, where the override
993 * erroneously sets the trigger to level, resulting in a HUGE
994 * increase of timer interrupts!
995 */
996 if ((bus_irq == 0) && (trigger == 3))
997 trigger = 1;
998
999 mp_irq.mp_type = MP_INTSRC;
1000 mp_irq.mp_irqtype = mp_INT;
1001 mp_irq.mp_irqflag = (trigger << 2) | polarity;
1002 mp_irq.mp_srcbus = MP_ISA_BUS;
1003 mp_irq.mp_srcbusirq = bus_irq; /* IRQ */
1004 mp_irq.mp_dstapic = mp_ioapics[ioapic].mp_apicid; /* APIC ID */
1005 mp_irq.mp_dstirq = pin; /* INTIN# */
1006
1007 save_mp_irq(&mp_irq);
1008}
1009
1010void __init mp_config_acpi_legacy_irqs(void)
1011{
1012 int i;
1013 int ioapic;
1014 unsigned int dstapic;
1015 struct mp_config_intsrc mp_irq;
1016
1017#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
1018 /*
1019 * Fabricate the legacy ISA bus (bus #31).
1020 */
1021 mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA;
1022#endif
1023 set_bit(MP_ISA_BUS, mp_bus_not_pci);
1024 Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
1025
1026#ifdef CONFIG_X86_ES7000
1027 /*
1028 * Older generations of ES7000 have no legacy identity mappings
1029 */
1030 if (es7000_plat == 1)
1031 return;
1032#endif
1033
1034 /*
1035 * Locate the IOAPIC that manages the ISA IRQs (0-15).
1036 */
1037 ioapic = mp_find_ioapic(0);
1038 if (ioapic < 0)
1039 return;
1040 dstapic = mp_ioapics[ioapic].mp_apicid;
1041
1042 /*
1043 * Use the default configuration for the IRQs 0-15. Unless
1044 * overridden by (MADT) interrupt source override entries.
1045 */
1046 for (i = 0; i < 16; i++) {
1047 int idx;
1048
1049 for (idx = 0; idx < mp_irq_entries; idx++) {
1050 struct mp_config_intsrc *irq = mp_irqs + idx;
1051
1052 /* Do we already have a mapping for this ISA IRQ? */
1053 if (irq->mp_srcbus == MP_ISA_BUS
1054 && irq->mp_srcbusirq == i)
1055 break;
1056
1057 /* Do we already have a mapping for this IOAPIC pin */
1058 if (irq->mp_dstapic == dstapic &&
1059 irq->mp_dstirq == i)
1060 break;
1061 }
1062
1063 if (idx != mp_irq_entries) {
1064 printk(KERN_DEBUG "ACPI: IRQ%d used by override.\n", i);
1065 continue; /* IRQ already used */
1066 }
1067
1068 mp_irq.mp_type = MP_INTSRC;
1069 mp_irq.mp_irqflag = 0; /* Conforming */
1070 mp_irq.mp_srcbus = MP_ISA_BUS;
1071 mp_irq.mp_dstapic = dstapic;
1072 mp_irq.mp_irqtype = mp_INT;
1073 mp_irq.mp_srcbusirq = i; /* Identity mapped */
1074 mp_irq.mp_dstirq = i;
1075
1076 save_mp_irq(&mp_irq);
1077 }
1078}
1079
1080int mp_register_gsi(u32 gsi, int triggering, int polarity)
1081{
1082 int ioapic;
1083 int ioapic_pin;
1084#ifdef CONFIG_X86_32
1085#define MAX_GSI_NUM 4096
1086#define IRQ_COMPRESSION_START 64
1087
1088 static int pci_irq = IRQ_COMPRESSION_START;
1089 /*
1090 * Mapping between Global System Interrupts, which
1091 * represent all possible interrupts, and IRQs
1092 * assigned to actual devices.
1093 */
1094 static int gsi_to_irq[MAX_GSI_NUM];
1095#else
1096
1097 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
1098 return gsi;
1099#endif
1100
1101 /* Don't set up the ACPI SCI because it's already set up */
1102 if (acpi_gbl_FADT.sci_interrupt == gsi)
1103 return gsi;
1104
1105 ioapic = mp_find_ioapic(gsi);
1106 if (ioapic < 0) {
1107 printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);
1108 return gsi;
1109 }
1110
1111 ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
1112
1113#ifdef CONFIG_X86_32
1114 if (ioapic_renumber_irq)
1115 gsi = ioapic_renumber_irq(ioapic, gsi);
1116#endif
1117
1118 /*
1119 * Avoid pin reprogramming. PRTs typically include entries
1120 * with redundant pin->gsi mappings (but unique PCI devices);
1121 * we only program the IOAPIC on the first.
1122 */
1123 if (ioapic_pin > MP_MAX_IOAPIC_PIN) {
1124 printk(KERN_ERR "Invalid reference to IOAPIC pin "
1125 "%d-%d\n", mp_ioapic_routing[ioapic].apic_id,
1126 ioapic_pin);
1127 return gsi;
1128 }
1129 if (test_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) {
1130 Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n",
1131 mp_ioapic_routing[ioapic].apic_id, ioapic_pin);
1132#ifdef CONFIG_X86_32
1133 return (gsi < IRQ_COMPRESSION_START ? gsi : gsi_to_irq[gsi]);
1134#else
1135 return gsi;
1136#endif
1137 }
1138
1139 set_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed);
1140#ifdef CONFIG_X86_32
1141 /*
1142 * For GSI >= 64, use IRQ compression
1143 */
1144 if ((gsi >= IRQ_COMPRESSION_START)
1145 && (triggering == ACPI_LEVEL_SENSITIVE)) {
1146 /*
1147 * For PCI devices assign IRQs in order, avoiding gaps
1148 * due to unused I/O APIC pins.
1149 */
1150 int irq = gsi;
1151 if (gsi < MAX_GSI_NUM) {
1152 /*
1153 * Retain the VIA chipset work-around (gsi > 15), but
1154 * avoid a problem where the 8254 timer (IRQ0) is setup
1155 * via an override (so it's not on pin 0 of the ioapic),
1156 * and at the same time, the pin 0 interrupt is a PCI
1157 * type. The gsi > 15 test could cause these two pins
1158 * to be shared as IRQ0, and they are not shareable.
1159 * So test for this condition, and if necessary, avoid
1160 * the pin collision.
1161 */
1162 gsi = pci_irq++;
1163 /*
1164 * Don't assign IRQ used by ACPI SCI
1165 */
1166 if (gsi == acpi_gbl_FADT.sci_interrupt)
1167 gsi = pci_irq++;
1168 gsi_to_irq[irq] = gsi;
1169 } else {
1170 printk(KERN_ERR "GSI %u is too high\n", gsi);
1171 return gsi;
1172 }
1173 }
1174#endif
1175 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
1176 triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
1177 polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
1178 return gsi;
1179}
1180
1181int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
1182 u32 gsi, int triggering, int polarity)
1183{
1184#ifdef CONFIG_X86_MPPARSE
1185 struct mp_config_intsrc mp_irq;
1186 int ioapic;
1187
1188 if (!acpi_ioapic)
1189 return 0;
1190
1191 /* print the entry should happen on mptable identically */
1192 mp_irq.mp_type = MP_INTSRC;
1193 mp_irq.mp_irqtype = mp_INT;
1194 mp_irq.mp_irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
1195 (polarity == ACPI_ACTIVE_HIGH ? 1 : 3);
1196 mp_irq.mp_srcbus = number;
1197 mp_irq.mp_srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
1198 ioapic = mp_find_ioapic(gsi);
1199 mp_irq.mp_dstapic = mp_ioapic_routing[ioapic].apic_id;
1200 mp_irq.mp_dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base;
1201
1202 save_mp_irq(&mp_irq);
1203#endif
1204 return 0;
1205}
1206
863/* 1207/*
864 * Parse IOAPIC related entries in MADT 1208 * Parse IOAPIC related entries in MADT
865 * returns 0 on success, < 0 on error 1209 * returns 0 on success, < 0 on error
@@ -1009,8 +1353,6 @@ static void __init acpi_process_madt(void)
1009 return; 1353 return;
1010} 1354}
1011 1355
1012#ifdef __i386__
1013
1014static int __init disable_acpi_irq(const struct dmi_system_id *d) 1356static int __init disable_acpi_irq(const struct dmi_system_id *d)
1015{ 1357{
1016 if (!acpi_force) { 1358 if (!acpi_force) {
@@ -1061,6 +1403,16 @@ static int __init force_acpi_ht(const struct dmi_system_id *d)
1061} 1403}
1062 1404
1063/* 1405/*
1406 * Force ignoring BIOS IRQ0 pin2 override
1407 */
1408static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
1409{
1410 pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n", d->ident);
1411 acpi_skip_timer_override = 1;
1412 return 0;
1413}
1414
1415/*
1064 * If your system is blacklisted here, but you find that acpi=force 1416 * If your system is blacklisted here, but you find that acpi=force
1065 * works for you, please contact acpi-devel@sourceforge.net 1417 * works for you, please contact acpi-devel@sourceforge.net
1066 */ 1418 */
@@ -1227,11 +1579,35 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
1227 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), 1579 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
1228 }, 1580 },
1229 }, 1581 },
1582 /*
1583 * HP laptops which use a DSDT reporting as HP/SB400/10000,
1584 * which includes some code which overrides all temperature
1585 * trip points to 16C if the INTIN2 input of the I/O APIC
1586 * is enabled. This input is incorrectly designated the
1587 * ISA IRQ 0 via an interrupt source override even though
1588 * it is wired to the output of the master 8259A and INTIN0
1589 * is not connected at all. Force ignoring BIOS IRQ0 pin2
1590 * override in that cases.
1591 */
1592 {
1593 .callback = dmi_ignore_irq0_timer_override,
1594 .ident = "HP NX6125 laptop",
1595 .matches = {
1596 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1597 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6125"),
1598 },
1599 },
1600 {
1601 .callback = dmi_ignore_irq0_timer_override,
1602 .ident = "HP NX6325 laptop",
1603 .matches = {
1604 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1605 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"),
1606 },
1607 },
1230 {} 1608 {}
1231}; 1609};
1232 1610
1233#endif /* __i386__ */
1234
1235/* 1611/*
1236 * acpi_boot_table_init() and acpi_boot_init() 1612 * acpi_boot_table_init() and acpi_boot_init()
1237 * called from setup_arch(), always. 1613 * called from setup_arch(), always.
@@ -1259,9 +1635,7 @@ int __init acpi_boot_table_init(void)
1259{ 1635{
1260 int error; 1636 int error;
1261 1637
1262#ifdef __i386__
1263 dmi_check_system(acpi_dmi_table); 1638 dmi_check_system(acpi_dmi_table);
1264#endif
1265 1639
1266 /* 1640 /*
1267 * If acpi_disabled, bail out 1641 * If acpi_disabled, bail out
@@ -1386,6 +1760,20 @@ static int __init parse_pci(char *arg)
1386} 1760}
1387early_param("pci", parse_pci); 1761early_param("pci", parse_pci);
1388 1762
1763int __init acpi_mps_check(void)
1764{
1765#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
1766/* mptable code is not built-in*/
1767 if (acpi_disabled || acpi_noirq) {
1768 printk(KERN_WARNING "MPS support code is not built-in.\n"
1769 "Using acpi=off or acpi=noirq or pci=noacpi "
1770 "may have problem\n");
1771 return 1;
1772 }
1773#endif
1774 return 0;
1775}
1776
1389#ifdef CONFIG_X86_IO_APIC 1777#ifdef CONFIG_X86_IO_APIC
1390static int __init parse_acpi_skip_timer_override(char *arg) 1778static int __init parse_acpi_skip_timer_override(char *arg)
1391{ 1779{
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 36af01f029ed..e6a4b564ccaa 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -86,7 +86,9 @@ int acpi_save_state_mem(void)
86 saved_magic = 0x12345678; 86 saved_magic = 0x12345678;
87#else /* CONFIG_64BIT */ 87#else /* CONFIG_64BIT */
88 header->trampoline_segment = setup_trampoline() >> 4; 88 header->trampoline_segment = setup_trampoline() >> 4;
89 init_rsp = (unsigned long)temp_stack + 4096; 89#ifdef CONFIG_SMP
90 stack_start.sp = temp_stack + 4096;
91#endif
90 initial_code = (unsigned long)wakeup_long64; 92 initial_code = (unsigned long)wakeup_long64;
91 saved_magic = 0x123456789abcdef0; 93 saved_magic = 0x123456789abcdef0;
92#endif /* CONFIG_64BIT */ 94#endif /* CONFIG_64BIT */
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 65c7857a90dd..2763cb37b553 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -1,6 +1,6 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/sched.h> 2#include <linux/sched.h>
3#include <linux/spinlock.h> 3#include <linux/mutex.h>
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/kprobes.h> 5#include <linux/kprobes.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
@@ -143,7 +143,7 @@ static const unsigned char *const p6_nops[ASM_NOP_MAX+1] = {
143#ifdef CONFIG_X86_64 143#ifdef CONFIG_X86_64
144 144
145extern char __vsyscall_0; 145extern char __vsyscall_0;
146static inline const unsigned char*const * find_nop_table(void) 146const unsigned char *const *find_nop_table(void)
147{ 147{
148 return boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || 148 return boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
149 boot_cpu_data.x86 < 6 ? k8_nops : p6_nops; 149 boot_cpu_data.x86 < 6 ? k8_nops : p6_nops;
@@ -162,7 +162,7 @@ static const struct nop {
162 { -1, NULL } 162 { -1, NULL }
163}; 163};
164 164
165static const unsigned char*const * find_nop_table(void) 165const unsigned char *const *find_nop_table(void)
166{ 166{
167 const unsigned char *const *noptable = intel_nops; 167 const unsigned char *const *noptable = intel_nops;
168 int i; 168 int i;
@@ -279,7 +279,7 @@ struct smp_alt_module {
279 struct list_head next; 279 struct list_head next;
280}; 280};
281static LIST_HEAD(smp_alt_modules); 281static LIST_HEAD(smp_alt_modules);
282static DEFINE_SPINLOCK(smp_alt); 282static DEFINE_MUTEX(smp_alt);
283static int smp_mode = 1; /* protected by smp_alt */ 283static int smp_mode = 1; /* protected by smp_alt */
284 284
285void alternatives_smp_module_add(struct module *mod, char *name, 285void alternatives_smp_module_add(struct module *mod, char *name,
@@ -312,12 +312,12 @@ void alternatives_smp_module_add(struct module *mod, char *name,
312 __func__, smp->locks, smp->locks_end, 312 __func__, smp->locks, smp->locks_end,
313 smp->text, smp->text_end, smp->name); 313 smp->text, smp->text_end, smp->name);
314 314
315 spin_lock(&smp_alt); 315 mutex_lock(&smp_alt);
316 list_add_tail(&smp->next, &smp_alt_modules); 316 list_add_tail(&smp->next, &smp_alt_modules);
317 if (boot_cpu_has(X86_FEATURE_UP)) 317 if (boot_cpu_has(X86_FEATURE_UP))
318 alternatives_smp_unlock(smp->locks, smp->locks_end, 318 alternatives_smp_unlock(smp->locks, smp->locks_end,
319 smp->text, smp->text_end); 319 smp->text, smp->text_end);
320 spin_unlock(&smp_alt); 320 mutex_unlock(&smp_alt);
321} 321}
322 322
323void alternatives_smp_module_del(struct module *mod) 323void alternatives_smp_module_del(struct module *mod)
@@ -327,17 +327,17 @@ void alternatives_smp_module_del(struct module *mod)
327 if (smp_alt_once || noreplace_smp) 327 if (smp_alt_once || noreplace_smp)
328 return; 328 return;
329 329
330 spin_lock(&smp_alt); 330 mutex_lock(&smp_alt);
331 list_for_each_entry(item, &smp_alt_modules, next) { 331 list_for_each_entry(item, &smp_alt_modules, next) {
332 if (mod != item->mod) 332 if (mod != item->mod)
333 continue; 333 continue;
334 list_del(&item->next); 334 list_del(&item->next);
335 spin_unlock(&smp_alt); 335 mutex_unlock(&smp_alt);
336 DPRINTK("%s: %s\n", __func__, item->name); 336 DPRINTK("%s: %s\n", __func__, item->name);
337 kfree(item); 337 kfree(item);
338 return; 338 return;
339 } 339 }
340 spin_unlock(&smp_alt); 340 mutex_unlock(&smp_alt);
341} 341}
342 342
343void alternatives_smp_switch(int smp) 343void alternatives_smp_switch(int smp)
@@ -359,7 +359,7 @@ void alternatives_smp_switch(int smp)
359 return; 359 return;
360 BUG_ON(!smp && (num_online_cpus() > 1)); 360 BUG_ON(!smp && (num_online_cpus() > 1));
361 361
362 spin_lock(&smp_alt); 362 mutex_lock(&smp_alt);
363 363
364 /* 364 /*
365 * Avoid unnecessary switches because it forces JIT based VMs to 365 * Avoid unnecessary switches because it forces JIT based VMs to
@@ -383,7 +383,7 @@ void alternatives_smp_switch(int smp)
383 mod->text, mod->text_end); 383 mod->text, mod->text_end);
384 } 384 }
385 smp_mode = smp; 385 smp_mode = smp;
386 spin_unlock(&smp_alt); 386 mutex_unlock(&smp_alt);
387} 387}
388 388
389#endif 389#endif
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
new file mode 100644
index 000000000000..f2766d84c7a0
--- /dev/null
+++ b/arch/x86/kernel/amd_iommu.c
@@ -0,0 +1,962 @@
1/*
2 * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
3 * Author: Joerg Roedel <joerg.roedel@amd.com>
4 * Leo Duran <leo.duran@amd.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
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/pci.h>
21#include <linux/gfp.h>
22#include <linux/bitops.h>
23#include <linux/scatterlist.h>
24#include <linux/iommu-helper.h>
25#include <asm/proto.h>
26#include <asm/gart.h>
27#include <asm/amd_iommu_types.h>
28#include <asm/amd_iommu.h>
29
30#define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28))
31
32#define to_pages(addr, size) \
33 (round_up(((addr) & ~PAGE_MASK) + (size), PAGE_SIZE) >> PAGE_SHIFT)
34
35static DEFINE_RWLOCK(amd_iommu_devtable_lock);
36
37struct command {
38 u32 data[4];
39};
40
41static int dma_ops_unity_map(struct dma_ops_domain *dma_dom,
42 struct unity_map_entry *e);
43
44static int iommu_has_npcache(struct amd_iommu *iommu)
45{
46 return iommu->cap & IOMMU_CAP_NPCACHE;
47}
48
49static int __iommu_queue_command(struct amd_iommu *iommu, struct command *cmd)
50{
51 u32 tail, head;
52 u8 *target;
53
54 tail = readl(iommu->mmio_base + MMIO_CMD_TAIL_OFFSET);
55 target = (iommu->cmd_buf + tail);
56 memcpy_toio(target, cmd, sizeof(*cmd));
57 tail = (tail + sizeof(*cmd)) % iommu->cmd_buf_size;
58 head = readl(iommu->mmio_base + MMIO_CMD_HEAD_OFFSET);
59 if (tail == head)
60 return -ENOMEM;
61 writel(tail, iommu->mmio_base + MMIO_CMD_TAIL_OFFSET);
62
63 return 0;
64}
65
66static int iommu_queue_command(struct amd_iommu *iommu, struct command *cmd)
67{
68 unsigned long flags;
69 int ret;
70
71 spin_lock_irqsave(&iommu->lock, flags);
72 ret = __iommu_queue_command(iommu, cmd);
73 spin_unlock_irqrestore(&iommu->lock, flags);
74
75 return ret;
76}
77
78static int iommu_completion_wait(struct amd_iommu *iommu)
79{
80 int ret;
81 struct command cmd;
82 volatile u64 ready = 0;
83 unsigned long ready_phys = virt_to_phys(&ready);
84
85 memset(&cmd, 0, sizeof(cmd));
86 cmd.data[0] = LOW_U32(ready_phys) | CMD_COMPL_WAIT_STORE_MASK;
87 cmd.data[1] = HIGH_U32(ready_phys);
88 cmd.data[2] = 1; /* value written to 'ready' */
89 CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT);
90
91 iommu->need_sync = 0;
92
93 ret = iommu_queue_command(iommu, &cmd);
94
95 if (ret)
96 return ret;
97
98 while (!ready)
99 cpu_relax();
100
101 return 0;
102}
103
104static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
105{
106 struct command cmd;
107
108 BUG_ON(iommu == NULL);
109
110 memset(&cmd, 0, sizeof(cmd));
111 CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY);
112 cmd.data[0] = devid;
113
114 iommu->need_sync = 1;
115
116 return iommu_queue_command(iommu, &cmd);
117}
118
119static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
120 u64 address, u16 domid, int pde, int s)
121{
122 struct command cmd;
123
124 memset(&cmd, 0, sizeof(cmd));
125 address &= PAGE_MASK;
126 CMD_SET_TYPE(&cmd, CMD_INV_IOMMU_PAGES);
127 cmd.data[1] |= domid;
128 cmd.data[2] = LOW_U32(address);
129 cmd.data[3] = HIGH_U32(address);
130 if (s)
131 cmd.data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK;
132 if (pde)
133 cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK;
134
135 iommu->need_sync = 1;
136
137 return iommu_queue_command(iommu, &cmd);
138}
139
140static int iommu_flush_pages(struct amd_iommu *iommu, u16 domid,
141 u64 address, size_t size)
142{
143 int s = 0;
144 unsigned pages = to_pages(address, size);
145
146 address &= PAGE_MASK;
147
148 if (pages > 1) {
149 /*
150 * If we have to flush more than one page, flush all
151 * TLB entries for this domain
152 */
153 address = CMD_INV_IOMMU_ALL_PAGES_ADDRESS;
154 s = 1;
155 }
156
157 iommu_queue_inv_iommu_pages(iommu, address, domid, 0, s);
158
159 return 0;
160}
161
162static int iommu_map(struct protection_domain *dom,
163 unsigned long bus_addr,
164 unsigned long phys_addr,
165 int prot)
166{
167 u64 __pte, *pte, *page;
168
169 bus_addr = PAGE_ALIGN(bus_addr);
170 phys_addr = PAGE_ALIGN(bus_addr);
171
172 /* only support 512GB address spaces for now */
173 if (bus_addr > IOMMU_MAP_SIZE_L3 || !(prot & IOMMU_PROT_MASK))
174 return -EINVAL;
175
176 pte = &dom->pt_root[IOMMU_PTE_L2_INDEX(bus_addr)];
177
178 if (!IOMMU_PTE_PRESENT(*pte)) {
179 page = (u64 *)get_zeroed_page(GFP_KERNEL);
180 if (!page)
181 return -ENOMEM;
182 *pte = IOMMU_L2_PDE(virt_to_phys(page));
183 }
184
185 pte = IOMMU_PTE_PAGE(*pte);
186 pte = &pte[IOMMU_PTE_L1_INDEX(bus_addr)];
187
188 if (!IOMMU_PTE_PRESENT(*pte)) {
189 page = (u64 *)get_zeroed_page(GFP_KERNEL);
190 if (!page)
191 return -ENOMEM;
192 *pte = IOMMU_L1_PDE(virt_to_phys(page));
193 }
194
195 pte = IOMMU_PTE_PAGE(*pte);
196 pte = &pte[IOMMU_PTE_L0_INDEX(bus_addr)];
197
198 if (IOMMU_PTE_PRESENT(*pte))
199 return -EBUSY;
200
201 __pte = phys_addr | IOMMU_PTE_P;
202 if (prot & IOMMU_PROT_IR)
203 __pte |= IOMMU_PTE_IR;
204 if (prot & IOMMU_PROT_IW)
205 __pte |= IOMMU_PTE_IW;
206
207 *pte = __pte;
208
209 return 0;
210}
211
212static int iommu_for_unity_map(struct amd_iommu *iommu,
213 struct unity_map_entry *entry)
214{
215 u16 bdf, i;
216
217 for (i = entry->devid_start; i <= entry->devid_end; ++i) {
218 bdf = amd_iommu_alias_table[i];
219 if (amd_iommu_rlookup_table[bdf] == iommu)
220 return 1;
221 }
222
223 return 0;
224}
225
226static int iommu_init_unity_mappings(struct amd_iommu *iommu)
227{
228 struct unity_map_entry *entry;
229 int ret;
230
231 list_for_each_entry(entry, &amd_iommu_unity_map, list) {
232 if (!iommu_for_unity_map(iommu, entry))
233 continue;
234 ret = dma_ops_unity_map(iommu->default_dom, entry);
235 if (ret)
236 return ret;
237 }
238
239 return 0;
240}
241
242static int dma_ops_unity_map(struct dma_ops_domain *dma_dom,
243 struct unity_map_entry *e)
244{
245 u64 addr;
246 int ret;
247
248 for (addr = e->address_start; addr < e->address_end;
249 addr += PAGE_SIZE) {
250 ret = iommu_map(&dma_dom->domain, addr, addr, e->prot);
251 if (ret)
252 return ret;
253 /*
254 * if unity mapping is in aperture range mark the page
255 * as allocated in the aperture
256 */
257 if (addr < dma_dom->aperture_size)
258 __set_bit(addr >> PAGE_SHIFT, dma_dom->bitmap);
259 }
260
261 return 0;
262}
263
264static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom,
265 u16 devid)
266{
267 struct unity_map_entry *e;
268 int ret;
269
270 list_for_each_entry(e, &amd_iommu_unity_map, list) {
271 if (!(devid >= e->devid_start && devid <= e->devid_end))
272 continue;
273 ret = dma_ops_unity_map(dma_dom, e);
274 if (ret)
275 return ret;
276 }
277
278 return 0;
279}
280
281static unsigned long dma_mask_to_pages(unsigned long mask)
282{
283 return (mask >> PAGE_SHIFT) +
284 (PAGE_ALIGN(mask & ~PAGE_MASK) >> PAGE_SHIFT);
285}
286
287static unsigned long dma_ops_alloc_addresses(struct device *dev,
288 struct dma_ops_domain *dom,
289 unsigned int pages)
290{
291 unsigned long limit = dma_mask_to_pages(*dev->dma_mask);
292 unsigned long address;
293 unsigned long size = dom->aperture_size >> PAGE_SHIFT;
294 unsigned long boundary_size;
295
296 boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
297 PAGE_SIZE) >> PAGE_SHIFT;
298 limit = limit < size ? limit : size;
299
300 if (dom->next_bit >= limit)
301 dom->next_bit = 0;
302
303 address = iommu_area_alloc(dom->bitmap, limit, dom->next_bit, pages,
304 0 , boundary_size, 0);
305 if (address == -1)
306 address = iommu_area_alloc(dom->bitmap, limit, 0, pages,
307 0, boundary_size, 0);
308
309 if (likely(address != -1)) {
310 dom->next_bit = address + pages;
311 address <<= PAGE_SHIFT;
312 } else
313 address = bad_dma_address;
314
315 WARN_ON((address + (PAGE_SIZE*pages)) > dom->aperture_size);
316
317 return address;
318}
319
320static void dma_ops_free_addresses(struct dma_ops_domain *dom,
321 unsigned long address,
322 unsigned int pages)
323{
324 address >>= PAGE_SHIFT;
325 iommu_area_free(dom->bitmap, address, pages);
326}
327
328static u16 domain_id_alloc(void)
329{
330 unsigned long flags;
331 int id;
332
333 write_lock_irqsave(&amd_iommu_devtable_lock, flags);
334 id = find_first_zero_bit(amd_iommu_pd_alloc_bitmap, MAX_DOMAIN_ID);
335 BUG_ON(id == 0);
336 if (id > 0 && id < MAX_DOMAIN_ID)
337 __set_bit(id, amd_iommu_pd_alloc_bitmap);
338 else
339 id = 0;
340 write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
341
342 return id;
343}
344
345static void dma_ops_reserve_addresses(struct dma_ops_domain *dom,
346 unsigned long start_page,
347 unsigned int pages)
348{
349 unsigned int last_page = dom->aperture_size >> PAGE_SHIFT;
350
351 if (start_page + pages > last_page)
352 pages = last_page - start_page;
353
354 set_bit_string(dom->bitmap, start_page, pages);
355}
356
357static void dma_ops_free_pagetable(struct dma_ops_domain *dma_dom)
358{
359 int i, j;
360 u64 *p1, *p2, *p3;
361
362 p1 = dma_dom->domain.pt_root;
363
364 if (!p1)
365 return;
366
367 for (i = 0; i < 512; ++i) {
368 if (!IOMMU_PTE_PRESENT(p1[i]))
369 continue;
370
371 p2 = IOMMU_PTE_PAGE(p1[i]);
372 for (j = 0; j < 512; ++i) {
373 if (!IOMMU_PTE_PRESENT(p2[j]))
374 continue;
375 p3 = IOMMU_PTE_PAGE(p2[j]);
376 free_page((unsigned long)p3);
377 }
378
379 free_page((unsigned long)p2);
380 }
381
382 free_page((unsigned long)p1);
383}
384
385static void dma_ops_domain_free(struct dma_ops_domain *dom)
386{
387 if (!dom)
388 return;
389
390 dma_ops_free_pagetable(dom);
391
392 kfree(dom->pte_pages);
393
394 kfree(dom->bitmap);
395
396 kfree(dom);
397}
398
399static struct dma_ops_domain *dma_ops_domain_alloc(struct amd_iommu *iommu,
400 unsigned order)
401{
402 struct dma_ops_domain *dma_dom;
403 unsigned i, num_pte_pages;
404 u64 *l2_pde;
405 u64 address;
406
407 /*
408 * Currently the DMA aperture must be between 32 MB and 1GB in size
409 */
410 if ((order < 25) || (order > 30))
411 return NULL;
412
413 dma_dom = kzalloc(sizeof(struct dma_ops_domain), GFP_KERNEL);
414 if (!dma_dom)
415 return NULL;
416
417 spin_lock_init(&dma_dom->domain.lock);
418
419 dma_dom->domain.id = domain_id_alloc();
420 if (dma_dom->domain.id == 0)
421 goto free_dma_dom;
422 dma_dom->domain.mode = PAGE_MODE_3_LEVEL;
423 dma_dom->domain.pt_root = (void *)get_zeroed_page(GFP_KERNEL);
424 dma_dom->domain.priv = dma_dom;
425 if (!dma_dom->domain.pt_root)
426 goto free_dma_dom;
427 dma_dom->aperture_size = (1ULL << order);
428 dma_dom->bitmap = kzalloc(dma_dom->aperture_size / (PAGE_SIZE * 8),
429 GFP_KERNEL);
430 if (!dma_dom->bitmap)
431 goto free_dma_dom;
432 /*
433 * mark the first page as allocated so we never return 0 as
434 * a valid dma-address. So we can use 0 as error value
435 */
436 dma_dom->bitmap[0] = 1;
437 dma_dom->next_bit = 0;
438
439 if (iommu->exclusion_start &&
440 iommu->exclusion_start < dma_dom->aperture_size) {
441 unsigned long startpage = iommu->exclusion_start >> PAGE_SHIFT;
442 int pages = to_pages(iommu->exclusion_start,
443 iommu->exclusion_length);
444 dma_ops_reserve_addresses(dma_dom, startpage, pages);
445 }
446
447 num_pte_pages = dma_dom->aperture_size / (PAGE_SIZE * 512);
448 dma_dom->pte_pages = kzalloc(num_pte_pages * sizeof(void *),
449 GFP_KERNEL);
450 if (!dma_dom->pte_pages)
451 goto free_dma_dom;
452
453 l2_pde = (u64 *)get_zeroed_page(GFP_KERNEL);
454 if (l2_pde == NULL)
455 goto free_dma_dom;
456
457 dma_dom->domain.pt_root[0] = IOMMU_L2_PDE(virt_to_phys(l2_pde));
458
459 for (i = 0; i < num_pte_pages; ++i) {
460 dma_dom->pte_pages[i] = (u64 *)get_zeroed_page(GFP_KERNEL);
461 if (!dma_dom->pte_pages[i])
462 goto free_dma_dom;
463 address = virt_to_phys(dma_dom->pte_pages[i]);
464 l2_pde[i] = IOMMU_L1_PDE(address);
465 }
466
467 return dma_dom;
468
469free_dma_dom:
470 dma_ops_domain_free(dma_dom);
471
472 return NULL;
473}
474
475static struct protection_domain *domain_for_device(u16 devid)
476{
477 struct protection_domain *dom;
478 unsigned long flags;
479
480 read_lock_irqsave(&amd_iommu_devtable_lock, flags);
481 dom = amd_iommu_pd_table[devid];
482 read_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
483
484 return dom;
485}
486
487static void set_device_domain(struct amd_iommu *iommu,
488 struct protection_domain *domain,
489 u16 devid)
490{
491 unsigned long flags;
492
493 u64 pte_root = virt_to_phys(domain->pt_root);
494
495 pte_root |= (domain->mode & 0x07) << 9;
496 pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | 2;
497
498 write_lock_irqsave(&amd_iommu_devtable_lock, flags);
499 amd_iommu_dev_table[devid].data[0] = pte_root;
500 amd_iommu_dev_table[devid].data[1] = pte_root >> 32;
501 amd_iommu_dev_table[devid].data[2] = domain->id;
502
503 amd_iommu_pd_table[devid] = domain;
504 write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
505
506 iommu_queue_inv_dev_entry(iommu, devid);
507
508 iommu->need_sync = 1;
509}
510
511static int get_device_resources(struct device *dev,
512 struct amd_iommu **iommu,
513 struct protection_domain **domain,
514 u16 *bdf)
515{
516 struct dma_ops_domain *dma_dom;
517 struct pci_dev *pcidev;
518 u16 _bdf;
519
520 BUG_ON(!dev || dev->bus != &pci_bus_type || !dev->dma_mask);
521
522 pcidev = to_pci_dev(dev);
523 _bdf = (pcidev->bus->number << 8) | pcidev->devfn;
524
525 if (_bdf >= amd_iommu_last_bdf) {
526 *iommu = NULL;
527 *domain = NULL;
528 *bdf = 0xffff;
529 return 0;
530 }
531
532 *bdf = amd_iommu_alias_table[_bdf];
533
534 *iommu = amd_iommu_rlookup_table[*bdf];
535 if (*iommu == NULL)
536 return 0;
537 dma_dom = (*iommu)->default_dom;
538 *domain = domain_for_device(*bdf);
539 if (*domain == NULL) {
540 *domain = &dma_dom->domain;
541 set_device_domain(*iommu, *domain, *bdf);
542 printk(KERN_INFO "AMD IOMMU: Using protection domain %d for "
543 "device ", (*domain)->id);
544 print_devid(_bdf, 1);
545 }
546
547 return 1;
548}
549
550static dma_addr_t dma_ops_domain_map(struct amd_iommu *iommu,
551 struct dma_ops_domain *dom,
552 unsigned long address,
553 phys_addr_t paddr,
554 int direction)
555{
556 u64 *pte, __pte;
557
558 WARN_ON(address > dom->aperture_size);
559
560 paddr &= PAGE_MASK;
561
562 pte = dom->pte_pages[IOMMU_PTE_L1_INDEX(address)];
563 pte += IOMMU_PTE_L0_INDEX(address);
564
565 __pte = paddr | IOMMU_PTE_P | IOMMU_PTE_FC;
566
567 if (direction == DMA_TO_DEVICE)
568 __pte |= IOMMU_PTE_IR;
569 else if (direction == DMA_FROM_DEVICE)
570 __pte |= IOMMU_PTE_IW;
571 else if (direction == DMA_BIDIRECTIONAL)
572 __pte |= IOMMU_PTE_IR | IOMMU_PTE_IW;
573
574 WARN_ON(*pte);
575
576 *pte = __pte;
577
578 return (dma_addr_t)address;
579}
580
581static void dma_ops_domain_unmap(struct amd_iommu *iommu,
582 struct dma_ops_domain *dom,
583 unsigned long address)
584{
585 u64 *pte;
586
587 if (address >= dom->aperture_size)
588 return;
589
590 WARN_ON(address & 0xfffULL || address > dom->aperture_size);
591
592 pte = dom->pte_pages[IOMMU_PTE_L1_INDEX(address)];
593 pte += IOMMU_PTE_L0_INDEX(address);
594
595 WARN_ON(!*pte);
596
597 *pte = 0ULL;
598}
599
600static dma_addr_t __map_single(struct device *dev,
601 struct amd_iommu *iommu,
602 struct dma_ops_domain *dma_dom,
603 phys_addr_t paddr,
604 size_t size,
605 int dir)
606{
607 dma_addr_t offset = paddr & ~PAGE_MASK;
608 dma_addr_t address, start;
609 unsigned int pages;
610 int i;
611
612 pages = to_pages(paddr, size);
613 paddr &= PAGE_MASK;
614
615 address = dma_ops_alloc_addresses(dev, dma_dom, pages);
616 if (unlikely(address == bad_dma_address))
617 goto out;
618
619 start = address;
620 for (i = 0; i < pages; ++i) {
621 dma_ops_domain_map(iommu, dma_dom, start, paddr, dir);
622 paddr += PAGE_SIZE;
623 start += PAGE_SIZE;
624 }
625 address += offset;
626
627out:
628 return address;
629}
630
631static void __unmap_single(struct amd_iommu *iommu,
632 struct dma_ops_domain *dma_dom,
633 dma_addr_t dma_addr,
634 size_t size,
635 int dir)
636{
637 dma_addr_t i, start;
638 unsigned int pages;
639
640 if ((dma_addr == 0) || (dma_addr + size > dma_dom->aperture_size))
641 return;
642
643 pages = to_pages(dma_addr, size);
644 dma_addr &= PAGE_MASK;
645 start = dma_addr;
646
647 for (i = 0; i < pages; ++i) {
648 dma_ops_domain_unmap(iommu, dma_dom, start);
649 start += PAGE_SIZE;
650 }
651
652 dma_ops_free_addresses(dma_dom, dma_addr, pages);
653}
654
655static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
656 size_t size, int dir)
657{
658 unsigned long flags;
659 struct amd_iommu *iommu;
660 struct protection_domain *domain;
661 u16 devid;
662 dma_addr_t addr;
663
664 get_device_resources(dev, &iommu, &domain, &devid);
665
666 if (iommu == NULL || domain == NULL)
667 return (dma_addr_t)paddr;
668
669 spin_lock_irqsave(&domain->lock, flags);
670 addr = __map_single(dev, iommu, domain->priv, paddr, size, dir);
671 if (addr == bad_dma_address)
672 goto out;
673
674 if (iommu_has_npcache(iommu))
675 iommu_flush_pages(iommu, domain->id, addr, size);
676
677 if (iommu->need_sync)
678 iommu_completion_wait(iommu);
679
680out:
681 spin_unlock_irqrestore(&domain->lock, flags);
682
683 return addr;
684}
685
686static void unmap_single(struct device *dev, dma_addr_t dma_addr,
687 size_t size, int dir)
688{
689 unsigned long flags;
690 struct amd_iommu *iommu;
691 struct protection_domain *domain;
692 u16 devid;
693
694 if (!get_device_resources(dev, &iommu, &domain, &devid))
695 return;
696
697 spin_lock_irqsave(&domain->lock, flags);
698
699 __unmap_single(iommu, domain->priv, dma_addr, size, dir);
700
701 iommu_flush_pages(iommu, domain->id, dma_addr, size);
702
703 if (iommu->need_sync)
704 iommu_completion_wait(iommu);
705
706 spin_unlock_irqrestore(&domain->lock, flags);
707}
708
709static int map_sg_no_iommu(struct device *dev, struct scatterlist *sglist,
710 int nelems, int dir)
711{
712 struct scatterlist *s;
713 int i;
714
715 for_each_sg(sglist, s, nelems, i) {
716 s->dma_address = (dma_addr_t)sg_phys(s);
717 s->dma_length = s->length;
718 }
719
720 return nelems;
721}
722
723static int map_sg(struct device *dev, struct scatterlist *sglist,
724 int nelems, int dir)
725{
726 unsigned long flags;
727 struct amd_iommu *iommu;
728 struct protection_domain *domain;
729 u16 devid;
730 int i;
731 struct scatterlist *s;
732 phys_addr_t paddr;
733 int mapped_elems = 0;
734
735 get_device_resources(dev, &iommu, &domain, &devid);
736
737 if (!iommu || !domain)
738 return map_sg_no_iommu(dev, sglist, nelems, dir);
739
740 spin_lock_irqsave(&domain->lock, flags);
741
742 for_each_sg(sglist, s, nelems, i) {
743 paddr = sg_phys(s);
744
745 s->dma_address = __map_single(dev, iommu, domain->priv,
746 paddr, s->length, dir);
747
748 if (s->dma_address) {
749 s->dma_length = s->length;
750 mapped_elems++;
751 } else
752 goto unmap;
753 if (iommu_has_npcache(iommu))
754 iommu_flush_pages(iommu, domain->id, s->dma_address,
755 s->dma_length);
756 }
757
758 if (iommu->need_sync)
759 iommu_completion_wait(iommu);
760
761out:
762 spin_unlock_irqrestore(&domain->lock, flags);
763
764 return mapped_elems;
765unmap:
766 for_each_sg(sglist, s, mapped_elems, i) {
767 if (s->dma_address)
768 __unmap_single(iommu, domain->priv, s->dma_address,
769 s->dma_length, dir);
770 s->dma_address = s->dma_length = 0;
771 }
772
773 mapped_elems = 0;
774
775 goto out;
776}
777
778static void unmap_sg(struct device *dev, struct scatterlist *sglist,
779 int nelems, int dir)
780{
781 unsigned long flags;
782 struct amd_iommu *iommu;
783 struct protection_domain *domain;
784 struct scatterlist *s;
785 u16 devid;
786 int i;
787
788 if (!get_device_resources(dev, &iommu, &domain, &devid))
789 return;
790
791 spin_lock_irqsave(&domain->lock, flags);
792
793 for_each_sg(sglist, s, nelems, i) {
794 __unmap_single(iommu, domain->priv, s->dma_address,
795 s->dma_length, dir);
796 iommu_flush_pages(iommu, domain->id, s->dma_address,
797 s->dma_length);
798 s->dma_address = s->dma_length = 0;
799 }
800
801 if (iommu->need_sync)
802 iommu_completion_wait(iommu);
803
804 spin_unlock_irqrestore(&domain->lock, flags);
805}
806
807static void *alloc_coherent(struct device *dev, size_t size,
808 dma_addr_t *dma_addr, gfp_t flag)
809{
810 unsigned long flags;
811 void *virt_addr;
812 struct amd_iommu *iommu;
813 struct protection_domain *domain;
814 u16 devid;
815 phys_addr_t paddr;
816
817 virt_addr = (void *)__get_free_pages(flag, get_order(size));
818 if (!virt_addr)
819 return 0;
820
821 memset(virt_addr, 0, size);
822 paddr = virt_to_phys(virt_addr);
823
824 get_device_resources(dev, &iommu, &domain, &devid);
825
826 if (!iommu || !domain) {
827 *dma_addr = (dma_addr_t)paddr;
828 return virt_addr;
829 }
830
831 spin_lock_irqsave(&domain->lock, flags);
832
833 *dma_addr = __map_single(dev, iommu, domain->priv, paddr,
834 size, DMA_BIDIRECTIONAL);
835
836 if (*dma_addr == bad_dma_address) {
837 free_pages((unsigned long)virt_addr, get_order(size));
838 virt_addr = NULL;
839 goto out;
840 }
841
842 if (iommu_has_npcache(iommu))
843 iommu_flush_pages(iommu, domain->id, *dma_addr, size);
844
845 if (iommu->need_sync)
846 iommu_completion_wait(iommu);
847
848out:
849 spin_unlock_irqrestore(&domain->lock, flags);
850
851 return virt_addr;
852}
853
854static void free_coherent(struct device *dev, size_t size,
855 void *virt_addr, dma_addr_t dma_addr)
856{
857 unsigned long flags;
858 struct amd_iommu *iommu;
859 struct protection_domain *domain;
860 u16 devid;
861
862 get_device_resources(dev, &iommu, &domain, &devid);
863
864 if (!iommu || !domain)
865 goto free_mem;
866
867 spin_lock_irqsave(&domain->lock, flags);
868
869 __unmap_single(iommu, domain->priv, dma_addr, size, DMA_BIDIRECTIONAL);
870 iommu_flush_pages(iommu, domain->id, dma_addr, size);
871
872 if (iommu->need_sync)
873 iommu_completion_wait(iommu);
874
875 spin_unlock_irqrestore(&domain->lock, flags);
876
877free_mem:
878 free_pages((unsigned long)virt_addr, get_order(size));
879}
880
881/*
882 * If the driver core informs the DMA layer if a driver grabs a device
883 * we don't need to preallocate the protection domains anymore.
884 * For now we have to.
885 */
886void prealloc_protection_domains(void)
887{
888 struct pci_dev *dev = NULL;
889 struct dma_ops_domain *dma_dom;
890 struct amd_iommu *iommu;
891 int order = amd_iommu_aperture_order;
892 u16 devid;
893
894 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
895 devid = (dev->bus->number << 8) | dev->devfn;
896 if (devid >= amd_iommu_last_bdf)
897 continue;
898 devid = amd_iommu_alias_table[devid];
899 if (domain_for_device(devid))
900 continue;
901 iommu = amd_iommu_rlookup_table[devid];
902 if (!iommu)
903 continue;
904 dma_dom = dma_ops_domain_alloc(iommu, order);
905 if (!dma_dom)
906 continue;
907 init_unity_mappings_for_device(dma_dom, devid);
908 set_device_domain(iommu, &dma_dom->domain, devid);
909 printk(KERN_INFO "AMD IOMMU: Allocated domain %d for device ",
910 dma_dom->domain.id);
911 print_devid(devid, 1);
912 }
913}
914
915static struct dma_mapping_ops amd_iommu_dma_ops = {
916 .alloc_coherent = alloc_coherent,
917 .free_coherent = free_coherent,
918 .map_single = map_single,
919 .unmap_single = unmap_single,
920 .map_sg = map_sg,
921 .unmap_sg = unmap_sg,
922};
923
924int __init amd_iommu_init_dma_ops(void)
925{
926 struct amd_iommu *iommu;
927 int order = amd_iommu_aperture_order;
928 int ret;
929
930 list_for_each_entry(iommu, &amd_iommu_list, list) {
931 iommu->default_dom = dma_ops_domain_alloc(iommu, order);
932 if (iommu->default_dom == NULL)
933 return -ENOMEM;
934 ret = iommu_init_unity_mappings(iommu);
935 if (ret)
936 goto free_domains;
937 }
938
939 if (amd_iommu_isolate)
940 prealloc_protection_domains();
941
942 iommu_detected = 1;
943 force_iommu = 1;
944 bad_dma_address = 0;
945#ifdef CONFIG_GART_IOMMU
946 gart_iommu_aperture_disabled = 1;
947 gart_iommu_aperture = 0;
948#endif
949
950 dma_ops = &amd_iommu_dma_ops;
951
952 return 0;
953
954free_domains:
955
956 list_for_each_entry(iommu, &amd_iommu_list, list) {
957 if (iommu->default_dom)
958 dma_ops_domain_free(iommu->default_dom);
959 }
960
961 return ret;
962}
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
new file mode 100644
index 000000000000..2a13e430437d
--- /dev/null
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -0,0 +1,875 @@
1/*
2 * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
3 * Author: Joerg Roedel <joerg.roedel@amd.com>
4 * Leo Duran <leo.duran@amd.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
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/pci.h>
21#include <linux/acpi.h>
22#include <linux/gfp.h>
23#include <linux/list.h>
24#include <linux/sysdev.h>
25#include <asm/pci-direct.h>
26#include <asm/amd_iommu_types.h>
27#include <asm/amd_iommu.h>
28#include <asm/gart.h>
29
30/*
31 * definitions for the ACPI scanning code
32 */
33#define UPDATE_LAST_BDF(x) do {\
34 if ((x) > amd_iommu_last_bdf) \
35 amd_iommu_last_bdf = (x); \
36 } while (0);
37
38#define DEVID(bus, devfn) (((bus) << 8) | (devfn))
39#define PCI_BUS(x) (((x) >> 8) & 0xff)
40#define IVRS_HEADER_LENGTH 48
41#define TBL_SIZE(x) (1 << (PAGE_SHIFT + get_order(amd_iommu_last_bdf * (x))))
42
43#define ACPI_IVHD_TYPE 0x10
44#define ACPI_IVMD_TYPE_ALL 0x20
45#define ACPI_IVMD_TYPE 0x21
46#define ACPI_IVMD_TYPE_RANGE 0x22
47
48#define IVHD_DEV_ALL 0x01
49#define IVHD_DEV_SELECT 0x02
50#define IVHD_DEV_SELECT_RANGE_START 0x03
51#define IVHD_DEV_RANGE_END 0x04
52#define IVHD_DEV_ALIAS 0x42
53#define IVHD_DEV_ALIAS_RANGE 0x43
54#define IVHD_DEV_EXT_SELECT 0x46
55#define IVHD_DEV_EXT_SELECT_RANGE 0x47
56
57#define IVHD_FLAG_HT_TUN_EN 0x00
58#define IVHD_FLAG_PASSPW_EN 0x01
59#define IVHD_FLAG_RESPASSPW_EN 0x02
60#define IVHD_FLAG_ISOC_EN 0x03
61
62#define IVMD_FLAG_EXCL_RANGE 0x08
63#define IVMD_FLAG_UNITY_MAP 0x01
64
65#define ACPI_DEVFLAG_INITPASS 0x01
66#define ACPI_DEVFLAG_EXTINT 0x02
67#define ACPI_DEVFLAG_NMI 0x04
68#define ACPI_DEVFLAG_SYSMGT1 0x10
69#define ACPI_DEVFLAG_SYSMGT2 0x20
70#define ACPI_DEVFLAG_LINT0 0x40
71#define ACPI_DEVFLAG_LINT1 0x80
72#define ACPI_DEVFLAG_ATSDIS 0x10000000
73
74struct ivhd_header {
75 u8 type;
76 u8 flags;
77 u16 length;
78 u16 devid;
79 u16 cap_ptr;
80 u64 mmio_phys;
81 u16 pci_seg;
82 u16 info;
83 u32 reserved;
84} __attribute__((packed));
85
86struct ivhd_entry {
87 u8 type;
88 u16 devid;
89 u8 flags;
90 u32 ext;
91} __attribute__((packed));
92
93struct ivmd_header {
94 u8 type;
95 u8 flags;
96 u16 length;
97 u16 devid;
98 u16 aux;
99 u64 resv;
100 u64 range_start;
101 u64 range_length;
102} __attribute__((packed));
103
104static int __initdata amd_iommu_detected;
105
106u16 amd_iommu_last_bdf;
107struct list_head amd_iommu_unity_map;
108unsigned amd_iommu_aperture_order = 26;
109int amd_iommu_isolate;
110
111struct list_head amd_iommu_list;
112struct dev_table_entry *amd_iommu_dev_table;
113u16 *amd_iommu_alias_table;
114struct amd_iommu **amd_iommu_rlookup_table;
115struct protection_domain **amd_iommu_pd_table;
116unsigned long *amd_iommu_pd_alloc_bitmap;
117
118static u32 dev_table_size;
119static u32 alias_table_size;
120static u32 rlookup_table_size;
121
122static void __init iommu_set_exclusion_range(struct amd_iommu *iommu)
123{
124 u64 start = iommu->exclusion_start & PAGE_MASK;
125 u64 limit = (start + iommu->exclusion_length) & PAGE_MASK;
126 u64 entry;
127
128 if (!iommu->exclusion_start)
129 return;
130
131 entry = start | MMIO_EXCL_ENABLE_MASK;
132 memcpy_toio(iommu->mmio_base + MMIO_EXCL_BASE_OFFSET,
133 &entry, sizeof(entry));
134
135 entry = limit;
136 memcpy_toio(iommu->mmio_base + MMIO_EXCL_LIMIT_OFFSET,
137 &entry, sizeof(entry));
138}
139
140static void __init iommu_set_device_table(struct amd_iommu *iommu)
141{
142 u32 entry;
143
144 BUG_ON(iommu->mmio_base == NULL);
145
146 entry = virt_to_phys(amd_iommu_dev_table);
147 entry |= (dev_table_size >> 12) - 1;
148 memcpy_toio(iommu->mmio_base + MMIO_DEV_TABLE_OFFSET,
149 &entry, sizeof(entry));
150}
151
152static void __init iommu_feature_enable(struct amd_iommu *iommu, u8 bit)
153{
154 u32 ctrl;
155
156 ctrl = readl(iommu->mmio_base + MMIO_CONTROL_OFFSET);
157 ctrl |= (1 << bit);
158 writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
159}
160
161static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
162{
163 u32 ctrl;
164
165 ctrl = (u64)readl(iommu->mmio_base + MMIO_CONTROL_OFFSET);
166 ctrl &= ~(1 << bit);
167 writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
168}
169
170void __init iommu_enable(struct amd_iommu *iommu)
171{
172 printk(KERN_INFO "AMD IOMMU: Enabling IOMMU at ");
173 print_devid(iommu->devid, 0);
174 printk(" cap 0x%hx\n", iommu->cap_ptr);
175
176 iommu_feature_enable(iommu, CONTROL_IOMMU_EN);
177}
178
179static u8 * __init iommu_map_mmio_space(u64 address)
180{
181 u8 *ret;
182
183 if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu"))
184 return NULL;
185
186 ret = ioremap_nocache(address, MMIO_REGION_LENGTH);
187 if (ret != NULL)
188 return ret;
189
190 release_mem_region(address, MMIO_REGION_LENGTH);
191
192 return NULL;
193}
194
195static void __init iommu_unmap_mmio_space(struct amd_iommu *iommu)
196{
197 if (iommu->mmio_base)
198 iounmap(iommu->mmio_base);
199 release_mem_region(iommu->mmio_phys, MMIO_REGION_LENGTH);
200}
201
202static int __init find_last_devid_on_pci(int bus, int dev, int fn, int cap_ptr)
203{
204 u32 cap;
205
206 cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET);
207 UPDATE_LAST_BDF(DEVID(MMIO_GET_BUS(cap), MMIO_GET_LD(cap)));
208
209 return 0;
210}
211
212static int __init find_last_devid_from_ivhd(struct ivhd_header *h)
213{
214 u8 *p = (void *)h, *end = (void *)h;
215 struct ivhd_entry *dev;
216
217 p += sizeof(*h);
218 end += h->length;
219
220 find_last_devid_on_pci(PCI_BUS(h->devid),
221 PCI_SLOT(h->devid),
222 PCI_FUNC(h->devid),
223 h->cap_ptr);
224
225 while (p < end) {
226 dev = (struct ivhd_entry *)p;
227 switch (dev->type) {
228 case IVHD_DEV_SELECT:
229 case IVHD_DEV_RANGE_END:
230 case IVHD_DEV_ALIAS:
231 case IVHD_DEV_EXT_SELECT:
232 UPDATE_LAST_BDF(dev->devid);
233 break;
234 default:
235 break;
236 }
237 p += 0x04 << (*p >> 6);
238 }
239
240 WARN_ON(p != end);
241
242 return 0;
243}
244
245static int __init find_last_devid_acpi(struct acpi_table_header *table)
246{
247 int i;
248 u8 checksum = 0, *p = (u8 *)table, *end = (u8 *)table;
249 struct ivhd_header *h;
250
251 /*
252 * Validate checksum here so we don't need to do it when
253 * we actually parse the table
254 */
255 for (i = 0; i < table->length; ++i)
256 checksum += p[i];
257 if (checksum != 0)
258 /* ACPI table corrupt */
259 return -ENODEV;
260
261 p += IVRS_HEADER_LENGTH;
262
263 end += table->length;
264 while (p < end) {
265 h = (struct ivhd_header *)p;
266 switch (h->type) {
267 case ACPI_IVHD_TYPE:
268 find_last_devid_from_ivhd(h);
269 break;
270 default:
271 break;
272 }
273 p += h->length;
274 }
275 WARN_ON(p != end);
276
277 return 0;
278}
279
280static u8 * __init alloc_command_buffer(struct amd_iommu *iommu)
281{
282 u8 *cmd_buf = (u8 *)__get_free_pages(GFP_KERNEL,
283 get_order(CMD_BUFFER_SIZE));
284 u64 entry = 0;
285
286 if (cmd_buf == NULL)
287 return NULL;
288
289 iommu->cmd_buf_size = CMD_BUFFER_SIZE;
290
291 memset(cmd_buf, 0, CMD_BUFFER_SIZE);
292
293 entry = (u64)virt_to_phys(cmd_buf);
294 entry |= MMIO_CMD_SIZE_512;
295 memcpy_toio(iommu->mmio_base + MMIO_CMD_BUF_OFFSET,
296 &entry, sizeof(entry));
297
298 iommu_feature_enable(iommu, CONTROL_CMDBUF_EN);
299
300 return cmd_buf;
301}
302
303static void __init free_command_buffer(struct amd_iommu *iommu)
304{
305 if (iommu->cmd_buf)
306 free_pages((unsigned long)iommu->cmd_buf,
307 get_order(CMD_BUFFER_SIZE));
308}
309
310static void set_dev_entry_bit(u16 devid, u8 bit)
311{
312 int i = (bit >> 5) & 0x07;
313 int _bit = bit & 0x1f;
314
315 amd_iommu_dev_table[devid].data[i] |= (1 << _bit);
316}
317
318static void __init set_dev_entry_from_acpi(u16 devid, u32 flags, u32 ext_flags)
319{
320 if (flags & ACPI_DEVFLAG_INITPASS)
321 set_dev_entry_bit(devid, DEV_ENTRY_INIT_PASS);
322 if (flags & ACPI_DEVFLAG_EXTINT)
323 set_dev_entry_bit(devid, DEV_ENTRY_EINT_PASS);
324 if (flags & ACPI_DEVFLAG_NMI)
325 set_dev_entry_bit(devid, DEV_ENTRY_NMI_PASS);
326 if (flags & ACPI_DEVFLAG_SYSMGT1)
327 set_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1);
328 if (flags & ACPI_DEVFLAG_SYSMGT2)
329 set_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2);
330 if (flags & ACPI_DEVFLAG_LINT0)
331 set_dev_entry_bit(devid, DEV_ENTRY_LINT0_PASS);
332 if (flags & ACPI_DEVFLAG_LINT1)
333 set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS);
334}
335
336static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid)
337{
338 amd_iommu_rlookup_table[devid] = iommu;
339}
340
341static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
342{
343 struct amd_iommu *iommu = amd_iommu_rlookup_table[devid];
344
345 if (!(m->flags & IVMD_FLAG_EXCL_RANGE))
346 return;
347
348 if (iommu) {
349 set_dev_entry_bit(m->devid, DEV_ENTRY_EX);
350 iommu->exclusion_start = m->range_start;
351 iommu->exclusion_length = m->range_length;
352 }
353}
354
355static void __init init_iommu_from_pci(struct amd_iommu *iommu)
356{
357 int bus = PCI_BUS(iommu->devid);
358 int dev = PCI_SLOT(iommu->devid);
359 int fn = PCI_FUNC(iommu->devid);
360 int cap_ptr = iommu->cap_ptr;
361 u32 range;
362
363 iommu->cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_CAP_HDR_OFFSET);
364
365 range = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET);
366 iommu->first_device = DEVID(MMIO_GET_BUS(range), MMIO_GET_FD(range));
367 iommu->last_device = DEVID(MMIO_GET_BUS(range), MMIO_GET_LD(range));
368}
369
370static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
371 struct ivhd_header *h)
372{
373 u8 *p = (u8 *)h;
374 u8 *end = p, flags = 0;
375 u16 dev_i, devid = 0, devid_start = 0, devid_to = 0;
376 u32 ext_flags = 0;
377 bool alias = 0;
378 struct ivhd_entry *e;
379
380 /*
381 * First set the recommended feature enable bits from ACPI
382 * into the IOMMU control registers
383 */
384 h->flags & IVHD_FLAG_HT_TUN_EN ?
385 iommu_feature_enable(iommu, CONTROL_HT_TUN_EN) :
386 iommu_feature_disable(iommu, CONTROL_HT_TUN_EN);
387
388 h->flags & IVHD_FLAG_PASSPW_EN ?
389 iommu_feature_enable(iommu, CONTROL_PASSPW_EN) :
390 iommu_feature_disable(iommu, CONTROL_PASSPW_EN);
391
392 h->flags & IVHD_FLAG_RESPASSPW_EN ?
393 iommu_feature_enable(iommu, CONTROL_RESPASSPW_EN) :
394 iommu_feature_disable(iommu, CONTROL_RESPASSPW_EN);
395
396 h->flags & IVHD_FLAG_ISOC_EN ?
397 iommu_feature_enable(iommu, CONTROL_ISOC_EN) :
398 iommu_feature_disable(iommu, CONTROL_ISOC_EN);
399
400 /*
401 * make IOMMU memory accesses cache coherent
402 */
403 iommu_feature_enable(iommu, CONTROL_COHERENT_EN);
404
405 /*
406 * Done. Now parse the device entries
407 */
408 p += sizeof(struct ivhd_header);
409 end += h->length;
410
411 while (p < end) {
412 e = (struct ivhd_entry *)p;
413 switch (e->type) {
414 case IVHD_DEV_ALL:
415 for (dev_i = iommu->first_device;
416 dev_i <= iommu->last_device; ++dev_i)
417 set_dev_entry_from_acpi(dev_i, e->flags, 0);
418 break;
419 case IVHD_DEV_SELECT:
420 devid = e->devid;
421 set_dev_entry_from_acpi(devid, e->flags, 0);
422 break;
423 case IVHD_DEV_SELECT_RANGE_START:
424 devid_start = e->devid;
425 flags = e->flags;
426 ext_flags = 0;
427 alias = 0;
428 break;
429 case IVHD_DEV_ALIAS:
430 devid = e->devid;
431 devid_to = e->ext >> 8;
432 set_dev_entry_from_acpi(devid, e->flags, 0);
433 amd_iommu_alias_table[devid] = devid_to;
434 break;
435 case IVHD_DEV_ALIAS_RANGE:
436 devid_start = e->devid;
437 flags = e->flags;
438 devid_to = e->ext >> 8;
439 ext_flags = 0;
440 alias = 1;
441 break;
442 case IVHD_DEV_EXT_SELECT:
443 devid = e->devid;
444 set_dev_entry_from_acpi(devid, e->flags, e->ext);
445 break;
446 case IVHD_DEV_EXT_SELECT_RANGE:
447 devid_start = e->devid;
448 flags = e->flags;
449 ext_flags = e->ext;
450 alias = 0;
451 break;
452 case IVHD_DEV_RANGE_END:
453 devid = e->devid;
454 for (dev_i = devid_start; dev_i <= devid; ++dev_i) {
455 if (alias)
456 amd_iommu_alias_table[dev_i] = devid_to;
457 set_dev_entry_from_acpi(
458 amd_iommu_alias_table[dev_i],
459 flags, ext_flags);
460 }
461 break;
462 default:
463 break;
464 }
465
466 p += 0x04 << (e->type >> 6);
467 }
468}
469
470static int __init init_iommu_devices(struct amd_iommu *iommu)
471{
472 u16 i;
473
474 for (i = iommu->first_device; i <= iommu->last_device; ++i)
475 set_iommu_for_device(iommu, i);
476
477 return 0;
478}
479
480static void __init free_iommu_one(struct amd_iommu *iommu)
481{
482 free_command_buffer(iommu);
483 iommu_unmap_mmio_space(iommu);
484}
485
486static void __init free_iommu_all(void)
487{
488 struct amd_iommu *iommu, *next;
489
490 list_for_each_entry_safe(iommu, next, &amd_iommu_list, list) {
491 list_del(&iommu->list);
492 free_iommu_one(iommu);
493 kfree(iommu);
494 }
495}
496
497static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
498{
499 spin_lock_init(&iommu->lock);
500 list_add_tail(&iommu->list, &amd_iommu_list);
501
502 /*
503 * Copy data from ACPI table entry to the iommu struct
504 */
505 iommu->devid = h->devid;
506 iommu->cap_ptr = h->cap_ptr;
507 iommu->mmio_phys = h->mmio_phys;
508 iommu->mmio_base = iommu_map_mmio_space(h->mmio_phys);
509 if (!iommu->mmio_base)
510 return -ENOMEM;
511
512 iommu_set_device_table(iommu);
513 iommu->cmd_buf = alloc_command_buffer(iommu);
514 if (!iommu->cmd_buf)
515 return -ENOMEM;
516
517 init_iommu_from_pci(iommu);
518 init_iommu_from_acpi(iommu, h);
519 init_iommu_devices(iommu);
520
521 return 0;
522}
523
524static int __init init_iommu_all(struct acpi_table_header *table)
525{
526 u8 *p = (u8 *)table, *end = (u8 *)table;
527 struct ivhd_header *h;
528 struct amd_iommu *iommu;
529 int ret;
530
531 INIT_LIST_HEAD(&amd_iommu_list);
532
533 end += table->length;
534 p += IVRS_HEADER_LENGTH;
535
536 while (p < end) {
537 h = (struct ivhd_header *)p;
538 switch (*p) {
539 case ACPI_IVHD_TYPE:
540 iommu = kzalloc(sizeof(struct amd_iommu), GFP_KERNEL);
541 if (iommu == NULL)
542 return -ENOMEM;
543 ret = init_iommu_one(iommu, h);
544 if (ret)
545 return ret;
546 break;
547 default:
548 break;
549 }
550 p += h->length;
551
552 }
553 WARN_ON(p != end);
554
555 return 0;
556}
557
558static void __init free_unity_maps(void)
559{
560 struct unity_map_entry *entry, *next;
561
562 list_for_each_entry_safe(entry, next, &amd_iommu_unity_map, list) {
563 list_del(&entry->list);
564 kfree(entry);
565 }
566}
567
568static int __init init_exclusion_range(struct ivmd_header *m)
569{
570 int i;
571
572 switch (m->type) {
573 case ACPI_IVMD_TYPE:
574 set_device_exclusion_range(m->devid, m);
575 break;
576 case ACPI_IVMD_TYPE_ALL:
577 for (i = 0; i < amd_iommu_last_bdf; ++i)
578 set_device_exclusion_range(i, m);
579 break;
580 case ACPI_IVMD_TYPE_RANGE:
581 for (i = m->devid; i <= m->aux; ++i)
582 set_device_exclusion_range(i, m);
583 break;
584 default:
585 break;
586 }
587
588 return 0;
589}
590
591static int __init init_unity_map_range(struct ivmd_header *m)
592{
593 struct unity_map_entry *e = 0;
594
595 e = kzalloc(sizeof(*e), GFP_KERNEL);
596 if (e == NULL)
597 return -ENOMEM;
598
599 switch (m->type) {
600 default:
601 case ACPI_IVMD_TYPE:
602 e->devid_start = e->devid_end = m->devid;
603 break;
604 case ACPI_IVMD_TYPE_ALL:
605 e->devid_start = 0;
606 e->devid_end = amd_iommu_last_bdf;
607 break;
608 case ACPI_IVMD_TYPE_RANGE:
609 e->devid_start = m->devid;
610 e->devid_end = m->aux;
611 break;
612 }
613 e->address_start = PAGE_ALIGN(m->range_start);
614 e->address_end = e->address_start + PAGE_ALIGN(m->range_length);
615 e->prot = m->flags >> 1;
616
617 list_add_tail(&e->list, &amd_iommu_unity_map);
618
619 return 0;
620}
621
622static int __init init_memory_definitions(struct acpi_table_header *table)
623{
624 u8 *p = (u8 *)table, *end = (u8 *)table;
625 struct ivmd_header *m;
626
627 INIT_LIST_HEAD(&amd_iommu_unity_map);
628
629 end += table->length;
630 p += IVRS_HEADER_LENGTH;
631
632 while (p < end) {
633 m = (struct ivmd_header *)p;
634 if (m->flags & IVMD_FLAG_EXCL_RANGE)
635 init_exclusion_range(m);
636 else if (m->flags & IVMD_FLAG_UNITY_MAP)
637 init_unity_map_range(m);
638
639 p += m->length;
640 }
641
642 return 0;
643}
644
645static void __init enable_iommus(void)
646{
647 struct amd_iommu *iommu;
648
649 list_for_each_entry(iommu, &amd_iommu_list, list) {
650 iommu_set_exclusion_range(iommu);
651 iommu_enable(iommu);
652 }
653}
654
655/*
656 * Suspend/Resume support
657 * disable suspend until real resume implemented
658 */
659
660static int amd_iommu_resume(struct sys_device *dev)
661{
662 return 0;
663}
664
665static int amd_iommu_suspend(struct sys_device *dev, pm_message_t state)
666{
667 return -EINVAL;
668}
669
670static struct sysdev_class amd_iommu_sysdev_class = {
671 .name = "amd_iommu",
672 .suspend = amd_iommu_suspend,
673 .resume = amd_iommu_resume,
674};
675
676static struct sys_device device_amd_iommu = {
677 .id = 0,
678 .cls = &amd_iommu_sysdev_class,
679};
680
681int __init amd_iommu_init(void)
682{
683 int i, ret = 0;
684
685
686 if (no_iommu) {
687 printk(KERN_INFO "AMD IOMMU disabled by kernel command line\n");
688 return 0;
689 }
690
691 if (!amd_iommu_detected)
692 return -ENODEV;
693
694 /*
695 * First parse ACPI tables to find the largest Bus/Dev/Func
696 * we need to handle. Upon this information the shared data
697 * structures for the IOMMUs in the system will be allocated
698 */
699 if (acpi_table_parse("IVRS", find_last_devid_acpi) != 0)
700 return -ENODEV;
701
702 dev_table_size = TBL_SIZE(DEV_TABLE_ENTRY_SIZE);
703 alias_table_size = TBL_SIZE(ALIAS_TABLE_ENTRY_SIZE);
704 rlookup_table_size = TBL_SIZE(RLOOKUP_TABLE_ENTRY_SIZE);
705
706 ret = -ENOMEM;
707
708 /* Device table - directly used by all IOMMUs */
709 amd_iommu_dev_table = (void *)__get_free_pages(GFP_KERNEL,
710 get_order(dev_table_size));
711 if (amd_iommu_dev_table == NULL)
712 goto out;
713
714 /*
715 * Alias table - map PCI Bus/Dev/Func to Bus/Dev/Func the
716 * IOMMU see for that device
717 */
718 amd_iommu_alias_table = (void *)__get_free_pages(GFP_KERNEL,
719 get_order(alias_table_size));
720 if (amd_iommu_alias_table == NULL)
721 goto free;
722
723 /* IOMMU rlookup table - find the IOMMU for a specific device */
724 amd_iommu_rlookup_table = (void *)__get_free_pages(GFP_KERNEL,
725 get_order(rlookup_table_size));
726 if (amd_iommu_rlookup_table == NULL)
727 goto free;
728
729 /*
730 * Protection Domain table - maps devices to protection domains
731 * This table has the same size as the rlookup_table
732 */
733 amd_iommu_pd_table = (void *)__get_free_pages(GFP_KERNEL,
734 get_order(rlookup_table_size));
735 if (amd_iommu_pd_table == NULL)
736 goto free;
737
738 amd_iommu_pd_alloc_bitmap = (void *)__get_free_pages(GFP_KERNEL,
739 get_order(MAX_DOMAIN_ID/8));
740 if (amd_iommu_pd_alloc_bitmap == NULL)
741 goto free;
742
743 /*
744 * memory is allocated now; initialize the device table with all zeroes
745 * and let all alias entries point to itself
746 */
747 memset(amd_iommu_dev_table, 0, dev_table_size);
748 for (i = 0; i < amd_iommu_last_bdf; ++i)
749 amd_iommu_alias_table[i] = i;
750
751 memset(amd_iommu_pd_table, 0, rlookup_table_size);
752 memset(amd_iommu_pd_alloc_bitmap, 0, MAX_DOMAIN_ID / 8);
753
754 /*
755 * never allocate domain 0 because its used as the non-allocated and
756 * error value placeholder
757 */
758 amd_iommu_pd_alloc_bitmap[0] = 1;
759
760 /*
761 * now the data structures are allocated and basically initialized
762 * start the real acpi table scan
763 */
764 ret = -ENODEV;
765 if (acpi_table_parse("IVRS", init_iommu_all) != 0)
766 goto free;
767
768 if (acpi_table_parse("IVRS", init_memory_definitions) != 0)
769 goto free;
770
771 ret = amd_iommu_init_dma_ops();
772 if (ret)
773 goto free;
774
775 ret = sysdev_class_register(&amd_iommu_sysdev_class);
776 if (ret)
777 goto free;
778
779 ret = sysdev_register(&device_amd_iommu);
780 if (ret)
781 goto free;
782
783 enable_iommus();
784
785 printk(KERN_INFO "AMD IOMMU: aperture size is %d MB\n",
786 (1 << (amd_iommu_aperture_order-20)));
787
788 printk(KERN_INFO "AMD IOMMU: device isolation ");
789 if (amd_iommu_isolate)
790 printk("enabled\n");
791 else
792 printk("disabled\n");
793
794out:
795 return ret;
796
797free:
798 if (amd_iommu_pd_alloc_bitmap)
799 free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, 1);
800
801 if (amd_iommu_pd_table)
802 free_pages((unsigned long)amd_iommu_pd_table,
803 get_order(rlookup_table_size));
804
805 if (amd_iommu_rlookup_table)
806 free_pages((unsigned long)amd_iommu_rlookup_table,
807 get_order(rlookup_table_size));
808
809 if (amd_iommu_alias_table)
810 free_pages((unsigned long)amd_iommu_alias_table,
811 get_order(alias_table_size));
812
813 if (amd_iommu_dev_table)
814 free_pages((unsigned long)amd_iommu_dev_table,
815 get_order(dev_table_size));
816
817 free_iommu_all();
818
819 free_unity_maps();
820
821 goto out;
822}
823
824static int __init early_amd_iommu_detect(struct acpi_table_header *table)
825{
826 return 0;
827}
828
829void __init amd_iommu_detect(void)
830{
831 if (swiotlb || no_iommu || iommu_detected)
832 return;
833
834 if (acpi_table_parse("IVRS", early_amd_iommu_detect) == 0) {
835 iommu_detected = 1;
836 amd_iommu_detected = 1;
837#ifdef CONFIG_GART_IOMMU
838 gart_iommu_aperture_disabled = 1;
839 gart_iommu_aperture = 0;
840#endif
841 }
842}
843
844static int __init parse_amd_iommu_options(char *str)
845{
846 for (; *str; ++str) {
847 if (strcmp(str, "isolate") == 0)
848 amd_iommu_isolate = 1;
849 }
850
851 return 1;
852}
853
854static int __init parse_amd_iommu_size_options(char *str)
855{
856 for (; *str; ++str) {
857 if (strcmp(str, "32M") == 0)
858 amd_iommu_aperture_order = 25;
859 if (strcmp(str, "64M") == 0)
860 amd_iommu_aperture_order = 26;
861 if (strcmp(str, "128M") == 0)
862 amd_iommu_aperture_order = 27;
863 if (strcmp(str, "256M") == 0)
864 amd_iommu_aperture_order = 28;
865 if (strcmp(str, "512M") == 0)
866 amd_iommu_aperture_order = 29;
867 if (strcmp(str, "1G") == 0)
868 amd_iommu_aperture_order = 30;
869 }
870
871 return 1;
872}
873
874__setup("amd_iommu=", parse_amd_iommu_options);
875__setup("amd_iommu_size=", parse_amd_iommu_size_options);
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 479926d9e004..9f907806c1a5 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -35,6 +35,18 @@ int fallback_aper_force __initdata;
35 35
36int fix_aperture __initdata = 1; 36int fix_aperture __initdata = 1;
37 37
38struct bus_dev_range {
39 int bus;
40 int dev_base;
41 int dev_limit;
42};
43
44static struct bus_dev_range bus_dev_ranges[] __initdata = {
45 { 0x00, 0x18, 0x20},
46 { 0xff, 0x00, 0x20},
47 { 0xfe, 0x00, 0x20}
48};
49
38static struct resource gart_resource = { 50static struct resource gart_resource = {
39 .name = "GART", 51 .name = "GART",
40 .flags = IORESOURCE_MEM, 52 .flags = IORESOURCE_MEM,
@@ -55,8 +67,9 @@ static u32 __init allocate_aperture(void)
55 u32 aper_size; 67 u32 aper_size;
56 void *p; 68 void *p;
57 69
58 if (fallback_aper_order > 7) 70 /* aper_size should <= 1G */
59 fallback_aper_order = 7; 71 if (fallback_aper_order > 5)
72 fallback_aper_order = 5;
60 aper_size = (32 * 1024 * 1024) << fallback_aper_order; 73 aper_size = (32 * 1024 * 1024) << fallback_aper_order;
61 74
62 /* 75 /*
@@ -65,7 +78,20 @@ static u32 __init allocate_aperture(void)
65 * memory. Unfortunately we cannot move it up because that would 78 * memory. Unfortunately we cannot move it up because that would
66 * make the IOMMU useless. 79 * make the IOMMU useless.
67 */ 80 */
68 p = __alloc_bootmem_nopanic(aper_size, aper_size, 0); 81 /*
82 * using 512M as goal, in case kexec will load kernel_big
83 * that will do the on position decompress, and could overlap with
84 * that positon with gart that is used.
85 * sequende:
86 * kernel_small
87 * ==> kexec (with kdump trigger path or previous doesn't shutdown gart)
88 * ==> kernel_small(gart area become e820_reserved)
89 * ==> kexec (with kdump trigger path or previous doesn't shutdown gart)
90 * ==> kerne_big (uncompressed size will be big than 64M or 128M)
91 * so don't use 512M below as gart iommu, leave the space for kernel
92 * code for safe
93 */
94 p = __alloc_bootmem_nopanic(aper_size, aper_size, 512ULL<<20);
69 if (!p || __pa(p)+aper_size > 0xffffffff) { 95 if (!p || __pa(p)+aper_size > 0xffffffff) {
70 printk(KERN_ERR 96 printk(KERN_ERR
71 "Cannot allocate aperture memory hole (%p,%uK)\n", 97 "Cannot allocate aperture memory hole (%p,%uK)\n",
@@ -83,69 +109,53 @@ static u32 __init allocate_aperture(void)
83 return (u32)__pa(p); 109 return (u32)__pa(p);
84} 110}
85 111
86static int __init aperture_valid(u64 aper_base, u32 aper_size)
87{
88 if (!aper_base)
89 return 0;
90
91 if (aper_base + aper_size > 0x100000000UL) {
92 printk(KERN_ERR "Aperture beyond 4GB. Ignoring.\n");
93 return 0;
94 }
95 if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
96 printk(KERN_ERR "Aperture pointing to e820 RAM. Ignoring.\n");
97 return 0;
98 }
99 if (aper_size < 64*1024*1024) {
100 printk(KERN_ERR "Aperture too small (%d MB)\n", aper_size>>20);
101 return 0;
102 }
103
104 return 1;
105}
106 112
107/* Find a PCI capability */ 113/* Find a PCI capability */
108static __u32 __init find_cap(int num, int slot, int func, int cap) 114static u32 __init find_cap(int bus, int slot, int func, int cap)
109{ 115{
110 int bytes; 116 int bytes;
111 u8 pos; 117 u8 pos;
112 118
113 if (!(read_pci_config_16(num, slot, func, PCI_STATUS) & 119 if (!(read_pci_config_16(bus, slot, func, PCI_STATUS) &
114 PCI_STATUS_CAP_LIST)) 120 PCI_STATUS_CAP_LIST))
115 return 0; 121 return 0;
116 122
117 pos = read_pci_config_byte(num, slot, func, PCI_CAPABILITY_LIST); 123 pos = read_pci_config_byte(bus, slot, func, PCI_CAPABILITY_LIST);
118 for (bytes = 0; bytes < 48 && pos >= 0x40; bytes++) { 124 for (bytes = 0; bytes < 48 && pos >= 0x40; bytes++) {
119 u8 id; 125 u8 id;
120 126
121 pos &= ~3; 127 pos &= ~3;
122 id = read_pci_config_byte(num, slot, func, pos+PCI_CAP_LIST_ID); 128 id = read_pci_config_byte(bus, slot, func, pos+PCI_CAP_LIST_ID);
123 if (id == 0xff) 129 if (id == 0xff)
124 break; 130 break;
125 if (id == cap) 131 if (id == cap)
126 return pos; 132 return pos;
127 pos = read_pci_config_byte(num, slot, func, 133 pos = read_pci_config_byte(bus, slot, func,
128 pos+PCI_CAP_LIST_NEXT); 134 pos+PCI_CAP_LIST_NEXT);
129 } 135 }
130 return 0; 136 return 0;
131} 137}
132 138
133/* Read a standard AGPv3 bridge header */ 139/* Read a standard AGPv3 bridge header */
134static __u32 __init read_agp(int num, int slot, int func, int cap, u32 *order) 140static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
135{ 141{
136 u32 apsize; 142 u32 apsize;
137 u32 apsizereg; 143 u32 apsizereg;
138 int nbits; 144 int nbits;
139 u32 aper_low, aper_hi; 145 u32 aper_low, aper_hi;
140 u64 aper; 146 u64 aper;
147 u32 old_order;
141 148
142 printk(KERN_INFO "AGP bridge at %02x:%02x:%02x\n", num, slot, func); 149 printk(KERN_INFO "AGP bridge at %02x:%02x:%02x\n", bus, slot, func);
143 apsizereg = read_pci_config_16(num, slot, func, cap + 0x14); 150 apsizereg = read_pci_config_16(bus, slot, func, cap + 0x14);
144 if (apsizereg == 0xffffffff) { 151 if (apsizereg == 0xffffffff) {
145 printk(KERN_ERR "APSIZE in AGP bridge unreadable\n"); 152 printk(KERN_ERR "APSIZE in AGP bridge unreadable\n");
146 return 0; 153 return 0;
147 } 154 }
148 155
156 /* old_order could be the value from NB gart setting */
157 old_order = *order;
158
149 apsize = apsizereg & 0xfff; 159 apsize = apsizereg & 0xfff;
150 /* Some BIOS use weird encodings not in the AGPv3 table. */ 160 /* Some BIOS use weird encodings not in the AGPv3 table. */
151 if (apsize & 0xff) 161 if (apsize & 0xff)
@@ -155,14 +165,26 @@ static __u32 __init read_agp(int num, int slot, int func, int cap, u32 *order)
155 if ((int)*order < 0) /* < 32MB */ 165 if ((int)*order < 0) /* < 32MB */
156 *order = 0; 166 *order = 0;
157 167
158 aper_low = read_pci_config(num, slot, func, 0x10); 168 aper_low = read_pci_config(bus, slot, func, 0x10);
159 aper_hi = read_pci_config(num, slot, func, 0x14); 169 aper_hi = read_pci_config(bus, slot, func, 0x14);
160 aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32); 170 aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32);
161 171
172 /*
173 * On some sick chips, APSIZE is 0. It means it wants 4G
174 * so let double check that order, and lets trust AMD NB settings:
175 */
176 printk(KERN_INFO "Aperture from AGP @ %Lx old size %u MB\n",
177 aper, 32 << old_order);
178 if (aper + (32ULL<<(20 + *order)) > 0x100000000ULL) {
179 printk(KERN_INFO "Aperture size %u MB (APSIZE %x) is not right, using settings from NB\n",
180 32 << *order, apsizereg);
181 *order = old_order;
182 }
183
162 printk(KERN_INFO "Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n", 184 printk(KERN_INFO "Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n",
163 aper, 32 << *order, apsizereg); 185 aper, 32 << *order, apsizereg);
164 186
165 if (!aperture_valid(aper, (32*1024*1024) << *order)) 187 if (!aperture_valid(aper, (32*1024*1024) << *order, 32<<20))
166 return 0; 188 return 0;
167 return (u32)aper; 189 return (u32)aper;
168} 190}
@@ -180,17 +202,17 @@ static __u32 __init read_agp(int num, int slot, int func, int cap, u32 *order)
180 * the AGP bridges should be always an own bus on the HT hierarchy, 202 * the AGP bridges should be always an own bus on the HT hierarchy,
181 * but do it here for future safety. 203 * but do it here for future safety.
182 */ 204 */
183static __u32 __init search_agp_bridge(u32 *order, int *valid_agp) 205static u32 __init search_agp_bridge(u32 *order, int *valid_agp)
184{ 206{
185 int num, slot, func; 207 int bus, slot, func;
186 208
187 /* Poor man's PCI discovery */ 209 /* Poor man's PCI discovery */
188 for (num = 0; num < 256; num++) { 210 for (bus = 0; bus < 256; bus++) {
189 for (slot = 0; slot < 32; slot++) { 211 for (slot = 0; slot < 32; slot++) {
190 for (func = 0; func < 8; func++) { 212 for (func = 0; func < 8; func++) {
191 u32 class, cap; 213 u32 class, cap;
192 u8 type; 214 u8 type;
193 class = read_pci_config(num, slot, func, 215 class = read_pci_config(bus, slot, func,
194 PCI_CLASS_REVISION); 216 PCI_CLASS_REVISION);
195 if (class == 0xffffffff) 217 if (class == 0xffffffff)
196 break; 218 break;
@@ -199,17 +221,17 @@ static __u32 __init search_agp_bridge(u32 *order, int *valid_agp)
199 case PCI_CLASS_BRIDGE_HOST: 221 case PCI_CLASS_BRIDGE_HOST:
200 case PCI_CLASS_BRIDGE_OTHER: /* needed? */ 222 case PCI_CLASS_BRIDGE_OTHER: /* needed? */
201 /* AGP bridge? */ 223 /* AGP bridge? */
202 cap = find_cap(num, slot, func, 224 cap = find_cap(bus, slot, func,
203 PCI_CAP_ID_AGP); 225 PCI_CAP_ID_AGP);
204 if (!cap) 226 if (!cap)
205 break; 227 break;
206 *valid_agp = 1; 228 *valid_agp = 1;
207 return read_agp(num, slot, func, cap, 229 return read_agp(bus, slot, func, cap,
208 order); 230 order);
209 } 231 }
210 232
211 /* No multi-function device? */ 233 /* No multi-function device? */
212 type = read_pci_config_byte(num, slot, func, 234 type = read_pci_config_byte(bus, slot, func,
213 PCI_HEADER_TYPE); 235 PCI_HEADER_TYPE);
214 if (!(type & 0x80)) 236 if (!(type & 0x80))
215 break; 237 break;
@@ -249,36 +271,50 @@ void __init early_gart_iommu_check(void)
249 * or BIOS forget to put that in reserved. 271 * or BIOS forget to put that in reserved.
250 * try to update e820 to make that region as reserved. 272 * try to update e820 to make that region as reserved.
251 */ 273 */
252 int fix, num; 274 int i, fix, slot;
253 u32 ctl; 275 u32 ctl;
254 u32 aper_size = 0, aper_order = 0, last_aper_order = 0; 276 u32 aper_size = 0, aper_order = 0, last_aper_order = 0;
255 u64 aper_base = 0, last_aper_base = 0; 277 u64 aper_base = 0, last_aper_base = 0;
256 int aper_enabled = 0, last_aper_enabled = 0; 278 int aper_enabled = 0, last_aper_enabled = 0, last_valid = 0;
257 279
258 if (!early_pci_allowed()) 280 if (!early_pci_allowed())
259 return; 281 return;
260 282
283 /* This is mostly duplicate of iommu_hole_init */
261 fix = 0; 284 fix = 0;
262 for (num = 24; num < 32; num++) { 285 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
263 if (!early_is_k8_nb(read_pci_config(0, num, 3, 0x00))) 286 int bus;
264 continue; 287 int dev_base, dev_limit;
265 288
266 ctl = read_pci_config(0, num, 3, 0x90); 289 bus = bus_dev_ranges[i].bus;
267 aper_enabled = ctl & 1; 290 dev_base = bus_dev_ranges[i].dev_base;
268 aper_order = (ctl >> 1) & 7; 291 dev_limit = bus_dev_ranges[i].dev_limit;
269 aper_size = (32 * 1024 * 1024) << aper_order; 292
270 aper_base = read_pci_config(0, num, 3, 0x94) & 0x7fff; 293 for (slot = dev_base; slot < dev_limit; slot++) {
271 aper_base <<= 25; 294 if (!early_is_k8_nb(read_pci_config(bus, slot, 3, 0x00)))
272 295 continue;
273 if ((last_aper_order && aper_order != last_aper_order) || 296
274 (last_aper_base && aper_base != last_aper_base) || 297 ctl = read_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL);
275 (last_aper_enabled && aper_enabled != last_aper_enabled)) { 298 aper_enabled = ctl & AMD64_GARTEN;
276 fix = 1; 299 aper_order = (ctl >> 1) & 7;
277 break; 300 aper_size = (32 * 1024 * 1024) << aper_order;
301 aper_base = read_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE) & 0x7fff;
302 aper_base <<= 25;
303
304 if (last_valid) {
305 if ((aper_order != last_aper_order) ||
306 (aper_base != last_aper_base) ||
307 (aper_enabled != last_aper_enabled)) {
308 fix = 1;
309 break;
310 }
311 }
312
313 last_aper_order = aper_order;
314 last_aper_base = aper_base;
315 last_aper_enabled = aper_enabled;
316 last_valid = 1;
278 } 317 }
279 last_aper_order = aper_order;
280 last_aper_base = aper_base;
281 last_aper_enabled = aper_enabled;
282 } 318 }
283 319
284 if (!fix && !aper_enabled) 320 if (!fix && !aper_enabled)
@@ -290,32 +326,46 @@ void __init early_gart_iommu_check(void)
290 if (gart_fix_e820 && !fix && aper_enabled) { 326 if (gart_fix_e820 && !fix && aper_enabled) {
291 if (e820_any_mapped(aper_base, aper_base + aper_size, 327 if (e820_any_mapped(aper_base, aper_base + aper_size,
292 E820_RAM)) { 328 E820_RAM)) {
293 /* reserved it, so we can resuse it in second kernel */ 329 /* reserve it, so we can reuse it in second kernel */
294 printk(KERN_INFO "update e820 for GART\n"); 330 printk(KERN_INFO "update e820 for GART\n");
295 add_memory_region(aper_base, aper_size, E820_RESERVED); 331 e820_add_region(aper_base, aper_size, E820_RESERVED);
296 update_e820(); 332 update_e820();
297 } 333 }
298 return;
299 } 334 }
300 335
336 if (!fix)
337 return;
338
301 /* different nodes have different setting, disable them all at first*/ 339 /* different nodes have different setting, disable them all at first*/
302 for (num = 24; num < 32; num++) { 340 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
303 if (!early_is_k8_nb(read_pci_config(0, num, 3, 0x00))) 341 int bus;
304 continue; 342 int dev_base, dev_limit;
343
344 bus = bus_dev_ranges[i].bus;
345 dev_base = bus_dev_ranges[i].dev_base;
346 dev_limit = bus_dev_ranges[i].dev_limit;
347
348 for (slot = dev_base; slot < dev_limit; slot++) {
349 if (!early_is_k8_nb(read_pci_config(bus, slot, 3, 0x00)))
350 continue;
305 351
306 ctl = read_pci_config(0, num, 3, 0x90); 352 ctl = read_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL);
307 ctl &= ~1; 353 ctl &= ~AMD64_GARTEN;
308 write_pci_config(0, num, 3, 0x90, ctl); 354 write_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL, ctl);
355 }
309 } 356 }
310 357
311} 358}
312 359
360static int __initdata printed_gart_size_msg;
361
313void __init gart_iommu_hole_init(void) 362void __init gart_iommu_hole_init(void)
314{ 363{
364 u32 agp_aper_base = 0, agp_aper_order = 0;
315 u32 aper_size, aper_alloc = 0, aper_order = 0, last_aper_order = 0; 365 u32 aper_size, aper_alloc = 0, aper_order = 0, last_aper_order = 0;
316 u64 aper_base, last_aper_base = 0; 366 u64 aper_base, last_aper_base = 0;
317 int fix, num, valid_agp = 0; 367 int fix, slot, valid_agp = 0;
318 int node; 368 int i, node;
319 369
320 if (gart_iommu_aperture_disabled || !fix_aperture || 370 if (gart_iommu_aperture_disabled || !fix_aperture ||
321 !early_pci_allowed()) 371 !early_pci_allowed())
@@ -323,38 +373,65 @@ void __init gart_iommu_hole_init(void)
323 373
324 printk(KERN_INFO "Checking aperture...\n"); 374 printk(KERN_INFO "Checking aperture...\n");
325 375
376 if (!fallback_aper_force)
377 agp_aper_base = search_agp_bridge(&agp_aper_order, &valid_agp);
378
326 fix = 0; 379 fix = 0;
327 node = 0; 380 node = 0;
328 for (num = 24; num < 32; num++) { 381 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
329 if (!early_is_k8_nb(read_pci_config(0, num, 3, 0x00))) 382 int bus;
330 continue; 383 int dev_base, dev_limit;
331 384
332 iommu_detected = 1; 385 bus = bus_dev_ranges[i].bus;
333 gart_iommu_aperture = 1; 386 dev_base = bus_dev_ranges[i].dev_base;
334 387 dev_limit = bus_dev_ranges[i].dev_limit;
335 aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7; 388
336 aper_size = (32 * 1024 * 1024) << aper_order; 389 for (slot = dev_base; slot < dev_limit; slot++) {
337 aper_base = read_pci_config(0, num, 3, 0x94) & 0x7fff; 390 if (!early_is_k8_nb(read_pci_config(bus, slot, 3, 0x00)))
338 aper_base <<= 25; 391 continue;
339 392
340 printk(KERN_INFO "Node %d: aperture @ %Lx size %u MB\n", 393 iommu_detected = 1;
341 node, aper_base, aper_size >> 20); 394 gart_iommu_aperture = 1;
342 node++; 395
343 396 aper_order = (read_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL) >> 1) & 7;
344 if (!aperture_valid(aper_base, aper_size)) { 397 aper_size = (32 * 1024 * 1024) << aper_order;
345 fix = 1; 398 aper_base = read_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE) & 0x7fff;
346 break; 399 aper_base <<= 25;
347 } 400
401 printk(KERN_INFO "Node %d: aperture @ %Lx size %u MB\n",
402 node, aper_base, aper_size >> 20);
403 node++;
404
405 if (!aperture_valid(aper_base, aper_size, 64<<20)) {
406 if (valid_agp && agp_aper_base &&
407 agp_aper_base == aper_base &&
408 agp_aper_order == aper_order) {
409 /* the same between two setting from NB and agp */
410 if (!no_iommu &&
411 max_pfn > MAX_DMA32_PFN &&
412 !printed_gart_size_msg) {
413 printk(KERN_ERR "you are using iommu with agp, but GART size is less than 64M\n");
414 printk(KERN_ERR "please increase GART size in your BIOS setup\n");
415 printk(KERN_ERR "if BIOS doesn't have that option, contact your HW vendor!\n");
416 printed_gart_size_msg = 1;
417 }
418 } else {
419 fix = 1;
420 goto out;
421 }
422 }
348 423
349 if ((last_aper_order && aper_order != last_aper_order) || 424 if ((last_aper_order && aper_order != last_aper_order) ||
350 (last_aper_base && aper_base != last_aper_base)) { 425 (last_aper_base && aper_base != last_aper_base)) {
351 fix = 1; 426 fix = 1;
352 break; 427 goto out;
428 }
429 last_aper_order = aper_order;
430 last_aper_base = aper_base;
353 } 431 }
354 last_aper_order = aper_order;
355 last_aper_base = aper_base;
356 } 432 }
357 433
434out:
358 if (!fix && !fallback_aper_force) { 435 if (!fix && !fallback_aper_force) {
359 if (last_aper_base) { 436 if (last_aper_base) {
360 unsigned long n = (32 * 1024 * 1024) << last_aper_order; 437 unsigned long n = (32 * 1024 * 1024) << last_aper_order;
@@ -364,14 +441,16 @@ void __init gart_iommu_hole_init(void)
364 return; 441 return;
365 } 442 }
366 443
367 if (!fallback_aper_force) 444 if (!fallback_aper_force) {
368 aper_alloc = search_agp_bridge(&aper_order, &valid_agp); 445 aper_alloc = agp_aper_base;
446 aper_order = agp_aper_order;
447 }
369 448
370 if (aper_alloc) { 449 if (aper_alloc) {
371 /* Got the aperture from the AGP bridge */ 450 /* Got the aperture from the AGP bridge */
372 } else if (swiotlb && !valid_agp) { 451 } else if (swiotlb && !valid_agp) {
373 /* Do nothing */ 452 /* Do nothing */
374 } else if ((!no_iommu && end_pfn > MAX_DMA32_PFN) || 453 } else if ((!no_iommu && max_pfn > MAX_DMA32_PFN) ||
375 force_iommu || 454 force_iommu ||
376 valid_agp || 455 valid_agp ||
377 fallback_aper_force) { 456 fallback_aper_force) {
@@ -401,16 +480,24 @@ void __init gart_iommu_hole_init(void)
401 } 480 }
402 481
403 /* Fix up the north bridges */ 482 /* Fix up the north bridges */
404 for (num = 24; num < 32; num++) { 483 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
405 if (!early_is_k8_nb(read_pci_config(0, num, 3, 0x00))) 484 int bus;
406 continue; 485 int dev_base, dev_limit;
407 486
408 /* 487 bus = bus_dev_ranges[i].bus;
409 * Don't enable translation yet. That is done later. 488 dev_base = bus_dev_ranges[i].dev_base;
410 * Assume this BIOS didn't initialise the GART so 489 dev_limit = bus_dev_ranges[i].dev_limit;
411 * just overwrite all previous bits 490 for (slot = dev_base; slot < dev_limit; slot++) {
412 */ 491 if (!early_is_k8_nb(read_pci_config(bus, slot, 3, 0x00)))
413 write_pci_config(0, num, 3, 0x90, aper_order<<1); 492 continue;
414 write_pci_config(0, num, 3, 0x94, aper_alloc>>25); 493
494 /* Don't enable translation yet. That is done later.
495 Assume this BIOS didn't initialise the GART so
496 just overwrite all previous bits */
497 write_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL, aper_order << 1);
498 write_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE, aper_alloc >> 25);
499 }
415 } 500 }
501
502 set_up_gart_resume(aper_order, aper_alloc);
416} 503}
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 4b99b1bdeb6c..3e58b676d23b 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -52,30 +52,41 @@
52 52
53unsigned long mp_lapic_addr; 53unsigned long mp_lapic_addr;
54 54
55DEFINE_PER_CPU(u16, x86_bios_cpu_apicid) = BAD_APICID;
56EXPORT_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
57
58/* 55/*
59 * Knob to control our willingness to enable the local APIC. 56 * Knob to control our willingness to enable the local APIC.
60 * 57 *
61 * -1=force-disable, +1=force-enable 58 * +1=force-enable
62 */ 59 */
63static int enable_local_apic __initdata; 60static int force_enable_local_apic;
61int disable_apic;
64 62
65/* Local APIC timer verification ok */ 63/* Local APIC timer verification ok */
66static int local_apic_timer_verify_ok; 64static int local_apic_timer_verify_ok;
67/* Disable local APIC timer from the kernel commandline or via dmi quirk 65/* Disable local APIC timer from the kernel commandline or via dmi quirk */
68 or using CPU MSR check */ 66static int local_apic_timer_disabled;
69int local_apic_timer_disabled;
70/* Local APIC timer works in C2 */ 67/* Local APIC timer works in C2 */
71int local_apic_timer_c2_ok; 68int local_apic_timer_c2_ok;
72EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); 69EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
73 70
71int first_system_vector = 0xfe;
72
73char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
74
74/* 75/*
75 * Debug level, exported for io_apic.c 76 * Debug level, exported for io_apic.c
76 */ 77 */
77int apic_verbosity; 78int apic_verbosity;
78 79
80int pic_mode;
81
82/* Have we found an MP table */
83int smp_found_config;
84
85static struct resource lapic_resource = {
86 .name = "Local APIC",
87 .flags = IORESOURCE_MEM | IORESOURCE_BUSY,
88};
89
79static unsigned int calibration_result; 90static unsigned int calibration_result;
80 91
81static int lapic_next_event(unsigned long delta, 92static int lapic_next_event(unsigned long delta,
@@ -545,7 +556,7 @@ void __init setup_boot_APIC_clock(void)
545 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY; 556 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
546 else 557 else
547 printk(KERN_WARNING "APIC timer registered as dummy," 558 printk(KERN_WARNING "APIC timer registered as dummy,"
548 " due to nmi_watchdog=1!\n"); 559 " due to nmi_watchdog=%d!\n", nmi_watchdog);
549 } 560 }
550 561
551 /* Setup the lapic or request the broadcast */ 562 /* Setup the lapic or request the broadcast */
@@ -963,7 +974,7 @@ void __cpuinit setup_local_APIC(void)
963 * Double-check whether this APIC is really registered. 974 * Double-check whether this APIC is really registered.
964 */ 975 */
965 if (!apic_id_registered()) 976 if (!apic_id_registered())
966 BUG(); 977 WARN_ON_ONCE(1);
967 978
968 /* 979 /*
969 * Intel recommends to set DFR, LDR and TPR before enabling 980 * Intel recommends to set DFR, LDR and TPR before enabling
@@ -1094,7 +1105,7 @@ static int __init detect_init_APIC(void)
1094 u32 h, l, features; 1105 u32 h, l, features;
1095 1106
1096 /* Disabled by kernel option? */ 1107 /* Disabled by kernel option? */
1097 if (enable_local_apic < 0) 1108 if (disable_apic)
1098 return -1; 1109 return -1;
1099 1110
1100 switch (boot_cpu_data.x86_vendor) { 1111 switch (boot_cpu_data.x86_vendor) {
@@ -1117,7 +1128,7 @@ static int __init detect_init_APIC(void)
1117 * Over-ride BIOS and try to enable the local APIC only if 1128 * Over-ride BIOS and try to enable the local APIC only if
1118 * "lapic" specified. 1129 * "lapic" specified.
1119 */ 1130 */
1120 if (enable_local_apic <= 0) { 1131 if (!force_enable_local_apic) {
1121 printk(KERN_INFO "Local APIC disabled by BIOS -- " 1132 printk(KERN_INFO "Local APIC disabled by BIOS -- "
1122 "you can enable it with \"lapic\"\n"); 1133 "you can enable it with \"lapic\"\n");
1123 return -1; 1134 return -1;
@@ -1154,9 +1165,6 @@ static int __init detect_init_APIC(void)
1154 if (l & MSR_IA32_APICBASE_ENABLE) 1165 if (l & MSR_IA32_APICBASE_ENABLE)
1155 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; 1166 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
1156 1167
1157 if (nmi_watchdog != NMI_NONE && nmi_watchdog != NMI_DISABLED)
1158 nmi_watchdog = NMI_LOCAL_APIC;
1159
1160 printk(KERN_INFO "Found and enabled local APIC!\n"); 1168 printk(KERN_INFO "Found and enabled local APIC!\n");
1161 1169
1162 apic_pm_activate(); 1170 apic_pm_activate();
@@ -1195,36 +1203,6 @@ void __init init_apic_mappings(void)
1195 if (boot_cpu_physical_apicid == -1U) 1203 if (boot_cpu_physical_apicid == -1U)
1196 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); 1204 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
1197 1205
1198#ifdef CONFIG_X86_IO_APIC
1199 {
1200 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
1201 int i;
1202
1203 for (i = 0; i < nr_ioapics; i++) {
1204 if (smp_found_config) {
1205 ioapic_phys = mp_ioapics[i].mpc_apicaddr;
1206 if (!ioapic_phys) {
1207 printk(KERN_ERR
1208 "WARNING: bogus zero IO-APIC "
1209 "address found in MPTABLE, "
1210 "disabling IO/APIC support!\n");
1211 smp_found_config = 0;
1212 skip_ioapic_setup = 1;
1213 goto fake_ioapic_page;
1214 }
1215 } else {
1216fake_ioapic_page:
1217 ioapic_phys = (unsigned long)
1218 alloc_bootmem_pages(PAGE_SIZE);
1219 ioapic_phys = __pa(ioapic_phys);
1220 }
1221 set_fixmap_nocache(idx, ioapic_phys);
1222 printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
1223 __fix_to_virt(idx), ioapic_phys);
1224 idx++;
1225 }
1226 }
1227#endif
1228} 1206}
1229 1207
1230/* 1208/*
@@ -1236,7 +1214,7 @@ int apic_version[MAX_APICS];
1236 1214
1237int __init APIC_init_uniprocessor(void) 1215int __init APIC_init_uniprocessor(void)
1238{ 1216{
1239 if (enable_local_apic < 0) 1217 if (disable_apic)
1240 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC); 1218 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
1241 1219
1242 if (!smp_found_config && !cpu_has_apic) 1220 if (!smp_found_config && !cpu_has_apic)
@@ -1265,10 +1243,14 @@ int __init APIC_init_uniprocessor(void)
1265#ifdef CONFIG_CRASH_DUMP 1243#ifdef CONFIG_CRASH_DUMP
1266 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); 1244 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
1267#endif 1245#endif
1268 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid); 1246 physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map);
1269 1247
1270 setup_local_APIC(); 1248 setup_local_APIC();
1271 1249
1250#ifdef CONFIG_X86_IO_APIC
1251 if (!smp_found_config || skip_ioapic_setup || !nr_ioapics)
1252#endif
1253 localise_nmi_watchdog();
1272 end_local_APIC_setup(); 1254 end_local_APIC_setup();
1273#ifdef CONFIG_X86_IO_APIC 1255#ifdef CONFIG_X86_IO_APIC
1274 if (smp_found_config) 1256 if (smp_found_config)
@@ -1351,13 +1333,13 @@ void __init smp_intr_init(void)
1351 * The reschedule interrupt is a CPU-to-CPU reschedule-helper 1333 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
1352 * IPI, driven by wakeup. 1334 * IPI, driven by wakeup.
1353 */ 1335 */
1354 set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); 1336 alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
1355 1337
1356 /* IPI for invalidation */ 1338 /* IPI for invalidation */
1357 set_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt); 1339 alloc_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt);
1358 1340
1359 /* IPI for generic function call */ 1341 /* IPI for generic function call */
1360 set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); 1342 alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
1361} 1343}
1362#endif 1344#endif
1363 1345
@@ -1370,15 +1352,15 @@ void __init apic_intr_init(void)
1370 smp_intr_init(); 1352 smp_intr_init();
1371#endif 1353#endif
1372 /* self generated IPI for local APIC timer */ 1354 /* self generated IPI for local APIC timer */
1373 set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt); 1355 alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
1374 1356
1375 /* IPI vectors for APIC spurious and error interrupts */ 1357 /* IPI vectors for APIC spurious and error interrupts */
1376 set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); 1358 alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
1377 set_intr_gate(ERROR_APIC_VECTOR, error_interrupt); 1359 alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
1378 1360
1379 /* thermal monitor LVT interrupt */ 1361 /* thermal monitor LVT interrupt */
1380#ifdef CONFIG_X86_MCE_P4THERMAL 1362#ifdef CONFIG_X86_MCE_P4THERMAL
1381 set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); 1363 alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
1382#endif 1364#endif
1383} 1365}
1384 1366
@@ -1513,6 +1495,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
1513 */ 1495 */
1514 cpu = 0; 1496 cpu = 0;
1515 1497
1498 if (apicid > max_physical_apicid)
1499 max_physical_apicid = apicid;
1500
1516 /* 1501 /*
1517 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y 1502 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
1518 * but we need to work other dependencies like SMP_SUSPEND etc 1503 * but we need to work other dependencies like SMP_SUSPEND etc
@@ -1520,7 +1505,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
1520 * if (CPU_HOTPLUG_ENABLED || num_processors > 8) 1505 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
1521 * - Ashok Raj <ashok.raj@intel.com> 1506 * - Ashok Raj <ashok.raj@intel.com>
1522 */ 1507 */
1523 if (num_processors > 8) { 1508 if (max_physical_apicid >= 8) {
1524 switch (boot_cpu_data.x86_vendor) { 1509 switch (boot_cpu_data.x86_vendor) {
1525 case X86_VENDOR_INTEL: 1510 case X86_VENDOR_INTEL:
1526 if (!APIC_XAPIC(version)) { 1511 if (!APIC_XAPIC(version)) {
@@ -1534,9 +1519,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
1534 } 1519 }
1535#ifdef CONFIG_SMP 1520#ifdef CONFIG_SMP
1536 /* are we being called early in kernel startup? */ 1521 /* are we being called early in kernel startup? */
1537 if (x86_cpu_to_apicid_early_ptr) { 1522 if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
1538 u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr; 1523 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
1539 u16 *bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr; 1524 u16 *bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
1540 1525
1541 cpu_to_apicid[cpu] = apicid; 1526 cpu_to_apicid[cpu] = apicid;
1542 bios_cpu_apicid[cpu] = apicid; 1527 bios_cpu_apicid[cpu] = apicid;
@@ -1703,14 +1688,14 @@ static void apic_pm_activate(void) { }
1703 */ 1688 */
1704static int __init parse_lapic(char *arg) 1689static int __init parse_lapic(char *arg)
1705{ 1690{
1706 enable_local_apic = 1; 1691 force_enable_local_apic = 1;
1707 return 0; 1692 return 0;
1708} 1693}
1709early_param("lapic", parse_lapic); 1694early_param("lapic", parse_lapic);
1710 1695
1711static int __init parse_nolapic(char *arg) 1696static int __init parse_nolapic(char *arg)
1712{ 1697{
1713 enable_local_apic = -1; 1698 disable_apic = 1;
1714 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC); 1699 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
1715 return 0; 1700 return 0;
1716} 1701}
@@ -1740,3 +1725,21 @@ static int __init apic_set_verbosity(char *str)
1740} 1725}
1741__setup("apic=", apic_set_verbosity); 1726__setup("apic=", apic_set_verbosity);
1742 1727
1728static int __init lapic_insert_resource(void)
1729{
1730 if (!apic_phys)
1731 return -1;
1732
1733 /* Put local APIC into the resource map. */
1734 lapic_resource.start = apic_phys;
1735 lapic_resource.end = lapic_resource.start + PAGE_SIZE - 1;
1736 insert_resource(&iomem_resource, &lapic_resource);
1737
1738 return 0;
1739}
1740
1741/*
1742 * need call insert after e820_reserve_resources()
1743 * that is using request_resource
1744 */
1745late_initcall(lapic_insert_resource);
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 0633cfd0dc29..1e3d32e27c14 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -43,7 +43,7 @@
43#include <mach_ipi.h> 43#include <mach_ipi.h>
44#include <mach_apic.h> 44#include <mach_apic.h>
45 45
46int disable_apic_timer __cpuinitdata; 46static int disable_apic_timer __cpuinitdata;
47static int apic_calibrate_pmtmr __initdata; 47static int apic_calibrate_pmtmr __initdata;
48int disable_apic; 48int disable_apic;
49 49
@@ -56,6 +56,9 @@ EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
56 */ 56 */
57int apic_verbosity; 57int apic_verbosity;
58 58
59/* Have we found an MP table */
60int smp_found_config;
61
59static struct resource lapic_resource = { 62static struct resource lapic_resource = {
60 .name = "Local APIC", 63 .name = "Local APIC",
61 .flags = IORESOURCE_MEM | IORESOURCE_BUSY, 64 .flags = IORESOURCE_MEM | IORESOURCE_BUSY,
@@ -87,9 +90,6 @@ static unsigned long apic_phys;
87 90
88unsigned long mp_lapic_addr; 91unsigned long mp_lapic_addr;
89 92
90DEFINE_PER_CPU(u16, x86_bios_cpu_apicid) = BAD_APICID;
91EXPORT_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
92
93unsigned int __cpuinitdata maxcpus = NR_CPUS; 93unsigned int __cpuinitdata maxcpus = NR_CPUS;
94/* 94/*
95 * Get the LAPIC version 95 * Get the LAPIC version
@@ -417,37 +417,13 @@ void __init setup_boot_APIC_clock(void)
417 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY; 417 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
418 else 418 else
419 printk(KERN_WARNING "APIC timer registered as dummy," 419 printk(KERN_WARNING "APIC timer registered as dummy,"
420 " due to nmi_watchdog=1!\n"); 420 " due to nmi_watchdog=%d!\n", nmi_watchdog);
421 421
422 setup_APIC_timer(); 422 setup_APIC_timer();
423} 423}
424 424
425/*
426 * AMD C1E enabled CPUs have a real nasty problem: Some BIOSes set the
427 * C1E flag only in the secondary CPU, so when we detect the wreckage
428 * we already have enabled the boot CPU local apic timer. Check, if
429 * disable_apic_timer is set and the DUMMY flag is cleared. If yes,
430 * set the DUMMY flag again and force the broadcast mode in the
431 * clockevents layer.
432 */
433static void __cpuinit check_boot_apic_timer_broadcast(void)
434{
435 if (!disable_apic_timer ||
436 (lapic_clockevent.features & CLOCK_EVT_FEAT_DUMMY))
437 return;
438
439 printk(KERN_INFO "AMD C1E detected late. Force timer broadcast.\n");
440 lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY;
441
442 local_irq_enable();
443 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
444 &boot_cpu_physical_apicid);
445 local_irq_disable();
446}
447
448void __cpuinit setup_secondary_APIC_clock(void) 425void __cpuinit setup_secondary_APIC_clock(void)
449{ 426{
450 check_boot_apic_timer_broadcast();
451 setup_APIC_timer(); 427 setup_APIC_timer();
452} 428}
453 429
@@ -850,7 +826,6 @@ static void __cpuinit lapic_setup_esr(void)
850void __cpuinit end_local_APIC_setup(void) 826void __cpuinit end_local_APIC_setup(void)
851{ 827{
852 lapic_setup_esr(); 828 lapic_setup_esr();
853 nmi_watchdog_default();
854 setup_apic_nmi_watchdog(NULL); 829 setup_apic_nmi_watchdog(NULL);
855 apic_pm_activate(); 830 apic_pm_activate();
856} 831}
@@ -875,7 +850,7 @@ static int __init detect_init_APIC(void)
875 850
876void __init early_init_lapic_mapping(void) 851void __init early_init_lapic_mapping(void)
877{ 852{
878 unsigned long apic_phys; 853 unsigned long phys_addr;
879 854
880 /* 855 /*
881 * If no local APIC can be found then go out 856 * If no local APIC can be found then go out
@@ -884,11 +859,11 @@ void __init early_init_lapic_mapping(void)
884 if (!smp_found_config) 859 if (!smp_found_config)
885 return; 860 return;
886 861
887 apic_phys = mp_lapic_addr; 862 phys_addr = mp_lapic_addr;
888 863
889 set_fixmap_nocache(FIX_APIC_BASE, apic_phys); 864 set_fixmap_nocache(FIX_APIC_BASE, phys_addr);
890 apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n", 865 apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
891 APIC_BASE, apic_phys); 866 APIC_BASE, phys_addr);
892 867
893 /* 868 /*
894 * Fetch the APIC ID of the BSP in case we have a 869 * Fetch the APIC ID of the BSP in case we have a
@@ -942,7 +917,9 @@ int __init APIC_init_uniprocessor(void)
942 917
943 verify_local_APIC(); 918 verify_local_APIC();
944 919
945 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid); 920 connect_bsp_APIC();
921
922 physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map);
946 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid)); 923 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid));
947 924
948 setup_local_APIC(); 925 setup_local_APIC();
@@ -954,6 +931,8 @@ int __init APIC_init_uniprocessor(void)
954 if (!skip_ioapic_setup && nr_ioapics) 931 if (!skip_ioapic_setup && nr_ioapics)
955 enable_IO_APIC(); 932 enable_IO_APIC();
956 933
934 if (!smp_found_config || skip_ioapic_setup || !nr_ioapics)
935 localise_nmi_watchdog();
957 end_local_APIC_setup(); 936 end_local_APIC_setup();
958 937
959 if (smp_found_config && !skip_ioapic_setup && nr_ioapics) 938 if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
@@ -1021,6 +1000,14 @@ asmlinkage void smp_error_interrupt(void)
1021 irq_exit(); 1000 irq_exit();
1022} 1001}
1023 1002
1003/**
1004 * * connect_bsp_APIC - attach the APIC to the interrupt system
1005 * */
1006void __init connect_bsp_APIC(void)
1007{
1008 enable_apic_mode();
1009}
1010
1024void disconnect_bsp_APIC(int virt_wire_setup) 1011void disconnect_bsp_APIC(int virt_wire_setup)
1025{ 1012{
1026 /* Go back to Virtual Wire compatibility mode */ 1013 /* Go back to Virtual Wire compatibility mode */
@@ -1090,10 +1077,13 @@ void __cpuinit generic_processor_info(int apicid, int version)
1090 */ 1077 */
1091 cpu = 0; 1078 cpu = 0;
1092 } 1079 }
1080 if (apicid > max_physical_apicid)
1081 max_physical_apicid = apicid;
1082
1093 /* are we being called early in kernel startup? */ 1083 /* are we being called early in kernel startup? */
1094 if (x86_cpu_to_apicid_early_ptr) { 1084 if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
1095 u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr; 1085 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
1096 u16 *bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr; 1086 u16 *bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
1097 1087
1098 cpu_to_apicid[cpu] = apicid; 1088 cpu_to_apicid[cpu] = apicid;
1099 bios_cpu_apicid[cpu] = apicid; 1089 bios_cpu_apicid[cpu] = apicid;
@@ -1269,7 +1259,7 @@ __cpuinit int apic_is_clustered_box(void)
1269 if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && !is_vsmp_box()) 1259 if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && !is_vsmp_box())
1270 return 0; 1260 return 0;
1271 1261
1272 bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr; 1262 bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
1273 bitmap_zero(clustermap, NUM_APIC_CLUSTERS); 1263 bitmap_zero(clustermap, NUM_APIC_CLUSTERS);
1274 1264
1275 for (i = 0; i < NR_CPUS; i++) { 1265 for (i = 0; i < NR_CPUS; i++) {
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index bf9290e29013..75cb5da4ea0a 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -204,6 +204,7 @@
204#include <linux/module.h> 204#include <linux/module.h>
205 205
206#include <linux/poll.h> 206#include <linux/poll.h>
207#include <linux/smp_lock.h>
207#include <linux/types.h> 208#include <linux/types.h>
208#include <linux/stddef.h> 209#include <linux/stddef.h>
209#include <linux/timer.h> 210#include <linux/timer.h>
@@ -228,6 +229,7 @@
228#include <linux/suspend.h> 229#include <linux/suspend.h>
229#include <linux/kthread.h> 230#include <linux/kthread.h>
230#include <linux/jiffies.h> 231#include <linux/jiffies.h>
232#include <linux/smp_lock.h>
231 233
232#include <asm/system.h> 234#include <asm/system.h>
233#include <asm/uaccess.h> 235#include <asm/uaccess.h>
@@ -1149,7 +1151,7 @@ static void queue_event(apm_event_t event, struct apm_user *sender)
1149 as->event_tail = 0; 1151 as->event_tail = 0;
1150 } 1152 }
1151 as->events[as->event_head] = event; 1153 as->events[as->event_head] = event;
1152 if ((!as->suser) || (!as->writer)) 1154 if (!as->suser || !as->writer)
1153 continue; 1155 continue;
1154 switch (event) { 1156 switch (event) {
1155 case APM_SYS_SUSPEND: 1157 case APM_SYS_SUSPEND:
@@ -1396,7 +1398,7 @@ static void apm_mainloop(void)
1396 1398
1397static int check_apm_user(struct apm_user *as, const char *func) 1399static int check_apm_user(struct apm_user *as, const char *func)
1398{ 1400{
1399 if ((as == NULL) || (as->magic != APM_BIOS_MAGIC)) { 1401 if (as == NULL || as->magic != APM_BIOS_MAGIC) {
1400 printk(KERN_ERR "apm: %s passed bad filp\n", func); 1402 printk(KERN_ERR "apm: %s passed bad filp\n", func);
1401 return 1; 1403 return 1;
1402 } 1404 }
@@ -1459,18 +1461,19 @@ static unsigned int do_poll(struct file *fp, poll_table *wait)
1459 return 0; 1461 return 0;
1460} 1462}
1461 1463
1462static int do_ioctl(struct inode *inode, struct file *filp, 1464static long do_ioctl(struct file *filp, u_int cmd, u_long arg)
1463 u_int cmd, u_long arg)
1464{ 1465{
1465 struct apm_user *as; 1466 struct apm_user *as;
1467 int ret;
1466 1468
1467 as = filp->private_data; 1469 as = filp->private_data;
1468 if (check_apm_user(as, "ioctl")) 1470 if (check_apm_user(as, "ioctl"))
1469 return -EIO; 1471 return -EIO;
1470 if ((!as->suser) || (!as->writer)) 1472 if (!as->suser || !as->writer)
1471 return -EPERM; 1473 return -EPERM;
1472 switch (cmd) { 1474 switch (cmd) {
1473 case APM_IOC_STANDBY: 1475 case APM_IOC_STANDBY:
1476 lock_kernel();
1474 if (as->standbys_read > 0) { 1477 if (as->standbys_read > 0) {
1475 as->standbys_read--; 1478 as->standbys_read--;
1476 as->standbys_pending--; 1479 as->standbys_pending--;
@@ -1479,8 +1482,10 @@ static int do_ioctl(struct inode *inode, struct file *filp,
1479 queue_event(APM_USER_STANDBY, as); 1482 queue_event(APM_USER_STANDBY, as);
1480 if (standbys_pending <= 0) 1483 if (standbys_pending <= 0)
1481 standby(); 1484 standby();
1485 unlock_kernel();
1482 break; 1486 break;
1483 case APM_IOC_SUSPEND: 1487 case APM_IOC_SUSPEND:
1488 lock_kernel();
1484 if (as->suspends_read > 0) { 1489 if (as->suspends_read > 0) {
1485 as->suspends_read--; 1490 as->suspends_read--;
1486 as->suspends_pending--; 1491 as->suspends_pending--;
@@ -1488,16 +1493,17 @@ static int do_ioctl(struct inode *inode, struct file *filp,
1488 } else 1493 } else
1489 queue_event(APM_USER_SUSPEND, as); 1494 queue_event(APM_USER_SUSPEND, as);
1490 if (suspends_pending <= 0) { 1495 if (suspends_pending <= 0) {
1491 return suspend(1); 1496 ret = suspend(1);
1492 } else { 1497 } else {
1493 as->suspend_wait = 1; 1498 as->suspend_wait = 1;
1494 wait_event_interruptible(apm_suspend_waitqueue, 1499 wait_event_interruptible(apm_suspend_waitqueue,
1495 as->suspend_wait == 0); 1500 as->suspend_wait == 0);
1496 return as->suspend_result; 1501 ret = as->suspend_result;
1497 } 1502 }
1498 break; 1503 unlock_kernel();
1504 return ret;
1499 default: 1505 default:
1500 return -EINVAL; 1506 return -ENOTTY;
1501 } 1507 }
1502 return 0; 1508 return 0;
1503} 1509}
@@ -1544,10 +1550,12 @@ static int do_open(struct inode *inode, struct file *filp)
1544{ 1550{
1545 struct apm_user *as; 1551 struct apm_user *as;
1546 1552
1553 lock_kernel();
1547 as = kmalloc(sizeof(*as), GFP_KERNEL); 1554 as = kmalloc(sizeof(*as), GFP_KERNEL);
1548 if (as == NULL) { 1555 if (as == NULL) {
1549 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", 1556 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n",
1550 sizeof(*as)); 1557 sizeof(*as));
1558 unlock_kernel();
1551 return -ENOMEM; 1559 return -ENOMEM;
1552 } 1560 }
1553 as->magic = APM_BIOS_MAGIC; 1561 as->magic = APM_BIOS_MAGIC;
@@ -1569,6 +1577,7 @@ static int do_open(struct inode *inode, struct file *filp)
1569 user_list = as; 1577 user_list = as;
1570 spin_unlock(&user_list_lock); 1578 spin_unlock(&user_list_lock);
1571 filp->private_data = as; 1579 filp->private_data = as;
1580 unlock_kernel();
1572 return 0; 1581 return 0;
1573} 1582}
1574 1583
@@ -1860,7 +1869,7 @@ static const struct file_operations apm_bios_fops = {
1860 .owner = THIS_MODULE, 1869 .owner = THIS_MODULE,
1861 .read = do_read, 1870 .read = do_read,
1862 .poll = do_poll, 1871 .poll = do_poll,
1863 .ioctl = do_ioctl, 1872 .unlocked_ioctl = do_ioctl,
1864 .open = do_open, 1873 .open = do_open,
1865 .release = do_release, 1874 .release = do_release,
1866}; 1875};
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 92588083950f..6649d09ad88f 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -111,7 +111,7 @@ void foo(void)
111 OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable); 111 OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
112 OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable); 112 OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
113 OFFSET(PV_CPU_iret, pv_cpu_ops, iret); 113 OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
114 OFFSET(PV_CPU_irq_enable_syscall_ret, pv_cpu_ops, irq_enable_syscall_ret); 114 OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
115 OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0); 115 OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
116#endif 116#endif
117 117
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index f126c05d6170..bacf5deeec2d 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -34,7 +34,7 @@ int main(void)
34 ENTRY(pid); 34 ENTRY(pid);
35 BLANK(); 35 BLANK();
36#undef ENTRY 36#undef ENTRY
37#define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry)) 37#define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
38 ENTRY(flags); 38 ENTRY(flags);
39 ENTRY(addr_limit); 39 ENTRY(addr_limit);
40 ENTRY(preempt_count); 40 ENTRY(preempt_count);
@@ -61,8 +61,11 @@ int main(void)
61 OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops); 61 OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
62 OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable); 62 OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
63 OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable); 63 OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
64 OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
64 OFFSET(PV_CPU_iret, pv_cpu_ops, iret); 65 OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
65 OFFSET(PV_CPU_irq_enable_syscall_ret, pv_cpu_ops, irq_enable_syscall_ret); 66 OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
67 OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
68 OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
66 OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs); 69 OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
67 OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2); 70 OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
68#endif 71#endif
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index a0c6f8190887..ee76eaad3001 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -6,11 +6,15 @@ obj-y := intel_cacheinfo.o addon_cpuid_features.o
6obj-y += proc.o feature_names.o 6obj-y += proc.o feature_names.o
7 7
8obj-$(CONFIG_X86_32) += common.o bugs.o 8obj-$(CONFIG_X86_32) += common.o bugs.o
9obj-$(CONFIG_X86_64) += common_64.o bugs_64.o
9obj-$(CONFIG_X86_32) += amd.o 10obj-$(CONFIG_X86_32) += amd.o
11obj-$(CONFIG_X86_64) += amd_64.o
10obj-$(CONFIG_X86_32) += cyrix.o 12obj-$(CONFIG_X86_32) += cyrix.o
11obj-$(CONFIG_X86_32) += centaur.o 13obj-$(CONFIG_X86_32) += centaur.o
14obj-$(CONFIG_X86_64) += centaur_64.o
12obj-$(CONFIG_X86_32) += transmeta.o 15obj-$(CONFIG_X86_32) += transmeta.o
13obj-$(CONFIG_X86_32) += intel.o 16obj-$(CONFIG_X86_32) += intel.o
17obj-$(CONFIG_X86_64) += intel_64.o
14obj-$(CONFIG_X86_32) += umc.o 18obj-$(CONFIG_X86_32) += umc.o
15 19
16obj-$(CONFIG_X86_MCE) += mcheck/ 20obj-$(CONFIG_X86_MCE) += mcheck/
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index c2e1ce33c7cb..84a8220a6072 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -1,9 +1,7 @@
1
2/* 1/*
3 * Routines to indentify additional cpu features that are scattered in 2 * Routines to indentify additional cpu features that are scattered in
4 * cpuid space. 3 * cpuid space.
5 */ 4 */
6
7#include <linux/cpu.h> 5#include <linux/cpu.h>
8 6
9#include <asm/pat.h> 7#include <asm/pat.h>
@@ -53,19 +51,20 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
53#ifdef CONFIG_X86_PAT 51#ifdef CONFIG_X86_PAT
54void __cpuinit validate_pat_support(struct cpuinfo_x86 *c) 52void __cpuinit validate_pat_support(struct cpuinfo_x86 *c)
55{ 53{
54 if (!cpu_has_pat)
55 pat_disable("PAT not supported by CPU.");
56
56 switch (c->x86_vendor) { 57 switch (c->x86_vendor) {
57 case X86_VENDOR_AMD:
58 if (c->x86 >= 0xf && c->x86 <= 0x11)
59 return;
60 break;
61 case X86_VENDOR_INTEL: 58 case X86_VENDOR_INTEL:
62 if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15)) 59 if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
63 return; 60 return;
64 break; 61 break;
62 case X86_VENDOR_AMD:
63 case X86_VENDOR_CENTAUR:
64 case X86_VENDOR_TRANSMETA:
65 return;
65 } 66 }
66 67
67 pat_disable(cpu_has_pat ? 68 pat_disable("PAT disabled. Not yet verified on this CPU type.");
68 "PAT disabled. Not yet verified on this CPU type." :
69 "PAT not supported by CPU.");
70} 69}
71#endif 70#endif
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 245866828294..81a07ca65d44 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -24,43 +24,6 @@
24extern void vide(void); 24extern void vide(void);
25__asm__(".align 4\nvide: ret"); 25__asm__(".align 4\nvide: ret");
26 26
27#ifdef CONFIG_X86_LOCAL_APIC
28#define ENABLE_C1E_MASK 0x18000000
29#define CPUID_PROCESSOR_SIGNATURE 1
30#define CPUID_XFAM 0x0ff00000
31#define CPUID_XFAM_K8 0x00000000
32#define CPUID_XFAM_10H 0x00100000
33#define CPUID_XFAM_11H 0x00200000
34#define CPUID_XMOD 0x000f0000
35#define CPUID_XMOD_REV_F 0x00040000
36
37/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */
38static __cpuinit int amd_apic_timer_broken(void)
39{
40 u32 lo, hi;
41 u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
42 switch (eax & CPUID_XFAM) {
43 case CPUID_XFAM_K8:
44 if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
45 break;
46 case CPUID_XFAM_10H:
47 case CPUID_XFAM_11H:
48 rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
49 if (lo & ENABLE_C1E_MASK) {
50 if (smp_processor_id() != boot_cpu_physical_apicid)
51 printk(KERN_INFO "AMD C1E detected late. "
52 " Force timer broadcast.\n");
53 return 1;
54 }
55 break;
56 default:
57 /* err on the side of caution */
58 return 1;
59 }
60 return 0;
61}
62#endif
63
64int force_mwait __cpuinitdata; 27int force_mwait __cpuinitdata;
65 28
66static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) 29static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
@@ -297,11 +260,6 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
297 num_cache_leaves = 3; 260 num_cache_leaves = 3;
298 } 261 }
299 262
300#ifdef CONFIG_X86_LOCAL_APIC
301 if (amd_apic_timer_broken())
302 local_apic_timer_disabled = 1;
303#endif
304
305 /* K6s reports MCEs but don't actually have all the MSRs */ 263 /* K6s reports MCEs but don't actually have all the MSRs */
306 if (c->x86 < 6) 264 if (c->x86 < 6)
307 clear_cpu_cap(c, X86_FEATURE_MCE); 265 clear_cpu_cap(c, X86_FEATURE_MCE);
diff --git a/arch/x86/kernel/cpu/amd_64.c b/arch/x86/kernel/cpu/amd_64.c
new file mode 100644
index 000000000000..7c36fb8a28d4
--- /dev/null
+++ b/arch/x86/kernel/cpu/amd_64.c
@@ -0,0 +1,222 @@
1#include <linux/init.h>
2#include <linux/mm.h>
3
4#include <asm/numa_64.h>
5#include <asm/mmconfig.h>
6#include <asm/cacheflush.h>
7
8#include <mach_apic.h>
9
10#include "cpu.h"
11
12int force_mwait __cpuinitdata;
13
14#ifdef CONFIG_NUMA
15static int __cpuinit nearby_node(int apicid)
16{
17 int i, node;
18
19 for (i = apicid - 1; i >= 0; i--) {
20 node = apicid_to_node[i];
21 if (node != NUMA_NO_NODE && node_online(node))
22 return node;
23 }
24 for (i = apicid + 1; i < MAX_LOCAL_APIC; i++) {
25 node = apicid_to_node[i];
26 if (node != NUMA_NO_NODE && node_online(node))
27 return node;
28 }
29 return first_node(node_online_map); /* Shouldn't happen */
30}
31#endif
32
33/*
34 * On a AMD dual core setup the lower bits of the APIC id distingush the cores.
35 * Assumes number of cores is a power of two.
36 */
37static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
38{
39#ifdef CONFIG_SMP
40 unsigned bits;
41#ifdef CONFIG_NUMA
42 int cpu = smp_processor_id();
43 int node = 0;
44 unsigned apicid = hard_smp_processor_id();
45#endif
46 bits = c->x86_coreid_bits;
47
48 /* Low order bits define the core id (index of core in socket) */
49 c->cpu_core_id = c->initial_apicid & ((1 << bits)-1);
50 /* Convert the initial APIC ID into the socket ID */
51 c->phys_proc_id = c->initial_apicid >> bits;
52
53#ifdef CONFIG_NUMA
54 node = c->phys_proc_id;
55 if (apicid_to_node[apicid] != NUMA_NO_NODE)
56 node = apicid_to_node[apicid];
57 if (!node_online(node)) {
58 /* Two possibilities here:
59 - The CPU is missing memory and no node was created.
60 In that case try picking one from a nearby CPU
61 - The APIC IDs differ from the HyperTransport node IDs
62 which the K8 northbridge parsing fills in.
63 Assume they are all increased by a constant offset,
64 but in the same order as the HT nodeids.
65 If that doesn't result in a usable node fall back to the
66 path for the previous case. */
67
68 int ht_nodeid = c->initial_apicid;
69
70 if (ht_nodeid >= 0 &&
71 apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
72 node = apicid_to_node[ht_nodeid];
73 /* Pick a nearby node */
74 if (!node_online(node))
75 node = nearby_node(apicid);
76 }
77 numa_set_node(cpu, node);
78
79 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
80#endif
81#endif
82}
83
84static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
85{
86#ifdef CONFIG_SMP
87 unsigned bits, ecx;
88
89 /* Multi core CPU? */
90 if (c->extended_cpuid_level < 0x80000008)
91 return;
92
93 ecx = cpuid_ecx(0x80000008);
94
95 c->x86_max_cores = (ecx & 0xff) + 1;
96
97 /* CPU telling us the core id bits shift? */
98 bits = (ecx >> 12) & 0xF;
99
100 /* Otherwise recompute */
101 if (bits == 0) {
102 while ((1 << bits) < c->x86_max_cores)
103 bits++;
104 }
105
106 c->x86_coreid_bits = bits;
107
108#endif
109}
110
111static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
112{
113 early_init_amd_mc(c);
114
115 /* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */
116 if (c->x86_power & (1<<8))
117 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
118}
119
120static void __cpuinit init_amd(struct cpuinfo_x86 *c)
121{
122 unsigned level;
123
124#ifdef CONFIG_SMP
125 unsigned long value;
126
127 /*
128 * Disable TLB flush filter by setting HWCR.FFDIS on K8
129 * bit 6 of msr C001_0015
130 *
131 * Errata 63 for SH-B3 steppings
132 * Errata 122 for all steppings (F+ have it disabled by default)
133 */
134 if (c->x86 == 0xf) {
135 rdmsrl(MSR_K8_HWCR, value);
136 value |= 1 << 6;
137 wrmsrl(MSR_K8_HWCR, value);
138 }
139#endif
140
141 /* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
142 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
143 clear_cpu_cap(c, 0*32+31);
144
145 /* On C+ stepping K8 rep microcode works well for copy/memset */
146 if (c->x86 == 0xf) {
147 level = cpuid_eax(1);
148 if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
149 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
150 }
151 if (c->x86 == 0x10 || c->x86 == 0x11)
152 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
153
154 /* Enable workaround for FXSAVE leak */
155 if (c->x86 >= 6)
156 set_cpu_cap(c, X86_FEATURE_FXSAVE_LEAK);
157
158 level = get_model_name(c);
159 if (!level) {
160 switch (c->x86) {
161 case 0xf:
162 /* Should distinguish Models here, but this is only
163 a fallback anyways. */
164 strcpy(c->x86_model_id, "Hammer");
165 break;
166 }
167 }
168 display_cacheinfo(c);
169
170 /* Multi core CPU? */
171 if (c->extended_cpuid_level >= 0x80000008)
172 amd_detect_cmp(c);
173
174 if (c->extended_cpuid_level >= 0x80000006 &&
175 (cpuid_edx(0x80000006) & 0xf000))
176 num_cache_leaves = 4;
177 else
178 num_cache_leaves = 3;
179
180 if (c->x86 >= 0xf && c->x86 <= 0x11)
181 set_cpu_cap(c, X86_FEATURE_K8);
182
183 /* MFENCE stops RDTSC speculation */
184 set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC);
185
186 if (c->x86 == 0x10) {
187 /* do this for boot cpu */
188 if (c == &boot_cpu_data)
189 check_enable_amd_mmconf_dmi();
190
191 fam10h_check_enable_mmcfg();
192 }
193
194 if (c == &boot_cpu_data && c->x86 >= 0xf && c->x86 <= 0x11) {
195 unsigned long long tseg;
196
197 /*
198 * Split up direct mapping around the TSEG SMM area.
199 * Don't do it for gbpages because there seems very little
200 * benefit in doing so.
201 */
202 if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) {
203 printk(KERN_DEBUG "tseg: %010llx\n", tseg);
204 if ((tseg>>PMD_SHIFT) <
205 (max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) ||
206 ((tseg>>PMD_SHIFT) <
207 (max_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) &&
208 (tseg>>PMD_SHIFT) >= (1ULL<<(32 - PMD_SHIFT))))
209 set_memory_4k((unsigned long)__va(tseg), 1);
210 }
211 }
212}
213
214static struct cpu_dev amd_cpu_dev __cpuinitdata = {
215 .c_vendor = "AMD",
216 .c_ident = { "AuthenticAMD" },
217 .c_early_init = early_init_amd,
218 .c_init = init_amd,
219};
220
221cpu_vendor_dev_register(X86_VENDOR_AMD, &amd_cpu_dev);
222
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 170d2f5523b2..1b1c56bb338f 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -59,8 +59,12 @@ static void __init check_fpu(void)
59 return; 59 return;
60 } 60 }
61 61
62/* trap_init() enabled FXSR and company _before_ testing for FP problems here. */ 62 /*
63 /* Test for the divl bug.. */ 63 * trap_init() enabled FXSR and company _before_ testing for FP
64 * problems here.
65 *
66 * Test for the divl bug..
67 */
64 __asm__("fninit\n\t" 68 __asm__("fninit\n\t"
65 "fldl %1\n\t" 69 "fldl %1\n\t"
66 "fdivl %2\n\t" 70 "fdivl %2\n\t"
@@ -108,10 +112,15 @@ static void __init check_popad(void)
108 "movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx " 112 "movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx "
109 : "=&a" (res) 113 : "=&a" (res)
110 : "d" (inp) 114 : "d" (inp)
111 : "ecx", "edi" ); 115 : "ecx", "edi");
112 /* If this fails, it means that any user program may lock the CPU hard. Too bad. */ 116 /*
113 if (res != 12345678) printk( "Buggy.\n" ); 117 * If this fails, it means that any user program may lock the
114 else printk( "OK.\n" ); 118 * CPU hard. Too bad.
119 */
120 if (res != 12345678)
121 printk("Buggy.\n");
122 else
123 printk("OK.\n");
115#endif 124#endif
116} 125}
117 126
@@ -137,7 +146,8 @@ static void __init check_config(void)
137 * i486+ only features! (WP works in supervisor mode and the 146 * i486+ only features! (WP works in supervisor mode and the
138 * new "invlpg" and "bswap" instructions) 147 * new "invlpg" and "bswap" instructions)
139 */ 148 */
140#if defined(CONFIG_X86_WP_WORKS_OK) || defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_BSWAP) 149#if defined(CONFIG_X86_WP_WORKS_OK) || defined(CONFIG_X86_INVLPG) || \
150 defined(CONFIG_X86_BSWAP)
141 if (boot_cpu_data.x86 == 3) 151 if (boot_cpu_data.x86 == 3)
142 panic("Kernel requires i486+ for 'invlpg' and other features"); 152 panic("Kernel requires i486+ for 'invlpg' and other features");
143#endif 153#endif
@@ -170,6 +180,7 @@ void __init check_bugs(void)
170 check_fpu(); 180 check_fpu();
171 check_hlt(); 181 check_hlt();
172 check_popad(); 182 check_popad();
173 init_utsname()->machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); 183 init_utsname()->machine[1] =
184 '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
174 alternative_instructions(); 185 alternative_instructions();
175} 186}
diff --git a/arch/x86/kernel/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c
index 9a3ed0649d4e..9a3ed0649d4e 100644
--- a/arch/x86/kernel/bugs_64.c
+++ b/arch/x86/kernel/cpu/bugs_64.c
diff --git a/arch/x86/kernel/cpu/centaur_64.c b/arch/x86/kernel/cpu/centaur_64.c
new file mode 100644
index 000000000000..1d181c40e2e1
--- /dev/null
+++ b/arch/x86/kernel/cpu/centaur_64.c
@@ -0,0 +1,35 @@
1#include <linux/init.h>
2#include <linux/smp.h>
3
4#include <asm/cpufeature.h>
5#include <asm/processor.h>
6
7#include "cpu.h"
8
9static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c)
10{
11 if (c->x86 == 0x6 && c->x86_model >= 0xf)
12 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
13
14 set_cpu_cap(c, X86_FEATURE_SYSENTER32);
15}
16
17static void __cpuinit init_centaur(struct cpuinfo_x86 *c)
18{
19 if (c->x86 == 0x6 && c->x86_model >= 0xf) {
20 c->x86_cache_alignment = c->x86_clflush_size * 2;
21 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
22 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
23 }
24 set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
25}
26
27static struct cpu_dev centaur_cpu_dev __cpuinitdata = {
28 .c_vendor = "Centaur",
29 .c_ident = { "CentaurHauls" },
30 .c_early_init = early_init_centaur,
31 .c_init = init_centaur,
32};
33
34cpu_vendor_dev_register(X86_VENDOR_CENTAUR, &centaur_cpu_dev);
35
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d0463a946247..80ab20d4fa39 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -427,7 +427,7 @@ __setup("serialnumber", x86_serial_nr_setup);
427/* 427/*
428 * This does the hard work of actually picking apart the CPU stuff... 428 * This does the hard work of actually picking apart the CPU stuff...
429 */ 429 */
430void __cpuinit identify_cpu(struct cpuinfo_x86 *c) 430static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
431{ 431{
432 int i; 432 int i;
433 433
diff --git a/arch/x86/kernel/cpu/common_64.c b/arch/x86/kernel/cpu/common_64.c
new file mode 100644
index 000000000000..7b8cc72feb40
--- /dev/null
+++ b/arch/x86/kernel/cpu/common_64.c
@@ -0,0 +1,681 @@
1#include <linux/init.h>
2#include <linux/kernel.h>
3#include <linux/sched.h>
4#include <linux/string.h>
5#include <linux/bootmem.h>
6#include <linux/bitops.h>
7#include <linux/module.h>
8#include <linux/kgdb.h>
9#include <linux/topology.h>
10#include <linux/string.h>
11#include <linux/delay.h>
12#include <linux/smp.h>
13#include <linux/module.h>
14#include <linux/percpu.h>
15#include <asm/processor.h>
16#include <asm/i387.h>
17#include <asm/msr.h>
18#include <asm/io.h>
19#include <asm/mmu_context.h>
20#include <asm/mtrr.h>
21#include <asm/mce.h>
22#include <asm/pat.h>
23#include <asm/numa.h>
24#ifdef CONFIG_X86_LOCAL_APIC
25#include <asm/mpspec.h>
26#include <asm/apic.h>
27#include <mach_apic.h>
28#endif
29#include <asm/pda.h>
30#include <asm/pgtable.h>
31#include <asm/processor.h>
32#include <asm/desc.h>
33#include <asm/atomic.h>
34#include <asm/proto.h>
35#include <asm/sections.h>
36#include <asm/setup.h>
37#include <asm/genapic.h>
38
39#include "cpu.h"
40
41/* We need valid kernel segments for data and code in long mode too
42 * IRET will check the segment types kkeil 2000/10/28
43 * Also sysret mandates a special GDT layout
44 */
45/* The TLS descriptors are currently at a different place compared to i386.
46 Hopefully nobody expects them at a fixed place (Wine?) */
47DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = {
48 [GDT_ENTRY_KERNEL32_CS] = { { { 0x0000ffff, 0x00cf9b00 } } },
49 [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00af9b00 } } },
50 [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9300 } } },
51 [GDT_ENTRY_DEFAULT_USER32_CS] = { { { 0x0000ffff, 0x00cffb00 } } },
52 [GDT_ENTRY_DEFAULT_USER_DS] = { { { 0x0000ffff, 0x00cff300 } } },
53 [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00affb00 } } },
54} };
55EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
56
57__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
58
59/* Current gdt points %fs at the "master" per-cpu area: after this,
60 * it's on the real one. */
61void switch_to_new_gdt(void)
62{
63 struct desc_ptr gdt_descr;
64
65 gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id());
66 gdt_descr.size = GDT_SIZE - 1;
67 load_gdt(&gdt_descr);
68}
69
70struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};
71
72static void __cpuinit default_init(struct cpuinfo_x86 *c)
73{
74 display_cacheinfo(c);
75}
76
77static struct cpu_dev __cpuinitdata default_cpu = {
78 .c_init = default_init,
79 .c_vendor = "Unknown",
80};
81static struct cpu_dev *this_cpu __cpuinitdata = &default_cpu;
82
83int __cpuinit get_model_name(struct cpuinfo_x86 *c)
84{
85 unsigned int *v;
86
87 if (c->extended_cpuid_level < 0x80000004)
88 return 0;
89
90 v = (unsigned int *) c->x86_model_id;
91 cpuid(0x80000002, &v[0], &v[1], &v[2], &v[3]);
92 cpuid(0x80000003, &v[4], &v[5], &v[6], &v[7]);
93 cpuid(0x80000004, &v[8], &v[9], &v[10], &v[11]);
94 c->x86_model_id[48] = 0;
95 return 1;
96}
97
98
99void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
100{
101 unsigned int n, dummy, ebx, ecx, edx;
102
103 n = c->extended_cpuid_level;
104
105 if (n >= 0x80000005) {
106 cpuid(0x80000005, &dummy, &ebx, &ecx, &edx);
107 printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), "
108 "D cache %dK (%d bytes/line)\n",
109 edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
110 c->x86_cache_size = (ecx>>24) + (edx>>24);
111 /* On K8 L1 TLB is inclusive, so don't count it */
112 c->x86_tlbsize = 0;
113 }
114
115 if (n >= 0x80000006) {
116 cpuid(0x80000006, &dummy, &ebx, &ecx, &edx);
117 ecx = cpuid_ecx(0x80000006);
118 c->x86_cache_size = ecx >> 16;
119 c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff);
120
121 printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n",
122 c->x86_cache_size, ecx & 0xFF);
123 }
124}
125
126void __cpuinit detect_ht(struct cpuinfo_x86 *c)
127{
128#ifdef CONFIG_SMP
129 u32 eax, ebx, ecx, edx;
130 int index_msb, core_bits;
131
132 cpuid(1, &eax, &ebx, &ecx, &edx);
133
134
135 if (!cpu_has(c, X86_FEATURE_HT))
136 return;
137 if (cpu_has(c, X86_FEATURE_CMP_LEGACY))
138 goto out;
139
140 smp_num_siblings = (ebx & 0xff0000) >> 16;
141
142 if (smp_num_siblings == 1) {
143 printk(KERN_INFO "CPU: Hyper-Threading is disabled\n");
144 } else if (smp_num_siblings > 1) {
145
146 if (smp_num_siblings > NR_CPUS) {
147 printk(KERN_WARNING "CPU: Unsupported number of "
148 "siblings %d", smp_num_siblings);
149 smp_num_siblings = 1;
150 return;
151 }
152
153 index_msb = get_count_order(smp_num_siblings);
154 c->phys_proc_id = phys_pkg_id(index_msb);
155
156 smp_num_siblings = smp_num_siblings / c->x86_max_cores;
157
158 index_msb = get_count_order(smp_num_siblings);
159
160 core_bits = get_count_order(c->x86_max_cores);
161
162 c->cpu_core_id = phys_pkg_id(index_msb) &
163 ((1 << core_bits) - 1);
164 }
165out:
166 if ((c->x86_max_cores * smp_num_siblings) > 1) {
167 printk(KERN_INFO "CPU: Physical Processor ID: %d\n",
168 c->phys_proc_id);
169 printk(KERN_INFO "CPU: Processor Core ID: %d\n",
170 c->cpu_core_id);
171 }
172
173#endif
174}
175
176static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
177{
178 char *v = c->x86_vendor_id;
179 int i;
180 static int printed;
181
182 for (i = 0; i < X86_VENDOR_NUM; i++) {
183 if (cpu_devs[i]) {
184 if (!strcmp(v, cpu_devs[i]->c_ident[0]) ||
185 (cpu_devs[i]->c_ident[1] &&
186 !strcmp(v, cpu_devs[i]->c_ident[1]))) {
187 c->x86_vendor = i;
188 this_cpu = cpu_devs[i];
189 return;
190 }
191 }
192 }
193 if (!printed) {
194 printed++;
195 printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n");
196 printk(KERN_ERR "CPU: Your system may be unstable.\n");
197 }
198 c->x86_vendor = X86_VENDOR_UNKNOWN;
199}
200
201static void __init early_cpu_support_print(void)
202{
203 int i,j;
204 struct cpu_dev *cpu_devx;
205
206 printk("KERNEL supported cpus:\n");
207 for (i = 0; i < X86_VENDOR_NUM; i++) {
208 cpu_devx = cpu_devs[i];
209 if (!cpu_devx)
210 continue;
211 for (j = 0; j < 2; j++) {
212 if (!cpu_devx->c_ident[j])
213 continue;
214 printk(" %s %s\n", cpu_devx->c_vendor,
215 cpu_devx->c_ident[j]);
216 }
217 }
218}
219
220static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c);
221
222void __init early_cpu_init(void)
223{
224 struct cpu_vendor_dev *cvdev;
225
226 for (cvdev = __x86cpuvendor_start ;
227 cvdev < __x86cpuvendor_end ;
228 cvdev++)
229 cpu_devs[cvdev->vendor] = cvdev->cpu_dev;
230 early_cpu_support_print();
231 early_identify_cpu(&boot_cpu_data);
232}
233
234/* Do some early cpuid on the boot CPU to get some parameter that are
235 needed before check_bugs. Everything advanced is in identify_cpu
236 below. */
237static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
238{
239 u32 tfms, xlvl;
240
241 c->loops_per_jiffy = loops_per_jiffy;
242 c->x86_cache_size = -1;
243 c->x86_vendor = X86_VENDOR_UNKNOWN;
244 c->x86_model = c->x86_mask = 0; /* So far unknown... */
245 c->x86_vendor_id[0] = '\0'; /* Unset */
246 c->x86_model_id[0] = '\0'; /* Unset */
247 c->x86_clflush_size = 64;
248 c->x86_cache_alignment = c->x86_clflush_size;
249 c->x86_max_cores = 1;
250 c->x86_coreid_bits = 0;
251 c->extended_cpuid_level = 0;
252 memset(&c->x86_capability, 0, sizeof c->x86_capability);
253
254 /* Get vendor name */
255 cpuid(0x00000000, (unsigned int *)&c->cpuid_level,
256 (unsigned int *)&c->x86_vendor_id[0],
257 (unsigned int *)&c->x86_vendor_id[8],
258 (unsigned int *)&c->x86_vendor_id[4]);
259
260 get_cpu_vendor(c);
261
262 /* Initialize the standard set of capabilities */
263 /* Note that the vendor-specific code below might override */
264
265 /* Intel-defined flags: level 0x00000001 */
266 if (c->cpuid_level >= 0x00000001) {
267 __u32 misc;
268 cpuid(0x00000001, &tfms, &misc, &c->x86_capability[4],
269 &c->x86_capability[0]);
270 c->x86 = (tfms >> 8) & 0xf;
271 c->x86_model = (tfms >> 4) & 0xf;
272 c->x86_mask = tfms & 0xf;
273 if (c->x86 == 0xf)
274 c->x86 += (tfms >> 20) & 0xff;
275 if (c->x86 >= 0x6)
276 c->x86_model += ((tfms >> 16) & 0xF) << 4;
277 if (test_cpu_cap(c, X86_FEATURE_CLFLSH))
278 c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
279 } else {
280 /* Have CPUID level 0 only - unheard of */
281 c->x86 = 4;
282 }
283
284 c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xff;
285#ifdef CONFIG_SMP
286 c->phys_proc_id = c->initial_apicid;
287#endif
288 /* AMD-defined flags: level 0x80000001 */
289 xlvl = cpuid_eax(0x80000000);
290 c->extended_cpuid_level = xlvl;
291 if ((xlvl & 0xffff0000) == 0x80000000) {
292 if (xlvl >= 0x80000001) {
293 c->x86_capability[1] = cpuid_edx(0x80000001);
294 c->x86_capability[6] = cpuid_ecx(0x80000001);
295 }
296 if (xlvl >= 0x80000004)
297 get_model_name(c); /* Default name */
298 }
299
300 /* Transmeta-defined flags: level 0x80860001 */
301 xlvl = cpuid_eax(0x80860000);
302 if ((xlvl & 0xffff0000) == 0x80860000) {
303 /* Don't set x86_cpuid_level here for now to not confuse. */
304 if (xlvl >= 0x80860001)
305 c->x86_capability[2] = cpuid_edx(0x80860001);
306 }
307
308 c->extended_cpuid_level = cpuid_eax(0x80000000);
309 if (c->extended_cpuid_level >= 0x80000007)
310 c->x86_power = cpuid_edx(0x80000007);
311
312 if (c->extended_cpuid_level >= 0x80000008) {
313 u32 eax = cpuid_eax(0x80000008);
314
315 c->x86_virt_bits = (eax >> 8) & 0xff;
316 c->x86_phys_bits = eax & 0xff;
317 }
318
319 /* Assume all 64-bit CPUs support 32-bit syscall */
320 set_cpu_cap(c, X86_FEATURE_SYSCALL32);
321
322 if (c->x86_vendor != X86_VENDOR_UNKNOWN &&
323 cpu_devs[c->x86_vendor]->c_early_init)
324 cpu_devs[c->x86_vendor]->c_early_init(c);
325
326 validate_pat_support(c);
327
328 /* early_param could clear that, but recall get it set again */
329 if (disable_apic)
330 clear_cpu_cap(c, X86_FEATURE_APIC);
331}
332
333/*
334 * This does the hard work of actually picking apart the CPU stuff...
335 */
336static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
337{
338 int i;
339
340 early_identify_cpu(c);
341
342 init_scattered_cpuid_features(c);
343
344 c->apicid = phys_pkg_id(0);
345
346 /*
347 * Vendor-specific initialization. In this section we
348 * canonicalize the feature flags, meaning if there are
349 * features a certain CPU supports which CPUID doesn't
350 * tell us, CPUID claiming incorrect flags, or other bugs,
351 * we handle them here.
352 *
353 * At the end of this section, c->x86_capability better
354 * indicate the features this CPU genuinely supports!
355 */
356 if (this_cpu->c_init)
357 this_cpu->c_init(c);
358
359 detect_ht(c);
360
361 /*
362 * On SMP, boot_cpu_data holds the common feature set between
363 * all CPUs; so make sure that we indicate which features are
364 * common between the CPUs. The first time this routine gets
365 * executed, c == &boot_cpu_data.
366 */
367 if (c != &boot_cpu_data) {
368 /* AND the already accumulated flags with these */
369 for (i = 0; i < NCAPINTS; i++)
370 boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
371 }
372
373 /* Clear all flags overriden by options */
374 for (i = 0; i < NCAPINTS; i++)
375 c->x86_capability[i] &= ~cleared_cpu_caps[i];
376
377#ifdef CONFIG_X86_MCE
378 mcheck_init(c);
379#endif
380 select_idle_routine(c);
381
382#ifdef CONFIG_NUMA
383 numa_add_cpu(smp_processor_id());
384#endif
385
386}
387
388void __cpuinit identify_boot_cpu(void)
389{
390 identify_cpu(&boot_cpu_data);
391}
392
393void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c)
394{
395 BUG_ON(c == &boot_cpu_data);
396 identify_cpu(c);
397 mtrr_ap_init();
398}
399
400static __init int setup_noclflush(char *arg)
401{
402 setup_clear_cpu_cap(X86_FEATURE_CLFLSH);
403 return 1;
404}
405__setup("noclflush", setup_noclflush);
406
407void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
408{
409 if (c->x86_model_id[0])
410 printk(KERN_CONT "%s", c->x86_model_id);
411
412 if (c->x86_mask || c->cpuid_level >= 0)
413 printk(KERN_CONT " stepping %02x\n", c->x86_mask);
414 else
415 printk(KERN_CONT "\n");
416}
417
418static __init int setup_disablecpuid(char *arg)
419{
420 int bit;
421 if (get_option(&arg, &bit) && bit < NCAPINTS*32)
422 setup_clear_cpu_cap(bit);
423 else
424 return 0;
425 return 1;
426}
427__setup("clearcpuid=", setup_disablecpuid);
428
429cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
430
431struct x8664_pda **_cpu_pda __read_mostly;
432EXPORT_SYMBOL(_cpu_pda);
433
434struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
435
436char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss;
437
438unsigned long __supported_pte_mask __read_mostly = ~0UL;
439EXPORT_SYMBOL_GPL(__supported_pte_mask);
440
441static int do_not_nx __cpuinitdata;
442
443/* noexec=on|off
444Control non executable mappings for 64bit processes.
445
446on Enable(default)
447off Disable
448*/
449static int __init nonx_setup(char *str)
450{
451 if (!str)
452 return -EINVAL;
453 if (!strncmp(str, "on", 2)) {
454 __supported_pte_mask |= _PAGE_NX;
455 do_not_nx = 0;
456 } else if (!strncmp(str, "off", 3)) {
457 do_not_nx = 1;
458 __supported_pte_mask &= ~_PAGE_NX;
459 }
460 return 0;
461}
462early_param("noexec", nonx_setup);
463
464int force_personality32;
465
466/* noexec32=on|off
467Control non executable heap for 32bit processes.
468To control the stack too use noexec=off
469
470on PROT_READ does not imply PROT_EXEC for 32bit processes (default)
471off PROT_READ implies PROT_EXEC
472*/
473static int __init nonx32_setup(char *str)
474{
475 if (!strcmp(str, "on"))
476 force_personality32 &= ~READ_IMPLIES_EXEC;
477 else if (!strcmp(str, "off"))
478 force_personality32 |= READ_IMPLIES_EXEC;
479 return 1;
480}
481__setup("noexec32=", nonx32_setup);
482
483void pda_init(int cpu)
484{
485 struct x8664_pda *pda = cpu_pda(cpu);
486
487 /* Setup up data that may be needed in __get_free_pages early */
488 loadsegment(fs, 0);
489 loadsegment(gs, 0);
490 /* Memory clobbers used to order PDA accessed */
491 mb();
492 wrmsrl(MSR_GS_BASE, pda);
493 mb();
494
495 pda->cpunumber = cpu;
496 pda->irqcount = -1;
497 pda->kernelstack = (unsigned long)stack_thread_info() -
498 PDA_STACKOFFSET + THREAD_SIZE;
499 pda->active_mm = &init_mm;
500 pda->mmu_state = 0;
501
502 if (cpu == 0) {
503 /* others are initialized in smpboot.c */
504 pda->pcurrent = &init_task;
505 pda->irqstackptr = boot_cpu_stack;
506 } else {
507 pda->irqstackptr = (char *)
508 __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER);
509 if (!pda->irqstackptr)
510 panic("cannot allocate irqstack for cpu %d", cpu);
511
512 if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE)
513 pda->nodenumber = cpu_to_node(cpu);
514 }
515
516 pda->irqstackptr += IRQSTACKSIZE-64;
517}
518
519char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ +
520 DEBUG_STKSZ]
521__attribute__((section(".bss.page_aligned")));
522
523extern asmlinkage void ignore_sysret(void);
524
525/* May not be marked __init: used by software suspend */
526void syscall_init(void)
527{
528 /*
529 * LSTAR and STAR live in a bit strange symbiosis.
530 * They both write to the same internal register. STAR allows to
531 * set CS/DS but only a 32bit target. LSTAR sets the 64bit rip.
532 */
533 wrmsrl(MSR_STAR, ((u64)__USER32_CS)<<48 | ((u64)__KERNEL_CS)<<32);
534 wrmsrl(MSR_LSTAR, system_call);
535 wrmsrl(MSR_CSTAR, ignore_sysret);
536
537#ifdef CONFIG_IA32_EMULATION
538 syscall32_cpu_init();
539#endif
540
541 /* Flags to clear on syscall */
542 wrmsrl(MSR_SYSCALL_MASK,
543 X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL);
544}
545
546void __cpuinit check_efer(void)
547{
548 unsigned long efer;
549
550 rdmsrl(MSR_EFER, efer);
551 if (!(efer & EFER_NX) || do_not_nx)
552 __supported_pte_mask &= ~_PAGE_NX;
553}
554
555unsigned long kernel_eflags;
556
557/*
558 * Copies of the original ist values from the tss are only accessed during
559 * debugging, no special alignment required.
560 */
561DEFINE_PER_CPU(struct orig_ist, orig_ist);
562
563/*
564 * cpu_init() initializes state that is per-CPU. Some data is already
565 * initialized (naturally) in the bootstrap process, such as the GDT
566 * and IDT. We reload them nevertheless, this function acts as a
567 * 'CPU state barrier', nothing should get across.
568 * A lot of state is already set up in PDA init.
569 */
570void __cpuinit cpu_init(void)
571{
572 int cpu = stack_smp_processor_id();
573 struct tss_struct *t = &per_cpu(init_tss, cpu);
574 struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu);
575 unsigned long v;
576 char *estacks = NULL;
577 struct task_struct *me;
578 int i;
579
580 /* CPU 0 is initialised in head64.c */
581 if (cpu != 0)
582 pda_init(cpu);
583 else
584 estacks = boot_exception_stacks;
585
586 me = current;
587
588 if (cpu_test_and_set(cpu, cpu_initialized))
589 panic("CPU#%d already initialized!\n", cpu);
590
591 printk(KERN_INFO "Initializing CPU#%d\n", cpu);
592
593 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
594
595 /*
596 * Initialize the per-CPU GDT with the boot GDT,
597 * and set up the GDT descriptor:
598 */
599
600 switch_to_new_gdt();
601 load_idt((const struct desc_ptr *)&idt_descr);
602
603 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
604 syscall_init();
605
606 wrmsrl(MSR_FS_BASE, 0);
607 wrmsrl(MSR_KERNEL_GS_BASE, 0);
608 barrier();
609
610 check_efer();
611
612 /*
613 * set up and load the per-CPU TSS
614 */
615 for (v = 0; v < N_EXCEPTION_STACKS; v++) {
616 static const unsigned int order[N_EXCEPTION_STACKS] = {
617 [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER,
618 [DEBUG_STACK - 1] = DEBUG_STACK_ORDER
619 };
620 if (cpu) {
621 estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
622 if (!estacks)
623 panic("Cannot allocate exception stack %ld %d\n",
624 v, cpu);
625 }
626 estacks += PAGE_SIZE << order[v];
627 orig_ist->ist[v] = t->x86_tss.ist[v] = (unsigned long)estacks;
628 }
629
630 t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
631 /*
632 * <= is required because the CPU will access up to
633 * 8 bits beyond the end of the IO permission bitmap.
634 */
635 for (i = 0; i <= IO_BITMAP_LONGS; i++)
636 t->io_bitmap[i] = ~0UL;
637
638 atomic_inc(&init_mm.mm_count);
639 me->active_mm = &init_mm;
640 if (me->mm)
641 BUG();
642 enter_lazy_tlb(&init_mm, me);
643
644 load_sp0(t, &current->thread);
645 set_tss_desc(cpu, t);
646 load_TR_desc();
647 load_LDT(&init_mm.context);
648
649#ifdef CONFIG_KGDB
650 /*
651 * If the kgdb is connected no debug regs should be altered. This
652 * is only applicable when KGDB and a KGDB I/O module are built
653 * into the kernel and you are using early debugging with
654 * kgdbwait. KGDB will control the kernel HW breakpoint registers.
655 */
656 if (kgdb_connected && arch_kgdb_ops.correct_hw_break)
657 arch_kgdb_ops.correct_hw_break();
658 else {
659#endif
660 /*
661 * Clear all 6 debug registers:
662 */
663
664 set_debugreg(0UL, 0);
665 set_debugreg(0UL, 1);
666 set_debugreg(0UL, 2);
667 set_debugreg(0UL, 3);
668 set_debugreg(0UL, 6);
669 set_debugreg(0UL, 7);
670#ifdef CONFIG_KGDB
671 /* If the kgdb is connected no debug regs should be altered. */
672 }
673#endif
674
675 fpu_init();
676
677 raw_local_save_flags(kernel_eflags);
678
679 if (is_uv_system())
680 uv_cpu_init();
681}
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h
index 783691b2a738..4d894e8565fe 100644
--- a/arch/x86/kernel/cpu/cpu.h
+++ b/arch/x86/kernel/cpu/cpu.h
@@ -1,3 +1,6 @@
1#ifndef ARCH_X86_CPU_H
2
3#define ARCH_X86_CPU_H
1 4
2struct cpu_model_info { 5struct cpu_model_info {
3 int vendor; 6 int vendor;
@@ -36,3 +39,5 @@ extern struct cpu_vendor_dev __x86cpuvendor_start[], __x86cpuvendor_end[];
36 39
37extern int get_model_name(struct cpuinfo_x86 *c); 40extern int get_model_name(struct cpuinfo_x86 *c);
38extern void display_cacheinfo(struct cpuinfo_x86 *c); 41extern void display_cacheinfo(struct cpuinfo_x86 *c);
42
43#endif
diff --git a/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
index f03e9153618e..965ea52767ac 100644
--- a/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
+++ b/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
@@ -26,9 +26,10 @@
26#define NFORCE2_SAFE_DISTANCE 50 26#define NFORCE2_SAFE_DISTANCE 50
27 27
28/* Delay in ms between FSB changes */ 28/* Delay in ms between FSB changes */
29//#define NFORCE2_DELAY 10 29/* #define NFORCE2_DELAY 10 */
30 30
31/* nforce2_chipset: 31/*
32 * nforce2_chipset:
32 * FSB is changed using the chipset 33 * FSB is changed using the chipset
33 */ 34 */
34static struct pci_dev *nforce2_chipset_dev; 35static struct pci_dev *nforce2_chipset_dev;
@@ -36,13 +37,13 @@ static struct pci_dev *nforce2_chipset_dev;
36/* fid: 37/* fid:
37 * multiplier * 10 38 * multiplier * 10
38 */ 39 */
39static int fid = 0; 40static int fid;
40 41
41/* min_fsb, max_fsb: 42/* min_fsb, max_fsb:
42 * minimum and maximum FSB (= FSB at boot time) 43 * minimum and maximum FSB (= FSB at boot time)
43 */ 44 */
44static int min_fsb = 0; 45static int min_fsb;
45static int max_fsb = 0; 46static int max_fsb;
46 47
47MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>"); 48MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");
48MODULE_DESCRIPTION("nForce2 FSB changing cpufreq driver"); 49MODULE_DESCRIPTION("nForce2 FSB changing cpufreq driver");
@@ -53,7 +54,7 @@ module_param(min_fsb, int, 0444);
53 54
54MODULE_PARM_DESC(fid, "CPU multiplier to use (11.5 = 115)"); 55MODULE_PARM_DESC(fid, "CPU multiplier to use (11.5 = 115)");
55MODULE_PARM_DESC(min_fsb, 56MODULE_PARM_DESC(min_fsb,
56 "Minimum FSB to use, if not defined: current FSB - 50"); 57 "Minimum FSB to use, if not defined: current FSB - 50");
57 58
58#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "cpufreq-nforce2", msg) 59#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "cpufreq-nforce2", msg)
59 60
@@ -139,7 +140,7 @@ static unsigned int nforce2_fsb_read(int bootfsb)
139 140
140 /* Get chipset boot FSB from subdevice 5 (FSB at boot-time) */ 141 /* Get chipset boot FSB from subdevice 5 (FSB at boot-time) */
141 nforce2_sub5 = pci_get_subsys(PCI_VENDOR_ID_NVIDIA, 142 nforce2_sub5 = pci_get_subsys(PCI_VENDOR_ID_NVIDIA,
142 0x01EF,PCI_ANY_ID,PCI_ANY_ID,NULL); 143 0x01EF, PCI_ANY_ID, PCI_ANY_ID, NULL);
143 if (!nforce2_sub5) 144 if (!nforce2_sub5)
144 return 0; 145 return 0;
145 146
@@ -147,13 +148,13 @@ static unsigned int nforce2_fsb_read(int bootfsb)
147 fsb /= 1000000; 148 fsb /= 1000000;
148 149
149 /* Check if PLL register is already set */ 150 /* Check if PLL register is already set */
150 pci_read_config_byte(nforce2_chipset_dev,NFORCE2_PLLENABLE, (u8 *)&temp); 151 pci_read_config_byte(nforce2_chipset_dev, NFORCE2_PLLENABLE, (u8 *)&temp);
151 152
152 if(bootfsb || !temp) 153 if (bootfsb || !temp)
153 return fsb; 154 return fsb;
154 155
155 /* Use PLL register FSB value */ 156 /* Use PLL register FSB value */
156 pci_read_config_dword(nforce2_chipset_dev,NFORCE2_PLLREG, &temp); 157 pci_read_config_dword(nforce2_chipset_dev, NFORCE2_PLLREG, &temp);
157 fsb = nforce2_calc_fsb(temp); 158 fsb = nforce2_calc_fsb(temp);
158 159
159 return fsb; 160 return fsb;
@@ -184,7 +185,7 @@ static int nforce2_set_fsb(unsigned int fsb)
184 } 185 }
185 186
186 /* First write? Then set actual value */ 187 /* First write? Then set actual value */
187 pci_read_config_byte(nforce2_chipset_dev,NFORCE2_PLLENABLE, (u8 *)&temp); 188 pci_read_config_byte(nforce2_chipset_dev, NFORCE2_PLLENABLE, (u8 *)&temp);
188 if (!temp) { 189 if (!temp) {
189 pll = nforce2_calc_pll(tfsb); 190 pll = nforce2_calc_pll(tfsb);
190 191
@@ -210,7 +211,8 @@ static int nforce2_set_fsb(unsigned int fsb)
210 tfsb--; 211 tfsb--;
211 212
212 /* Calculate the PLL reg. value */ 213 /* Calculate the PLL reg. value */
213 if ((pll = nforce2_calc_pll(tfsb)) == -1) 214 pll = nforce2_calc_pll(tfsb);
215 if (pll == -1)
214 return -EINVAL; 216 return -EINVAL;
215 217
216 nforce2_write_pll(pll); 218 nforce2_write_pll(pll);
@@ -249,7 +251,7 @@ static unsigned int nforce2_get(unsigned int cpu)
249static int nforce2_target(struct cpufreq_policy *policy, 251static int nforce2_target(struct cpufreq_policy *policy,
250 unsigned int target_freq, unsigned int relation) 252 unsigned int target_freq, unsigned int relation)
251{ 253{
252// unsigned long flags; 254/* unsigned long flags; */
253 struct cpufreq_freqs freqs; 255 struct cpufreq_freqs freqs;
254 unsigned int target_fsb; 256 unsigned int target_fsb;
255 257
@@ -271,17 +273,17 @@ static int nforce2_target(struct cpufreq_policy *policy,
271 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 273 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
272 274
273 /* Disable IRQs */ 275 /* Disable IRQs */
274 //local_irq_save(flags); 276 /* local_irq_save(flags); */
275 277
276 if (nforce2_set_fsb(target_fsb) < 0) 278 if (nforce2_set_fsb(target_fsb) < 0)
277 printk(KERN_ERR "cpufreq: Changing FSB to %d failed\n", 279 printk(KERN_ERR "cpufreq: Changing FSB to %d failed\n",
278 target_fsb); 280 target_fsb);
279 else 281 else
280 dprintk("Changed FSB successfully to %d\n", 282 dprintk("Changed FSB successfully to %d\n",
281 target_fsb); 283 target_fsb);
282 284
283 /* Enable IRQs */ 285 /* Enable IRQs */
284 //local_irq_restore(flags); 286 /* local_irq_restore(flags); */
285 287
286 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 288 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
287 289
@@ -302,8 +304,8 @@ static int nforce2_verify(struct cpufreq_policy *policy)
302 policy->max = (fsb_pol_max + 1) * fid * 100; 304 policy->max = (fsb_pol_max + 1) * fid * 100;
303 305
304 cpufreq_verify_within_limits(policy, 306 cpufreq_verify_within_limits(policy,
305 policy->cpuinfo.min_freq, 307 policy->cpuinfo.min_freq,
306 policy->cpuinfo.max_freq); 308 policy->cpuinfo.max_freq);
307 return 0; 309 return 0;
308} 310}
309 311
@@ -347,7 +349,7 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy)
347 /* Set maximum FSB to FSB at boot time */ 349 /* Set maximum FSB to FSB at boot time */
348 max_fsb = nforce2_fsb_read(1); 350 max_fsb = nforce2_fsb_read(1);
349 351
350 if(!max_fsb) 352 if (!max_fsb)
351 return -EIO; 353 return -EIO;
352 354
353 if (!min_fsb) 355 if (!min_fsb)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index fe9224c51d37..70609efdf1da 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -226,6 +226,10 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
226 226
227 if (cpu_has_bts) 227 if (cpu_has_bts)
228 ds_init_intel(c); 228 ds_init_intel(c);
229
230#ifdef CONFIG_X86_NUMAQ
231 numaq_tsc_disable();
232#endif
229} 233}
230 234
231static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 *c, unsigned int size) 235static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 *c, unsigned int size)
diff --git a/arch/x86/kernel/cpu/intel_64.c b/arch/x86/kernel/cpu/intel_64.c
new file mode 100644
index 000000000000..1019c58d39f0
--- /dev/null
+++ b/arch/x86/kernel/cpu/intel_64.c
@@ -0,0 +1,95 @@
1#include <linux/init.h>
2#include <linux/smp.h>
3#include <asm/processor.h>
4#include <asm/ptrace.h>
5#include <asm/topology.h>
6#include <asm/numa_64.h>
7
8#include "cpu.h"
9
10static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
11{
12 if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
13 (c->x86 == 0x6 && c->x86_model >= 0x0e))
14 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
15
16 set_cpu_cap(c, X86_FEATURE_SYSENTER32);
17}
18
19/*
20 * find out the number of processor cores on the die
21 */
22static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
23{
24 unsigned int eax, t;
25
26 if (c->cpuid_level < 4)
27 return 1;
28
29 cpuid_count(4, 0, &eax, &t, &t, &t);
30
31 if (eax & 0x1f)
32 return ((eax >> 26) + 1);
33 else
34 return 1;
35}
36
37static void __cpuinit srat_detect_node(void)
38{
39#ifdef CONFIG_NUMA
40 unsigned node;
41 int cpu = smp_processor_id();
42 int apicid = hard_smp_processor_id();
43
44 /* Don't do the funky fallback heuristics the AMD version employs
45 for now. */
46 node = apicid_to_node[apicid];
47 if (node == NUMA_NO_NODE || !node_online(node))
48 node = first_node(node_online_map);
49 numa_set_node(cpu, node);
50
51 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
52#endif
53}
54
55static void __cpuinit init_intel(struct cpuinfo_x86 *c)
56{
57 init_intel_cacheinfo(c);
58 if (c->cpuid_level > 9) {
59 unsigned eax = cpuid_eax(10);
60 /* Check for version and the number of counters */
61 if ((eax & 0xff) && (((eax>>8) & 0xff) > 1))
62 set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
63 }
64
65 if (cpu_has_ds) {
66 unsigned int l1, l2;
67 rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
68 if (!(l1 & (1<<11)))
69 set_cpu_cap(c, X86_FEATURE_BTS);
70 if (!(l1 & (1<<12)))
71 set_cpu_cap(c, X86_FEATURE_PEBS);
72 }
73
74
75 if (cpu_has_bts)
76 ds_init_intel(c);
77
78 if (c->x86 == 15)
79 c->x86_cache_alignment = c->x86_clflush_size * 2;
80 if (c->x86 == 6)
81 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
82 set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
83 c->x86_max_cores = intel_num_cpu_cores(c);
84
85 srat_detect_node();
86}
87
88static struct cpu_dev intel_cpu_dev __cpuinitdata = {
89 .c_vendor = "Intel",
90 .c_ident = { "GenuineIntel" },
91 .c_early_init = early_init_intel,
92 .c_init = init_intel,
93};
94cpu_vendor_dev_register(X86_VENDOR_INTEL, &intel_cpu_dev);
95
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 26d615dcb149..2c8afafa18e8 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -62,6 +62,7 @@ static struct _cache_table cache_table[] __cpuinitdata =
62 { 0x4b, LVL_3, 8192 }, /* 16-way set assoc, 64 byte line size */ 62 { 0x4b, LVL_3, 8192 }, /* 16-way set assoc, 64 byte line size */
63 { 0x4c, LVL_3, 12288 }, /* 12-way set assoc, 64 byte line size */ 63 { 0x4c, LVL_3, 12288 }, /* 12-way set assoc, 64 byte line size */
64 { 0x4d, LVL_3, 16384 }, /* 16-way set assoc, 64 byte line size */ 64 { 0x4d, LVL_3, 16384 }, /* 16-way set assoc, 64 byte line size */
65 { 0x4e, LVL_2, 6144 }, /* 24-way set assoc, 64 byte line size */
65 { 0x60, LVL_1_DATA, 16 }, /* 8-way set assoc, sectored cache, 64 byte line size */ 66 { 0x60, LVL_1_DATA, 16 }, /* 8-way set assoc, sectored cache, 64 byte line size */
66 { 0x66, LVL_1_DATA, 8 }, /* 4-way set assoc, sectored cache, 64 byte line size */ 67 { 0x66, LVL_1_DATA, 8 }, /* 4-way set assoc, sectored cache, 64 byte line size */
67 { 0x67, LVL_1_DATA, 16 }, /* 4-way set assoc, sectored cache, 64 byte line size */ 68 { 0x67, LVL_1_DATA, 16 }, /* 4-way set assoc, sectored cache, 64 byte line size */
diff --git a/arch/x86/kernel/cpu/mcheck/k7.c b/arch/x86/kernel/cpu/mcheck/k7.c
index e633c9c2b764..f390c9f66351 100644
--- a/arch/x86/kernel/cpu/mcheck/k7.c
+++ b/arch/x86/kernel/cpu/mcheck/k7.c
@@ -9,23 +9,23 @@
9#include <linux/interrupt.h> 9#include <linux/interrupt.h>
10#include <linux/smp.h> 10#include <linux/smp.h>
11 11
12#include <asm/processor.h> 12#include <asm/processor.h>
13#include <asm/system.h> 13#include <asm/system.h>
14#include <asm/msr.h> 14#include <asm/msr.h>
15 15
16#include "mce.h" 16#include "mce.h"
17 17
18/* Machine Check Handler For AMD Athlon/Duron */ 18/* Machine Check Handler For AMD Athlon/Duron */
19static void k7_machine_check(struct pt_regs * regs, long error_code) 19static void k7_machine_check(struct pt_regs *regs, long error_code)
20{ 20{
21 int recover=1; 21 int recover = 1;
22 u32 alow, ahigh, high, low; 22 u32 alow, ahigh, high, low;
23 u32 mcgstl, mcgsth; 23 u32 mcgstl, mcgsth;
24 int i; 24 int i;
25 25
26 rdmsr (MSR_IA32_MCG_STATUS, mcgstl, mcgsth); 26 rdmsr(MSR_IA32_MCG_STATUS, mcgstl, mcgsth);
27 if (mcgstl & (1<<0)) /* Recoverable ? */ 27 if (mcgstl & (1<<0)) /* Recoverable ? */
28 recover=0; 28 recover = 0;
29 29
30 printk(KERN_EMERG "CPU %d: Machine Check Exception: %08x%08x\n", 30 printk(KERN_EMERG "CPU %d: Machine Check Exception: %08x%08x\n",
31 smp_processor_id(), mcgsth, mcgstl); 31 smp_processor_id(), mcgsth, mcgstl);
@@ -60,12 +60,12 @@ static void k7_machine_check(struct pt_regs * regs, long error_code)
60 } 60 }
61 61
62 if (recover&2) 62 if (recover&2)
63 panic ("CPU context corrupt"); 63 panic("CPU context corrupt");
64 if (recover&1) 64 if (recover&1)
65 panic ("Unable to continue"); 65 panic("Unable to continue");
66 printk (KERN_EMERG "Attempting to continue.\n"); 66 printk(KERN_EMERG "Attempting to continue.\n");
67 mcgstl &= ~(1<<2); 67 mcgstl &= ~(1<<2);
68 wrmsr (MSR_IA32_MCG_STATUS,mcgstl, mcgsth); 68 wrmsr(MSR_IA32_MCG_STATUS, mcgstl, mcgsth);
69} 69}
70 70
71 71
@@ -81,25 +81,25 @@ void amd_mcheck_init(struct cpuinfo_x86 *c)
81 machine_check_vector = k7_machine_check; 81 machine_check_vector = k7_machine_check;
82 wmb(); 82 wmb();
83 83
84 printk (KERN_INFO "Intel machine check architecture supported.\n"); 84 printk(KERN_INFO "Intel machine check architecture supported.\n");
85 rdmsr (MSR_IA32_MCG_CAP, l, h); 85 rdmsr(MSR_IA32_MCG_CAP, l, h);
86 if (l & (1<<8)) /* Control register present ? */ 86 if (l & (1<<8)) /* Control register present ? */
87 wrmsr (MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff); 87 wrmsr(MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff);
88 nr_mce_banks = l & 0xff; 88 nr_mce_banks = l & 0xff;
89 89
90 /* Clear status for MC index 0 separately, we don't touch CTL, 90 /* Clear status for MC index 0 separately, we don't touch CTL,
91 * as some K7 Athlons cause spurious MCEs when its enabled. */ 91 * as some K7 Athlons cause spurious MCEs when its enabled. */
92 if (boot_cpu_data.x86 == 6) { 92 if (boot_cpu_data.x86 == 6) {
93 wrmsr (MSR_IA32_MC0_STATUS, 0x0, 0x0); 93 wrmsr(MSR_IA32_MC0_STATUS, 0x0, 0x0);
94 i = 1; 94 i = 1;
95 } else 95 } else
96 i = 0; 96 i = 0;
97 for (; i<nr_mce_banks; i++) { 97 for (; i < nr_mce_banks; i++) {
98 wrmsr (MSR_IA32_MC0_CTL+4*i, 0xffffffff, 0xffffffff); 98 wrmsr(MSR_IA32_MC0_CTL+4*i, 0xffffffff, 0xffffffff);
99 wrmsr (MSR_IA32_MC0_STATUS+4*i, 0x0, 0x0); 99 wrmsr(MSR_IA32_MC0_STATUS+4*i, 0x0, 0x0);
100 } 100 }
101 101
102 set_in_cr4 (X86_CR4_MCE); 102 set_in_cr4(X86_CR4_MCE);
103 printk (KERN_INFO "Intel machine check reporting enabled on CPU#%d.\n", 103 printk(KERN_INFO "Intel machine check reporting enabled on CPU#%d.\n",
104 smp_processor_id()); 104 smp_processor_id());
105} 105}
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index e07e8c068ae0..987410745182 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -9,6 +9,7 @@
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/smp_lock.h>
12#include <linux/string.h> 13#include <linux/string.h>
13#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
14#include <linux/kallsyms.h> 15#include <linux/kallsyms.h>
@@ -31,7 +32,7 @@
31#include <asm/idle.h> 32#include <asm/idle.h>
32 33
33#define MISC_MCELOG_MINOR 227 34#define MISC_MCELOG_MINOR 227
34#define NR_BANKS 6 35#define NR_SYSFS_BANKS 6
35 36
36atomic_t mce_entry; 37atomic_t mce_entry;
37 38
@@ -46,7 +47,7 @@ static int mce_dont_init;
46 */ 47 */
47static int tolerant = 1; 48static int tolerant = 1;
48static int banks; 49static int banks;
49static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL }; 50static unsigned long bank[NR_SYSFS_BANKS] = { [0 ... NR_SYSFS_BANKS-1] = ~0UL };
50static unsigned long notify_user; 51static unsigned long notify_user;
51static int rip_msr; 52static int rip_msr;
52static int mce_bootlog = -1; 53static int mce_bootlog = -1;
@@ -209,7 +210,7 @@ void do_machine_check(struct pt_regs * regs, long error_code)
209 barrier(); 210 barrier();
210 211
211 for (i = 0; i < banks; i++) { 212 for (i = 0; i < banks; i++) {
212 if (!bank[i]) 213 if (i < NR_SYSFS_BANKS && !bank[i])
213 continue; 214 continue;
214 215
215 m.misc = 0; 216 m.misc = 0;
@@ -444,9 +445,10 @@ static void mce_init(void *dummy)
444 445
445 rdmsrl(MSR_IA32_MCG_CAP, cap); 446 rdmsrl(MSR_IA32_MCG_CAP, cap);
446 banks = cap & 0xff; 447 banks = cap & 0xff;
447 if (banks > NR_BANKS) { 448 if (banks > MCE_EXTENDED_BANK) {
448 printk(KERN_INFO "MCE: warning: using only %d banks\n", banks); 449 banks = MCE_EXTENDED_BANK;
449 banks = NR_BANKS; 450 printk(KERN_INFO "MCE: warning: using only %d banks\n",
451 MCE_EXTENDED_BANK);
450 } 452 }
451 /* Use accurate RIP reporting if available. */ 453 /* Use accurate RIP reporting if available. */
452 if ((cap & (1<<9)) && ((cap >> 16) & 0xff) >= 9) 454 if ((cap & (1<<9)) && ((cap >> 16) & 0xff) >= 9)
@@ -462,7 +464,11 @@ static void mce_init(void *dummy)
462 wrmsr(MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff); 464 wrmsr(MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff);
463 465
464 for (i = 0; i < banks; i++) { 466 for (i = 0; i < banks; i++) {
465 wrmsrl(MSR_IA32_MC0_CTL+4*i, bank[i]); 467 if (i < NR_SYSFS_BANKS)
468 wrmsrl(MSR_IA32_MC0_CTL+4*i, bank[i]);
469 else
470 wrmsrl(MSR_IA32_MC0_CTL+4*i, ~0UL);
471
466 wrmsrl(MSR_IA32_MC0_STATUS+4*i, 0); 472 wrmsrl(MSR_IA32_MC0_STATUS+4*i, 0);
467 } 473 }
468} 474}
@@ -527,10 +533,12 @@ static int open_exclu; /* already open exclusive? */
527 533
528static int mce_open(struct inode *inode, struct file *file) 534static int mce_open(struct inode *inode, struct file *file)
529{ 535{
536 lock_kernel();
530 spin_lock(&mce_state_lock); 537 spin_lock(&mce_state_lock);
531 538
532 if (open_exclu || (open_count && (file->f_flags & O_EXCL))) { 539 if (open_exclu || (open_count && (file->f_flags & O_EXCL))) {
533 spin_unlock(&mce_state_lock); 540 spin_unlock(&mce_state_lock);
541 unlock_kernel();
534 return -EBUSY; 542 return -EBUSY;
535 } 543 }
536 544
@@ -539,6 +547,7 @@ static int mce_open(struct inode *inode, struct file *file)
539 open_count++; 547 open_count++;
540 548
541 spin_unlock(&mce_state_lock); 549 spin_unlock(&mce_state_lock);
550 unlock_kernel();
542 551
543 return nonseekable_open(inode, file); 552 return nonseekable_open(inode, file);
544} 553}
@@ -766,7 +775,10 @@ DEFINE_PER_CPU(struct sys_device, device_mce);
766 } \ 775 } \
767 static SYSDEV_ATTR(name, 0644, show_ ## name, set_ ## name); 776 static SYSDEV_ATTR(name, 0644, show_ ## name, set_ ## name);
768 777
769/* TBD should generate these dynamically based on number of available banks */ 778/*
779 * TBD should generate these dynamically based on number of available banks.
780 * Have only 6 contol banks in /sysfs until then.
781 */
770ACCESSOR(bank0ctl,bank[0],mce_restart()) 782ACCESSOR(bank0ctl,bank[0],mce_restart())
771ACCESSOR(bank1ctl,bank[1],mce_restart()) 783ACCESSOR(bank1ctl,bank[1],mce_restart())
772ACCESSOR(bank2ctl,bank[2],mce_restart()) 784ACCESSOR(bank2ctl,bank[2],mce_restart())
diff --git a/arch/x86/kernel/cpu/mcheck/p4.c b/arch/x86/kernel/cpu/mcheck/p4.c
index cb03345554a5..eef001ad3bde 100644
--- a/arch/x86/kernel/cpu/mcheck/p4.c
+++ b/arch/x86/kernel/cpu/mcheck/p4.c
@@ -8,7 +8,7 @@
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9#include <linux/smp.h> 9#include <linux/smp.h>
10 10
11#include <asm/processor.h> 11#include <asm/processor.h>
12#include <asm/system.h> 12#include <asm/system.h>
13#include <asm/msr.h> 13#include <asm/msr.h>
14#include <asm/apic.h> 14#include <asm/apic.h>
@@ -32,12 +32,12 @@ struct intel_mce_extended_msrs {
32 /* u32 *reserved[]; */ 32 /* u32 *reserved[]; */
33}; 33};
34 34
35static int mce_num_extended_msrs = 0; 35static int mce_num_extended_msrs;
36 36
37 37
38#ifdef CONFIG_X86_MCE_P4THERMAL 38#ifdef CONFIG_X86_MCE_P4THERMAL
39static void unexpected_thermal_interrupt(struct pt_regs *regs) 39static void unexpected_thermal_interrupt(struct pt_regs *regs)
40{ 40{
41 printk(KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n", 41 printk(KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n",
42 smp_processor_id()); 42 smp_processor_id());
43 add_taint(TAINT_MACHINE_CHECK); 43 add_taint(TAINT_MACHINE_CHECK);
@@ -83,7 +83,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c)
83 * be some SMM goo which handles it, so we can't even put a handler 83 * be some SMM goo which handles it, so we can't even put a handler
84 * since it might be delivered via SMI already -zwanem. 84 * since it might be delivered via SMI already -zwanem.
85 */ 85 */
86 rdmsr (MSR_IA32_MISC_ENABLE, l, h); 86 rdmsr(MSR_IA32_MISC_ENABLE, l, h);
87 h = apic_read(APIC_LVTTHMR); 87 h = apic_read(APIC_LVTTHMR);
88 if ((l & (1<<3)) && (h & APIC_DM_SMI)) { 88 if ((l & (1<<3)) && (h & APIC_DM_SMI)) {
89 printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n", 89 printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n",
@@ -91,7 +91,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c)
91 return; /* -EBUSY */ 91 return; /* -EBUSY */
92 } 92 }
93 93
94 /* check whether a vector already exists, temporarily masked? */ 94 /* check whether a vector already exists, temporarily masked? */
95 if (h & APIC_VECTOR_MASK) { 95 if (h & APIC_VECTOR_MASK) {
96 printk(KERN_DEBUG "CPU%d: Thermal LVT vector (%#x) already " 96 printk(KERN_DEBUG "CPU%d: Thermal LVT vector (%#x) already "
97 "installed\n", 97 "installed\n",
@@ -104,18 +104,18 @@ static void intel_init_thermal(struct cpuinfo_x86 *c)
104 h |= (APIC_DM_FIXED | APIC_LVT_MASKED); /* we'll mask till we're ready */ 104 h |= (APIC_DM_FIXED | APIC_LVT_MASKED); /* we'll mask till we're ready */
105 apic_write_around(APIC_LVTTHMR, h); 105 apic_write_around(APIC_LVTTHMR, h);
106 106
107 rdmsr (MSR_IA32_THERM_INTERRUPT, l, h); 107 rdmsr(MSR_IA32_THERM_INTERRUPT, l, h);
108 wrmsr (MSR_IA32_THERM_INTERRUPT, l | 0x03 , h); 108 wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03 , h);
109 109
110 /* ok we're good to go... */ 110 /* ok we're good to go... */
111 vendor_thermal_interrupt = intel_thermal_interrupt; 111 vendor_thermal_interrupt = intel_thermal_interrupt;
112
113 rdmsr (MSR_IA32_MISC_ENABLE, l, h);
114 wrmsr (MSR_IA32_MISC_ENABLE, l | (1<<3), h);
115 112
116 l = apic_read (APIC_LVTTHMR); 113 rdmsr(MSR_IA32_MISC_ENABLE, l, h);
117 apic_write_around (APIC_LVTTHMR, l & ~APIC_LVT_MASKED); 114 wrmsr(MSR_IA32_MISC_ENABLE, l | (1<<3), h);
118 printk (KERN_INFO "CPU%d: Thermal monitoring enabled\n", cpu); 115
116 l = apic_read(APIC_LVTTHMR);
117 apic_write_around(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
118 printk(KERN_INFO "CPU%d: Thermal monitoring enabled\n", cpu);
119 119
120 /* enable thermal throttle processing */ 120 /* enable thermal throttle processing */
121 atomic_set(&therm_throt_en, 1); 121 atomic_set(&therm_throt_en, 1);
@@ -129,28 +129,28 @@ static inline void intel_get_extended_msrs(struct intel_mce_extended_msrs *r)
129{ 129{
130 u32 h; 130 u32 h;
131 131
132 rdmsr (MSR_IA32_MCG_EAX, r->eax, h); 132 rdmsr(MSR_IA32_MCG_EAX, r->eax, h);
133 rdmsr (MSR_IA32_MCG_EBX, r->ebx, h); 133 rdmsr(MSR_IA32_MCG_EBX, r->ebx, h);
134 rdmsr (MSR_IA32_MCG_ECX, r->ecx, h); 134 rdmsr(MSR_IA32_MCG_ECX, r->ecx, h);
135 rdmsr (MSR_IA32_MCG_EDX, r->edx, h); 135 rdmsr(MSR_IA32_MCG_EDX, r->edx, h);
136 rdmsr (MSR_IA32_MCG_ESI, r->esi, h); 136 rdmsr(MSR_IA32_MCG_ESI, r->esi, h);
137 rdmsr (MSR_IA32_MCG_EDI, r->edi, h); 137 rdmsr(MSR_IA32_MCG_EDI, r->edi, h);
138 rdmsr (MSR_IA32_MCG_EBP, r->ebp, h); 138 rdmsr(MSR_IA32_MCG_EBP, r->ebp, h);
139 rdmsr (MSR_IA32_MCG_ESP, r->esp, h); 139 rdmsr(MSR_IA32_MCG_ESP, r->esp, h);
140 rdmsr (MSR_IA32_MCG_EFLAGS, r->eflags, h); 140 rdmsr(MSR_IA32_MCG_EFLAGS, r->eflags, h);
141 rdmsr (MSR_IA32_MCG_EIP, r->eip, h); 141 rdmsr(MSR_IA32_MCG_EIP, r->eip, h);
142} 142}
143 143
144static void intel_machine_check(struct pt_regs * regs, long error_code) 144static void intel_machine_check(struct pt_regs *regs, long error_code)
145{ 145{
146 int recover=1; 146 int recover = 1;
147 u32 alow, ahigh, high, low; 147 u32 alow, ahigh, high, low;
148 u32 mcgstl, mcgsth; 148 u32 mcgstl, mcgsth;
149 int i; 149 int i;
150 150
151 rdmsr (MSR_IA32_MCG_STATUS, mcgstl, mcgsth); 151 rdmsr(MSR_IA32_MCG_STATUS, mcgstl, mcgsth);
152 if (mcgstl & (1<<0)) /* Recoverable ? */ 152 if (mcgstl & (1<<0)) /* Recoverable ? */
153 recover=0; 153 recover = 0;
154 154
155 printk(KERN_EMERG "CPU %d: Machine Check Exception: %08x%08x\n", 155 printk(KERN_EMERG "CPU %d: Machine Check Exception: %08x%08x\n",
156 smp_processor_id(), mcgsth, mcgstl); 156 smp_processor_id(), mcgsth, mcgstl);
@@ -191,20 +191,20 @@ static void intel_machine_check(struct pt_regs * regs, long error_code)
191 } 191 }
192 192
193 if (recover & 2) 193 if (recover & 2)
194 panic ("CPU context corrupt"); 194 panic("CPU context corrupt");
195 if (recover & 1) 195 if (recover & 1)
196 panic ("Unable to continue"); 196 panic("Unable to continue");
197 197
198 printk(KERN_EMERG "Attempting to continue.\n"); 198 printk(KERN_EMERG "Attempting to continue.\n");
199 /* 199 /*
200 * Do not clear the MSR_IA32_MCi_STATUS if the error is not 200 * Do not clear the MSR_IA32_MCi_STATUS if the error is not
201 * recoverable/continuable.This will allow BIOS to look at the MSRs 201 * recoverable/continuable.This will allow BIOS to look at the MSRs
202 * for errors if the OS could not log the error. 202 * for errors if the OS could not log the error.
203 */ 203 */
204 for (i=0; i<nr_mce_banks; i++) { 204 for (i = 0; i < nr_mce_banks; i++) {
205 u32 msr; 205 u32 msr;
206 msr = MSR_IA32_MC0_STATUS+i*4; 206 msr = MSR_IA32_MC0_STATUS+i*4;
207 rdmsr (msr, low, high); 207 rdmsr(msr, low, high);
208 if (high&(1<<31)) { 208 if (high&(1<<31)) {
209 /* Clear it */ 209 /* Clear it */
210 wrmsr(msr, 0UL, 0UL); 210 wrmsr(msr, 0UL, 0UL);
@@ -214,7 +214,7 @@ static void intel_machine_check(struct pt_regs * regs, long error_code)
214 } 214 }
215 } 215 }
216 mcgstl &= ~(1<<2); 216 mcgstl &= ~(1<<2);
217 wrmsr (MSR_IA32_MCG_STATUS,mcgstl, mcgsth); 217 wrmsr(MSR_IA32_MCG_STATUS, mcgstl, mcgsth);
218} 218}
219 219
220 220
@@ -222,30 +222,30 @@ void intel_p4_mcheck_init(struct cpuinfo_x86 *c)
222{ 222{
223 u32 l, h; 223 u32 l, h;
224 int i; 224 int i;
225 225
226 machine_check_vector = intel_machine_check; 226 machine_check_vector = intel_machine_check;
227 wmb(); 227 wmb();
228 228
229 printk (KERN_INFO "Intel machine check architecture supported.\n"); 229 printk(KERN_INFO "Intel machine check architecture supported.\n");
230 rdmsr (MSR_IA32_MCG_CAP, l, h); 230 rdmsr(MSR_IA32_MCG_CAP, l, h);
231 if (l & (1<<8)) /* Control register present ? */ 231 if (l & (1<<8)) /* Control register present ? */
232 wrmsr (MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff); 232 wrmsr(MSR_IA32_MCG_CTL, 0xffffffff, 0xffffffff);
233 nr_mce_banks = l & 0xff; 233 nr_mce_banks = l & 0xff;
234 234
235 for (i=0; i<nr_mce_banks; i++) { 235 for (i = 0; i < nr_mce_banks; i++) {
236 wrmsr (MSR_IA32_MC0_CTL+4*i, 0xffffffff, 0xffffffff); 236 wrmsr(MSR_IA32_MC0_CTL+4*i, 0xffffffff, 0xffffffff);
237 wrmsr (MSR_IA32_MC0_STATUS+4*i, 0x0, 0x0); 237 wrmsr(MSR_IA32_MC0_STATUS+4*i, 0x0, 0x0);
238 } 238 }
239 239
240 set_in_cr4 (X86_CR4_MCE); 240 set_in_cr4(X86_CR4_MCE);
241 printk (KERN_INFO "Intel machine check reporting enabled on CPU#%d.\n", 241 printk(KERN_INFO "Intel machine check reporting enabled on CPU#%d.\n",
242 smp_processor_id()); 242 smp_processor_id());
243 243
244 /* Check for P4/Xeon extended MCE MSRs */ 244 /* Check for P4/Xeon extended MCE MSRs */
245 rdmsr (MSR_IA32_MCG_CAP, l, h); 245 rdmsr(MSR_IA32_MCG_CAP, l, h);
246 if (l & (1<<9)) {/* MCG_EXT_P */ 246 if (l & (1<<9)) {/* MCG_EXT_P */
247 mce_num_extended_msrs = (l >> 16) & 0xff; 247 mce_num_extended_msrs = (l >> 16) & 0xff;
248 printk (KERN_INFO "CPU%d: Intel P4/Xeon Extended MCE MSRs (%d)" 248 printk(KERN_INFO "CPU%d: Intel P4/Xeon Extended MCE MSRs (%d)"
249 " available\n", 249 " available\n",
250 smp_processor_id(), mce_num_extended_msrs); 250 smp_processor_id(), mce_num_extended_msrs);
251 251
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 5d241ce94a44..509bd3d9eacd 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -37,7 +37,7 @@ static struct fixed_range_block fixed_range_blocks[] = {
37static unsigned long smp_changes_mask; 37static unsigned long smp_changes_mask;
38static struct mtrr_state mtrr_state = {}; 38static struct mtrr_state mtrr_state = {};
39static int mtrr_state_set; 39static int mtrr_state_set;
40static u64 tom2; 40u64 mtrr_tom2;
41 41
42#undef MODULE_PARAM_PREFIX 42#undef MODULE_PARAM_PREFIX
43#define MODULE_PARAM_PREFIX "mtrr." 43#define MODULE_PARAM_PREFIX "mtrr."
@@ -139,8 +139,8 @@ u8 mtrr_type_lookup(u64 start, u64 end)
139 } 139 }
140 } 140 }
141 141
142 if (tom2) { 142 if (mtrr_tom2) {
143 if (start >= (1ULL<<32) && (end < tom2)) 143 if (start >= (1ULL<<32) && (end < mtrr_tom2))
144 return MTRR_TYPE_WRBACK; 144 return MTRR_TYPE_WRBACK;
145 } 145 }
146 146
@@ -158,6 +158,20 @@ get_mtrr_var_range(unsigned int index, struct mtrr_var_range *vr)
158 rdmsr(MTRRphysMask_MSR(index), vr->mask_lo, vr->mask_hi); 158 rdmsr(MTRRphysMask_MSR(index), vr->mask_lo, vr->mask_hi);
159} 159}
160 160
161/* fill the MSR pair relating to a var range */
162void fill_mtrr_var_range(unsigned int index,
163 u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi)
164{
165 struct mtrr_var_range *vr;
166
167 vr = mtrr_state.var_ranges;
168
169 vr[index].base_lo = base_lo;
170 vr[index].base_hi = base_hi;
171 vr[index].mask_lo = mask_lo;
172 vr[index].mask_hi = mask_hi;
173}
174
161static void 175static void
162get_fixed_ranges(mtrr_type * frs) 176get_fixed_ranges(mtrr_type * frs)
163{ 177{
@@ -213,13 +227,13 @@ void __init get_mtrr_state(void)
213 mtrr_state.enabled = (lo & 0xc00) >> 10; 227 mtrr_state.enabled = (lo & 0xc00) >> 10;
214 228
215 if (amd_special_default_mtrr()) { 229 if (amd_special_default_mtrr()) {
216 unsigned lo, hi; 230 unsigned low, high;
217 /* TOP_MEM2 */ 231 /* TOP_MEM2 */
218 rdmsr(MSR_K8_TOP_MEM2, lo, hi); 232 rdmsr(MSR_K8_TOP_MEM2, low, high);
219 tom2 = hi; 233 mtrr_tom2 = high;
220 tom2 <<= 32; 234 mtrr_tom2 <<= 32;
221 tom2 |= lo; 235 mtrr_tom2 |= low;
222 tom2 &= 0xffffff8000000ULL; 236 mtrr_tom2 &= 0xffffff800000ULL;
223 } 237 }
224 if (mtrr_show) { 238 if (mtrr_show) {
225 int high_width; 239 int high_width;
@@ -251,9 +265,9 @@ void __init get_mtrr_state(void)
251 else 265 else
252 printk(KERN_INFO "MTRR %u disabled\n", i); 266 printk(KERN_INFO "MTRR %u disabled\n", i);
253 } 267 }
254 if (tom2) { 268 if (mtrr_tom2) {
255 printk(KERN_INFO "TOM2: %016llx aka %lldM\n", 269 printk(KERN_INFO "TOM2: %016llx aka %lldM\n",
256 tom2, tom2>>20); 270 mtrr_tom2, mtrr_tom2>>20);
257 } 271 }
258 } 272 }
259 mtrr_state_set = 1; 273 mtrr_state_set = 1;
@@ -328,7 +342,7 @@ static void set_fixed_range(int msr, bool *changed, unsigned int *msrwords)
328 342
329 if (lo != msrwords[0] || hi != msrwords[1]) { 343 if (lo != msrwords[0] || hi != msrwords[1]) {
330 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD && 344 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
331 boot_cpu_data.x86 == 15 && 345 (boot_cpu_data.x86 >= 0x0f && boot_cpu_data.x86 <= 0x11) &&
332 ((msrwords[0] | msrwords[1]) & K8_MTRR_RDMEM_WRMEM_MASK)) 346 ((msrwords[0] | msrwords[1]) & K8_MTRR_RDMEM_WRMEM_MASK))
333 k8_enable_fixed_iorrs(); 347 k8_enable_fixed_iorrs();
334 mtrr_wrmsr(msr, msrwords[0], msrwords[1]); 348 mtrr_wrmsr(msr, msrwords[0], msrwords[1]);
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 6a1e278d9323..105afe12beb0 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -37,6 +37,7 @@
37#include <linux/smp.h> 37#include <linux/smp.h>
38#include <linux/cpu.h> 38#include <linux/cpu.h>
39#include <linux/mutex.h> 39#include <linux/mutex.h>
40#include <linux/sort.h>
40 41
41#include <asm/e820.h> 42#include <asm/e820.h>
42#include <asm/mtrr.h> 43#include <asm/mtrr.h>
@@ -609,6 +610,787 @@ static struct sysdev_driver mtrr_sysdev_driver = {
609 .resume = mtrr_restore, 610 .resume = mtrr_restore,
610}; 611};
611 612
613/* should be related to MTRR_VAR_RANGES nums */
614#define RANGE_NUM 256
615
616struct res_range {
617 unsigned long start;
618 unsigned long end;
619};
620
621static int __init
622add_range(struct res_range *range, int nr_range, unsigned long start,
623 unsigned long end)
624{
625 /* out of slots */
626 if (nr_range >= RANGE_NUM)
627 return nr_range;
628
629 range[nr_range].start = start;
630 range[nr_range].end = end;
631
632 nr_range++;
633
634 return nr_range;
635}
636
637static int __init
638add_range_with_merge(struct res_range *range, int nr_range, unsigned long start,
639 unsigned long end)
640{
641 int i;
642
643 /* try to merge it with old one */
644 for (i = 0; i < nr_range; i++) {
645 unsigned long final_start, final_end;
646 unsigned long common_start, common_end;
647
648 if (!range[i].end)
649 continue;
650
651 common_start = max(range[i].start, start);
652 common_end = min(range[i].end, end);
653 if (common_start > common_end + 1)
654 continue;
655
656 final_start = min(range[i].start, start);
657 final_end = max(range[i].end, end);
658
659 range[i].start = final_start;
660 range[i].end = final_end;
661 return nr_range;
662 }
663
664 /* need to add that */
665 return add_range(range, nr_range, start, end);
666}
667
668static void __init
669subtract_range(struct res_range *range, unsigned long start, unsigned long end)
670{
671 int i, j;
672
673 for (j = 0; j < RANGE_NUM; j++) {
674 if (!range[j].end)
675 continue;
676
677 if (start <= range[j].start && end >= range[j].end) {
678 range[j].start = 0;
679 range[j].end = 0;
680 continue;
681 }
682
683 if (start <= range[j].start && end < range[j].end &&
684 range[j].start < end + 1) {
685 range[j].start = end + 1;
686 continue;
687 }
688
689
690 if (start > range[j].start && end >= range[j].end &&
691 range[j].end > start - 1) {
692 range[j].end = start - 1;
693 continue;
694 }
695
696 if (start > range[j].start && end < range[j].end) {
697 /* find the new spare */
698 for (i = 0; i < RANGE_NUM; i++) {
699 if (range[i].end == 0)
700 break;
701 }
702 if (i < RANGE_NUM) {
703 range[i].end = range[j].end;
704 range[i].start = end + 1;
705 } else {
706 printk(KERN_ERR "run of slot in ranges\n");
707 }
708 range[j].end = start - 1;
709 continue;
710 }
711 }
712}
713
714static int __init cmp_range(const void *x1, const void *x2)
715{
716 const struct res_range *r1 = x1;
717 const struct res_range *r2 = x2;
718 long start1, start2;
719
720 start1 = r1->start;
721 start2 = r2->start;
722
723 return start1 - start2;
724}
725
726struct var_mtrr_range_state {
727 unsigned long base_pfn;
728 unsigned long size_pfn;
729 mtrr_type type;
730};
731
732struct var_mtrr_range_state __initdata range_state[RANGE_NUM];
733static int __initdata debug_print;
734
735static int __init
736x86_get_mtrr_mem_range(struct res_range *range, int nr_range,
737 unsigned long extra_remove_base,
738 unsigned long extra_remove_size)
739{
740 unsigned long i, base, size;
741 mtrr_type type;
742
743 for (i = 0; i < num_var_ranges; i++) {
744 type = range_state[i].type;
745 if (type != MTRR_TYPE_WRBACK)
746 continue;
747 base = range_state[i].base_pfn;
748 size = range_state[i].size_pfn;
749 nr_range = add_range_with_merge(range, nr_range, base,
750 base + size - 1);
751 }
752 if (debug_print) {
753 printk(KERN_DEBUG "After WB checking\n");
754 for (i = 0; i < nr_range; i++)
755 printk(KERN_DEBUG "MTRR MAP PFN: %016lx - %016lx\n",
756 range[i].start, range[i].end + 1);
757 }
758
759 /* take out UC ranges */
760 for (i = 0; i < num_var_ranges; i++) {
761 type = range_state[i].type;
762 if (type != MTRR_TYPE_UNCACHABLE)
763 continue;
764 size = range_state[i].size_pfn;
765 if (!size)
766 continue;
767 base = range_state[i].base_pfn;
768 subtract_range(range, base, base + size - 1);
769 }
770 if (extra_remove_size)
771 subtract_range(range, extra_remove_base,
772 extra_remove_base + extra_remove_size - 1);
773
774 /* get new range num */
775 nr_range = 0;
776 for (i = 0; i < RANGE_NUM; i++) {
777 if (!range[i].end)
778 continue;
779 nr_range++;
780 }
781 if (debug_print) {
782 printk(KERN_DEBUG "After UC checking\n");
783 for (i = 0; i < nr_range; i++)
784 printk(KERN_DEBUG "MTRR MAP PFN: %016lx - %016lx\n",
785 range[i].start, range[i].end + 1);
786 }
787
788 /* sort the ranges */
789 sort(range, nr_range, sizeof(struct res_range), cmp_range, NULL);
790 if (debug_print) {
791 printk(KERN_DEBUG "After sorting\n");
792 for (i = 0; i < nr_range; i++)
793 printk(KERN_DEBUG "MTRR MAP PFN: %016lx - %016lx\n",
794 range[i].start, range[i].end + 1);
795 }
796
797 /* clear those is not used */
798 for (i = nr_range; i < RANGE_NUM; i++)
799 memset(&range[i], 0, sizeof(range[i]));
800
801 return nr_range;
802}
803
804static struct res_range __initdata range[RANGE_NUM];
805
806#ifdef CONFIG_MTRR_SANITIZER
807
808static unsigned long __init sum_ranges(struct res_range *range, int nr_range)
809{
810 unsigned long sum;
811 int i;
812
813 sum = 0;
814 for (i = 0; i < nr_range; i++)
815 sum += range[i].end + 1 - range[i].start;
816
817 return sum;
818}
819
820static int enable_mtrr_cleanup __initdata =
821 CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT;
822
823static int __init disable_mtrr_cleanup_setup(char *str)
824{
825 if (enable_mtrr_cleanup != -1)
826 enable_mtrr_cleanup = 0;
827 return 0;
828}
829early_param("disable_mtrr_cleanup", disable_mtrr_cleanup_setup);
830
831static int __init enable_mtrr_cleanup_setup(char *str)
832{
833 if (enable_mtrr_cleanup != -1)
834 enable_mtrr_cleanup = 1;
835 return 0;
836}
837early_param("enble_mtrr_cleanup", enable_mtrr_cleanup_setup);
838
839struct var_mtrr_state {
840 unsigned long range_startk;
841 unsigned long range_sizek;
842 unsigned long chunk_sizek;
843 unsigned long gran_sizek;
844 unsigned int reg;
845};
846
847static void __init
848set_var_mtrr(unsigned int reg, unsigned long basek, unsigned long sizek,
849 unsigned char type, unsigned int address_bits)
850{
851 u32 base_lo, base_hi, mask_lo, mask_hi;
852 u64 base, mask;
853
854 if (!sizek) {
855 fill_mtrr_var_range(reg, 0, 0, 0, 0);
856 return;
857 }
858
859 mask = (1ULL << address_bits) - 1;
860 mask &= ~((((u64)sizek) << 10) - 1);
861
862 base = ((u64)basek) << 10;
863
864 base |= type;
865 mask |= 0x800;
866
867 base_lo = base & ((1ULL<<32) - 1);
868 base_hi = base >> 32;
869
870 mask_lo = mask & ((1ULL<<32) - 1);
871 mask_hi = mask >> 32;
872
873 fill_mtrr_var_range(reg, base_lo, base_hi, mask_lo, mask_hi);
874}
875
876static void __init
877save_var_mtrr(unsigned int reg, unsigned long basek, unsigned long sizek,
878 unsigned char type)
879{
880 range_state[reg].base_pfn = basek >> (PAGE_SHIFT - 10);
881 range_state[reg].size_pfn = sizek >> (PAGE_SHIFT - 10);
882 range_state[reg].type = type;
883}
884
885static void __init
886set_var_mtrr_all(unsigned int address_bits)
887{
888 unsigned long basek, sizek;
889 unsigned char type;
890 unsigned int reg;
891
892 for (reg = 0; reg < num_var_ranges; reg++) {
893 basek = range_state[reg].base_pfn << (PAGE_SHIFT - 10);
894 sizek = range_state[reg].size_pfn << (PAGE_SHIFT - 10);
895 type = range_state[reg].type;
896
897 set_var_mtrr(reg, basek, sizek, type, address_bits);
898 }
899}
900
901static unsigned int __init
902range_to_mtrr(unsigned int reg, unsigned long range_startk,
903 unsigned long range_sizek, unsigned char type)
904{
905 if (!range_sizek || (reg >= num_var_ranges))
906 return reg;
907
908 while (range_sizek) {
909 unsigned long max_align, align;
910 unsigned long sizek;
911
912 /* Compute the maximum size I can make a range */
913 if (range_startk)
914 max_align = ffs(range_startk) - 1;
915 else
916 max_align = 32;
917 align = fls(range_sizek) - 1;
918 if (align > max_align)
919 align = max_align;
920
921 sizek = 1 << align;
922 if (debug_print)
923 printk(KERN_DEBUG "Setting variable MTRR %d, "
924 "base: %ldMB, range: %ldMB, type %s\n",
925 reg, range_startk >> 10, sizek >> 10,
926 (type == MTRR_TYPE_UNCACHABLE)?"UC":
927 ((type == MTRR_TYPE_WRBACK)?"WB":"Other")
928 );
929 save_var_mtrr(reg++, range_startk, sizek, type);
930 range_startk += sizek;
931 range_sizek -= sizek;
932 if (reg >= num_var_ranges)
933 break;
934 }
935 return reg;
936}
937
938static unsigned __init
939range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek,
940 unsigned long sizek)
941{
942 unsigned long hole_basek, hole_sizek;
943 unsigned long second_basek, second_sizek;
944 unsigned long range0_basek, range0_sizek;
945 unsigned long range_basek, range_sizek;
946 unsigned long chunk_sizek;
947 unsigned long gran_sizek;
948
949 hole_basek = 0;
950 hole_sizek = 0;
951 second_basek = 0;
952 second_sizek = 0;
953 chunk_sizek = state->chunk_sizek;
954 gran_sizek = state->gran_sizek;
955
956 /* align with gran size, prevent small block used up MTRRs */
957 range_basek = ALIGN(state->range_startk, gran_sizek);
958 if ((range_basek > basek) && basek)
959 return second_sizek;
960 state->range_sizek -= (range_basek - state->range_startk);
961 range_sizek = ALIGN(state->range_sizek, gran_sizek);
962
963 while (range_sizek > state->range_sizek) {
964 range_sizek -= gran_sizek;
965 if (!range_sizek)
966 return 0;
967 }
968 state->range_sizek = range_sizek;
969
970 /* try to append some small hole */
971 range0_basek = state->range_startk;
972 range0_sizek = ALIGN(state->range_sizek, chunk_sizek);
973 if (range0_sizek == state->range_sizek) {
974 if (debug_print)
975 printk(KERN_DEBUG "rangeX: %016lx - %016lx\n",
976 range0_basek<<10,
977 (range0_basek + state->range_sizek)<<10);
978 state->reg = range_to_mtrr(state->reg, range0_basek,
979 state->range_sizek, MTRR_TYPE_WRBACK);
980 return 0;
981 }
982
983 range0_sizek -= chunk_sizek;
984 if (range0_sizek && sizek) {
985 while (range0_basek + range0_sizek > (basek + sizek)) {
986 range0_sizek -= chunk_sizek;
987 if (!range0_sizek)
988 break;
989 }
990 }
991
992 if (range0_sizek) {
993 if (debug_print)
994 printk(KERN_DEBUG "range0: %016lx - %016lx\n",
995 range0_basek<<10,
996 (range0_basek + range0_sizek)<<10);
997 state->reg = range_to_mtrr(state->reg, range0_basek,
998 range0_sizek, MTRR_TYPE_WRBACK);
999
1000 }
1001
1002 range_basek = range0_basek + range0_sizek;
1003 range_sizek = chunk_sizek;
1004
1005 if (range_basek + range_sizek > basek &&
1006 range_basek + range_sizek <= (basek + sizek)) {
1007 /* one hole */
1008 second_basek = basek;
1009 second_sizek = range_basek + range_sizek - basek;
1010 }
1011
1012 /* if last piece, only could one hole near end */
1013 if ((second_basek || !basek) &&
1014 range_sizek - (state->range_sizek - range0_sizek) - second_sizek <
1015 (chunk_sizek >> 1)) {
1016 /*
1017 * one hole in middle (second_sizek is 0) or at end
1018 * (second_sizek is 0 )
1019 */
1020 hole_sizek = range_sizek - (state->range_sizek - range0_sizek)
1021 - second_sizek;
1022 hole_basek = range_basek + range_sizek - hole_sizek
1023 - second_sizek;
1024 } else {
1025 /* fallback for big hole, or several holes */
1026 range_sizek = state->range_sizek - range0_sizek;
1027 second_basek = 0;
1028 second_sizek = 0;
1029 }
1030
1031 if (debug_print)
1032 printk(KERN_DEBUG "range: %016lx - %016lx\n", range_basek<<10,
1033 (range_basek + range_sizek)<<10);
1034 state->reg = range_to_mtrr(state->reg, range_basek, range_sizek,
1035 MTRR_TYPE_WRBACK);
1036 if (hole_sizek) {
1037 if (debug_print)
1038 printk(KERN_DEBUG "hole: %016lx - %016lx\n",
1039 hole_basek<<10, (hole_basek + hole_sizek)<<10);
1040 state->reg = range_to_mtrr(state->reg, hole_basek, hole_sizek,
1041 MTRR_TYPE_UNCACHABLE);
1042
1043 }
1044
1045 return second_sizek;
1046}
1047
1048static void __init
1049set_var_mtrr_range(struct var_mtrr_state *state, unsigned long base_pfn,
1050 unsigned long size_pfn)
1051{
1052 unsigned long basek, sizek;
1053 unsigned long second_sizek = 0;
1054
1055 if (state->reg >= num_var_ranges)
1056 return;
1057
1058 basek = base_pfn << (PAGE_SHIFT - 10);
1059 sizek = size_pfn << (PAGE_SHIFT - 10);
1060
1061 /* See if I can merge with the last range */
1062 if ((basek <= 1024) ||
1063 (state->range_startk + state->range_sizek == basek)) {
1064 unsigned long endk = basek + sizek;
1065 state->range_sizek = endk - state->range_startk;
1066 return;
1067 }
1068 /* Write the range mtrrs */
1069 if (state->range_sizek != 0)
1070 second_sizek = range_to_mtrr_with_hole(state, basek, sizek);
1071
1072 /* Allocate an msr */
1073 state->range_startk = basek + second_sizek;
1074 state->range_sizek = sizek - second_sizek;
1075}
1076
1077/* mininum size of mtrr block that can take hole */
1078static u64 mtrr_chunk_size __initdata = (256ULL<<20);
1079
1080static int __init parse_mtrr_chunk_size_opt(char *p)
1081{
1082 if (!p)
1083 return -EINVAL;
1084 mtrr_chunk_size = memparse(p, &p);
1085 return 0;
1086}
1087early_param("mtrr_chunk_size", parse_mtrr_chunk_size_opt);
1088
1089/* granity of mtrr of block */
1090static u64 mtrr_gran_size __initdata;
1091
1092static int __init parse_mtrr_gran_size_opt(char *p)
1093{
1094 if (!p)
1095 return -EINVAL;
1096 mtrr_gran_size = memparse(p, &p);
1097 return 0;
1098}
1099early_param("mtrr_gran_size", parse_mtrr_gran_size_opt);
1100
1101static int nr_mtrr_spare_reg __initdata =
1102 CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT;
1103
1104static int __init parse_mtrr_spare_reg(char *arg)
1105{
1106 if (arg)
1107 nr_mtrr_spare_reg = simple_strtoul(arg, NULL, 0);
1108 return 0;
1109}
1110
1111early_param("mtrr_spare_reg_nr", parse_mtrr_spare_reg);
1112
1113static int __init
1114x86_setup_var_mtrrs(struct res_range *range, int nr_range,
1115 u64 chunk_size, u64 gran_size)
1116{
1117 struct var_mtrr_state var_state;
1118 int i;
1119 int num_reg;
1120
1121 var_state.range_startk = 0;
1122 var_state.range_sizek = 0;
1123 var_state.reg = 0;
1124 var_state.chunk_sizek = chunk_size >> 10;
1125 var_state.gran_sizek = gran_size >> 10;
1126
1127 memset(range_state, 0, sizeof(range_state));
1128
1129 /* Write the range etc */
1130 for (i = 0; i < nr_range; i++)
1131 set_var_mtrr_range(&var_state, range[i].start,
1132 range[i].end - range[i].start + 1);
1133
1134 /* Write the last range */
1135 if (var_state.range_sizek != 0)
1136 range_to_mtrr_with_hole(&var_state, 0, 0);
1137
1138 num_reg = var_state.reg;
1139 /* Clear out the extra MTRR's */
1140 while (var_state.reg < num_var_ranges) {
1141 save_var_mtrr(var_state.reg, 0, 0, 0);
1142 var_state.reg++;
1143 }
1144
1145 return num_reg;
1146}
1147
1148struct mtrr_cleanup_result {
1149 unsigned long gran_sizek;
1150 unsigned long chunk_sizek;
1151 unsigned long lose_cover_sizek;
1152 unsigned int num_reg;
1153 int bad;
1154};
1155
1156/*
1157 * gran_size: 1M, 2M, ..., 2G
1158 * chunk size: gran_size, ..., 4G
1159 * so we need (2+13)*6
1160 */
1161#define NUM_RESULT 90
1162#define PSHIFT (PAGE_SHIFT - 10)
1163
1164static struct mtrr_cleanup_result __initdata result[NUM_RESULT];
1165static struct res_range __initdata range_new[RANGE_NUM];
1166static unsigned long __initdata min_loss_pfn[RANGE_NUM];
1167
1168static int __init mtrr_cleanup(unsigned address_bits)
1169{
1170 unsigned long extra_remove_base, extra_remove_size;
1171 unsigned long i, base, size, def, dummy;
1172 mtrr_type type;
1173 int nr_range, nr_range_new;
1174 u64 chunk_size, gran_size;
1175 unsigned long range_sums, range_sums_new;
1176 int index_good;
1177 int num_reg_good;
1178
1179 /* extra one for all 0 */
1180 int num[MTRR_NUM_TYPES + 1];
1181
1182 if (!is_cpu(INTEL) || enable_mtrr_cleanup < 1)
1183 return 0;
1184 rdmsr(MTRRdefType_MSR, def, dummy);
1185 def &= 0xff;
1186 if (def != MTRR_TYPE_UNCACHABLE)
1187 return 0;
1188
1189 /* get it and store it aside */
1190 memset(range_state, 0, sizeof(range_state));
1191 for (i = 0; i < num_var_ranges; i++) {
1192 mtrr_if->get(i, &base, &size, &type);
1193 range_state[i].base_pfn = base;
1194 range_state[i].size_pfn = size;
1195 range_state[i].type = type;
1196 }
1197
1198 /* check entries number */
1199 memset(num, 0, sizeof(num));
1200 for (i = 0; i < num_var_ranges; i++) {
1201 type = range_state[i].type;
1202 size = range_state[i].size_pfn;
1203 if (type >= MTRR_NUM_TYPES)
1204 continue;
1205 if (!size)
1206 type = MTRR_NUM_TYPES;
1207 num[type]++;
1208 }
1209
1210 /* check if we got UC entries */
1211 if (!num[MTRR_TYPE_UNCACHABLE])
1212 return 0;
1213
1214 /* check if we only had WB and UC */
1215 if (num[MTRR_TYPE_WRBACK] + num[MTRR_TYPE_UNCACHABLE] !=
1216 num_var_ranges - num[MTRR_NUM_TYPES])
1217 return 0;
1218
1219 memset(range, 0, sizeof(range));
1220 extra_remove_size = 0;
1221 if (mtrr_tom2) {
1222 extra_remove_base = 1 << (32 - PAGE_SHIFT);
1223 extra_remove_size =
1224 (mtrr_tom2 >> PAGE_SHIFT) - extra_remove_base;
1225 }
1226 nr_range = x86_get_mtrr_mem_range(range, 0, extra_remove_base,
1227 extra_remove_size);
1228 range_sums = sum_ranges(range, nr_range);
1229 printk(KERN_INFO "total RAM coverred: %ldM\n",
1230 range_sums >> (20 - PAGE_SHIFT));
1231
1232 if (mtrr_chunk_size && mtrr_gran_size) {
1233 int num_reg;
1234
1235 debug_print = 1;
1236 /* convert ranges to var ranges state */
1237 num_reg = x86_setup_var_mtrrs(range, nr_range, mtrr_chunk_size,
1238 mtrr_gran_size);
1239
1240 /* we got new setting in range_state, check it */
1241 memset(range_new, 0, sizeof(range_new));
1242 nr_range_new = x86_get_mtrr_mem_range(range_new, 0,
1243 extra_remove_base,
1244 extra_remove_size);
1245 range_sums_new = sum_ranges(range_new, nr_range_new);
1246
1247 i = 0;
1248 result[i].chunk_sizek = mtrr_chunk_size >> 10;
1249 result[i].gran_sizek = mtrr_gran_size >> 10;
1250 result[i].num_reg = num_reg;
1251 if (range_sums < range_sums_new) {
1252 result[i].lose_cover_sizek =
1253 (range_sums_new - range_sums) << PSHIFT;
1254 result[i].bad = 1;
1255 } else
1256 result[i].lose_cover_sizek =
1257 (range_sums - range_sums_new) << PSHIFT;
1258
1259 printk(KERN_INFO "%sgran_size: %ldM \tchunk_size: %ldM \t",
1260 result[i].bad?"*BAD*":" ", result[i].gran_sizek >> 10,
1261 result[i].chunk_sizek >> 10);
1262 printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ldM \n",
1263 result[i].num_reg, result[i].bad?"-":"",
1264 result[i].lose_cover_sizek >> 10);
1265 if (!result[i].bad) {
1266 set_var_mtrr_all(address_bits);
1267 return 1;
1268 }
1269 printk(KERN_INFO "invalid mtrr_gran_size or mtrr_chunk_size, "
1270 "will find optimal one\n");
1271 debug_print = 0;
1272 memset(result, 0, sizeof(result[0]));
1273 }
1274
1275 i = 0;
1276 memset(min_loss_pfn, 0xff, sizeof(min_loss_pfn));
1277 memset(result, 0, sizeof(result));
1278 for (gran_size = (1ULL<<20); gran_size < (1ULL<<32); gran_size <<= 1) {
1279 for (chunk_size = gran_size; chunk_size < (1ULL<<33);
1280 chunk_size <<= 1) {
1281 int num_reg;
1282
1283 if (debug_print)
1284 printk(KERN_INFO
1285 "\ngran_size: %lldM chunk_size_size: %lldM\n",
1286 gran_size >> 20, chunk_size >> 20);
1287 if (i >= NUM_RESULT)
1288 continue;
1289
1290 /* convert ranges to var ranges state */
1291 num_reg = x86_setup_var_mtrrs(range, nr_range,
1292 chunk_size, gran_size);
1293
1294 /* we got new setting in range_state, check it */
1295 memset(range_new, 0, sizeof(range_new));
1296 nr_range_new = x86_get_mtrr_mem_range(range_new, 0,
1297 extra_remove_base, extra_remove_size);
1298 range_sums_new = sum_ranges(range_new, nr_range_new);
1299
1300 result[i].chunk_sizek = chunk_size >> 10;
1301 result[i].gran_sizek = gran_size >> 10;
1302 result[i].num_reg = num_reg;
1303 if (range_sums < range_sums_new) {
1304 result[i].lose_cover_sizek =
1305 (range_sums_new - range_sums) << PSHIFT;
1306 result[i].bad = 1;
1307 } else
1308 result[i].lose_cover_sizek =
1309 (range_sums - range_sums_new) << PSHIFT;
1310
1311 /* double check it */
1312 if (!result[i].bad && !result[i].lose_cover_sizek) {
1313 if (nr_range_new != nr_range ||
1314 memcmp(range, range_new, sizeof(range)))
1315 result[i].bad = 1;
1316 }
1317
1318 if (!result[i].bad && (range_sums - range_sums_new <
1319 min_loss_pfn[num_reg])) {
1320 min_loss_pfn[num_reg] =
1321 range_sums - range_sums_new;
1322 }
1323 i++;
1324 }
1325 }
1326
1327 /* print out all */
1328 for (i = 0; i < NUM_RESULT; i++) {
1329 printk(KERN_INFO "%sgran_size: %ldM \tchunk_size: %ldM \t",
1330 result[i].bad?"*BAD* ":" ", result[i].gran_sizek >> 10,
1331 result[i].chunk_sizek >> 10);
1332 printk(KERN_CONT "num_reg: %d \tlose RAM: %s%ldM\n",
1333 result[i].num_reg, result[i].bad?"-":"",
1334 result[i].lose_cover_sizek >> 10);
1335 }
1336
1337 /* try to find the optimal index */
1338 if (nr_mtrr_spare_reg >= num_var_ranges)
1339 nr_mtrr_spare_reg = num_var_ranges - 1;
1340 num_reg_good = -1;
1341 for (i = num_var_ranges - nr_mtrr_spare_reg; i > 0; i--) {
1342 if (!min_loss_pfn[i]) {
1343 num_reg_good = i;
1344 break;
1345 }
1346 }
1347
1348 index_good = -1;
1349 if (num_reg_good != -1) {
1350 for (i = 0; i < NUM_RESULT; i++) {
1351 if (!result[i].bad &&
1352 result[i].num_reg == num_reg_good &&
1353 !result[i].lose_cover_sizek) {
1354 index_good = i;
1355 break;
1356 }
1357 }
1358 }
1359
1360 if (index_good != -1) {
1361 printk(KERN_INFO "Found optimal setting for mtrr clean up\n");
1362 i = index_good;
1363 printk(KERN_INFO "gran_size: %ldM \tchunk_size: %ldM \t",
1364 result[i].gran_sizek >> 10,
1365 result[i].chunk_sizek >> 10);
1366 printk(KERN_CONT "num_reg: %d \tlose RAM: %ldM\n",
1367 result[i].num_reg,
1368 result[i].lose_cover_sizek >> 10);
1369 /* convert ranges to var ranges state */
1370 chunk_size = result[i].chunk_sizek;
1371 chunk_size <<= 10;
1372 gran_size = result[i].gran_sizek;
1373 gran_size <<= 10;
1374 debug_print = 1;
1375 x86_setup_var_mtrrs(range, nr_range, chunk_size, gran_size);
1376 set_var_mtrr_all(address_bits);
1377 return 1;
1378 }
1379
1380 printk(KERN_INFO "mtrr_cleanup: can not find optimal value\n");
1381 printk(KERN_INFO "please specify mtrr_gran_size/mtrr_chunk_size\n");
1382
1383 return 0;
1384}
1385#else
1386static int __init mtrr_cleanup(unsigned address_bits)
1387{
1388 return 0;
1389}
1390#endif
1391
1392static int __initdata changed_by_mtrr_cleanup;
1393
612static int disable_mtrr_trim; 1394static int disable_mtrr_trim;
613 1395
614static int __init disable_mtrr_trim_setup(char *str) 1396static int __init disable_mtrr_trim_setup(char *str)
@@ -648,6 +1430,19 @@ int __init amd_special_default_mtrr(void)
648 return 0; 1430 return 0;
649} 1431}
650 1432
1433static u64 __init real_trim_memory(unsigned long start_pfn,
1434 unsigned long limit_pfn)
1435{
1436 u64 trim_start, trim_size;
1437 trim_start = start_pfn;
1438 trim_start <<= PAGE_SHIFT;
1439 trim_size = limit_pfn;
1440 trim_size <<= PAGE_SHIFT;
1441 trim_size -= trim_start;
1442
1443 return e820_update_range(trim_start, trim_size, E820_RAM,
1444 E820_RESERVED);
1445}
651/** 1446/**
652 * mtrr_trim_uncached_memory - trim RAM not covered by MTRRs 1447 * mtrr_trim_uncached_memory - trim RAM not covered by MTRRs
653 * @end_pfn: ending page frame number 1448 * @end_pfn: ending page frame number
@@ -663,8 +1458,11 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
663{ 1458{
664 unsigned long i, base, size, highest_pfn = 0, def, dummy; 1459 unsigned long i, base, size, highest_pfn = 0, def, dummy;
665 mtrr_type type; 1460 mtrr_type type;
666 u64 trim_start, trim_size; 1461 int nr_range;
1462 u64 total_trim_size;
667 1463
1464 /* extra one for all 0 */
1465 int num[MTRR_NUM_TYPES + 1];
668 /* 1466 /*
669 * Make sure we only trim uncachable memory on machines that 1467 * Make sure we only trim uncachable memory on machines that
670 * support the Intel MTRR architecture: 1468 * support the Intel MTRR architecture:
@@ -676,14 +1474,22 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
676 if (def != MTRR_TYPE_UNCACHABLE) 1474 if (def != MTRR_TYPE_UNCACHABLE)
677 return 0; 1475 return 0;
678 1476
679 if (amd_special_default_mtrr()) 1477 /* get it and store it aside */
680 return 0; 1478 memset(range_state, 0, sizeof(range_state));
1479 for (i = 0; i < num_var_ranges; i++) {
1480 mtrr_if->get(i, &base, &size, &type);
1481 range_state[i].base_pfn = base;
1482 range_state[i].size_pfn = size;
1483 range_state[i].type = type;
1484 }
681 1485
682 /* Find highest cached pfn */ 1486 /* Find highest cached pfn */
683 for (i = 0; i < num_var_ranges; i++) { 1487 for (i = 0; i < num_var_ranges; i++) {
684 mtrr_if->get(i, &base, &size, &type); 1488 type = range_state[i].type;
685 if (type != MTRR_TYPE_WRBACK) 1489 if (type != MTRR_TYPE_WRBACK)
686 continue; 1490 continue;
1491 base = range_state[i].base_pfn;
1492 size = range_state[i].size_pfn;
687 if (highest_pfn < base + size) 1493 if (highest_pfn < base + size)
688 highest_pfn = base + size; 1494 highest_pfn = base + size;
689 } 1495 }
@@ -698,22 +1504,65 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
698 return 0; 1504 return 0;
699 } 1505 }
700 1506
701 if (highest_pfn < end_pfn) { 1507 /* check entries number */
1508 memset(num, 0, sizeof(num));
1509 for (i = 0; i < num_var_ranges; i++) {
1510 type = range_state[i].type;
1511 if (type >= MTRR_NUM_TYPES)
1512 continue;
1513 size = range_state[i].size_pfn;
1514 if (!size)
1515 type = MTRR_NUM_TYPES;
1516 num[type]++;
1517 }
1518
1519 /* no entry for WB? */
1520 if (!num[MTRR_TYPE_WRBACK])
1521 return 0;
1522
1523 /* check if we only had WB and UC */
1524 if (num[MTRR_TYPE_WRBACK] + num[MTRR_TYPE_UNCACHABLE] !=
1525 num_var_ranges - num[MTRR_NUM_TYPES])
1526 return 0;
1527
1528 memset(range, 0, sizeof(range));
1529 nr_range = 0;
1530 if (mtrr_tom2) {
1531 range[nr_range].start = (1ULL<<(32 - PAGE_SHIFT));
1532 range[nr_range].end = (mtrr_tom2 >> PAGE_SHIFT) - 1;
1533 if (highest_pfn < range[nr_range].end + 1)
1534 highest_pfn = range[nr_range].end + 1;
1535 nr_range++;
1536 }
1537 nr_range = x86_get_mtrr_mem_range(range, nr_range, 0, 0);
1538
1539 total_trim_size = 0;
1540 /* check the head */
1541 if (range[0].start)
1542 total_trim_size += real_trim_memory(0, range[0].start);
1543 /* check the holes */
1544 for (i = 0; i < nr_range - 1; i++) {
1545 if (range[i].end + 1 < range[i+1].start)
1546 total_trim_size += real_trim_memory(range[i].end + 1,
1547 range[i+1].start);
1548 }
1549 /* check the top */
1550 i = nr_range - 1;
1551 if (range[i].end + 1 < end_pfn)
1552 total_trim_size += real_trim_memory(range[i].end + 1,
1553 end_pfn);
1554
1555 if (total_trim_size) {
702 printk(KERN_WARNING "WARNING: BIOS bug: CPU MTRRs don't cover" 1556 printk(KERN_WARNING "WARNING: BIOS bug: CPU MTRRs don't cover"
703 " all of memory, losing %luMB of RAM.\n", 1557 " all of memory, losing %lluMB of RAM.\n",
704 (end_pfn - highest_pfn) >> (20 - PAGE_SHIFT)); 1558 total_trim_size >> 20);
705 1559
706 WARN_ON(1); 1560 if (!changed_by_mtrr_cleanup)
1561 WARN_ON(1);
707 1562
708 printk(KERN_INFO "update e820 for mtrr\n"); 1563 printk(KERN_INFO "update e820 for mtrr\n");
709 trim_start = highest_pfn;
710 trim_start <<= PAGE_SHIFT;
711 trim_size = end_pfn;
712 trim_size <<= PAGE_SHIFT;
713 trim_size -= trim_start;
714 update_memory_range(trim_start, trim_size, E820_RAM,
715 E820_RESERVED);
716 update_e820(); 1564 update_e820();
1565
717 return 1; 1566 return 1;
718 } 1567 }
719 1568
@@ -729,18 +1578,21 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
729 */ 1578 */
730void __init mtrr_bp_init(void) 1579void __init mtrr_bp_init(void)
731{ 1580{
1581 u32 phys_addr;
732 init_ifs(); 1582 init_ifs();
733 1583
1584 phys_addr = 32;
1585
734 if (cpu_has_mtrr) { 1586 if (cpu_has_mtrr) {
735 mtrr_if = &generic_mtrr_ops; 1587 mtrr_if = &generic_mtrr_ops;
736 size_or_mask = 0xff000000; /* 36 bits */ 1588 size_or_mask = 0xff000000; /* 36 bits */
737 size_and_mask = 0x00f00000; 1589 size_and_mask = 0x00f00000;
1590 phys_addr = 36;
738 1591
739 /* This is an AMD specific MSR, but we assume(hope?) that 1592 /* This is an AMD specific MSR, but we assume(hope?) that
740 Intel will implement it to when they extend the address 1593 Intel will implement it to when they extend the address
741 bus of the Xeon. */ 1594 bus of the Xeon. */
742 if (cpuid_eax(0x80000000) >= 0x80000008) { 1595 if (cpuid_eax(0x80000000) >= 0x80000008) {
743 u32 phys_addr;
744 phys_addr = cpuid_eax(0x80000008) & 0xff; 1596 phys_addr = cpuid_eax(0x80000008) & 0xff;
745 /* CPUID workaround for Intel 0F33/0F34 CPU */ 1597 /* CPUID workaround for Intel 0F33/0F34 CPU */
746 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && 1598 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
@@ -758,6 +1610,7 @@ void __init mtrr_bp_init(void)
758 don't support PAE */ 1610 don't support PAE */
759 size_or_mask = 0xfff00000; /* 32 bits */ 1611 size_or_mask = 0xfff00000; /* 32 bits */
760 size_and_mask = 0; 1612 size_and_mask = 0;
1613 phys_addr = 32;
761 } 1614 }
762 } else { 1615 } else {
763 switch (boot_cpu_data.x86_vendor) { 1616 switch (boot_cpu_data.x86_vendor) {
@@ -791,8 +1644,15 @@ void __init mtrr_bp_init(void)
791 if (mtrr_if) { 1644 if (mtrr_if) {
792 set_num_var_ranges(); 1645 set_num_var_ranges();
793 init_table(); 1646 init_table();
794 if (use_intel()) 1647 if (use_intel()) {
795 get_mtrr_state(); 1648 get_mtrr_state();
1649
1650 if (mtrr_cleanup(phys_addr)) {
1651 changed_by_mtrr_cleanup = 1;
1652 mtrr_if->set_all();
1653 }
1654
1655 }
796 } 1656 }
797} 1657}
798 1658
@@ -829,9 +1689,10 @@ static int __init mtrr_init_finialize(void)
829{ 1689{
830 if (!mtrr_if) 1690 if (!mtrr_if)
831 return 0; 1691 return 0;
832 if (use_intel()) 1692 if (use_intel()) {
833 mtrr_state_warn(); 1693 if (!changed_by_mtrr_cleanup)
834 else { 1694 mtrr_state_warn();
1695 } else {
835 /* The CPUs haven't MTRR and seem to not support SMP. They have 1696 /* The CPUs haven't MTRR and seem to not support SMP. They have
836 * specific drivers, we use a tricky method to support 1697 * specific drivers, we use a tricky method to support
837 * suspend/resume for them. 1698 * suspend/resume for them.
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h
index 2cc77eb6fea3..2dc4ec656b23 100644
--- a/arch/x86/kernel/cpu/mtrr/mtrr.h
+++ b/arch/x86/kernel/cpu/mtrr/mtrr.h
@@ -81,6 +81,8 @@ void set_mtrr_done(struct set_mtrr_context *ctxt);
81void set_mtrr_cache_disable(struct set_mtrr_context *ctxt); 81void set_mtrr_cache_disable(struct set_mtrr_context *ctxt);
82void set_mtrr_prepare_save(struct set_mtrr_context *ctxt); 82void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
83 83
84void fill_mtrr_var_range(unsigned int index,
85 u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi);
84void get_mtrr_state(void); 86void get_mtrr_state(void);
85 87
86extern void set_mtrr_ops(struct mtrr_ops * ops); 88extern void set_mtrr_ops(struct mtrr_ops * ops);
@@ -92,6 +94,7 @@ extern struct mtrr_ops * mtrr_if;
92#define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1) 94#define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1)
93 95
94extern unsigned int num_var_ranges; 96extern unsigned int num_var_ranges;
97extern u64 mtrr_tom2;
95 98
96void mtrr_state_warn(void); 99void mtrr_state_warn(void);
97const char *mtrr_attrib_to_str(int x); 100const char *mtrr_attrib_to_str(int x);
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index f9ae93adffe5..2e9bef6e3aa3 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -1,11 +1,15 @@
1/* local apic based NMI watchdog for various CPUs. 1/*
2 This file also handles reservation of performance counters for coordination 2 * local apic based NMI watchdog for various CPUs.
3 with other users (like oprofile). 3 *
4 4 * This file also handles reservation of performance counters for coordination
5 Note that these events normally don't tick when the CPU idles. This means 5 * with other users (like oprofile).
6 the frequency varies with CPU load. 6 *
7 7 * Note that these events normally don't tick when the CPU idles. This means
8 Original code for K7/P6 written by Keith Owens */ 8 * the frequency varies with CPU load.
9 *
10 * Original code for K7/P6 written by Keith Owens
11 *
12 */
9 13
10#include <linux/percpu.h> 14#include <linux/percpu.h>
11#include <linux/module.h> 15#include <linux/module.h>
@@ -36,12 +40,16 @@ struct wd_ops {
36 40
37static const struct wd_ops *wd_ops; 41static const struct wd_ops *wd_ops;
38 42
39/* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's 43/*
40 * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) 44 * this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's
45 * offset from MSR_P4_BSU_ESCR0.
46 *
47 * It will be the max for all platforms (for now)
41 */ 48 */
42#define NMI_MAX_COUNTER_BITS 66 49#define NMI_MAX_COUNTER_BITS 66
43 50
44/* perfctr_nmi_owner tracks the ownership of the perfctr registers: 51/*
52 * perfctr_nmi_owner tracks the ownership of the perfctr registers:
45 * evtsel_nmi_owner tracks the ownership of the event selection 53 * evtsel_nmi_owner tracks the ownership of the event selection
46 * - different performance counters/ event selection may be reserved for 54 * - different performance counters/ event selection may be reserved for
47 * different subsystems this reservation system just tries to coordinate 55 * different subsystems this reservation system just tries to coordinate
@@ -73,8 +81,10 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
73 return 0; 81 return 0;
74} 82}
75 83
76/* converts an msr to an appropriate reservation bit */ 84/*
77/* returns the bit offset of the event selection register */ 85 * converts an msr to an appropriate reservation bit
86 * returns the bit offset of the event selection register
87 */
78static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr) 88static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
79{ 89{
80 /* returns the bit offset of the event selection register */ 90 /* returns the bit offset of the event selection register */
@@ -114,6 +124,7 @@ int avail_to_resrv_perfctr_nmi(unsigned int msr)
114 124
115 return (!test_bit(counter, perfctr_nmi_owner)); 125 return (!test_bit(counter, perfctr_nmi_owner));
116} 126}
127EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi_bit);
117 128
118int reserve_perfctr_nmi(unsigned int msr) 129int reserve_perfctr_nmi(unsigned int msr)
119{ 130{
@@ -128,6 +139,7 @@ int reserve_perfctr_nmi(unsigned int msr)
128 return 1; 139 return 1;
129 return 0; 140 return 0;
130} 141}
142EXPORT_SYMBOL(reserve_perfctr_nmi);
131 143
132void release_perfctr_nmi(unsigned int msr) 144void release_perfctr_nmi(unsigned int msr)
133{ 145{
@@ -140,6 +152,7 @@ void release_perfctr_nmi(unsigned int msr)
140 152
141 clear_bit(counter, perfctr_nmi_owner); 153 clear_bit(counter, perfctr_nmi_owner);
142} 154}
155EXPORT_SYMBOL(release_perfctr_nmi);
143 156
144int reserve_evntsel_nmi(unsigned int msr) 157int reserve_evntsel_nmi(unsigned int msr)
145{ 158{
@@ -154,6 +167,7 @@ int reserve_evntsel_nmi(unsigned int msr)
154 return 1; 167 return 1;
155 return 0; 168 return 0;
156} 169}
170EXPORT_SYMBOL(reserve_evntsel_nmi);
157 171
158void release_evntsel_nmi(unsigned int msr) 172void release_evntsel_nmi(unsigned int msr)
159{ 173{
@@ -166,11 +180,6 @@ void release_evntsel_nmi(unsigned int msr)
166 180
167 clear_bit(counter, evntsel_nmi_owner); 181 clear_bit(counter, evntsel_nmi_owner);
168} 182}
169
170EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi_bit);
171EXPORT_SYMBOL(reserve_perfctr_nmi);
172EXPORT_SYMBOL(release_perfctr_nmi);
173EXPORT_SYMBOL(reserve_evntsel_nmi);
174EXPORT_SYMBOL(release_evntsel_nmi); 183EXPORT_SYMBOL(release_evntsel_nmi);
175 184
176void disable_lapic_nmi_watchdog(void) 185void disable_lapic_nmi_watchdog(void)
@@ -181,7 +190,9 @@ void disable_lapic_nmi_watchdog(void)
181 return; 190 return;
182 191
183 on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1); 192 on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1);
184 wd_ops->unreserve(); 193
194 if (wd_ops)
195 wd_ops->unreserve();
185 196
186 BUG_ON(atomic_read(&nmi_active) != 0); 197 BUG_ON(atomic_read(&nmi_active) != 0);
187} 198}
@@ -232,8 +243,8 @@ static unsigned int adjust_for_32bit_ctr(unsigned int hz)
232 return retval; 243 return retval;
233} 244}
234 245
235static void 246static void write_watchdog_counter(unsigned int perfctr_msr,
236write_watchdog_counter(unsigned int perfctr_msr, const char *descr, unsigned nmi_hz) 247 const char *descr, unsigned nmi_hz)
237{ 248{
238 u64 count = (u64)cpu_khz * 1000; 249 u64 count = (u64)cpu_khz * 1000;
239 250
@@ -244,7 +255,7 @@ write_watchdog_counter(unsigned int perfctr_msr, const char *descr, unsigned nmi
244} 255}
245 256
246static void write_watchdog_counter32(unsigned int perfctr_msr, 257static void write_watchdog_counter32(unsigned int perfctr_msr,
247 const char *descr, unsigned nmi_hz) 258 const char *descr, unsigned nmi_hz)
248{ 259{
249 u64 count = (u64)cpu_khz * 1000; 260 u64 count = (u64)cpu_khz * 1000;
250 261
@@ -254,9 +265,10 @@ static void write_watchdog_counter32(unsigned int perfctr_msr,
254 wrmsr(perfctr_msr, (u32)(-count), 0); 265 wrmsr(perfctr_msr, (u32)(-count), 0);
255} 266}
256 267
257/* AMD K7/K8/Family10h/Family11h support. AMD keeps this interface 268/*
258 nicely stable so there is not much variety */ 269 * AMD K7/K8/Family10h/Family11h support.
259 270 * AMD keeps this interface nicely stable so there is not much variety
271 */
260#define K7_EVNTSEL_ENABLE (1 << 22) 272#define K7_EVNTSEL_ENABLE (1 << 22)
261#define K7_EVNTSEL_INT (1 << 20) 273#define K7_EVNTSEL_INT (1 << 20)
262#define K7_EVNTSEL_OS (1 << 17) 274#define K7_EVNTSEL_OS (1 << 17)
@@ -289,7 +301,7 @@ static int setup_k7_watchdog(unsigned nmi_hz)
289 301
290 wd->perfctr_msr = perfctr_msr; 302 wd->perfctr_msr = perfctr_msr;
291 wd->evntsel_msr = evntsel_msr; 303 wd->evntsel_msr = evntsel_msr;
292 wd->cccr_msr = 0; //unused 304 wd->cccr_msr = 0; /* unused */
293 return 1; 305 return 1;
294} 306}
295 307
@@ -325,18 +337,19 @@ static void single_msr_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
325} 337}
326 338
327static const struct wd_ops k7_wd_ops = { 339static const struct wd_ops k7_wd_ops = {
328 .reserve = single_msr_reserve, 340 .reserve = single_msr_reserve,
329 .unreserve = single_msr_unreserve, 341 .unreserve = single_msr_unreserve,
330 .setup = setup_k7_watchdog, 342 .setup = setup_k7_watchdog,
331 .rearm = single_msr_rearm, 343 .rearm = single_msr_rearm,
332 .stop = single_msr_stop_watchdog, 344 .stop = single_msr_stop_watchdog,
333 .perfctr = MSR_K7_PERFCTR0, 345 .perfctr = MSR_K7_PERFCTR0,
334 .evntsel = MSR_K7_EVNTSEL0, 346 .evntsel = MSR_K7_EVNTSEL0,
335 .checkbit = 1ULL<<47, 347 .checkbit = 1ULL << 47,
336}; 348};
337 349
338/* Intel Model 6 (PPro+,P2,P3,P-M,Core1) */ 350/*
339 351 * Intel Model 6 (PPro+,P2,P3,P-M,Core1)
352 */
340#define P6_EVNTSEL0_ENABLE (1 << 22) 353#define P6_EVNTSEL0_ENABLE (1 << 22)
341#define P6_EVNTSEL_INT (1 << 20) 354#define P6_EVNTSEL_INT (1 << 20)
342#define P6_EVNTSEL_OS (1 << 17) 355#define P6_EVNTSEL_OS (1 << 17)
@@ -372,52 +385,58 @@ static int setup_p6_watchdog(unsigned nmi_hz)
372 385
373 wd->perfctr_msr = perfctr_msr; 386 wd->perfctr_msr = perfctr_msr;
374 wd->evntsel_msr = evntsel_msr; 387 wd->evntsel_msr = evntsel_msr;
375 wd->cccr_msr = 0; //unused 388 wd->cccr_msr = 0; /* unused */
376 return 1; 389 return 1;
377} 390}
378 391
379static void p6_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz) 392static void p6_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
380{ 393{
381 /* P6 based Pentium M need to re-unmask 394 /*
395 * P6 based Pentium M need to re-unmask
382 * the apic vector but it doesn't hurt 396 * the apic vector but it doesn't hurt
383 * other P6 variant. 397 * other P6 variant.
384 * ArchPerfom/Core Duo also needs this */ 398 * ArchPerfom/Core Duo also needs this
399 */
385 apic_write(APIC_LVTPC, APIC_DM_NMI); 400 apic_write(APIC_LVTPC, APIC_DM_NMI);
401
386 /* P6/ARCH_PERFMON has 32 bit counter write */ 402 /* P6/ARCH_PERFMON has 32 bit counter write */
387 write_watchdog_counter32(wd->perfctr_msr, NULL,nmi_hz); 403 write_watchdog_counter32(wd->perfctr_msr, NULL,nmi_hz);
388} 404}
389 405
390static const struct wd_ops p6_wd_ops = { 406static const struct wd_ops p6_wd_ops = {
391 .reserve = single_msr_reserve, 407 .reserve = single_msr_reserve,
392 .unreserve = single_msr_unreserve, 408 .unreserve = single_msr_unreserve,
393 .setup = setup_p6_watchdog, 409 .setup = setup_p6_watchdog,
394 .rearm = p6_rearm, 410 .rearm = p6_rearm,
395 .stop = single_msr_stop_watchdog, 411 .stop = single_msr_stop_watchdog,
396 .perfctr = MSR_P6_PERFCTR0, 412 .perfctr = MSR_P6_PERFCTR0,
397 .evntsel = MSR_P6_EVNTSEL0, 413 .evntsel = MSR_P6_EVNTSEL0,
398 .checkbit = 1ULL<<39, 414 .checkbit = 1ULL << 39,
399}; 415};
400 416
401/* Intel P4 performance counters. By far the most complicated of all. */ 417/*
402 418 * Intel P4 performance counters.
403#define MSR_P4_MISC_ENABLE_PERF_AVAIL (1<<7) 419 * By far the most complicated of all.
404#define P4_ESCR_EVENT_SELECT(N) ((N)<<25) 420 */
405#define P4_ESCR_OS (1<<3) 421#define MSR_P4_MISC_ENABLE_PERF_AVAIL (1 << 7)
406#define P4_ESCR_USR (1<<2) 422#define P4_ESCR_EVENT_SELECT(N) ((N) << 25)
407#define P4_CCCR_OVF_PMI0 (1<<26) 423#define P4_ESCR_OS (1 << 3)
408#define P4_CCCR_OVF_PMI1 (1<<27) 424#define P4_ESCR_USR (1 << 2)
409#define P4_CCCR_THRESHOLD(N) ((N)<<20) 425#define P4_CCCR_OVF_PMI0 (1 << 26)
410#define P4_CCCR_COMPLEMENT (1<<19) 426#define P4_CCCR_OVF_PMI1 (1 << 27)
411#define P4_CCCR_COMPARE (1<<18) 427#define P4_CCCR_THRESHOLD(N) ((N) << 20)
412#define P4_CCCR_REQUIRED (3<<16) 428#define P4_CCCR_COMPLEMENT (1 << 19)
413#define P4_CCCR_ESCR_SELECT(N) ((N)<<13) 429#define P4_CCCR_COMPARE (1 << 18)
414#define P4_CCCR_ENABLE (1<<12) 430#define P4_CCCR_REQUIRED (3 << 16)
415#define P4_CCCR_OVF (1<<31) 431#define P4_CCCR_ESCR_SELECT(N) ((N) << 13)
416 432#define P4_CCCR_ENABLE (1 << 12)
417/* Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter 433#define P4_CCCR_OVF (1 << 31)
418 CRU_ESCR0 (with any non-null event selector) through a complemented
419 max threshold. [IA32-Vol3, Section 14.9.9] */
420 434
435/*
436 * Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter
437 * CRU_ESCR0 (with any non-null event selector) through a complemented
438 * max threshold. [IA32-Vol3, Section 14.9.9]
439 */
421static int setup_p4_watchdog(unsigned nmi_hz) 440static int setup_p4_watchdog(unsigned nmi_hz)
422{ 441{
423 unsigned int perfctr_msr, evntsel_msr, cccr_msr; 442 unsigned int perfctr_msr, evntsel_msr, cccr_msr;
@@ -442,7 +461,8 @@ static int setup_p4_watchdog(unsigned nmi_hz)
442#endif 461#endif
443 ht_num = 0; 462 ht_num = 0;
444 463
445 /* performance counters are shared resources 464 /*
465 * performance counters are shared resources
446 * assign each hyperthread its own set 466 * assign each hyperthread its own set
447 * (re-use the ESCR0 register, seems safe 467 * (re-use the ESCR0 register, seems safe
448 * and keeps the cccr_val the same) 468 * and keeps the cccr_val the same)
@@ -540,20 +560,21 @@ static void p4_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz)
540} 560}
541 561
542static const struct wd_ops p4_wd_ops = { 562static const struct wd_ops p4_wd_ops = {
543 .reserve = p4_reserve, 563 .reserve = p4_reserve,
544 .unreserve = p4_unreserve, 564 .unreserve = p4_unreserve,
545 .setup = setup_p4_watchdog, 565 .setup = setup_p4_watchdog,
546 .rearm = p4_rearm, 566 .rearm = p4_rearm,
547 .stop = stop_p4_watchdog, 567 .stop = stop_p4_watchdog,
548 /* RED-PEN this is wrong for the other sibling */ 568 /* RED-PEN this is wrong for the other sibling */
549 .perfctr = MSR_P4_BPU_PERFCTR0, 569 .perfctr = MSR_P4_BPU_PERFCTR0,
550 .evntsel = MSR_P4_BSU_ESCR0, 570 .evntsel = MSR_P4_BSU_ESCR0,
551 .checkbit = 1ULL<<39, 571 .checkbit = 1ULL << 39,
552}; 572};
553 573
554/* Watchdog using the Intel architected PerfMon. Used for Core2 and hopefully 574/*
555 all future Intel CPUs. */ 575 * Watchdog using the Intel architected PerfMon.
556 576 * Used for Core2 and hopefully all future Intel CPUs.
577 */
557#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 578#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL
558#define ARCH_PERFMON_NMI_EVENT_UMASK ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK 579#define ARCH_PERFMON_NMI_EVENT_UMASK ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK
559 580
@@ -599,19 +620,19 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz)
599 620
600 wd->perfctr_msr = perfctr_msr; 621 wd->perfctr_msr = perfctr_msr;
601 wd->evntsel_msr = evntsel_msr; 622 wd->evntsel_msr = evntsel_msr;
602 wd->cccr_msr = 0; //unused 623 wd->cccr_msr = 0; /* unused */
603 intel_arch_wd_ops.checkbit = 1ULL << (eax.split.bit_width - 1); 624 intel_arch_wd_ops.checkbit = 1ULL << (eax.split.bit_width - 1);
604 return 1; 625 return 1;
605} 626}
606 627
607static struct wd_ops intel_arch_wd_ops __read_mostly = { 628static struct wd_ops intel_arch_wd_ops __read_mostly = {
608 .reserve = single_msr_reserve, 629 .reserve = single_msr_reserve,
609 .unreserve = single_msr_unreserve, 630 .unreserve = single_msr_unreserve,
610 .setup = setup_intel_arch_watchdog, 631 .setup = setup_intel_arch_watchdog,
611 .rearm = p6_rearm, 632 .rearm = p6_rearm,
612 .stop = single_msr_stop_watchdog, 633 .stop = single_msr_stop_watchdog,
613 .perfctr = MSR_ARCH_PERFMON_PERFCTR1, 634 .perfctr = MSR_ARCH_PERFMON_PERFCTR1,
614 .evntsel = MSR_ARCH_PERFMON_EVENTSEL1, 635 .evntsel = MSR_ARCH_PERFMON_EVENTSEL1,
615}; 636};
616 637
617static void probe_nmi_watchdog(void) 638static void probe_nmi_watchdog(void)
@@ -624,8 +645,10 @@ static void probe_nmi_watchdog(void)
624 wd_ops = &k7_wd_ops; 645 wd_ops = &k7_wd_ops;
625 break; 646 break;
626 case X86_VENDOR_INTEL: 647 case X86_VENDOR_INTEL:
627 /* Work around Core Duo (Yonah) errata AE49 where perfctr1 648 /*
628 doesn't have a working enable bit. */ 649 * Work around Core Duo (Yonah) errata AE49 where perfctr1
650 * doesn't have a working enable bit.
651 */
629 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 14) { 652 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 14) {
630 intel_arch_wd_ops.perfctr = MSR_ARCH_PERFMON_PERFCTR0; 653 intel_arch_wd_ops.perfctr = MSR_ARCH_PERFMON_PERFCTR0;
631 intel_arch_wd_ops.evntsel = MSR_ARCH_PERFMON_EVENTSEL0; 654 intel_arch_wd_ops.evntsel = MSR_ARCH_PERFMON_EVENTSEL0;
@@ -636,7 +659,7 @@ static void probe_nmi_watchdog(void)
636 } 659 }
637 switch (boot_cpu_data.x86) { 660 switch (boot_cpu_data.x86) {
638 case 6: 661 case 6:
639 if (boot_cpu_data.x86_model > 0xd) 662 if (boot_cpu_data.x86_model > 13)
640 return; 663 return;
641 664
642 wd_ops = &p6_wd_ops; 665 wd_ops = &p6_wd_ops;
@@ -697,10 +720,11 @@ int lapic_wd_event(unsigned nmi_hz)
697{ 720{
698 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 721 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
699 u64 ctr; 722 u64 ctr;
723
700 rdmsrl(wd->perfctr_msr, ctr); 724 rdmsrl(wd->perfctr_msr, ctr);
701 if (ctr & wd_ops->checkbit) { /* perfctr still running? */ 725 if (ctr & wd_ops->checkbit) /* perfctr still running? */
702 return 0; 726 return 0;
703 } 727
704 wd_ops->rearm(wd, nmi_hz); 728 wd_ops->rearm(wd, nmi_hz);
705 return 1; 729 return 1;
706} 730}
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index daff52a62248..71f1c2654bec 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -33,6 +33,7 @@
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/poll.h> 34#include <linux/poll.h>
35#include <linux/smp.h> 35#include <linux/smp.h>
36#include <linux/smp_lock.h>
36#include <linux/major.h> 37#include <linux/major.h>
37#include <linux/fs.h> 38#include <linux/fs.h>
38#include <linux/smp_lock.h> 39#include <linux/smp_lock.h>
@@ -107,15 +108,23 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
107 108
108static int cpuid_open(struct inode *inode, struct file *file) 109static int cpuid_open(struct inode *inode, struct file *file)
109{ 110{
110 unsigned int cpu = iminor(file->f_path.dentry->d_inode); 111 unsigned int cpu;
111 struct cpuinfo_x86 *c = &cpu_data(cpu); 112 struct cpuinfo_x86 *c;
112 113 int ret = 0;
113 if (cpu >= NR_CPUS || !cpu_online(cpu)) 114
114 return -ENXIO; /* No such CPU */ 115 lock_kernel();
116
117 cpu = iminor(file->f_path.dentry->d_inode);
118 if (cpu >= NR_CPUS || !cpu_online(cpu)) {
119 ret = -ENXIO; /* No such CPU */
120 goto out;
121 }
122 c = &cpu_data(cpu);
115 if (c->cpuid_level < 0) 123 if (c->cpuid_level < 0)
116 return -EIO; /* CPUID not supported */ 124 ret = -EIO; /* CPUID not supported */
117 125out:
118 return 0; 126 unlock_kernel();
127 return ret;
119} 128}
120 129
121/* 130/*
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
new file mode 100644
index 000000000000..28c29180b380
--- /dev/null
+++ b/arch/x86/kernel/e820.c
@@ -0,0 +1,1390 @@
1/*
2 * Handle the memory map.
3 * The functions here do the job until bootmem takes over.
4 *
5 * Getting sanitize_e820_map() in sync with i386 version by applying change:
6 * - Provisions for empty E820 memory regions (reported by certain BIOSes).
7 * Alex Achenbach <xela@slit.de>, December 2002.
8 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
9 *
10 */
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/init.h>
14#include <linux/bootmem.h>
15#include <linux/ioport.h>
16#include <linux/string.h>
17#include <linux/kexec.h>
18#include <linux/module.h>
19#include <linux/mm.h>
20#include <linux/pfn.h>
21#include <linux/suspend.h>
22#include <linux/firmware-map.h>
23
24#include <asm/pgtable.h>
25#include <asm/page.h>
26#include <asm/e820.h>
27#include <asm/proto.h>
28#include <asm/setup.h>
29#include <asm/trampoline.h>
30
31/*
32 * The e820 map is the map that gets modified e.g. with command line parameters
33 * and that is also registered with modifications in the kernel resource tree
34 * with the iomem_resource as parent.
35 *
36 * The e820_saved is directly saved after the BIOS-provided memory map is
37 * copied. It doesn't get modified afterwards. It's registered for the
38 * /sys/firmware/memmap interface.
39 *
40 * That memory map is not modified and is used as base for kexec. The kexec'd
41 * kernel should get the same memory map as the firmware provides. Then the
42 * user can e.g. boot the original kernel with mem=1G while still booting the
43 * next kernel with full memory.
44 */
45struct e820map e820;
46struct e820map e820_saved;
47
48/* For PCI or other memory-mapped resources */
49unsigned long pci_mem_start = 0xaeedbabe;
50#ifdef CONFIG_PCI
51EXPORT_SYMBOL(pci_mem_start);
52#endif
53
54/*
55 * This function checks if any part of the range <start,end> is mapped
56 * with type.
57 */
58int
59e820_any_mapped(u64 start, u64 end, unsigned type)
60{
61 int i;
62
63 for (i = 0; i < e820.nr_map; i++) {
64 struct e820entry *ei = &e820.map[i];
65
66 if (type && ei->type != type)
67 continue;
68 if (ei->addr >= end || ei->addr + ei->size <= start)
69 continue;
70 return 1;
71 }
72 return 0;
73}
74EXPORT_SYMBOL_GPL(e820_any_mapped);
75
76/*
77 * This function checks if the entire range <start,end> is mapped with type.
78 *
79 * Note: this function only works correct if the e820 table is sorted and
80 * not-overlapping, which is the case
81 */
82int __init e820_all_mapped(u64 start, u64 end, unsigned type)
83{
84 int i;
85
86 for (i = 0; i < e820.nr_map; i++) {
87 struct e820entry *ei = &e820.map[i];
88
89 if (type && ei->type != type)
90 continue;
91 /* is the region (part) in overlap with the current region ?*/
92 if (ei->addr >= end || ei->addr + ei->size <= start)
93 continue;
94
95 /* if the region is at the beginning of <start,end> we move
96 * start to the end of the region since it's ok until there
97 */
98 if (ei->addr <= start)
99 start = ei->addr + ei->size;
100 /*
101 * if start is now at or beyond end, we're done, full
102 * coverage
103 */
104 if (start >= end)
105 return 1;
106 }
107 return 0;
108}
109
110/*
111 * Add a memory region to the kernel e820 map.
112 */
113void __init e820_add_region(u64 start, u64 size, int type)
114{
115 int x = e820.nr_map;
116
117 if (x == ARRAY_SIZE(e820.map)) {
118 printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
119 return;
120 }
121
122 e820.map[x].addr = start;
123 e820.map[x].size = size;
124 e820.map[x].type = type;
125 e820.nr_map++;
126}
127
128void __init e820_print_map(char *who)
129{
130 int i;
131
132 for (i = 0; i < e820.nr_map; i++) {
133 printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
134 (unsigned long long) e820.map[i].addr,
135 (unsigned long long)
136 (e820.map[i].addr + e820.map[i].size));
137 switch (e820.map[i].type) {
138 case E820_RAM:
139 case E820_RESERVED_KERN:
140 printk(KERN_CONT "(usable)\n");
141 break;
142 case E820_RESERVED:
143 printk(KERN_CONT "(reserved)\n");
144 break;
145 case E820_ACPI:
146 printk(KERN_CONT "(ACPI data)\n");
147 break;
148 case E820_NVS:
149 printk(KERN_CONT "(ACPI NVS)\n");
150 break;
151 default:
152 printk(KERN_CONT "type %u\n", e820.map[i].type);
153 break;
154 }
155 }
156}
157
158/*
159 * Sanitize the BIOS e820 map.
160 *
161 * Some e820 responses include overlapping entries. The following
162 * replaces the original e820 map with a new one, removing overlaps,
163 * and resolving conflicting memory types in favor of highest
164 * numbered type.
165 *
166 * The input parameter biosmap points to an array of 'struct
167 * e820entry' which on entry has elements in the range [0, *pnr_map)
168 * valid, and which has space for up to max_nr_map entries.
169 * On return, the resulting sanitized e820 map entries will be in
170 * overwritten in the same location, starting at biosmap.
171 *
172 * The integer pointed to by pnr_map must be valid on entry (the
173 * current number of valid entries located at biosmap) and will
174 * be updated on return, with the new number of valid entries
175 * (something no more than max_nr_map.)
176 *
177 * The return value from sanitize_e820_map() is zero if it
178 * successfully 'sanitized' the map entries passed in, and is -1
179 * if it did nothing, which can happen if either of (1) it was
180 * only passed one map entry, or (2) any of the input map entries
181 * were invalid (start + size < start, meaning that the size was
182 * so big the described memory range wrapped around through zero.)
183 *
184 * Visually we're performing the following
185 * (1,2,3,4 = memory types)...
186 *
187 * Sample memory map (w/overlaps):
188 * ____22__________________
189 * ______________________4_
190 * ____1111________________
191 * _44_____________________
192 * 11111111________________
193 * ____________________33__
194 * ___________44___________
195 * __________33333_________
196 * ______________22________
197 * ___________________2222_
198 * _________111111111______
199 * _____________________11_
200 * _________________4______
201 *
202 * Sanitized equivalent (no overlap):
203 * 1_______________________
204 * _44_____________________
205 * ___1____________________
206 * ____22__________________
207 * ______11________________
208 * _________1______________
209 * __________3_____________
210 * ___________44___________
211 * _____________33_________
212 * _______________2________
213 * ________________1_______
214 * _________________4______
215 * ___________________2____
216 * ____________________33__
217 * ______________________4_
218 */
219
220int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
221 int *pnr_map)
222{
223 struct change_member {
224 struct e820entry *pbios; /* pointer to original bios entry */
225 unsigned long long addr; /* address for this change point */
226 };
227 static struct change_member change_point_list[2*E820_X_MAX] __initdata;
228 static struct change_member *change_point[2*E820_X_MAX] __initdata;
229 static struct e820entry *overlap_list[E820_X_MAX] __initdata;
230 static struct e820entry new_bios[E820_X_MAX] __initdata;
231 struct change_member *change_tmp;
232 unsigned long current_type, last_type;
233 unsigned long long last_addr;
234 int chgidx, still_changing;
235 int overlap_entries;
236 int new_bios_entry;
237 int old_nr, new_nr, chg_nr;
238 int i;
239
240 /* if there's only one memory region, don't bother */
241 if (*pnr_map < 2)
242 return -1;
243
244 old_nr = *pnr_map;
245 BUG_ON(old_nr > max_nr_map);
246
247 /* bail out if we find any unreasonable addresses in bios map */
248 for (i = 0; i < old_nr; i++)
249 if (biosmap[i].addr + biosmap[i].size < biosmap[i].addr)
250 return -1;
251
252 /* create pointers for initial change-point information (for sorting) */
253 for (i = 0; i < 2 * old_nr; i++)
254 change_point[i] = &change_point_list[i];
255
256 /* record all known change-points (starting and ending addresses),
257 omitting those that are for empty memory regions */
258 chgidx = 0;
259 for (i = 0; i < old_nr; i++) {
260 if (biosmap[i].size != 0) {
261 change_point[chgidx]->addr = biosmap[i].addr;
262 change_point[chgidx++]->pbios = &biosmap[i];
263 change_point[chgidx]->addr = biosmap[i].addr +
264 biosmap[i].size;
265 change_point[chgidx++]->pbios = &biosmap[i];
266 }
267 }
268 chg_nr = chgidx;
269
270 /* sort change-point list by memory addresses (low -> high) */
271 still_changing = 1;
272 while (still_changing) {
273 still_changing = 0;
274 for (i = 1; i < chg_nr; i++) {
275 unsigned long long curaddr, lastaddr;
276 unsigned long long curpbaddr, lastpbaddr;
277
278 curaddr = change_point[i]->addr;
279 lastaddr = change_point[i - 1]->addr;
280 curpbaddr = change_point[i]->pbios->addr;
281 lastpbaddr = change_point[i - 1]->pbios->addr;
282
283 /*
284 * swap entries, when:
285 *
286 * curaddr > lastaddr or
287 * curaddr == lastaddr and curaddr == curpbaddr and
288 * lastaddr != lastpbaddr
289 */
290 if (curaddr < lastaddr ||
291 (curaddr == lastaddr && curaddr == curpbaddr &&
292 lastaddr != lastpbaddr)) {
293 change_tmp = change_point[i];
294 change_point[i] = change_point[i-1];
295 change_point[i-1] = change_tmp;
296 still_changing = 1;
297 }
298 }
299 }
300
301 /* create a new bios memory map, removing overlaps */
302 overlap_entries = 0; /* number of entries in the overlap table */
303 new_bios_entry = 0; /* index for creating new bios map entries */
304 last_type = 0; /* start with undefined memory type */
305 last_addr = 0; /* start with 0 as last starting address */
306
307 /* loop through change-points, determining affect on the new bios map */
308 for (chgidx = 0; chgidx < chg_nr; chgidx++) {
309 /* keep track of all overlapping bios entries */
310 if (change_point[chgidx]->addr ==
311 change_point[chgidx]->pbios->addr) {
312 /*
313 * add map entry to overlap list (> 1 entry
314 * implies an overlap)
315 */
316 overlap_list[overlap_entries++] =
317 change_point[chgidx]->pbios;
318 } else {
319 /*
320 * remove entry from list (order independent,
321 * so swap with last)
322 */
323 for (i = 0; i < overlap_entries; i++) {
324 if (overlap_list[i] ==
325 change_point[chgidx]->pbios)
326 overlap_list[i] =
327 overlap_list[overlap_entries-1];
328 }
329 overlap_entries--;
330 }
331 /*
332 * if there are overlapping entries, decide which
333 * "type" to use (larger value takes precedence --
334 * 1=usable, 2,3,4,4+=unusable)
335 */
336 current_type = 0;
337 for (i = 0; i < overlap_entries; i++)
338 if (overlap_list[i]->type > current_type)
339 current_type = overlap_list[i]->type;
340 /*
341 * continue building up new bios map based on this
342 * information
343 */
344 if (current_type != last_type) {
345 if (last_type != 0) {
346 new_bios[new_bios_entry].size =
347 change_point[chgidx]->addr - last_addr;
348 /*
349 * move forward only if the new size
350 * was non-zero
351 */
352 if (new_bios[new_bios_entry].size != 0)
353 /*
354 * no more space left for new
355 * bios entries ?
356 */
357 if (++new_bios_entry >= max_nr_map)
358 break;
359 }
360 if (current_type != 0) {
361 new_bios[new_bios_entry].addr =
362 change_point[chgidx]->addr;
363 new_bios[new_bios_entry].type = current_type;
364 last_addr = change_point[chgidx]->addr;
365 }
366 last_type = current_type;
367 }
368 }
369 /* retain count for new bios entries */
370 new_nr = new_bios_entry;
371
372 /* copy new bios mapping into original location */
373 memcpy(biosmap, new_bios, new_nr * sizeof(struct e820entry));
374 *pnr_map = new_nr;
375
376 return 0;
377}
378
379static int __init __append_e820_map(struct e820entry *biosmap, int nr_map)
380{
381 while (nr_map) {
382 u64 start = biosmap->addr;
383 u64 size = biosmap->size;
384 u64 end = start + size;
385 u32 type = biosmap->type;
386
387 /* Overflow in 64 bits? Ignore the memory map. */
388 if (start > end)
389 return -1;
390
391 e820_add_region(start, size, type);
392
393 biosmap++;
394 nr_map--;
395 }
396 return 0;
397}
398
399/*
400 * Copy the BIOS e820 map into a safe place.
401 *
402 * Sanity-check it while we're at it..
403 *
404 * If we're lucky and live on a modern system, the setup code
405 * will have given us a memory map that we can use to properly
406 * set up memory. If we aren't, we'll fake a memory map.
407 */
408static int __init append_e820_map(struct e820entry *biosmap, int nr_map)
409{
410 /* Only one memory region (or negative)? Ignore it */
411 if (nr_map < 2)
412 return -1;
413
414 return __append_e820_map(biosmap, nr_map);
415}
416
417static u64 __init e820_update_range_map(struct e820map *e820x, u64 start,
418 u64 size, unsigned old_type,
419 unsigned new_type)
420{
421 int i;
422 u64 real_updated_size = 0;
423
424 BUG_ON(old_type == new_type);
425
426 if (size > (ULLONG_MAX - start))
427 size = ULLONG_MAX - start;
428
429 for (i = 0; i < e820.nr_map; i++) {
430 struct e820entry *ei = &e820x->map[i];
431 u64 final_start, final_end;
432 if (ei->type != old_type)
433 continue;
434 /* totally covered? */
435 if (ei->addr >= start &&
436 (ei->addr + ei->size) <= (start + size)) {
437 ei->type = new_type;
438 real_updated_size += ei->size;
439 continue;
440 }
441 /* partially covered */
442 final_start = max(start, ei->addr);
443 final_end = min(start + size, ei->addr + ei->size);
444 if (final_start >= final_end)
445 continue;
446 e820_add_region(final_start, final_end - final_start,
447 new_type);
448 real_updated_size += final_end - final_start;
449
450 ei->size -= final_end - final_start;
451 if (ei->addr < final_start)
452 continue;
453 ei->addr = final_end;
454 }
455 return real_updated_size;
456}
457
458u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
459 unsigned new_type)
460{
461 return e820_update_range_map(&e820, start, size, old_type, new_type);
462}
463
464static u64 __init e820_update_range_saved(u64 start, u64 size,
465 unsigned old_type, unsigned new_type)
466{
467 return e820_update_range_map(&e820_saved, start, size, old_type,
468 new_type);
469}
470
471/* make e820 not cover the range */
472u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
473 int checktype)
474{
475 int i;
476 u64 real_removed_size = 0;
477
478 if (size > (ULLONG_MAX - start))
479 size = ULLONG_MAX - start;
480
481 for (i = 0; i < e820.nr_map; i++) {
482 struct e820entry *ei = &e820.map[i];
483 u64 final_start, final_end;
484
485 if (checktype && ei->type != old_type)
486 continue;
487 /* totally covered? */
488 if (ei->addr >= start &&
489 (ei->addr + ei->size) <= (start + size)) {
490 real_removed_size += ei->size;
491 memset(ei, 0, sizeof(struct e820entry));
492 continue;
493 }
494 /* partially covered */
495 final_start = max(start, ei->addr);
496 final_end = min(start + size, ei->addr + ei->size);
497 if (final_start >= final_end)
498 continue;
499 real_removed_size += final_end - final_start;
500
501 ei->size -= final_end - final_start;
502 if (ei->addr < final_start)
503 continue;
504 ei->addr = final_end;
505 }
506 return real_removed_size;
507}
508
509void __init update_e820(void)
510{
511 int nr_map;
512
513 nr_map = e820.nr_map;
514 if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map))
515 return;
516 e820.nr_map = nr_map;
517 printk(KERN_INFO "modified physical RAM map:\n");
518 e820_print_map("modified");
519}
520static void __init update_e820_saved(void)
521{
522 int nr_map;
523
524 nr_map = e820_saved.nr_map;
525 if (sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), &nr_map))
526 return;
527 e820_saved.nr_map = nr_map;
528}
529#define MAX_GAP_END 0x100000000ull
530/*
531 * Search for a gap in the e820 memory space from start_addr to end_addr.
532 */
533__init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
534 unsigned long start_addr, unsigned long long end_addr)
535{
536 unsigned long long last;
537 int i = e820.nr_map;
538 int found = 0;
539
540 last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END;
541
542 while (--i >= 0) {
543 unsigned long long start = e820.map[i].addr;
544 unsigned long long end = start + e820.map[i].size;
545
546 if (end < start_addr)
547 continue;
548
549 /*
550 * Since "last" is at most 4GB, we know we'll
551 * fit in 32 bits if this condition is true
552 */
553 if (last > end) {
554 unsigned long gap = last - end;
555
556 if (gap >= *gapsize) {
557 *gapsize = gap;
558 *gapstart = end;
559 found = 1;
560 }
561 }
562 if (start < last)
563 last = start;
564 }
565 return found;
566}
567
568/*
569 * Search for the biggest gap in the low 32 bits of the e820
570 * memory space. We pass this space to PCI to assign MMIO resources
571 * for hotplug or unconfigured devices in.
572 * Hopefully the BIOS let enough space left.
573 */
574__init void e820_setup_gap(void)
575{
576 unsigned long gapstart, gapsize, round;
577 int found;
578
579 gapstart = 0x10000000;
580 gapsize = 0x400000;
581 found = e820_search_gap(&gapstart, &gapsize, 0, MAX_GAP_END);
582
583#ifdef CONFIG_X86_64
584 if (!found) {
585 gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024;
586 printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit "
587 "address range\n"
588 KERN_ERR "PCI: Unassigned devices with 32bit resource "
589 "registers may break!\n");
590 }
591#endif
592
593 /*
594 * See how much we want to round up: start off with
595 * rounding to the next 1MB area.
596 */
597 round = 0x100000;
598 while ((gapsize >> 4) > round)
599 round += round;
600 /* Fun with two's complement */
601 pci_mem_start = (gapstart + round) & -round;
602
603 printk(KERN_INFO
604 "Allocating PCI resources starting at %lx (gap: %lx:%lx)\n",
605 pci_mem_start, gapstart, gapsize);
606}
607
608/**
609 * Because of the size limitation of struct boot_params, only first
610 * 128 E820 memory entries are passed to kernel via
611 * boot_params.e820_map, others are passed via SETUP_E820_EXT node of
612 * linked list of struct setup_data, which is parsed here.
613 */
614void __init parse_e820_ext(struct setup_data *sdata, unsigned long pa_data)
615{
616 u32 map_len;
617 int entries;
618 struct e820entry *extmap;
619
620 entries = sdata->len / sizeof(struct e820entry);
621 map_len = sdata->len + sizeof(struct setup_data);
622 if (map_len > PAGE_SIZE)
623 sdata = early_ioremap(pa_data, map_len);
624 extmap = (struct e820entry *)(sdata->data);
625 __append_e820_map(extmap, entries);
626 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
627 if (map_len > PAGE_SIZE)
628 early_iounmap(sdata, map_len);
629 printk(KERN_INFO "extended physical RAM map:\n");
630 e820_print_map("extended");
631}
632
633#if defined(CONFIG_X86_64) || \
634 (defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
635/**
636 * Find the ranges of physical addresses that do not correspond to
637 * e820 RAM areas and mark the corresponding pages as nosave for
638 * hibernation (32 bit) or software suspend and suspend to RAM (64 bit).
639 *
640 * This function requires the e820 map to be sorted and without any
641 * overlapping entries and assumes the first e820 area to be RAM.
642 */
643void __init e820_mark_nosave_regions(unsigned long limit_pfn)
644{
645 int i;
646 unsigned long pfn;
647
648 pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
649 for (i = 1; i < e820.nr_map; i++) {
650 struct e820entry *ei = &e820.map[i];
651
652 if (pfn < PFN_UP(ei->addr))
653 register_nosave_region(pfn, PFN_UP(ei->addr));
654
655 pfn = PFN_DOWN(ei->addr + ei->size);
656 if (ei->type != E820_RAM && ei->type != E820_RESERVED_KERN)
657 register_nosave_region(PFN_UP(ei->addr), pfn);
658
659 if (pfn >= limit_pfn)
660 break;
661 }
662}
663#endif
664
665/*
666 * Early reserved memory areas.
667 */
668#define MAX_EARLY_RES 20
669
670struct early_res {
671 u64 start, end;
672 char name[16];
673 char overlap_ok;
674};
675static struct early_res early_res[MAX_EARLY_RES] __initdata = {
676 { 0, PAGE_SIZE, "BIOS data page" }, /* BIOS data page */
677#if defined(CONFIG_X86_64) && defined(CONFIG_X86_TRAMPOLINE)
678 { TRAMPOLINE_BASE, TRAMPOLINE_BASE + 2 * PAGE_SIZE, "TRAMPOLINE" },
679#endif
680#if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
681 /*
682 * But first pinch a few for the stack/trampoline stuff
683 * FIXME: Don't need the extra page at 4K, but need to fix
684 * trampoline before removing it. (see the GDT stuff)
685 */
686 { PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE" },
687 /*
688 * Has to be in very low memory so we can execute
689 * real-mode AP code.
690 */
691 { TRAMPOLINE_BASE, TRAMPOLINE_BASE + PAGE_SIZE, "TRAMPOLINE" },
692#endif
693 {}
694};
695
696static int __init find_overlapped_early(u64 start, u64 end)
697{
698 int i;
699 struct early_res *r;
700
701 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
702 r = &early_res[i];
703 if (end > r->start && start < r->end)
704 break;
705 }
706
707 return i;
708}
709
710/*
711 * Drop the i-th range from the early reservation map,
712 * by copying any higher ranges down one over it, and
713 * clearing what had been the last slot.
714 */
715static void __init drop_range(int i)
716{
717 int j;
718
719 for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++)
720 ;
721
722 memmove(&early_res[i], &early_res[i + 1],
723 (j - 1 - i) * sizeof(struct early_res));
724
725 early_res[j - 1].end = 0;
726}
727
728/*
729 * Split any existing ranges that:
730 * 1) are marked 'overlap_ok', and
731 * 2) overlap with the stated range [start, end)
732 * into whatever portion (if any) of the existing range is entirely
733 * below or entirely above the stated range. Drop the portion
734 * of the existing range that overlaps with the stated range,
735 * which will allow the caller of this routine to then add that
736 * stated range without conflicting with any existing range.
737 */
738static void __init drop_overlaps_that_are_ok(u64 start, u64 end)
739{
740 int i;
741 struct early_res *r;
742 u64 lower_start, lower_end;
743 u64 upper_start, upper_end;
744 char name[16];
745
746 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
747 r = &early_res[i];
748
749 /* Continue past non-overlapping ranges */
750 if (end <= r->start || start >= r->end)
751 continue;
752
753 /*
754 * Leave non-ok overlaps as is; let caller
755 * panic "Overlapping early reservations"
756 * when it hits this overlap.
757 */
758 if (!r->overlap_ok)
759 return;
760
761 /*
762 * We have an ok overlap. We will drop it from the early
763 * reservation map, and add back in any non-overlapping
764 * portions (lower or upper) as separate, overlap_ok,
765 * non-overlapping ranges.
766 */
767
768 /* 1. Note any non-overlapping (lower or upper) ranges. */
769 strncpy(name, r->name, sizeof(name) - 1);
770
771 lower_start = lower_end = 0;
772 upper_start = upper_end = 0;
773 if (r->start < start) {
774 lower_start = r->start;
775 lower_end = start;
776 }
777 if (r->end > end) {
778 upper_start = end;
779 upper_end = r->end;
780 }
781
782 /* 2. Drop the original ok overlapping range */
783 drop_range(i);
784
785 i--; /* resume for-loop on copied down entry */
786
787 /* 3. Add back in any non-overlapping ranges. */
788 if (lower_end)
789 reserve_early_overlap_ok(lower_start, lower_end, name);
790 if (upper_end)
791 reserve_early_overlap_ok(upper_start, upper_end, name);
792 }
793}
794
795static void __init __reserve_early(u64 start, u64 end, char *name,
796 int overlap_ok)
797{
798 int i;
799 struct early_res *r;
800
801 i = find_overlapped_early(start, end);
802 if (i >= MAX_EARLY_RES)
803 panic("Too many early reservations");
804 r = &early_res[i];
805 if (r->end)
806 panic("Overlapping early reservations "
807 "%llx-%llx %s to %llx-%llx %s\n",
808 start, end - 1, name?name:"", r->start,
809 r->end - 1, r->name);
810 r->start = start;
811 r->end = end;
812 r->overlap_ok = overlap_ok;
813 if (name)
814 strncpy(r->name, name, sizeof(r->name) - 1);
815}
816
817/*
818 * A few early reservtations come here.
819 *
820 * The 'overlap_ok' in the name of this routine does -not- mean it
821 * is ok for these reservations to overlap an earlier reservation.
822 * Rather it means that it is ok for subsequent reservations to
823 * overlap this one.
824 *
825 * Use this entry point to reserve early ranges when you are doing
826 * so out of "Paranoia", reserving perhaps more memory than you need,
827 * just in case, and don't mind a subsequent overlapping reservation
828 * that is known to be needed.
829 *
830 * The drop_overlaps_that_are_ok() call here isn't really needed.
831 * It would be needed if we had two colliding 'overlap_ok'
832 * reservations, so that the second such would not panic on the
833 * overlap with the first. We don't have any such as of this
834 * writing, but might as well tolerate such if it happens in
835 * the future.
836 */
837void __init reserve_early_overlap_ok(u64 start, u64 end, char *name)
838{
839 drop_overlaps_that_are_ok(start, end);
840 __reserve_early(start, end, name, 1);
841}
842
843/*
844 * Most early reservations come here.
845 *
846 * We first have drop_overlaps_that_are_ok() drop any pre-existing
847 * 'overlap_ok' ranges, so that we can then reserve this memory
848 * range without risk of panic'ing on an overlapping overlap_ok
849 * early reservation.
850 */
851void __init reserve_early(u64 start, u64 end, char *name)
852{
853 drop_overlaps_that_are_ok(start, end);
854 __reserve_early(start, end, name, 0);
855}
856
857void __init free_early(u64 start, u64 end)
858{
859 struct early_res *r;
860 int i;
861
862 i = find_overlapped_early(start, end);
863 r = &early_res[i];
864 if (i >= MAX_EARLY_RES || r->end != end || r->start != start)
865 panic("free_early on not reserved area: %llx-%llx!",
866 start, end - 1);
867
868 drop_range(i);
869}
870
871void __init early_res_to_bootmem(u64 start, u64 end)
872{
873 int i, count;
874 u64 final_start, final_end;
875
876 count = 0;
877 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++)
878 count++;
879
880 printk(KERN_INFO "(%d early reservations) ==> bootmem\n", count);
881 for (i = 0; i < count; i++) {
882 struct early_res *r = &early_res[i];
883 printk(KERN_INFO " #%d [%010llx - %010llx] %16s", i,
884 r->start, r->end, r->name);
885 final_start = max(start, r->start);
886 final_end = min(end, r->end);
887 if (final_start >= final_end) {
888 printk(KERN_CONT "\n");
889 continue;
890 }
891 printk(KERN_CONT " ==> [%010llx - %010llx]\n",
892 final_start, final_end);
893 reserve_bootmem_generic(final_start, final_end - final_start,
894 BOOTMEM_DEFAULT);
895 }
896}
897
898/* Check for already reserved areas */
899static inline int __init bad_addr(u64 *addrp, u64 size, u64 align)
900{
901 int i;
902 u64 addr = *addrp;
903 int changed = 0;
904 struct early_res *r;
905again:
906 i = find_overlapped_early(addr, addr + size);
907 r = &early_res[i];
908 if (i < MAX_EARLY_RES && r->end) {
909 *addrp = addr = round_up(r->end, align);
910 changed = 1;
911 goto again;
912 }
913 return changed;
914}
915
916/* Check for already reserved areas */
917static inline int __init bad_addr_size(u64 *addrp, u64 *sizep, u64 align)
918{
919 int i;
920 u64 addr = *addrp, last;
921 u64 size = *sizep;
922 int changed = 0;
923again:
924 last = addr + size;
925 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
926 struct early_res *r = &early_res[i];
927 if (last > r->start && addr < r->start) {
928 size = r->start - addr;
929 changed = 1;
930 goto again;
931 }
932 if (last > r->end && addr < r->end) {
933 addr = round_up(r->end, align);
934 size = last - addr;
935 changed = 1;
936 goto again;
937 }
938 if (last <= r->end && addr >= r->start) {
939 (*sizep)++;
940 return 0;
941 }
942 }
943 if (changed) {
944 *addrp = addr;
945 *sizep = size;
946 }
947 return changed;
948}
949
950/*
951 * Find a free area with specified alignment in a specific range.
952 */
953u64 __init find_e820_area(u64 start, u64 end, u64 size, u64 align)
954{
955 int i;
956
957 for (i = 0; i < e820.nr_map; i++) {
958 struct e820entry *ei = &e820.map[i];
959 u64 addr, last;
960 u64 ei_last;
961
962 if (ei->type != E820_RAM)
963 continue;
964 addr = round_up(ei->addr, align);
965 ei_last = ei->addr + ei->size;
966 if (addr < start)
967 addr = round_up(start, align);
968 if (addr >= ei_last)
969 continue;
970 while (bad_addr(&addr, size, align) && addr+size <= ei_last)
971 ;
972 last = addr + size;
973 if (last > ei_last)
974 continue;
975 if (last > end)
976 continue;
977 return addr;
978 }
979 return -1ULL;
980}
981
982/*
983 * Find next free range after *start
984 */
985u64 __init find_e820_area_size(u64 start, u64 *sizep, u64 align)
986{
987 int i;
988
989 for (i = 0; i < e820.nr_map; i++) {
990 struct e820entry *ei = &e820.map[i];
991 u64 addr, last;
992 u64 ei_last;
993
994 if (ei->type != E820_RAM)
995 continue;
996 addr = round_up(ei->addr, align);
997 ei_last = ei->addr + ei->size;
998 if (addr < start)
999 addr = round_up(start, align);
1000 if (addr >= ei_last)
1001 continue;
1002 *sizep = ei_last - addr;
1003 while (bad_addr_size(&addr, sizep, align) &&
1004 addr + *sizep <= ei_last)
1005 ;
1006 last = addr + *sizep;
1007 if (last > ei_last)
1008 continue;
1009 return addr;
1010 }
1011 return -1UL;
1012
1013}
1014
1015/*
1016 * pre allocated 4k and reserved it in e820
1017 */
1018u64 __init early_reserve_e820(u64 startt, u64 sizet, u64 align)
1019{
1020 u64 size = 0;
1021 u64 addr;
1022 u64 start;
1023
1024 start = startt;
1025 while (size < sizet)
1026 start = find_e820_area_size(start, &size, align);
1027
1028 if (size < sizet)
1029 return 0;
1030
1031 addr = round_down(start + size - sizet, align);
1032 e820_update_range(addr, sizet, E820_RAM, E820_RESERVED);
1033 e820_update_range_saved(addr, sizet, E820_RAM, E820_RESERVED);
1034 printk(KERN_INFO "update e820 for early_reserve_e820\n");
1035 update_e820();
1036 update_e820_saved();
1037
1038 return addr;
1039}
1040
1041#ifdef CONFIG_X86_32
1042# ifdef CONFIG_X86_PAE
1043# define MAX_ARCH_PFN (1ULL<<(36-PAGE_SHIFT))
1044# else
1045# define MAX_ARCH_PFN (1ULL<<(32-PAGE_SHIFT))
1046# endif
1047#else /* CONFIG_X86_32 */
1048# define MAX_ARCH_PFN MAXMEM>>PAGE_SHIFT
1049#endif
1050
1051/*
1052 * Find the highest page frame number we have available
1053 */
1054static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
1055{
1056 int i;
1057 unsigned long last_pfn = 0;
1058 unsigned long max_arch_pfn = MAX_ARCH_PFN;
1059
1060 for (i = 0; i < e820.nr_map; i++) {
1061 struct e820entry *ei = &e820.map[i];
1062 unsigned long start_pfn;
1063 unsigned long end_pfn;
1064
1065 if (ei->type != type)
1066 continue;
1067
1068 start_pfn = ei->addr >> PAGE_SHIFT;
1069 end_pfn = (ei->addr + ei->size) >> PAGE_SHIFT;
1070
1071 if (start_pfn >= limit_pfn)
1072 continue;
1073 if (end_pfn > limit_pfn) {
1074 last_pfn = limit_pfn;
1075 break;
1076 }
1077 if (end_pfn > last_pfn)
1078 last_pfn = end_pfn;
1079 }
1080
1081 if (last_pfn > max_arch_pfn)
1082 last_pfn = max_arch_pfn;
1083
1084 printk(KERN_INFO "last_pfn = %#lx max_arch_pfn = %#lx\n",
1085 last_pfn, max_arch_pfn);
1086 return last_pfn;
1087}
1088unsigned long __init e820_end_of_ram_pfn(void)
1089{
1090 return e820_end_pfn(MAX_ARCH_PFN, E820_RAM);
1091}
1092
1093unsigned long __init e820_end_of_low_ram_pfn(void)
1094{
1095 return e820_end_pfn(1UL<<(32 - PAGE_SHIFT), E820_RAM);
1096}
1097/*
1098 * Finds an active region in the address range from start_pfn to last_pfn and
1099 * returns its range in ei_startpfn and ei_endpfn for the e820 entry.
1100 */
1101int __init e820_find_active_region(const struct e820entry *ei,
1102 unsigned long start_pfn,
1103 unsigned long last_pfn,
1104 unsigned long *ei_startpfn,
1105 unsigned long *ei_endpfn)
1106{
1107 u64 align = PAGE_SIZE;
1108
1109 *ei_startpfn = round_up(ei->addr, align) >> PAGE_SHIFT;
1110 *ei_endpfn = round_down(ei->addr + ei->size, align) >> PAGE_SHIFT;
1111
1112 /* Skip map entries smaller than a page */
1113 if (*ei_startpfn >= *ei_endpfn)
1114 return 0;
1115
1116 /* Skip if map is outside the node */
1117 if (ei->type != E820_RAM || *ei_endpfn <= start_pfn ||
1118 *ei_startpfn >= last_pfn)
1119 return 0;
1120
1121 /* Check for overlaps */
1122 if (*ei_startpfn < start_pfn)
1123 *ei_startpfn = start_pfn;
1124 if (*ei_endpfn > last_pfn)
1125 *ei_endpfn = last_pfn;
1126
1127 return 1;
1128}
1129
1130/* Walk the e820 map and register active regions within a node */
1131void __init e820_register_active_regions(int nid, unsigned long start_pfn,
1132 unsigned long last_pfn)
1133{
1134 unsigned long ei_startpfn;
1135 unsigned long ei_endpfn;
1136 int i;
1137
1138 for (i = 0; i < e820.nr_map; i++)
1139 if (e820_find_active_region(&e820.map[i],
1140 start_pfn, last_pfn,
1141 &ei_startpfn, &ei_endpfn))
1142 add_active_range(nid, ei_startpfn, ei_endpfn);
1143}
1144
1145/*
1146 * Find the hole size (in bytes) in the memory range.
1147 * @start: starting address of the memory range to scan
1148 * @end: ending address of the memory range to scan
1149 */
1150u64 __init e820_hole_size(u64 start, u64 end)
1151{
1152 unsigned long start_pfn = start >> PAGE_SHIFT;
1153 unsigned long last_pfn = end >> PAGE_SHIFT;
1154 unsigned long ei_startpfn, ei_endpfn, ram = 0;
1155 int i;
1156
1157 for (i = 0; i < e820.nr_map; i++) {
1158 if (e820_find_active_region(&e820.map[i],
1159 start_pfn, last_pfn,
1160 &ei_startpfn, &ei_endpfn))
1161 ram += ei_endpfn - ei_startpfn;
1162 }
1163 return end - start - ((u64)ram << PAGE_SHIFT);
1164}
1165
1166static void early_panic(char *msg)
1167{
1168 early_printk(msg);
1169 panic(msg);
1170}
1171
1172static int userdef __initdata;
1173
1174/* "mem=nopentium" disables the 4MB page tables. */
1175static int __init parse_memopt(char *p)
1176{
1177 u64 mem_size;
1178
1179 if (!p)
1180 return -EINVAL;
1181
1182#ifdef CONFIG_X86_32
1183 if (!strcmp(p, "nopentium")) {
1184 setup_clear_cpu_cap(X86_FEATURE_PSE);
1185 return 0;
1186 }
1187#endif
1188
1189 userdef = 1;
1190 mem_size = memparse(p, &p);
1191 e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
1192
1193 return 0;
1194}
1195early_param("mem", parse_memopt);
1196
1197static int __init parse_memmap_opt(char *p)
1198{
1199 char *oldp;
1200 u64 start_at, mem_size;
1201
1202 if (!p)
1203 return -EINVAL;
1204
1205 if (!strcmp(p, "exactmap")) {
1206#ifdef CONFIG_CRASH_DUMP
1207 /*
1208 * If we are doing a crash dump, we still need to know
1209 * the real mem size before original memory map is
1210 * reset.
1211 */
1212 saved_max_pfn = e820_end_of_ram_pfn();
1213#endif
1214 e820.nr_map = 0;
1215 userdef = 1;
1216 return 0;
1217 }
1218
1219 oldp = p;
1220 mem_size = memparse(p, &p);
1221 if (p == oldp)
1222 return -EINVAL;
1223
1224 userdef = 1;
1225 if (*p == '@') {
1226 start_at = memparse(p+1, &p);
1227 e820_add_region(start_at, mem_size, E820_RAM);
1228 } else if (*p == '#') {
1229 start_at = memparse(p+1, &p);
1230 e820_add_region(start_at, mem_size, E820_ACPI);
1231 } else if (*p == '$') {
1232 start_at = memparse(p+1, &p);
1233 e820_add_region(start_at, mem_size, E820_RESERVED);
1234 } else
1235 e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
1236
1237 return *p == '\0' ? 0 : -EINVAL;
1238}
1239early_param("memmap", parse_memmap_opt);
1240
1241void __init finish_e820_parsing(void)
1242{
1243 if (userdef) {
1244 int nr = e820.nr_map;
1245
1246 if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0)
1247 early_panic("Invalid user supplied memory map");
1248 e820.nr_map = nr;
1249
1250 printk(KERN_INFO "user-defined physical RAM map:\n");
1251 e820_print_map("user");
1252 }
1253}
1254
1255static inline const char *e820_type_to_string(int e820_type)
1256{
1257 switch (e820_type) {
1258 case E820_RESERVED_KERN:
1259 case E820_RAM: return "System RAM";
1260 case E820_ACPI: return "ACPI Tables";
1261 case E820_NVS: return "ACPI Non-volatile Storage";
1262 default: return "reserved";
1263 }
1264}
1265
1266/*
1267 * Mark e820 reserved areas as busy for the resource manager.
1268 */
1269void __init e820_reserve_resources(void)
1270{
1271 int i;
1272 struct resource *res;
1273 u64 end;
1274
1275 res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
1276 for (i = 0; i < e820.nr_map; i++) {
1277 end = e820.map[i].addr + e820.map[i].size - 1;
1278#ifndef CONFIG_RESOURCES_64BIT
1279 if (end > 0x100000000ULL) {
1280 res++;
1281 continue;
1282 }
1283#endif
1284 res->name = e820_type_to_string(e820.map[i].type);
1285 res->start = e820.map[i].addr;
1286 res->end = end;
1287
1288 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
1289 insert_resource(&iomem_resource, res);
1290 res++;
1291 }
1292
1293 for (i = 0; i < e820_saved.nr_map; i++) {
1294 struct e820entry *entry = &e820_saved.map[i];
1295 firmware_map_add_early(entry->addr,
1296 entry->addr + entry->size - 1,
1297 e820_type_to_string(entry->type));
1298 }
1299}
1300
1301/*
1302 * Non-standard memory setup can be specified via this quirk:
1303 */
1304char * (*arch_memory_setup_quirk)(void);
1305
1306char *__init default_machine_specific_memory_setup(void)
1307{
1308 char *who = "BIOS-e820";
1309 int new_nr;
1310 /*
1311 * Try to copy the BIOS-supplied E820-map.
1312 *
1313 * Otherwise fake a memory map; one section from 0k->640k,
1314 * the next section from 1mb->appropriate_mem_k
1315 */
1316 new_nr = boot_params.e820_entries;
1317 sanitize_e820_map(boot_params.e820_map,
1318 ARRAY_SIZE(boot_params.e820_map),
1319 &new_nr);
1320 boot_params.e820_entries = new_nr;
1321 if (append_e820_map(boot_params.e820_map, boot_params.e820_entries)
1322 < 0) {
1323 u64 mem_size;
1324
1325 /* compare results from other methods and take the greater */
1326 if (boot_params.alt_mem_k
1327 < boot_params.screen_info.ext_mem_k) {
1328 mem_size = boot_params.screen_info.ext_mem_k;
1329 who = "BIOS-88";
1330 } else {
1331 mem_size = boot_params.alt_mem_k;
1332 who = "BIOS-e801";
1333 }
1334
1335 e820.nr_map = 0;
1336 e820_add_region(0, LOWMEMSIZE(), E820_RAM);
1337 e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
1338 }
1339
1340 /* In case someone cares... */
1341 return who;
1342}
1343
1344char *__init __attribute__((weak)) machine_specific_memory_setup(void)
1345{
1346 if (arch_memory_setup_quirk) {
1347 char *who = arch_memory_setup_quirk();
1348
1349 if (who)
1350 return who;
1351 }
1352 return default_machine_specific_memory_setup();
1353}
1354
1355/* Overridden in paravirt.c if CONFIG_PARAVIRT */
1356char * __init __attribute__((weak)) memory_setup(void)
1357{
1358 return machine_specific_memory_setup();
1359}
1360
1361void __init setup_memory_map(void)
1362{
1363 char *who;
1364
1365 who = memory_setup();
1366 memcpy(&e820_saved, &e820, sizeof(struct e820map));
1367 printk(KERN_INFO "BIOS-provided physical RAM map:\n");
1368 e820_print_map(who);
1369}
1370
1371#ifdef CONFIG_X86_64
1372int __init arch_get_ram_range(int slot, u64 *addr, u64 *size)
1373{
1374 int i;
1375
1376 if (slot < 0 || slot >= e820.nr_map)
1377 return -1;
1378 for (i = slot; i < e820.nr_map; i++) {
1379 if (e820.map[i].type != E820_RAM)
1380 continue;
1381 break;
1382 }
1383 if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT))
1384 return -1;
1385 *addr = e820.map[i].addr;
1386 *size = min_t(u64, e820.map[i].size + e820.map[i].addr,
1387 max_pfn << PAGE_SHIFT) - *addr;
1388 return i + 1;
1389}
1390#endif
diff --git a/arch/x86/kernel/e820_32.c b/arch/x86/kernel/e820_32.c
deleted file mode 100644
index ed733e7cf4e6..000000000000
--- a/arch/x86/kernel/e820_32.c
+++ /dev/null
@@ -1,775 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/types.h>
3#include <linux/init.h>
4#include <linux/bootmem.h>
5#include <linux/ioport.h>
6#include <linux/string.h>
7#include <linux/kexec.h>
8#include <linux/module.h>
9#include <linux/mm.h>
10#include <linux/pfn.h>
11#include <linux/uaccess.h>
12#include <linux/suspend.h>
13
14#include <asm/pgtable.h>
15#include <asm/page.h>
16#include <asm/e820.h>
17#include <asm/setup.h>
18
19struct e820map e820;
20struct change_member {
21 struct e820entry *pbios; /* pointer to original bios entry */
22 unsigned long long addr; /* address for this change point */
23};
24static struct change_member change_point_list[2*E820MAX] __initdata;
25static struct change_member *change_point[2*E820MAX] __initdata;
26static struct e820entry *overlap_list[E820MAX] __initdata;
27static struct e820entry new_bios[E820MAX] __initdata;
28/* For PCI or other memory-mapped resources */
29unsigned long pci_mem_start = 0x10000000;
30#ifdef CONFIG_PCI
31EXPORT_SYMBOL(pci_mem_start);
32#endif
33extern int user_defined_memmap;
34
35static struct resource system_rom_resource = {
36 .name = "System ROM",
37 .start = 0xf0000,
38 .end = 0xfffff,
39 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
40};
41
42static struct resource extension_rom_resource = {
43 .name = "Extension ROM",
44 .start = 0xe0000,
45 .end = 0xeffff,
46 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
47};
48
49static struct resource adapter_rom_resources[] = { {
50 .name = "Adapter ROM",
51 .start = 0xc8000,
52 .end = 0,
53 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
54}, {
55 .name = "Adapter ROM",
56 .start = 0,
57 .end = 0,
58 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
59}, {
60 .name = "Adapter ROM",
61 .start = 0,
62 .end = 0,
63 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
64}, {
65 .name = "Adapter ROM",
66 .start = 0,
67 .end = 0,
68 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
69}, {
70 .name = "Adapter ROM",
71 .start = 0,
72 .end = 0,
73 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
74}, {
75 .name = "Adapter ROM",
76 .start = 0,
77 .end = 0,
78 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
79} };
80
81static struct resource video_rom_resource = {
82 .name = "Video ROM",
83 .start = 0xc0000,
84 .end = 0xc7fff,
85 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
86};
87
88#define ROMSIGNATURE 0xaa55
89
90static int __init romsignature(const unsigned char *rom)
91{
92 const unsigned short * const ptr = (const unsigned short *)rom;
93 unsigned short sig;
94
95 return probe_kernel_address(ptr, sig) == 0 && sig == ROMSIGNATURE;
96}
97
98static int __init romchecksum(const unsigned char *rom, unsigned long length)
99{
100 unsigned char sum, c;
101
102 for (sum = 0; length && probe_kernel_address(rom++, c) == 0; length--)
103 sum += c;
104 return !length && !sum;
105}
106
107static void __init probe_roms(void)
108{
109 const unsigned char *rom;
110 unsigned long start, length, upper;
111 unsigned char c;
112 int i;
113
114 /* video rom */
115 upper = adapter_rom_resources[0].start;
116 for (start = video_rom_resource.start; start < upper; start += 2048) {
117 rom = isa_bus_to_virt(start);
118 if (!romsignature(rom))
119 continue;
120
121 video_rom_resource.start = start;
122
123 if (probe_kernel_address(rom + 2, c) != 0)
124 continue;
125
126 /* 0 < length <= 0x7f * 512, historically */
127 length = c * 512;
128
129 /* if checksum okay, trust length byte */
130 if (length && romchecksum(rom, length))
131 video_rom_resource.end = start + length - 1;
132
133 request_resource(&iomem_resource, &video_rom_resource);
134 break;
135 }
136
137 start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
138 if (start < upper)
139 start = upper;
140
141 /* system rom */
142 request_resource(&iomem_resource, &system_rom_resource);
143 upper = system_rom_resource.start;
144
145 /* check for extension rom (ignore length byte!) */
146 rom = isa_bus_to_virt(extension_rom_resource.start);
147 if (romsignature(rom)) {
148 length = extension_rom_resource.end - extension_rom_resource.start + 1;
149 if (romchecksum(rom, length)) {
150 request_resource(&iomem_resource, &extension_rom_resource);
151 upper = extension_rom_resource.start;
152 }
153 }
154
155 /* check for adapter roms on 2k boundaries */
156 for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) {
157 rom = isa_bus_to_virt(start);
158 if (!romsignature(rom))
159 continue;
160
161 if (probe_kernel_address(rom + 2, c) != 0)
162 continue;
163
164 /* 0 < length <= 0x7f * 512, historically */
165 length = c * 512;
166
167 /* but accept any length that fits if checksum okay */
168 if (!length || start + length > upper || !romchecksum(rom, length))
169 continue;
170
171 adapter_rom_resources[i].start = start;
172 adapter_rom_resources[i].end = start + length - 1;
173 request_resource(&iomem_resource, &adapter_rom_resources[i]);
174
175 start = adapter_rom_resources[i++].end & ~2047UL;
176 }
177}
178
179/*
180 * Request address space for all standard RAM and ROM resources
181 * and also for regions reported as reserved by the e820.
182 */
183void __init init_iomem_resources(struct resource *code_resource,
184 struct resource *data_resource,
185 struct resource *bss_resource)
186{
187 int i;
188
189 probe_roms();
190 for (i = 0; i < e820.nr_map; i++) {
191 struct resource *res;
192#ifndef CONFIG_RESOURCES_64BIT
193 if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
194 continue;
195#endif
196 res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
197 switch (e820.map[i].type) {
198 case E820_RAM: res->name = "System RAM"; break;
199 case E820_ACPI: res->name = "ACPI Tables"; break;
200 case E820_NVS: res->name = "ACPI Non-volatile Storage"; break;
201 default: res->name = "reserved";
202 }
203 res->start = e820.map[i].addr;
204 res->end = res->start + e820.map[i].size - 1;
205 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
206 if (request_resource(&iomem_resource, res)) {
207 kfree(res);
208 continue;
209 }
210 if (e820.map[i].type == E820_RAM) {
211 /*
212 * We don't know which RAM region contains kernel data,
213 * so we try it repeatedly and let the resource manager
214 * test it.
215 */
216 request_resource(res, code_resource);
217 request_resource(res, data_resource);
218 request_resource(res, bss_resource);
219#ifdef CONFIG_KEXEC
220 if (crashk_res.start != crashk_res.end)
221 request_resource(res, &crashk_res);
222#endif
223 }
224 }
225}
226
227#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
228/**
229 * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
230 * correspond to e820 RAM areas and mark the corresponding pages as nosave for
231 * hibernation.
232 *
233 * This function requires the e820 map to be sorted and without any
234 * overlapping entries and assumes the first e820 area to be RAM.
235 */
236void __init e820_mark_nosave_regions(void)
237{
238 int i;
239 unsigned long pfn;
240
241 pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
242 for (i = 1; i < e820.nr_map; i++) {
243 struct e820entry *ei = &e820.map[i];
244
245 if (pfn < PFN_UP(ei->addr))
246 register_nosave_region(pfn, PFN_UP(ei->addr));
247
248 pfn = PFN_DOWN(ei->addr + ei->size);
249 if (ei->type != E820_RAM)
250 register_nosave_region(PFN_UP(ei->addr), pfn);
251
252 if (pfn >= max_low_pfn)
253 break;
254 }
255}
256#endif
257
258void __init add_memory_region(unsigned long long start,
259 unsigned long long size, int type)
260{
261 int x;
262
263 x = e820.nr_map;
264
265 if (x == E820MAX) {
266 printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
267 return;
268 }
269
270 e820.map[x].addr = start;
271 e820.map[x].size = size;
272 e820.map[x].type = type;
273 e820.nr_map++;
274} /* add_memory_region */
275
276/*
277 * Sanitize the BIOS e820 map.
278 *
279 * Some e820 responses include overlapping entries. The following
280 * replaces the original e820 map with a new one, removing overlaps.
281 *
282 */
283int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
284{
285 struct change_member *change_tmp;
286 unsigned long current_type, last_type;
287 unsigned long long last_addr;
288 int chgidx, still_changing;
289 int overlap_entries;
290 int new_bios_entry;
291 int old_nr, new_nr, chg_nr;
292 int i;
293
294 /*
295 Visually we're performing the following (1,2,3,4 = memory types)...
296
297 Sample memory map (w/overlaps):
298 ____22__________________
299 ______________________4_
300 ____1111________________
301 _44_____________________
302 11111111________________
303 ____________________33__
304 ___________44___________
305 __________33333_________
306 ______________22________
307 ___________________2222_
308 _________111111111______
309 _____________________11_
310 _________________4______
311
312 Sanitized equivalent (no overlap):
313 1_______________________
314 _44_____________________
315 ___1____________________
316 ____22__________________
317 ______11________________
318 _________1______________
319 __________3_____________
320 ___________44___________
321 _____________33_________
322 _______________2________
323 ________________1_______
324 _________________4______
325 ___________________2____
326 ____________________33__
327 ______________________4_
328 */
329 /* if there's only one memory region, don't bother */
330 if (*pnr_map < 2) {
331 return -1;
332 }
333
334 old_nr = *pnr_map;
335
336 /* bail out if we find any unreasonable addresses in bios map */
337 for (i=0; i<old_nr; i++)
338 if (biosmap[i].addr + biosmap[i].size < biosmap[i].addr) {
339 return -1;
340 }
341
342 /* create pointers for initial change-point information (for sorting) */
343 for (i=0; i < 2*old_nr; i++)
344 change_point[i] = &change_point_list[i];
345
346 /* record all known change-points (starting and ending addresses),
347 omitting those that are for empty memory regions */
348 chgidx = 0;
349 for (i=0; i < old_nr; i++) {
350 if (biosmap[i].size != 0) {
351 change_point[chgidx]->addr = biosmap[i].addr;
352 change_point[chgidx++]->pbios = &biosmap[i];
353 change_point[chgidx]->addr = biosmap[i].addr + biosmap[i].size;
354 change_point[chgidx++]->pbios = &biosmap[i];
355 }
356 }
357 chg_nr = chgidx; /* true number of change-points */
358
359 /* sort change-point list by memory addresses (low -> high) */
360 still_changing = 1;
361 while (still_changing) {
362 still_changing = 0;
363 for (i=1; i < chg_nr; i++) {
364 /* if <current_addr> > <last_addr>, swap */
365 /* or, if current=<start_addr> & last=<end_addr>, swap */
366 if ((change_point[i]->addr < change_point[i-1]->addr) ||
367 ((change_point[i]->addr == change_point[i-1]->addr) &&
368 (change_point[i]->addr == change_point[i]->pbios->addr) &&
369 (change_point[i-1]->addr != change_point[i-1]->pbios->addr))
370 )
371 {
372 change_tmp = change_point[i];
373 change_point[i] = change_point[i-1];
374 change_point[i-1] = change_tmp;
375 still_changing=1;
376 }
377 }
378 }
379
380 /* create a new bios memory map, removing overlaps */
381 overlap_entries=0; /* number of entries in the overlap table */
382 new_bios_entry=0; /* index for creating new bios map entries */
383 last_type = 0; /* start with undefined memory type */
384 last_addr = 0; /* start with 0 as last starting address */
385 /* loop through change-points, determining affect on the new bios map */
386 for (chgidx=0; chgidx < chg_nr; chgidx++)
387 {
388 /* keep track of all overlapping bios entries */
389 if (change_point[chgidx]->addr == change_point[chgidx]->pbios->addr)
390 {
391 /* add map entry to overlap list (> 1 entry implies an overlap) */
392 overlap_list[overlap_entries++]=change_point[chgidx]->pbios;
393 }
394 else
395 {
396 /* remove entry from list (order independent, so swap with last) */
397 for (i=0; i<overlap_entries; i++)
398 {
399 if (overlap_list[i] == change_point[chgidx]->pbios)
400 overlap_list[i] = overlap_list[overlap_entries-1];
401 }
402 overlap_entries--;
403 }
404 /* if there are overlapping entries, decide which "type" to use */
405 /* (larger value takes precedence -- 1=usable, 2,3,4,4+=unusable) */
406 current_type = 0;
407 for (i=0; i<overlap_entries; i++)
408 if (overlap_list[i]->type > current_type)
409 current_type = overlap_list[i]->type;
410 /* continue building up new bios map based on this information */
411 if (current_type != last_type) {
412 if (last_type != 0) {
413 new_bios[new_bios_entry].size =
414 change_point[chgidx]->addr - last_addr;
415 /* move forward only if the new size was non-zero */
416 if (new_bios[new_bios_entry].size != 0)
417 if (++new_bios_entry >= E820MAX)
418 break; /* no more space left for new bios entries */
419 }
420 if (current_type != 0) {
421 new_bios[new_bios_entry].addr = change_point[chgidx]->addr;
422 new_bios[new_bios_entry].type = current_type;
423 last_addr=change_point[chgidx]->addr;
424 }
425 last_type = current_type;
426 }
427 }
428 new_nr = new_bios_entry; /* retain count for new bios entries */
429
430 /* copy new bios mapping into original location */
431 memcpy(biosmap, new_bios, new_nr*sizeof(struct e820entry));
432 *pnr_map = new_nr;
433
434 return 0;
435}
436
437/*
438 * Copy the BIOS e820 map into a safe place.
439 *
440 * Sanity-check it while we're at it..
441 *
442 * If we're lucky and live on a modern system, the setup code
443 * will have given us a memory map that we can use to properly
444 * set up memory. If we aren't, we'll fake a memory map.
445 *
446 * We check to see that the memory map contains at least 2 elements
447 * before we'll use it, because the detection code in setup.S may
448 * not be perfect and most every PC known to man has two memory
449 * regions: one from 0 to 640k, and one from 1mb up. (The IBM
450 * thinkpad 560x, for example, does not cooperate with the memory
451 * detection code.)
452 */
453int __init copy_e820_map(struct e820entry *biosmap, int nr_map)
454{
455 /* Only one memory region (or negative)? Ignore it */
456 if (nr_map < 2)
457 return -1;
458
459 do {
460 u64 start = biosmap->addr;
461 u64 size = biosmap->size;
462 u64 end = start + size;
463 u32 type = biosmap->type;
464
465 /* Overflow in 64 bits? Ignore the memory map. */
466 if (start > end)
467 return -1;
468
469 add_memory_region(start, size, type);
470 } while (biosmap++, --nr_map);
471
472 return 0;
473}
474
475/*
476 * Find the highest page frame number we have available
477 */
478void __init propagate_e820_map(void)
479{
480 int i;
481
482 max_pfn = 0;
483
484 for (i = 0; i < e820.nr_map; i++) {
485 unsigned long start, end;
486 /* RAM? */
487 if (e820.map[i].type != E820_RAM)
488 continue;
489 start = PFN_UP(e820.map[i].addr);
490 end = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
491 if (start >= end)
492 continue;
493 if (end > max_pfn)
494 max_pfn = end;
495 memory_present(0, start, end);
496 }
497}
498
499/*
500 * Register fully available low RAM pages with the bootmem allocator.
501 */
502void __init register_bootmem_low_pages(unsigned long max_low_pfn)
503{
504 int i;
505
506 for (i = 0; i < e820.nr_map; i++) {
507 unsigned long curr_pfn, last_pfn, size;
508 /*
509 * Reserve usable low memory
510 */
511 if (e820.map[i].type != E820_RAM)
512 continue;
513 /*
514 * We are rounding up the start address of usable memory:
515 */
516 curr_pfn = PFN_UP(e820.map[i].addr);
517 if (curr_pfn >= max_low_pfn)
518 continue;
519 /*
520 * ... and at the end of the usable range downwards:
521 */
522 last_pfn = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
523
524 if (last_pfn > max_low_pfn)
525 last_pfn = max_low_pfn;
526
527 /*
528 * .. finally, did all the rounding and playing
529 * around just make the area go away?
530 */
531 if (last_pfn <= curr_pfn)
532 continue;
533
534 size = last_pfn - curr_pfn;
535 free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
536 }
537}
538
539void __init e820_register_memory(void)
540{
541 unsigned long gapstart, gapsize, round;
542 unsigned long long last;
543 int i;
544
545 /*
546 * Search for the biggest gap in the low 32 bits of the e820
547 * memory space.
548 */
549 last = 0x100000000ull;
550 gapstart = 0x10000000;
551 gapsize = 0x400000;
552 i = e820.nr_map;
553 while (--i >= 0) {
554 unsigned long long start = e820.map[i].addr;
555 unsigned long long end = start + e820.map[i].size;
556
557 /*
558 * Since "last" is at most 4GB, we know we'll
559 * fit in 32 bits if this condition is true
560 */
561 if (last > end) {
562 unsigned long gap = last - end;
563
564 if (gap > gapsize) {
565 gapsize = gap;
566 gapstart = end;
567 }
568 }
569 if (start < last)
570 last = start;
571 }
572
573 /*
574 * See how much we want to round up: start off with
575 * rounding to the next 1MB area.
576 */
577 round = 0x100000;
578 while ((gapsize >> 4) > round)
579 round += round;
580 /* Fun with two's complement */
581 pci_mem_start = (gapstart + round) & -round;
582
583 printk("Allocating PCI resources starting at %08lx (gap: %08lx:%08lx)\n",
584 pci_mem_start, gapstart, gapsize);
585}
586
587void __init print_memory_map(char *who)
588{
589 int i;
590
591 for (i = 0; i < e820.nr_map; i++) {
592 printk(" %s: %016Lx - %016Lx ", who,
593 e820.map[i].addr,
594 e820.map[i].addr + e820.map[i].size);
595 switch (e820.map[i].type) {
596 case E820_RAM: printk("(usable)\n");
597 break;
598 case E820_RESERVED:
599 printk("(reserved)\n");
600 break;
601 case E820_ACPI:
602 printk("(ACPI data)\n");
603 break;
604 case E820_NVS:
605 printk("(ACPI NVS)\n");
606 break;
607 default: printk("type %u\n", e820.map[i].type);
608 break;
609 }
610 }
611}
612
613void __init limit_regions(unsigned long long size)
614{
615 unsigned long long current_addr;
616 int i;
617
618 print_memory_map("limit_regions start");
619 for (i = 0; i < e820.nr_map; i++) {
620 current_addr = e820.map[i].addr + e820.map[i].size;
621 if (current_addr < size)
622 continue;
623
624 if (e820.map[i].type != E820_RAM)
625 continue;
626
627 if (e820.map[i].addr >= size) {
628 /*
629 * This region starts past the end of the
630 * requested size, skip it completely.
631 */
632 e820.nr_map = i;
633 } else {
634 e820.nr_map = i + 1;
635 e820.map[i].size -= current_addr - size;
636 }
637 print_memory_map("limit_regions endfor");
638 return;
639 }
640 print_memory_map("limit_regions endfunc");
641}
642
643/*
644 * This function checks if any part of the range <start,end> is mapped
645 * with type.
646 */
647int
648e820_any_mapped(u64 start, u64 end, unsigned type)
649{
650 int i;
651 for (i = 0; i < e820.nr_map; i++) {
652 const struct e820entry *ei = &e820.map[i];
653 if (type && ei->type != type)
654 continue;
655 if (ei->addr >= end || ei->addr + ei->size <= start)
656 continue;
657 return 1;
658 }
659 return 0;
660}
661EXPORT_SYMBOL_GPL(e820_any_mapped);
662
663 /*
664 * This function checks if the entire range <start,end> is mapped with type.
665 *
666 * Note: this function only works correct if the e820 table is sorted and
667 * not-overlapping, which is the case
668 */
669int __init
670e820_all_mapped(unsigned long s, unsigned long e, unsigned type)
671{
672 u64 start = s;
673 u64 end = e;
674 int i;
675 for (i = 0; i < e820.nr_map; i++) {
676 struct e820entry *ei = &e820.map[i];
677 if (type && ei->type != type)
678 continue;
679 /* is the region (part) in overlap with the current region ?*/
680 if (ei->addr >= end || ei->addr + ei->size <= start)
681 continue;
682 /* if the region is at the beginning of <start,end> we move
683 * start to the end of the region since it's ok until there
684 */
685 if (ei->addr <= start)
686 start = ei->addr + ei->size;
687 /* if start is now at or beyond end, we're done, full
688 * coverage */
689 if (start >= end)
690 return 1; /* we're done */
691 }
692 return 0;
693}
694
695static int __init parse_memmap(char *arg)
696{
697 if (!arg)
698 return -EINVAL;
699
700 if (strcmp(arg, "exactmap") == 0) {
701#ifdef CONFIG_CRASH_DUMP
702 /* If we are doing a crash dump, we
703 * still need to know the real mem
704 * size before original memory map is
705 * reset.
706 */
707 propagate_e820_map();
708 saved_max_pfn = max_pfn;
709#endif
710 e820.nr_map = 0;
711 user_defined_memmap = 1;
712 } else {
713 /* If the user specifies memory size, we
714 * limit the BIOS-provided memory map to
715 * that size. exactmap can be used to specify
716 * the exact map. mem=number can be used to
717 * trim the existing memory map.
718 */
719 unsigned long long start_at, mem_size;
720
721 mem_size = memparse(arg, &arg);
722 if (*arg == '@') {
723 start_at = memparse(arg+1, &arg);
724 add_memory_region(start_at, mem_size, E820_RAM);
725 } else if (*arg == '#') {
726 start_at = memparse(arg+1, &arg);
727 add_memory_region(start_at, mem_size, E820_ACPI);
728 } else if (*arg == '$') {
729 start_at = memparse(arg+1, &arg);
730 add_memory_region(start_at, mem_size, E820_RESERVED);
731 } else {
732 limit_regions(mem_size);
733 user_defined_memmap = 1;
734 }
735 }
736 return 0;
737}
738early_param("memmap", parse_memmap);
739void __init update_memory_range(u64 start, u64 size, unsigned old_type,
740 unsigned new_type)
741{
742 int i;
743
744 BUG_ON(old_type == new_type);
745
746 for (i = 0; i < e820.nr_map; i++) {
747 struct e820entry *ei = &e820.map[i];
748 u64 final_start, final_end;
749 if (ei->type != old_type)
750 continue;
751 /* totally covered? */
752 if (ei->addr >= start && ei->size <= size) {
753 ei->type = new_type;
754 continue;
755 }
756 /* partially covered */
757 final_start = max(start, ei->addr);
758 final_end = min(start + size, ei->addr + ei->size);
759 if (final_start >= final_end)
760 continue;
761 add_memory_region(final_start, final_end - final_start,
762 new_type);
763 }
764}
765void __init update_e820(void)
766{
767 u8 nr_map;
768
769 nr_map = e820.nr_map;
770 if (sanitize_e820_map(e820.map, &nr_map))
771 return;
772 e820.nr_map = nr_map;
773 printk(KERN_INFO "modified physical RAM map:\n");
774 print_memory_map("modified");
775}
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
deleted file mode 100644
index 124480c0008d..000000000000
--- a/arch/x86/kernel/e820_64.c
+++ /dev/null
@@ -1,952 +0,0 @@
1/*
2 * Handle the memory map.
3 * The functions here do the job until bootmem takes over.
4 *
5 * Getting sanitize_e820_map() in sync with i386 version by applying change:
6 * - Provisions for empty E820 memory regions (reported by certain BIOSes).
7 * Alex Achenbach <xela@slit.de>, December 2002.
8 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
9 *
10 */
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/init.h>
14#include <linux/bootmem.h>
15#include <linux/ioport.h>
16#include <linux/string.h>
17#include <linux/kexec.h>
18#include <linux/module.h>
19#include <linux/mm.h>
20#include <linux/suspend.h>
21#include <linux/pfn.h>
22
23#include <asm/pgtable.h>
24#include <asm/page.h>
25#include <asm/e820.h>
26#include <asm/proto.h>
27#include <asm/setup.h>
28#include <asm/sections.h>
29#include <asm/kdebug.h>
30#include <asm/trampoline.h>
31
32struct e820map e820;
33
34/*
35 * PFN of last memory page.
36 */
37unsigned long end_pfn;
38
39/*
40 * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
41 * The direct mapping extends to max_pfn_mapped, so that we can directly access
42 * apertures, ACPI and other tables without having to play with fixmaps.
43 */
44unsigned long max_pfn_mapped;
45
46/*
47 * Last pfn which the user wants to use.
48 */
49static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT;
50
51/*
52 * Early reserved memory areas.
53 */
54#define MAX_EARLY_RES 20
55
56struct early_res {
57 unsigned long start, end;
58 char name[16];
59};
60static struct early_res early_res[MAX_EARLY_RES] __initdata = {
61 { 0, PAGE_SIZE, "BIOS data page" }, /* BIOS data page */
62#ifdef CONFIG_X86_TRAMPOLINE
63 { TRAMPOLINE_BASE, TRAMPOLINE_BASE + 2 * PAGE_SIZE, "TRAMPOLINE" },
64#endif
65 {}
66};
67
68void __init reserve_early(unsigned long start, unsigned long end, char *name)
69{
70 int i;
71 struct early_res *r;
72 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
73 r = &early_res[i];
74 if (end > r->start && start < r->end)
75 panic("Overlapping early reservations %lx-%lx %s to %lx-%lx %s\n",
76 start, end - 1, name?name:"", r->start, r->end - 1, r->name);
77 }
78 if (i >= MAX_EARLY_RES)
79 panic("Too many early reservations");
80 r = &early_res[i];
81 r->start = start;
82 r->end = end;
83 if (name)
84 strncpy(r->name, name, sizeof(r->name) - 1);
85}
86
87void __init free_early(unsigned long start, unsigned long end)
88{
89 struct early_res *r;
90 int i, j;
91
92 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
93 r = &early_res[i];
94 if (start == r->start && end == r->end)
95 break;
96 }
97 if (i >= MAX_EARLY_RES || !early_res[i].end)
98 panic("free_early on not reserved area: %lx-%lx!", start, end);
99
100 for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++)
101 ;
102
103 memmove(&early_res[i], &early_res[i + 1],
104 (j - 1 - i) * sizeof(struct early_res));
105
106 early_res[j - 1].end = 0;
107}
108
109void __init early_res_to_bootmem(unsigned long start, unsigned long end)
110{
111 int i;
112 unsigned long final_start, final_end;
113 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
114 struct early_res *r = &early_res[i];
115 final_start = max(start, r->start);
116 final_end = min(end, r->end);
117 if (final_start >= final_end)
118 continue;
119 printk(KERN_INFO " early res: %d [%lx-%lx] %s\n", i,
120 final_start, final_end - 1, r->name);
121 reserve_bootmem_generic(final_start, final_end - final_start);
122 }
123}
124
125/* Check for already reserved areas */
126static inline int __init
127bad_addr(unsigned long *addrp, unsigned long size, unsigned long align)
128{
129 int i;
130 unsigned long addr = *addrp, last;
131 int changed = 0;
132again:
133 last = addr + size;
134 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
135 struct early_res *r = &early_res[i];
136 if (last >= r->start && addr < r->end) {
137 *addrp = addr = round_up(r->end, align);
138 changed = 1;
139 goto again;
140 }
141 }
142 return changed;
143}
144
145/* Check for already reserved areas */
146static inline int __init
147bad_addr_size(unsigned long *addrp, unsigned long *sizep, unsigned long align)
148{
149 int i;
150 unsigned long addr = *addrp, last;
151 unsigned long size = *sizep;
152 int changed = 0;
153again:
154 last = addr + size;
155 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
156 struct early_res *r = &early_res[i];
157 if (last > r->start && addr < r->start) {
158 size = r->start - addr;
159 changed = 1;
160 goto again;
161 }
162 if (last > r->end && addr < r->end) {
163 addr = round_up(r->end, align);
164 size = last - addr;
165 changed = 1;
166 goto again;
167 }
168 if (last <= r->end && addr >= r->start) {
169 (*sizep)++;
170 return 0;
171 }
172 }
173 if (changed) {
174 *addrp = addr;
175 *sizep = size;
176 }
177 return changed;
178}
179/*
180 * This function checks if any part of the range <start,end> is mapped
181 * with type.
182 */
183int
184e820_any_mapped(unsigned long start, unsigned long end, unsigned type)
185{
186 int i;
187
188 for (i = 0; i < e820.nr_map; i++) {
189 struct e820entry *ei = &e820.map[i];
190
191 if (type && ei->type != type)
192 continue;
193 if (ei->addr >= end || ei->addr + ei->size <= start)
194 continue;
195 return 1;
196 }
197 return 0;
198}
199EXPORT_SYMBOL_GPL(e820_any_mapped);
200
201/*
202 * This function checks if the entire range <start,end> is mapped with type.
203 *
204 * Note: this function only works correct if the e820 table is sorted and
205 * not-overlapping, which is the case
206 */
207int __init e820_all_mapped(unsigned long start, unsigned long end,
208 unsigned type)
209{
210 int i;
211
212 for (i = 0; i < e820.nr_map; i++) {
213 struct e820entry *ei = &e820.map[i];
214
215 if (type && ei->type != type)
216 continue;
217 /* is the region (part) in overlap with the current region ?*/
218 if (ei->addr >= end || ei->addr + ei->size <= start)
219 continue;
220
221 /* if the region is at the beginning of <start,end> we move
222 * start to the end of the region since it's ok until there
223 */
224 if (ei->addr <= start)
225 start = ei->addr + ei->size;
226 /*
227 * if start is now at or beyond end, we're done, full
228 * coverage
229 */
230 if (start >= end)
231 return 1;
232 }
233 return 0;
234}
235
236/*
237 * Find a free area with specified alignment in a specific range.
238 */
239unsigned long __init find_e820_area(unsigned long start, unsigned long end,
240 unsigned long size, unsigned long align)
241{
242 int i;
243
244 for (i = 0; i < e820.nr_map; i++) {
245 struct e820entry *ei = &e820.map[i];
246 unsigned long addr, last;
247 unsigned long ei_last;
248
249 if (ei->type != E820_RAM)
250 continue;
251 addr = round_up(ei->addr, align);
252 ei_last = ei->addr + ei->size;
253 if (addr < start)
254 addr = round_up(start, align);
255 if (addr >= ei_last)
256 continue;
257 while (bad_addr(&addr, size, align) && addr+size <= ei_last)
258 ;
259 last = addr + size;
260 if (last > ei_last)
261 continue;
262 if (last > end)
263 continue;
264 return addr;
265 }
266 return -1UL;
267}
268
269/*
270 * Find next free range after *start
271 */
272unsigned long __init find_e820_area_size(unsigned long start,
273 unsigned long *sizep,
274 unsigned long align)
275{
276 int i;
277
278 for (i = 0; i < e820.nr_map; i++) {
279 struct e820entry *ei = &e820.map[i];
280 unsigned long addr, last;
281 unsigned long ei_last;
282
283 if (ei->type != E820_RAM)
284 continue;
285 addr = round_up(ei->addr, align);
286 ei_last = ei->addr + ei->size;
287 if (addr < start)
288 addr = round_up(start, align);
289 if (addr >= ei_last)
290 continue;
291 *sizep = ei_last - addr;
292 while (bad_addr_size(&addr, sizep, align) &&
293 addr + *sizep <= ei_last)
294 ;
295 last = addr + *sizep;
296 if (last > ei_last)
297 continue;
298 return addr;
299 }
300 return -1UL;
301
302}
303/*
304 * Find the highest page frame number we have available
305 */
306unsigned long __init e820_end_of_ram(void)
307{
308 unsigned long end_pfn;
309
310 end_pfn = find_max_pfn_with_active_regions();
311
312 if (end_pfn > max_pfn_mapped)
313 max_pfn_mapped = end_pfn;
314 if (max_pfn_mapped > MAXMEM>>PAGE_SHIFT)
315 max_pfn_mapped = MAXMEM>>PAGE_SHIFT;
316 if (end_pfn > end_user_pfn)
317 end_pfn = end_user_pfn;
318 if (end_pfn > max_pfn_mapped)
319 end_pfn = max_pfn_mapped;
320
321 printk(KERN_INFO "max_pfn_mapped = %lu\n", max_pfn_mapped);
322 return end_pfn;
323}
324
325/*
326 * Mark e820 reserved areas as busy for the resource manager.
327 */
328void __init e820_reserve_resources(void)
329{
330 int i;
331 struct resource *res;
332
333 res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
334 for (i = 0; i < e820.nr_map; i++) {
335 switch (e820.map[i].type) {
336 case E820_RAM: res->name = "System RAM"; break;
337 case E820_ACPI: res->name = "ACPI Tables"; break;
338 case E820_NVS: res->name = "ACPI Non-volatile Storage"; break;
339 default: res->name = "reserved";
340 }
341 res->start = e820.map[i].addr;
342 res->end = res->start + e820.map[i].size - 1;
343 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
344 insert_resource(&iomem_resource, res);
345 res++;
346 }
347}
348
349/*
350 * Find the ranges of physical addresses that do not correspond to
351 * e820 RAM areas and mark the corresponding pages as nosave for software
352 * suspend and suspend to RAM.
353 *
354 * This function requires the e820 map to be sorted and without any
355 * overlapping entries and assumes the first e820 area to be RAM.
356 */
357void __init e820_mark_nosave_regions(void)
358{
359 int i;
360 unsigned long paddr;
361
362 paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
363 for (i = 1; i < e820.nr_map; i++) {
364 struct e820entry *ei = &e820.map[i];
365
366 if (paddr < ei->addr)
367 register_nosave_region(PFN_DOWN(paddr),
368 PFN_UP(ei->addr));
369
370 paddr = round_down(ei->addr + ei->size, PAGE_SIZE);
371 if (ei->type != E820_RAM)
372 register_nosave_region(PFN_UP(ei->addr),
373 PFN_DOWN(paddr));
374
375 if (paddr >= (end_pfn << PAGE_SHIFT))
376 break;
377 }
378}
379
380/*
381 * Finds an active region in the address range from start_pfn to end_pfn and
382 * returns its range in ei_startpfn and ei_endpfn for the e820 entry.
383 */
384static int __init e820_find_active_region(const struct e820entry *ei,
385 unsigned long start_pfn,
386 unsigned long end_pfn,
387 unsigned long *ei_startpfn,
388 unsigned long *ei_endpfn)
389{
390 *ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
391 *ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) >> PAGE_SHIFT;
392
393 /* Skip map entries smaller than a page */
394 if (*ei_startpfn >= *ei_endpfn)
395 return 0;
396
397 /* Check if max_pfn_mapped should be updated */
398 if (ei->type != E820_RAM && *ei_endpfn > max_pfn_mapped)
399 max_pfn_mapped = *ei_endpfn;
400
401 /* Skip if map is outside the node */
402 if (ei->type != E820_RAM || *ei_endpfn <= start_pfn ||
403 *ei_startpfn >= end_pfn)
404 return 0;
405
406 /* Check for overlaps */
407 if (*ei_startpfn < start_pfn)
408 *ei_startpfn = start_pfn;
409 if (*ei_endpfn > end_pfn)
410 *ei_endpfn = end_pfn;
411
412 /* Obey end_user_pfn to save on memmap */
413 if (*ei_startpfn >= end_user_pfn)
414 return 0;
415 if (*ei_endpfn > end_user_pfn)
416 *ei_endpfn = end_user_pfn;
417
418 return 1;
419}
420
421/* Walk the e820 map and register active regions within a node */
422void __init
423e820_register_active_regions(int nid, unsigned long start_pfn,
424 unsigned long end_pfn)
425{
426 unsigned long ei_startpfn;
427 unsigned long ei_endpfn;
428 int i;
429
430 for (i = 0; i < e820.nr_map; i++)
431 if (e820_find_active_region(&e820.map[i],
432 start_pfn, end_pfn,
433 &ei_startpfn, &ei_endpfn))
434 add_active_range(nid, ei_startpfn, ei_endpfn);
435}
436
437/*
438 * Add a memory region to the kernel e820 map.
439 */
440void __init add_memory_region(unsigned long start, unsigned long size, int type)
441{
442 int x = e820.nr_map;
443
444 if (x == E820MAX) {
445 printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
446 return;
447 }
448
449 e820.map[x].addr = start;
450 e820.map[x].size = size;
451 e820.map[x].type = type;
452 e820.nr_map++;
453}
454
455/*
456 * Find the hole size (in bytes) in the memory range.
457 * @start: starting address of the memory range to scan
458 * @end: ending address of the memory range to scan
459 */
460unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
461{
462 unsigned long start_pfn = start >> PAGE_SHIFT;
463 unsigned long end_pfn = end >> PAGE_SHIFT;
464 unsigned long ei_startpfn, ei_endpfn, ram = 0;
465 int i;
466
467 for (i = 0; i < e820.nr_map; i++) {
468 if (e820_find_active_region(&e820.map[i],
469 start_pfn, end_pfn,
470 &ei_startpfn, &ei_endpfn))
471 ram += ei_endpfn - ei_startpfn;
472 }
473 return end - start - (ram << PAGE_SHIFT);
474}
475
476static void __init e820_print_map(char *who)
477{
478 int i;
479
480 for (i = 0; i < e820.nr_map; i++) {
481 printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
482 (unsigned long long) e820.map[i].addr,
483 (unsigned long long)
484 (e820.map[i].addr + e820.map[i].size));
485 switch (e820.map[i].type) {
486 case E820_RAM:
487 printk(KERN_CONT "(usable)\n");
488 break;
489 case E820_RESERVED:
490 printk(KERN_CONT "(reserved)\n");
491 break;
492 case E820_ACPI:
493 printk(KERN_CONT "(ACPI data)\n");
494 break;
495 case E820_NVS:
496 printk(KERN_CONT "(ACPI NVS)\n");
497 break;
498 default:
499 printk(KERN_CONT "type %u\n", e820.map[i].type);
500 break;
501 }
502 }
503}
504
505/*
506 * Sanitize the BIOS e820 map.
507 *
508 * Some e820 responses include overlapping entries. The following
509 * replaces the original e820 map with a new one, removing overlaps.
510 *
511 */
512static int __init sanitize_e820_map(struct e820entry *biosmap, char *pnr_map)
513{
514 struct change_member {
515 struct e820entry *pbios; /* pointer to original bios entry */
516 unsigned long long addr; /* address for this change point */
517 };
518 static struct change_member change_point_list[2*E820MAX] __initdata;
519 static struct change_member *change_point[2*E820MAX] __initdata;
520 static struct e820entry *overlap_list[E820MAX] __initdata;
521 static struct e820entry new_bios[E820MAX] __initdata;
522 struct change_member *change_tmp;
523 unsigned long current_type, last_type;
524 unsigned long long last_addr;
525 int chgidx, still_changing;
526 int overlap_entries;
527 int new_bios_entry;
528 int old_nr, new_nr, chg_nr;
529 int i;
530
531 /*
532 Visually we're performing the following
533 (1,2,3,4 = memory types)...
534
535 Sample memory map (w/overlaps):
536 ____22__________________
537 ______________________4_
538 ____1111________________
539 _44_____________________
540 11111111________________
541 ____________________33__
542 ___________44___________
543 __________33333_________
544 ______________22________
545 ___________________2222_
546 _________111111111______
547 _____________________11_
548 _________________4______
549
550 Sanitized equivalent (no overlap):
551 1_______________________
552 _44_____________________
553 ___1____________________
554 ____22__________________
555 ______11________________
556 _________1______________
557 __________3_____________
558 ___________44___________
559 _____________33_________
560 _______________2________
561 ________________1_______
562 _________________4______
563 ___________________2____
564 ____________________33__
565 ______________________4_
566 */
567
568 /* if there's only one memory region, don't bother */
569 if (*pnr_map < 2)
570 return -1;
571
572 old_nr = *pnr_map;
573
574 /* bail out if we find any unreasonable addresses in bios map */
575 for (i = 0; i < old_nr; i++)
576 if (biosmap[i].addr + biosmap[i].size < biosmap[i].addr)
577 return -1;
578
579 /* create pointers for initial change-point information (for sorting) */
580 for (i = 0; i < 2 * old_nr; i++)
581 change_point[i] = &change_point_list[i];
582
583 /* record all known change-points (starting and ending addresses),
584 omitting those that are for empty memory regions */
585 chgidx = 0;
586 for (i = 0; i < old_nr; i++) {
587 if (biosmap[i].size != 0) {
588 change_point[chgidx]->addr = biosmap[i].addr;
589 change_point[chgidx++]->pbios = &biosmap[i];
590 change_point[chgidx]->addr = biosmap[i].addr +
591 biosmap[i].size;
592 change_point[chgidx++]->pbios = &biosmap[i];
593 }
594 }
595 chg_nr = chgidx;
596
597 /* sort change-point list by memory addresses (low -> high) */
598 still_changing = 1;
599 while (still_changing) {
600 still_changing = 0;
601 for (i = 1; i < chg_nr; i++) {
602 unsigned long long curaddr, lastaddr;
603 unsigned long long curpbaddr, lastpbaddr;
604
605 curaddr = change_point[i]->addr;
606 lastaddr = change_point[i - 1]->addr;
607 curpbaddr = change_point[i]->pbios->addr;
608 lastpbaddr = change_point[i - 1]->pbios->addr;
609
610 /*
611 * swap entries, when:
612 *
613 * curaddr > lastaddr or
614 * curaddr == lastaddr and curaddr == curpbaddr and
615 * lastaddr != lastpbaddr
616 */
617 if (curaddr < lastaddr ||
618 (curaddr == lastaddr && curaddr == curpbaddr &&
619 lastaddr != lastpbaddr)) {
620 change_tmp = change_point[i];
621 change_point[i] = change_point[i-1];
622 change_point[i-1] = change_tmp;
623 still_changing = 1;
624 }
625 }
626 }
627
628 /* create a new bios memory map, removing overlaps */
629 overlap_entries = 0; /* number of entries in the overlap table */
630 new_bios_entry = 0; /* index for creating new bios map entries */
631 last_type = 0; /* start with undefined memory type */
632 last_addr = 0; /* start with 0 as last starting address */
633
634 /* loop through change-points, determining affect on the new bios map */
635 for (chgidx = 0; chgidx < chg_nr; chgidx++) {
636 /* keep track of all overlapping bios entries */
637 if (change_point[chgidx]->addr ==
638 change_point[chgidx]->pbios->addr) {
639 /*
640 * add map entry to overlap list (> 1 entry
641 * implies an overlap)
642 */
643 overlap_list[overlap_entries++] =
644 change_point[chgidx]->pbios;
645 } else {
646 /*
647 * remove entry from list (order independent,
648 * so swap with last)
649 */
650 for (i = 0; i < overlap_entries; i++) {
651 if (overlap_list[i] ==
652 change_point[chgidx]->pbios)
653 overlap_list[i] =
654 overlap_list[overlap_entries-1];
655 }
656 overlap_entries--;
657 }
658 /*
659 * if there are overlapping entries, decide which
660 * "type" to use (larger value takes precedence --
661 * 1=usable, 2,3,4,4+=unusable)
662 */
663 current_type = 0;
664 for (i = 0; i < overlap_entries; i++)
665 if (overlap_list[i]->type > current_type)
666 current_type = overlap_list[i]->type;
667 /*
668 * continue building up new bios map based on this
669 * information
670 */
671 if (current_type != last_type) {
672 if (last_type != 0) {
673 new_bios[new_bios_entry].size =
674 change_point[chgidx]->addr - last_addr;
675 /*
676 * move forward only if the new size
677 * was non-zero
678 */
679 if (new_bios[new_bios_entry].size != 0)
680 /*
681 * no more space left for new
682 * bios entries ?
683 */
684 if (++new_bios_entry >= E820MAX)
685 break;
686 }
687 if (current_type != 0) {
688 new_bios[new_bios_entry].addr =
689 change_point[chgidx]->addr;
690 new_bios[new_bios_entry].type = current_type;
691 last_addr = change_point[chgidx]->addr;
692 }
693 last_type = current_type;
694 }
695 }
696 /* retain count for new bios entries */
697 new_nr = new_bios_entry;
698
699 /* copy new bios mapping into original location */
700 memcpy(biosmap, new_bios, new_nr * sizeof(struct e820entry));
701 *pnr_map = new_nr;
702
703 return 0;
704}
705
706/*
707 * Copy the BIOS e820 map into a safe place.
708 *
709 * Sanity-check it while we're at it..
710 *
711 * If we're lucky and live on a modern system, the setup code
712 * will have given us a memory map that we can use to properly
713 * set up memory. If we aren't, we'll fake a memory map.
714 */
715static int __init copy_e820_map(struct e820entry *biosmap, int nr_map)
716{
717 /* Only one memory region (or negative)? Ignore it */
718 if (nr_map < 2)
719 return -1;
720
721 do {
722 u64 start = biosmap->addr;
723 u64 size = biosmap->size;
724 u64 end = start + size;
725 u32 type = biosmap->type;
726
727 /* Overflow in 64 bits? Ignore the memory map. */
728 if (start > end)
729 return -1;
730
731 add_memory_region(start, size, type);
732 } while (biosmap++, --nr_map);
733 return 0;
734}
735
736static void early_panic(char *msg)
737{
738 early_printk(msg);
739 panic(msg);
740}
741
742/* We're not void only for x86 32-bit compat */
743char * __init machine_specific_memory_setup(void)
744{
745 char *who = "BIOS-e820";
746 /*
747 * Try to copy the BIOS-supplied E820-map.
748 *
749 * Otherwise fake a memory map; one section from 0k->640k,
750 * the next section from 1mb->appropriate_mem_k
751 */
752 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
753 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0)
754 early_panic("Cannot find a valid memory map");
755 printk(KERN_INFO "BIOS-provided physical RAM map:\n");
756 e820_print_map(who);
757
758 /* In case someone cares... */
759 return who;
760}
761
762static int __init parse_memopt(char *p)
763{
764 if (!p)
765 return -EINVAL;
766 end_user_pfn = memparse(p, &p);
767 end_user_pfn >>= PAGE_SHIFT;
768 return 0;
769}
770early_param("mem", parse_memopt);
771
772static int userdef __initdata;
773
774static int __init parse_memmap_opt(char *p)
775{
776 char *oldp;
777 unsigned long long start_at, mem_size;
778
779 if (!strcmp(p, "exactmap")) {
780#ifdef CONFIG_CRASH_DUMP
781 /*
782 * If we are doing a crash dump, we still need to know
783 * the real mem size before original memory map is
784 * reset.
785 */
786 e820_register_active_regions(0, 0, -1UL);
787 saved_max_pfn = e820_end_of_ram();
788 remove_all_active_ranges();
789#endif
790 max_pfn_mapped = 0;
791 e820.nr_map = 0;
792 userdef = 1;
793 return 0;
794 }
795
796 oldp = p;
797 mem_size = memparse(p, &p);
798 if (p == oldp)
799 return -EINVAL;
800
801 userdef = 1;
802 if (*p == '@') {
803 start_at = memparse(p+1, &p);
804 add_memory_region(start_at, mem_size, E820_RAM);
805 } else if (*p == '#') {
806 start_at = memparse(p+1, &p);
807 add_memory_region(start_at, mem_size, E820_ACPI);
808 } else if (*p == '$') {
809 start_at = memparse(p+1, &p);
810 add_memory_region(start_at, mem_size, E820_RESERVED);
811 } else {
812 end_user_pfn = (mem_size >> PAGE_SHIFT);
813 }
814 return *p == '\0' ? 0 : -EINVAL;
815}
816early_param("memmap", parse_memmap_opt);
817
818void __init finish_e820_parsing(void)
819{
820 if (userdef) {
821 char nr = e820.nr_map;
822
823 if (sanitize_e820_map(e820.map, &nr) < 0)
824 early_panic("Invalid user supplied memory map");
825 e820.nr_map = nr;
826
827 printk(KERN_INFO "user-defined physical RAM map:\n");
828 e820_print_map("user");
829 }
830}
831
832void __init update_memory_range(u64 start, u64 size, unsigned old_type,
833 unsigned new_type)
834{
835 int i;
836
837 BUG_ON(old_type == new_type);
838
839 for (i = 0; i < e820.nr_map; i++) {
840 struct e820entry *ei = &e820.map[i];
841 u64 final_start, final_end;
842 if (ei->type != old_type)
843 continue;
844 /* totally covered? */
845 if (ei->addr >= start && ei->size <= size) {
846 ei->type = new_type;
847 continue;
848 }
849 /* partially covered */
850 final_start = max(start, ei->addr);
851 final_end = min(start + size, ei->addr + ei->size);
852 if (final_start >= final_end)
853 continue;
854 add_memory_region(final_start, final_end - final_start,
855 new_type);
856 }
857}
858
859void __init update_e820(void)
860{
861 u8 nr_map;
862
863 nr_map = e820.nr_map;
864 if (sanitize_e820_map(e820.map, &nr_map))
865 return;
866 e820.nr_map = nr_map;
867 printk(KERN_INFO "modified physical RAM map:\n");
868 e820_print_map("modified");
869}
870
871unsigned long pci_mem_start = 0xaeedbabe;
872EXPORT_SYMBOL(pci_mem_start);
873
874/*
875 * Search for the biggest gap in the low 32 bits of the e820
876 * memory space. We pass this space to PCI to assign MMIO resources
877 * for hotplug or unconfigured devices in.
878 * Hopefully the BIOS let enough space left.
879 */
880__init void e820_setup_gap(void)
881{
882 unsigned long gapstart, gapsize, round;
883 unsigned long last;
884 int i;
885 int found = 0;
886
887 last = 0x100000000ull;
888 gapstart = 0x10000000;
889 gapsize = 0x400000;
890 i = e820.nr_map;
891 while (--i >= 0) {
892 unsigned long long start = e820.map[i].addr;
893 unsigned long long end = start + e820.map[i].size;
894
895 /*
896 * Since "last" is at most 4GB, we know we'll
897 * fit in 32 bits if this condition is true
898 */
899 if (last > end) {
900 unsigned long gap = last - end;
901
902 if (gap > gapsize) {
903 gapsize = gap;
904 gapstart = end;
905 found = 1;
906 }
907 }
908 if (start < last)
909 last = start;
910 }
911
912 if (!found) {
913 gapstart = (end_pfn << PAGE_SHIFT) + 1024*1024;
914 printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit "
915 "address range\n"
916 KERN_ERR "PCI: Unassigned devices with 32bit resource "
917 "registers may break!\n");
918 }
919
920 /*
921 * See how much we want to round up: start off with
922 * rounding to the next 1MB area.
923 */
924 round = 0x100000;
925 while ((gapsize >> 4) > round)
926 round += round;
927 /* Fun with two's complement */
928 pci_mem_start = (gapstart + round) & -round;
929
930 printk(KERN_INFO
931 "Allocating PCI resources starting at %lx (gap: %lx:%lx)\n",
932 pci_mem_start, gapstart, gapsize);
933}
934
935int __init arch_get_ram_range(int slot, u64 *addr, u64 *size)
936{
937 int i;
938
939 if (slot < 0 || slot >= e820.nr_map)
940 return -1;
941 for (i = slot; i < e820.nr_map; i++) {
942 if (e820.map[i].type != E820_RAM)
943 continue;
944 break;
945 }
946 if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT))
947 return -1;
948 *addr = e820.map[i].addr;
949 *size = min_t(u64, e820.map[i].size + e820.map[i].addr,
950 max_pfn << PAGE_SHIFT) - *addr;
951 return i + 1;
952}
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 9f51e1ea9e82..a4665f37cfc5 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -50,7 +50,7 @@ static void __init fix_hypertransport_config(int num, int slot, int func)
50static void __init via_bugs(int num, int slot, int func) 50static void __init via_bugs(int num, int slot, int func)
51{ 51{
52#ifdef CONFIG_GART_IOMMU 52#ifdef CONFIG_GART_IOMMU
53 if ((end_pfn > MAX_DMA32_PFN || force_iommu) && 53 if ((max_pfn > MAX_DMA32_PFN || force_iommu) &&
54 !gart_iommu_aperture_allowed) { 54 !gart_iommu_aperture_allowed) {
55 printk(KERN_INFO 55 printk(KERN_INFO
56 "Looks like a VIA chipset. Disabling IOMMU." 56 "Looks like a VIA chipset. Disabling IOMMU."
@@ -98,17 +98,6 @@ static void __init nvidia_bugs(int num, int slot, int func)
98 98
99} 99}
100 100
101static void __init ati_bugs(int num, int slot, int func)
102{
103#ifdef CONFIG_X86_IO_APIC
104 if (timer_over_8254 == 1) {
105 timer_over_8254 = 0;
106 printk(KERN_INFO
107 "ATI board detected. Disabling timer routing over 8254.\n");
108 }
109#endif
110}
111
112#define QFLAG_APPLY_ONCE 0x1 101#define QFLAG_APPLY_ONCE 0x1
113#define QFLAG_APPLIED 0x2 102#define QFLAG_APPLIED 0x2
114#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) 103#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -126,8 +115,6 @@ static struct chipset early_qrk[] __initdata = {
126 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs }, 115 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs },
127 { PCI_VENDOR_ID_VIA, PCI_ANY_ID, 116 { PCI_VENDOR_ID_VIA, PCI_ANY_ID,
128 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs }, 117 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs },
129 { PCI_VENDOR_ID_ATI, PCI_ANY_ID,
130 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, ati_bugs },
131 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB, 118 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB,
132 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config }, 119 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config },
133 {} 120 {}
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 643fd861b724..ff9e7350da54 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -196,7 +196,7 @@ static struct console simnow_console = {
196static struct console *early_console = &early_vga_console; 196static struct console *early_console = &early_vga_console;
197static int early_console_initialized; 197static int early_console_initialized;
198 198
199void early_printk(const char *fmt, ...) 199asmlinkage void early_printk(const char *fmt, ...)
200{ 200{
201 char buf[512]; 201 char buf[512];
202 int n; 202 int n;
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index 77d424cf68b3..06cc8d4254b1 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -64,6 +64,17 @@ static int __init setup_noefi(char *arg)
64} 64}
65early_param("noefi", setup_noefi); 65early_param("noefi", setup_noefi);
66 66
67int add_efi_memmap;
68EXPORT_SYMBOL(add_efi_memmap);
69
70static int __init setup_add_efi_memmap(char *arg)
71{
72 add_efi_memmap = 1;
73 return 0;
74}
75early_param("add_efi_memmap", setup_add_efi_memmap);
76
77
67static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) 78static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
68{ 79{
69 return efi_call_virt2(get_time, tm, tc); 80 return efi_call_virt2(get_time, tm, tc);
@@ -213,6 +224,50 @@ unsigned long efi_get_time(void)
213 eft.minute, eft.second); 224 eft.minute, eft.second);
214} 225}
215 226
227/*
228 * Tell the kernel about the EFI memory map. This might include
229 * more than the max 128 entries that can fit in the e820 legacy
230 * (zeropage) memory map.
231 */
232
233static void __init do_add_efi_memmap(void)
234{
235 void *p;
236
237 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
238 efi_memory_desc_t *md = p;
239 unsigned long long start = md->phys_addr;
240 unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;
241 int e820_type;
242
243 if (md->attribute & EFI_MEMORY_WB)
244 e820_type = E820_RAM;
245 else
246 e820_type = E820_RESERVED;
247 e820_add_region(start, size, e820_type);
248 }
249 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
250}
251
252void __init efi_reserve_early(void)
253{
254 unsigned long pmap;
255
256#ifdef CONFIG_X86_32
257 pmap = boot_params.efi_info.efi_memmap;
258#else
259 pmap = (boot_params.efi_info.efi_memmap |
260 ((__u64)boot_params.efi_info.efi_memmap_hi<<32));
261#endif
262 memmap.phys_map = (void *)pmap;
263 memmap.nr_map = boot_params.efi_info.efi_memmap_size /
264 boot_params.efi_info.efi_memdesc_size;
265 memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
266 memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
267 reserve_early(pmap, pmap + memmap.nr_map * memmap.desc_size,
268 "EFI memmap");
269}
270
216#if EFI_DEBUG 271#if EFI_DEBUG
217static void __init print_efi_memmap(void) 272static void __init print_efi_memmap(void)
218{ 273{
@@ -244,19 +299,11 @@ void __init efi_init(void)
244 299
245#ifdef CONFIG_X86_32 300#ifdef CONFIG_X86_32
246 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; 301 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab;
247 memmap.phys_map = (void *)boot_params.efi_info.efi_memmap;
248#else 302#else
249 efi_phys.systab = (efi_system_table_t *) 303 efi_phys.systab = (efi_system_table_t *)
250 (boot_params.efi_info.efi_systab | 304 (boot_params.efi_info.efi_systab |
251 ((__u64)boot_params.efi_info.efi_systab_hi<<32)); 305 ((__u64)boot_params.efi_info.efi_systab_hi<<32));
252 memmap.phys_map = (void *)
253 (boot_params.efi_info.efi_memmap |
254 ((__u64)boot_params.efi_info.efi_memmap_hi<<32));
255#endif 306#endif
256 memmap.nr_map = boot_params.efi_info.efi_memmap_size /
257 boot_params.efi_info.efi_memdesc_size;
258 memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
259 memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
260 307
261 efi.systab = early_ioremap((unsigned long)efi_phys.systab, 308 efi.systab = early_ioremap((unsigned long)efi_phys.systab,
262 sizeof(efi_system_table_t)); 309 sizeof(efi_system_table_t));
@@ -370,6 +417,8 @@ void __init efi_init(void)
370 if (memmap.desc_size != sizeof(efi_memory_desc_t)) 417 if (memmap.desc_size != sizeof(efi_memory_desc_t))
371 printk(KERN_WARNING "Kernel-defined memdesc" 418 printk(KERN_WARNING "Kernel-defined memdesc"
372 "doesn't match the one from EFI!\n"); 419 "doesn't match the one from EFI!\n");
420 if (add_efi_memmap)
421 do_add_efi_memmap();
373 422
374 /* Setup for EFI runtime service */ 423 /* Setup for EFI runtime service */
375 reboot_type = BOOT_EFI; 424 reboot_type = BOOT_EFI;
@@ -424,7 +473,7 @@ void __init efi_enter_virtual_mode(void)
424 size = md->num_pages << EFI_PAGE_SHIFT; 473 size = md->num_pages << EFI_PAGE_SHIFT;
425 end = md->phys_addr + size; 474 end = md->phys_addr + size;
426 475
427 if (PFN_UP(end) <= max_pfn_mapped) 476 if (PFN_UP(end) <= max_low_pfn_mapped)
428 va = __va(md->phys_addr); 477 va = __va(md->phys_addr);
429 else 478 else
430 va = efi_ioremap(md->phys_addr, size); 479 va = efi_ioremap(md->phys_addr, size);
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c
index d0060fdcccac..652c5287215f 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/kernel/efi_64.c
@@ -97,13 +97,7 @@ void __init efi_call_phys_epilog(void)
97 early_runtime_code_mapping_set_exec(0); 97 early_runtime_code_mapping_set_exec(0);
98} 98}
99 99
100void __init efi_reserve_bootmem(void) 100void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size)
101{
102 reserve_bootmem_generic((unsigned long)memmap.phys_map,
103 memmap.nr_map * memmap.desc_size);
104}
105
106void __iomem * __init efi_ioremap(unsigned long phys_addr, unsigned long size)
107{ 101{
108 static unsigned pages_mapped __initdata; 102 static unsigned pages_mapped __initdata;
109 unsigned i, pages; 103 unsigned i, pages;
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index c778e4fa55a2..6bc07f0f1202 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -51,14 +51,15 @@
51#include <asm/percpu.h> 51#include <asm/percpu.h>
52#include <asm/dwarf2.h> 52#include <asm/dwarf2.h>
53#include <asm/processor-flags.h> 53#include <asm/processor-flags.h>
54#include "irq_vectors.h" 54#include <asm/ftrace.h>
55#include <asm/irq_vectors.h>
55 56
56/* 57/*
57 * We use macros for low-level operations which need to be overridden 58 * We use macros for low-level operations which need to be overridden
58 * for paravirtualization. The following will never clobber any registers: 59 * for paravirtualization. The following will never clobber any registers:
59 * INTERRUPT_RETURN (aka. "iret") 60 * INTERRUPT_RETURN (aka. "iret")
60 * GET_CR0_INTO_EAX (aka. "movl %cr0, %eax") 61 * GET_CR0_INTO_EAX (aka. "movl %cr0, %eax")
61 * ENABLE_INTERRUPTS_SYSCALL_RET (aka "sti; sysexit"). 62 * ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit").
62 * 63 *
63 * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must 64 * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must
64 * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY). 65 * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY).
@@ -349,7 +350,7 @@ sysenter_past_esp:
349 xorl %ebp,%ebp 350 xorl %ebp,%ebp
350 TRACE_IRQS_ON 351 TRACE_IRQS_ON
3511: mov PT_FS(%esp), %fs 3521: mov PT_FS(%esp), %fs
352 ENABLE_INTERRUPTS_SYSCALL_RET 353 ENABLE_INTERRUPTS_SYSEXIT
353 CFI_ENDPROC 354 CFI_ENDPROC
354.pushsection .fixup,"ax" 355.pushsection .fixup,"ax"
3552: movl $0,PT_FS(%esp) 3562: movl $0,PT_FS(%esp)
@@ -874,10 +875,10 @@ ENTRY(native_iret)
874.previous 875.previous
875END(native_iret) 876END(native_iret)
876 877
877ENTRY(native_irq_enable_syscall_ret) 878ENTRY(native_irq_enable_sysexit)
878 sti 879 sti
879 sysexit 880 sysexit
880END(native_irq_enable_syscall_ret) 881END(native_irq_enable_sysexit)
881#endif 882#endif
882 883
883KPROBE_ENTRY(int3) 884KPROBE_ENTRY(int3)
@@ -1024,6 +1025,7 @@ ENTRY(xen_sysenter_target)
1024 RING0_INT_FRAME 1025 RING0_INT_FRAME
1025 addl $5*4, %esp /* remove xen-provided frame */ 1026 addl $5*4, %esp /* remove xen-provided frame */
1026 jmp sysenter_past_esp 1027 jmp sysenter_past_esp
1028 CFI_ENDPROC
1027 1029
1028ENTRY(xen_hypervisor_callback) 1030ENTRY(xen_hypervisor_callback)
1029 CFI_STARTPROC 1031 CFI_STARTPROC
@@ -1110,6 +1112,77 @@ ENDPROC(xen_failsafe_callback)
1110 1112
1111#endif /* CONFIG_XEN */ 1113#endif /* CONFIG_XEN */
1112 1114
1115#ifdef CONFIG_FTRACE
1116#ifdef CONFIG_DYNAMIC_FTRACE
1117
1118ENTRY(mcount)
1119 pushl %eax
1120 pushl %ecx
1121 pushl %edx
1122 movl 0xc(%esp), %eax
1123 subl $MCOUNT_INSN_SIZE, %eax
1124
1125.globl mcount_call
1126mcount_call:
1127 call ftrace_stub
1128
1129 popl %edx
1130 popl %ecx
1131 popl %eax
1132
1133 ret
1134END(mcount)
1135
1136ENTRY(ftrace_caller)
1137 pushl %eax
1138 pushl %ecx
1139 pushl %edx
1140 movl 0xc(%esp), %eax
1141 movl 0x4(%ebp), %edx
1142 subl $MCOUNT_INSN_SIZE, %eax
1143
1144.globl ftrace_call
1145ftrace_call:
1146 call ftrace_stub
1147
1148 popl %edx
1149 popl %ecx
1150 popl %eax
1151
1152.globl ftrace_stub
1153ftrace_stub:
1154 ret
1155END(ftrace_caller)
1156
1157#else /* ! CONFIG_DYNAMIC_FTRACE */
1158
1159ENTRY(mcount)
1160 cmpl $ftrace_stub, ftrace_trace_function
1161 jnz trace
1162.globl ftrace_stub
1163ftrace_stub:
1164 ret
1165
1166 /* taken from glibc */
1167trace:
1168 pushl %eax
1169 pushl %ecx
1170 pushl %edx
1171 movl 0xc(%esp), %eax
1172 movl 0x4(%ebp), %edx
1173 subl $MCOUNT_INSN_SIZE, %eax
1174
1175 call *ftrace_trace_function
1176
1177 popl %edx
1178 popl %ecx
1179 popl %eax
1180
1181 jmp ftrace_stub
1182END(mcount)
1183#endif /* CONFIG_DYNAMIC_FTRACE */
1184#endif /* CONFIG_FTRACE */
1185
1113.section .rodata,"a" 1186.section .rodata,"a"
1114#include "syscall_table_32.S" 1187#include "syscall_table_32.S"
1115 1188
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 556a8df522a7..ba41bf42748d 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -51,16 +51,121 @@
51#include <asm/page.h> 51#include <asm/page.h>
52#include <asm/irqflags.h> 52#include <asm/irqflags.h>
53#include <asm/paravirt.h> 53#include <asm/paravirt.h>
54#include <asm/ftrace.h>
54 55
55 .code64 56 .code64
56 57
58#ifdef CONFIG_FTRACE
59#ifdef CONFIG_DYNAMIC_FTRACE
60ENTRY(mcount)
61
62 subq $0x38, %rsp
63 movq %rax, (%rsp)
64 movq %rcx, 8(%rsp)
65 movq %rdx, 16(%rsp)
66 movq %rsi, 24(%rsp)
67 movq %rdi, 32(%rsp)
68 movq %r8, 40(%rsp)
69 movq %r9, 48(%rsp)
70
71 movq 0x38(%rsp), %rdi
72 subq $MCOUNT_INSN_SIZE, %rdi
73
74.globl mcount_call
75mcount_call:
76 call ftrace_stub
77
78 movq 48(%rsp), %r9
79 movq 40(%rsp), %r8
80 movq 32(%rsp), %rdi
81 movq 24(%rsp), %rsi
82 movq 16(%rsp), %rdx
83 movq 8(%rsp), %rcx
84 movq (%rsp), %rax
85 addq $0x38, %rsp
86
87 retq
88END(mcount)
89
90ENTRY(ftrace_caller)
91
92 /* taken from glibc */
93 subq $0x38, %rsp
94 movq %rax, (%rsp)
95 movq %rcx, 8(%rsp)
96 movq %rdx, 16(%rsp)
97 movq %rsi, 24(%rsp)
98 movq %rdi, 32(%rsp)
99 movq %r8, 40(%rsp)
100 movq %r9, 48(%rsp)
101
102 movq 0x38(%rsp), %rdi
103 movq 8(%rbp), %rsi
104 subq $MCOUNT_INSN_SIZE, %rdi
105
106.globl ftrace_call
107ftrace_call:
108 call ftrace_stub
109
110 movq 48(%rsp), %r9
111 movq 40(%rsp), %r8
112 movq 32(%rsp), %rdi
113 movq 24(%rsp), %rsi
114 movq 16(%rsp), %rdx
115 movq 8(%rsp), %rcx
116 movq (%rsp), %rax
117 addq $0x38, %rsp
118
119.globl ftrace_stub
120ftrace_stub:
121 retq
122END(ftrace_caller)
123
124#else /* ! CONFIG_DYNAMIC_FTRACE */
125ENTRY(mcount)
126 cmpq $ftrace_stub, ftrace_trace_function
127 jnz trace
128.globl ftrace_stub
129ftrace_stub:
130 retq
131
132trace:
133 /* taken from glibc */
134 subq $0x38, %rsp
135 movq %rax, (%rsp)
136 movq %rcx, 8(%rsp)
137 movq %rdx, 16(%rsp)
138 movq %rsi, 24(%rsp)
139 movq %rdi, 32(%rsp)
140 movq %r8, 40(%rsp)
141 movq %r9, 48(%rsp)
142
143 movq 0x38(%rsp), %rdi
144 movq 8(%rbp), %rsi
145 subq $MCOUNT_INSN_SIZE, %rdi
146
147 call *ftrace_trace_function
148
149 movq 48(%rsp), %r9
150 movq 40(%rsp), %r8
151 movq 32(%rsp), %rdi
152 movq 24(%rsp), %rsi
153 movq 16(%rsp), %rdx
154 movq 8(%rsp), %rcx
155 movq (%rsp), %rax
156 addq $0x38, %rsp
157
158 jmp ftrace_stub
159END(mcount)
160#endif /* CONFIG_DYNAMIC_FTRACE */
161#endif /* CONFIG_FTRACE */
162
57#ifndef CONFIG_PREEMPT 163#ifndef CONFIG_PREEMPT
58#define retint_kernel retint_restore_args 164#define retint_kernel retint_restore_args
59#endif 165#endif
60 166
61#ifdef CONFIG_PARAVIRT 167#ifdef CONFIG_PARAVIRT
62ENTRY(native_irq_enable_syscall_ret) 168ENTRY(native_usergs_sysret64)
63 movq %gs:pda_oldrsp,%rsp
64 swapgs 169 swapgs
65 sysretq 170 sysretq
66#endif /* CONFIG_PARAVIRT */ 171#endif /* CONFIG_PARAVIRT */
@@ -104,7 +209,7 @@ ENTRY(native_irq_enable_syscall_ret)
104 .macro FAKE_STACK_FRAME child_rip 209 .macro FAKE_STACK_FRAME child_rip
105 /* push in order ss, rsp, eflags, cs, rip */ 210 /* push in order ss, rsp, eflags, cs, rip */
106 xorl %eax, %eax 211 xorl %eax, %eax
107 pushq %rax /* ss */ 212 pushq $__KERNEL_DS /* ss */
108 CFI_ADJUST_CFA_OFFSET 8 213 CFI_ADJUST_CFA_OFFSET 8
109 /*CFI_REL_OFFSET ss,0*/ 214 /*CFI_REL_OFFSET ss,0*/
110 pushq %rax /* rsp */ 215 pushq %rax /* rsp */
@@ -169,13 +274,13 @@ ENTRY(ret_from_fork)
169 CFI_ADJUST_CFA_OFFSET -4 274 CFI_ADJUST_CFA_OFFSET -4
170 call schedule_tail 275 call schedule_tail
171 GET_THREAD_INFO(%rcx) 276 GET_THREAD_INFO(%rcx)
172 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%rcx) 277 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx)
173 jnz rff_trace 278 jnz rff_trace
174rff_action: 279rff_action:
175 RESTORE_REST 280 RESTORE_REST
176 testl $3,CS-ARGOFFSET(%rsp) # from kernel_thread? 281 testl $3,CS-ARGOFFSET(%rsp) # from kernel_thread?
177 je int_ret_from_sys_call 282 je int_ret_from_sys_call
178 testl $_TIF_IA32,threadinfo_flags(%rcx) 283 testl $_TIF_IA32,TI_flags(%rcx)
179 jnz int_ret_from_sys_call 284 jnz int_ret_from_sys_call
180 RESTORE_TOP_OF_STACK %rdi,ARGOFFSET 285 RESTORE_TOP_OF_STACK %rdi,ARGOFFSET
181 jmp ret_from_sys_call 286 jmp ret_from_sys_call
@@ -244,7 +349,8 @@ ENTRY(system_call_after_swapgs)
244 movq %rcx,RIP-ARGOFFSET(%rsp) 349 movq %rcx,RIP-ARGOFFSET(%rsp)
245 CFI_REL_OFFSET rip,RIP-ARGOFFSET 350 CFI_REL_OFFSET rip,RIP-ARGOFFSET
246 GET_THREAD_INFO(%rcx) 351 GET_THREAD_INFO(%rcx)
247 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx) 352 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP), \
353 TI_flags(%rcx)
248 jnz tracesys 354 jnz tracesys
249 cmpq $__NR_syscall_max,%rax 355 cmpq $__NR_syscall_max,%rax
250 ja badsys 356 ja badsys
@@ -263,7 +369,7 @@ sysret_check:
263 GET_THREAD_INFO(%rcx) 369 GET_THREAD_INFO(%rcx)
264 DISABLE_INTERRUPTS(CLBR_NONE) 370 DISABLE_INTERRUPTS(CLBR_NONE)
265 TRACE_IRQS_OFF 371 TRACE_IRQS_OFF
266 movl threadinfo_flags(%rcx),%edx 372 movl TI_flags(%rcx),%edx
267 andl %edi,%edx 373 andl %edi,%edx
268 jnz sysret_careful 374 jnz sysret_careful
269 CFI_REMEMBER_STATE 375 CFI_REMEMBER_STATE
@@ -275,7 +381,8 @@ sysret_check:
275 CFI_REGISTER rip,rcx 381 CFI_REGISTER rip,rcx
276 RESTORE_ARGS 0,-ARG_SKIP,1 382 RESTORE_ARGS 0,-ARG_SKIP,1
277 /*CFI_REGISTER rflags,r11*/ 383 /*CFI_REGISTER rflags,r11*/
278 ENABLE_INTERRUPTS_SYSCALL_RET 384 movq %gs:pda_oldrsp, %rsp
385 USERGS_SYSRET64
279 386
280 CFI_RESTORE_STATE 387 CFI_RESTORE_STATE
281 /* Handle reschedules */ 388 /* Handle reschedules */
@@ -305,7 +412,7 @@ sysret_signal:
305 leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1 412 leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1
306 xorl %esi,%esi # oldset -> arg2 413 xorl %esi,%esi # oldset -> arg2
307 call ptregscall_common 414 call ptregscall_common
3081: movl $_TIF_NEED_RESCHED,%edi 4151: movl $_TIF_WORK_MASK,%edi
309 /* Use IRET because user could have changed frame. This 416 /* Use IRET because user could have changed frame. This
310 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */ 417 works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
311 DISABLE_INTERRUPTS(CLBR_NONE) 418 DISABLE_INTERRUPTS(CLBR_NONE)
@@ -347,10 +454,10 @@ int_ret_from_sys_call:
347int_with_check: 454int_with_check:
348 LOCKDEP_SYS_EXIT_IRQ 455 LOCKDEP_SYS_EXIT_IRQ
349 GET_THREAD_INFO(%rcx) 456 GET_THREAD_INFO(%rcx)
350 movl threadinfo_flags(%rcx),%edx 457 movl TI_flags(%rcx),%edx
351 andl %edi,%edx 458 andl %edi,%edx
352 jnz int_careful 459 jnz int_careful
353 andl $~TS_COMPAT,threadinfo_status(%rcx) 460 andl $~TS_COMPAT,TI_status(%rcx)
354 jmp retint_swapgs 461 jmp retint_swapgs
355 462
356 /* Either reschedule or signal or syscall exit tracking needed. */ 463 /* Either reschedule or signal or syscall exit tracking needed. */
@@ -393,7 +500,7 @@ int_signal:
393 movq %rsp,%rdi # &ptregs -> arg1 500 movq %rsp,%rdi # &ptregs -> arg1
394 xorl %esi,%esi # oldset -> arg2 501 xorl %esi,%esi # oldset -> arg2
395 call do_notify_resume 502 call do_notify_resume
3961: movl $_TIF_NEED_RESCHED,%edi 5031: movl $_TIF_WORK_MASK,%edi
397int_restore_rest: 504int_restore_rest:
398 RESTORE_REST 505 RESTORE_REST
399 DISABLE_INTERRUPTS(CLBR_NONE) 506 DISABLE_INTERRUPTS(CLBR_NONE)
@@ -420,7 +527,6 @@ END(\label)
420 PTREGSCALL stub_clone, sys_clone, %r8 527 PTREGSCALL stub_clone, sys_clone, %r8
421 PTREGSCALL stub_fork, sys_fork, %rdi 528 PTREGSCALL stub_fork, sys_fork, %rdi
422 PTREGSCALL stub_vfork, sys_vfork, %rdi 529 PTREGSCALL stub_vfork, sys_vfork, %rdi
423 PTREGSCALL stub_rt_sigsuspend, sys_rt_sigsuspend, %rdx
424 PTREGSCALL stub_sigaltstack, sys_sigaltstack, %rdx 530 PTREGSCALL stub_sigaltstack, sys_sigaltstack, %rdx
425 PTREGSCALL stub_iopl, sys_iopl, %rsi 531 PTREGSCALL stub_iopl, sys_iopl, %rsi
426 532
@@ -559,7 +665,7 @@ retint_with_reschedule:
559 movl $_TIF_WORK_MASK,%edi 665 movl $_TIF_WORK_MASK,%edi
560retint_check: 666retint_check:
561 LOCKDEP_SYS_EXIT_IRQ 667 LOCKDEP_SYS_EXIT_IRQ
562 movl threadinfo_flags(%rcx),%edx 668 movl TI_flags(%rcx),%edx
563 andl %edi,%edx 669 andl %edi,%edx
564 CFI_REMEMBER_STATE 670 CFI_REMEMBER_STATE
565 jnz retint_careful 671 jnz retint_careful
@@ -647,17 +753,16 @@ retint_signal:
647 RESTORE_REST 753 RESTORE_REST
648 DISABLE_INTERRUPTS(CLBR_NONE) 754 DISABLE_INTERRUPTS(CLBR_NONE)
649 TRACE_IRQS_OFF 755 TRACE_IRQS_OFF
650 movl $_TIF_NEED_RESCHED,%edi
651 GET_THREAD_INFO(%rcx) 756 GET_THREAD_INFO(%rcx)
652 jmp retint_check 757 jmp retint_with_reschedule
653 758
654#ifdef CONFIG_PREEMPT 759#ifdef CONFIG_PREEMPT
655 /* Returning to kernel space. Check if we need preemption */ 760 /* Returning to kernel space. Check if we need preemption */
656 /* rcx: threadinfo. interrupts off. */ 761 /* rcx: threadinfo. interrupts off. */
657ENTRY(retint_kernel) 762ENTRY(retint_kernel)
658 cmpl $0,threadinfo_preempt_count(%rcx) 763 cmpl $0,TI_preempt_count(%rcx)
659 jnz retint_restore_args 764 jnz retint_restore_args
660 bt $TIF_NEED_RESCHED,threadinfo_flags(%rcx) 765 bt $TIF_NEED_RESCHED,TI_flags(%rcx)
661 jnc retint_restore_args 766 jnc retint_restore_args
662 bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */ 767 bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */
663 jnc retint_restore_args 768 jnc retint_restore_args
@@ -720,6 +825,10 @@ ENTRY(apic_timer_interrupt)
720 apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt 825 apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt
721END(apic_timer_interrupt) 826END(apic_timer_interrupt)
722 827
828ENTRY(uv_bau_message_intr1)
829 apicinterrupt 220,uv_bau_message_interrupt
830END(uv_bau_message_intr1)
831
723ENTRY(error_interrupt) 832ENTRY(error_interrupt)
724 apicinterrupt ERROR_APIC_VECTOR,smp_error_interrupt 833 apicinterrupt ERROR_APIC_VECTOR,smp_error_interrupt
725END(error_interrupt) 834END(error_interrupt)
@@ -733,6 +842,7 @@ END(spurious_interrupt)
733 */ 842 */
734 .macro zeroentry sym 843 .macro zeroentry sym
735 INTR_FRAME 844 INTR_FRAME
845 PARAVIRT_ADJUST_EXCEPTION_FRAME
736 pushq $0 /* push error code/oldrax */ 846 pushq $0 /* push error code/oldrax */
737 CFI_ADJUST_CFA_OFFSET 8 847 CFI_ADJUST_CFA_OFFSET 8
738 pushq %rax /* push real oldrax to the rdi slot */ 848 pushq %rax /* push real oldrax to the rdi slot */
@@ -745,6 +855,7 @@ END(spurious_interrupt)
745 855
746 .macro errorentry sym 856 .macro errorentry sym
747 XCPT_FRAME 857 XCPT_FRAME
858 PARAVIRT_ADJUST_EXCEPTION_FRAME
748 pushq %rax 859 pushq %rax
749 CFI_ADJUST_CFA_OFFSET 8 860 CFI_ADJUST_CFA_OFFSET 8
750 CFI_REL_OFFSET rax,0 861 CFI_REL_OFFSET rax,0
@@ -814,7 +925,7 @@ paranoid_restore\trace:
814 jmp irq_return 925 jmp irq_return
815paranoid_userspace\trace: 926paranoid_userspace\trace:
816 GET_THREAD_INFO(%rcx) 927 GET_THREAD_INFO(%rcx)
817 movl threadinfo_flags(%rcx),%ebx 928 movl TI_flags(%rcx),%ebx
818 andl $_TIF_WORK_MASK,%ebx 929 andl $_TIF_WORK_MASK,%ebx
819 jz paranoid_swapgs\trace 930 jz paranoid_swapgs\trace
820 movq %rsp,%rdi /* &pt_regs */ 931 movq %rsp,%rdi /* &pt_regs */
@@ -912,7 +1023,7 @@ error_exit:
912 testl %eax,%eax 1023 testl %eax,%eax
913 jne retint_kernel 1024 jne retint_kernel
914 LOCKDEP_SYS_EXIT_IRQ 1025 LOCKDEP_SYS_EXIT_IRQ
915 movl threadinfo_flags(%rcx),%edx 1026 movl TI_flags(%rcx),%edx
916 movl $_TIF_WORK_MASK,%edi 1027 movl $_TIF_WORK_MASK,%edi
917 andl %edi,%edx 1028 andl %edi,%edx
918 jnz retint_careful 1029 jnz retint_careful
@@ -926,11 +1037,11 @@ error_kernelspace:
926 iret run with kernel gs again, so don't set the user space flag. 1037 iret run with kernel gs again, so don't set the user space flag.
927 B stepping K8s sometimes report an truncated RIP for IRET 1038 B stepping K8s sometimes report an truncated RIP for IRET
928 exceptions returning to compat mode. Check for these here too. */ 1039 exceptions returning to compat mode. Check for these here too. */
929 leaq irq_return(%rip),%rbp 1040 leaq irq_return(%rip),%rcx
930 cmpq %rbp,RIP(%rsp) 1041 cmpq %rcx,RIP(%rsp)
931 je error_swapgs 1042 je error_swapgs
932 movl %ebp,%ebp /* zero extend */ 1043 movl %ecx,%ecx /* zero extend */
933 cmpq %rbp,RIP(%rsp) 1044 cmpq %rcx,RIP(%rsp)
934 je error_swapgs 1045 je error_swapgs
935 cmpq $gs_change,RIP(%rsp) 1046 cmpq $gs_change,RIP(%rsp)
936 je error_swapgs 1047 je error_swapgs
@@ -939,7 +1050,7 @@ KPROBE_END(error_entry)
939 1050
940 /* Reload gs selector with exception handling */ 1051 /* Reload gs selector with exception handling */
941 /* edi: new selector */ 1052 /* edi: new selector */
942ENTRY(load_gs_index) 1053ENTRY(native_load_gs_index)
943 CFI_STARTPROC 1054 CFI_STARTPROC
944 pushf 1055 pushf
945 CFI_ADJUST_CFA_OFFSET 8 1056 CFI_ADJUST_CFA_OFFSET 8
@@ -953,7 +1064,7 @@ gs_change:
953 CFI_ADJUST_CFA_OFFSET -8 1064 CFI_ADJUST_CFA_OFFSET -8
954 ret 1065 ret
955 CFI_ENDPROC 1066 CFI_ENDPROC
956ENDPROC(load_gs_index) 1067ENDPROC(native_load_gs_index)
957 1068
958 .section __ex_table,"a" 1069 .section __ex_table,"a"
959 .align 8 1070 .align 8
@@ -1120,10 +1231,6 @@ ENTRY(coprocessor_segment_overrun)
1120 zeroentry do_coprocessor_segment_overrun 1231 zeroentry do_coprocessor_segment_overrun
1121END(coprocessor_segment_overrun) 1232END(coprocessor_segment_overrun)
1122 1233
1123ENTRY(reserved)
1124 zeroentry do_reserved
1125END(reserved)
1126
1127 /* runs on exception stack */ 1234 /* runs on exception stack */
1128ENTRY(double_fault) 1235ENTRY(double_fault)
1129 XCPT_FRAME 1236 XCPT_FRAME
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
new file mode 100644
index 000000000000..ab115cd15fdf
--- /dev/null
+++ b/arch/x86/kernel/ftrace.c
@@ -0,0 +1,141 @@
1/*
2 * Code for replacing ftrace calls with jumps.
3 *
4 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
5 *
6 * Thanks goes to Ingo Molnar, for suggesting the idea.
7 * Mathieu Desnoyers, for suggesting postponing the modifications.
8 * Arjan van de Ven, for keeping me straight, and explaining to me
9 * the dangers of modifying code on the run.
10 */
11
12#include <linux/spinlock.h>
13#include <linux/hardirq.h>
14#include <linux/ftrace.h>
15#include <linux/percpu.h>
16#include <linux/init.h>
17#include <linux/list.h>
18
19#include <asm/alternative.h>
20#include <asm/ftrace.h>
21
22
23/* Long is fine, even if it is only 4 bytes ;-) */
24static long *ftrace_nop;
25
26union ftrace_code_union {
27 char code[MCOUNT_INSN_SIZE];
28 struct {
29 char e8;
30 int offset;
31 } __attribute__((packed));
32};
33
34
35static int notrace ftrace_calc_offset(long ip, long addr)
36{
37 return (int)(addr - ip);
38}
39
40notrace unsigned char *ftrace_nop_replace(void)
41{
42 return (char *)ftrace_nop;
43}
44
45notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
46{
47 static union ftrace_code_union calc;
48
49 calc.e8 = 0xe8;
50 calc.offset = ftrace_calc_offset(ip + MCOUNT_INSN_SIZE, addr);
51
52 /*
53 * No locking needed, this must be called via kstop_machine
54 * which in essence is like running on a uniprocessor machine.
55 */
56 return calc.code;
57}
58
59notrace int
60ftrace_modify_code(unsigned long ip, unsigned char *old_code,
61 unsigned char *new_code)
62{
63 unsigned replaced;
64 unsigned old = *(unsigned *)old_code; /* 4 bytes */
65 unsigned new = *(unsigned *)new_code; /* 4 bytes */
66 unsigned char newch = new_code[4];
67 int faulted = 0;
68
69 /*
70 * Note: Due to modules and __init, code can
71 * disappear and change, we need to protect against faulting
72 * as well as code changing.
73 *
74 * No real locking needed, this code is run through
75 * kstop_machine.
76 */
77 asm volatile (
78 "1: lock\n"
79 " cmpxchg %3, (%2)\n"
80 " jnz 2f\n"
81 " movb %b4, 4(%2)\n"
82 "2:\n"
83 ".section .fixup, \"ax\"\n"
84 "3: movl $1, %0\n"
85 " jmp 2b\n"
86 ".previous\n"
87 _ASM_EXTABLE(1b, 3b)
88 : "=r"(faulted), "=a"(replaced)
89 : "r"(ip), "r"(new), "c"(newch),
90 "0"(faulted), "a"(old)
91 : "memory");
92 sync_core();
93
94 if (replaced != old && replaced != new)
95 faulted = 2;
96
97 return faulted;
98}
99
100notrace int ftrace_update_ftrace_func(ftrace_func_t func)
101{
102 unsigned long ip = (unsigned long)(&ftrace_call);
103 unsigned char old[MCOUNT_INSN_SIZE], *new;
104 int ret;
105
106 memcpy(old, &ftrace_call, MCOUNT_INSN_SIZE);
107 new = ftrace_call_replace(ip, (unsigned long)func);
108 ret = ftrace_modify_code(ip, old, new);
109
110 return ret;
111}
112
113notrace int ftrace_mcount_set(unsigned long *data)
114{
115 unsigned long ip = (long)(&mcount_call);
116 unsigned long *addr = data;
117 unsigned char old[MCOUNT_INSN_SIZE], *new;
118
119 /*
120 * Replace the mcount stub with a pointer to the
121 * ip recorder function.
122 */
123 memcpy(old, &mcount_call, MCOUNT_INSN_SIZE);
124 new = ftrace_call_replace(ip, *addr);
125 *addr = ftrace_modify_code(ip, old, new);
126
127 return 0;
128}
129
130int __init ftrace_dyn_arch_init(void *data)
131{
132 const unsigned char *const *noptable = find_nop_table();
133
134 /* This is running in kstop_machine */
135
136 ftrace_mcount_set(data);
137
138 ftrace_nop = (unsigned long *)noptable[MCOUNT_INSN_SIZE];
139
140 return 0;
141}
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index cbaaf69bedb2..1fa8be5bd217 100644
--- a/arch/x86/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
@@ -51,7 +51,7 @@ void __init setup_apic_routing(void)
51 else 51 else
52#endif 52#endif
53 53
54 if (num_possible_cpus() <= 8) 54 if (max_physical_apicid < 8)
55 genapic = &apic_flat; 55 genapic = &apic_flat;
56 else 56 else
57 genapic = &apic_physflat; 57 genapic = &apic_physflat;
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c
index ebf13908a743..711f11c30b06 100644
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@ -5,9 +5,10 @@
5 * 5 *
6 * SGI UV APIC functions (note: not an Intel compatible APIC) 6 * SGI UV APIC functions (note: not an Intel compatible APIC)
7 * 7 *
8 * Copyright (C) 2007 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved.
9 */ 9 */
10 10
11#include <linux/kernel.h>
11#include <linux/threads.h> 12#include <linux/threads.h>
12#include <linux/cpumask.h> 13#include <linux/cpumask.h>
13#include <linux/string.h> 14#include <linux/string.h>
@@ -20,6 +21,7 @@
20#include <asm/smp.h> 21#include <asm/smp.h>
21#include <asm/ipi.h> 22#include <asm/ipi.h>
22#include <asm/genapic.h> 23#include <asm/genapic.h>
24#include <asm/pgtable.h>
23#include <asm/uv/uv_mmrs.h> 25#include <asm/uv/uv_mmrs.h>
24#include <asm/uv/uv_hub.h> 26#include <asm/uv/uv_hub.h>
25 27
@@ -55,37 +57,37 @@ static cpumask_t uv_vector_allocation_domain(int cpu)
55int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip) 57int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip)
56{ 58{
57 unsigned long val; 59 unsigned long val;
58 int nasid; 60 int pnode;
59 61
60 nasid = uv_apicid_to_nasid(phys_apicid); 62 pnode = uv_apicid_to_pnode(phys_apicid);
61 val = (1UL << UVH_IPI_INT_SEND_SHFT) | 63 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
62 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) | 64 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) |
63 (((long)start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) | 65 (((long)start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) |
64 APIC_DM_INIT; 66 APIC_DM_INIT;
65 uv_write_global_mmr64(nasid, UVH_IPI_INT, val); 67 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
66 mdelay(10); 68 mdelay(10);
67 69
68 val = (1UL << UVH_IPI_INT_SEND_SHFT) | 70 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
69 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) | 71 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) |
70 (((long)start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) | 72 (((long)start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) |
71 APIC_DM_STARTUP; 73 APIC_DM_STARTUP;
72 uv_write_global_mmr64(nasid, UVH_IPI_INT, val); 74 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
73 return 0; 75 return 0;
74} 76}
75 77
76static void uv_send_IPI_one(int cpu, int vector) 78static void uv_send_IPI_one(int cpu, int vector)
77{ 79{
78 unsigned long val, apicid, lapicid; 80 unsigned long val, apicid, lapicid;
79 int nasid; 81 int pnode;
80 82
81 apicid = per_cpu(x86_cpu_to_apicid, cpu); /* ZZZ - cache node-local ? */ 83 apicid = per_cpu(x86_cpu_to_apicid, cpu); /* ZZZ - cache node-local ? */
82 lapicid = apicid & 0x3f; /* ZZZ macro needed */ 84 lapicid = apicid & 0x3f; /* ZZZ macro needed */
83 nasid = uv_apicid_to_nasid(apicid); 85 pnode = uv_apicid_to_pnode(apicid);
84 val = 86 val =
85 (1UL << UVH_IPI_INT_SEND_SHFT) | (lapicid << 87 (1UL << UVH_IPI_INT_SEND_SHFT) | (lapicid <<
86 UVH_IPI_INT_APIC_ID_SHFT) | 88 UVH_IPI_INT_APIC_ID_SHFT) |
87 (vector << UVH_IPI_INT_VECTOR_SHFT); 89 (vector << UVH_IPI_INT_VECTOR_SHFT);
88 uv_write_global_mmr64(nasid, UVH_IPI_INT, val); 90 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
89} 91}
90 92
91static void uv_send_IPI_mask(cpumask_t mask, int vector) 93static void uv_send_IPI_mask(cpumask_t mask, int vector)
@@ -159,39 +161,146 @@ struct genapic apic_x2apic_uv_x = {
159 .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */ 161 .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */
160}; 162};
161 163
162static __cpuinit void set_x2apic_extra_bits(int nasid) 164static __cpuinit void set_x2apic_extra_bits(int pnode)
163{ 165{
164 __get_cpu_var(x2apic_extra_bits) = ((nasid >> 1) << 6); 166 __get_cpu_var(x2apic_extra_bits) = (pnode << 6);
165} 167}
166 168
167/* 169/*
168 * Called on boot cpu. 170 * Called on boot cpu.
169 */ 171 */
172static __init int boot_pnode_to_blade(int pnode)
173{
174 int blade;
175
176 for (blade = 0; blade < uv_num_possible_blades(); blade++)
177 if (pnode == uv_blade_info[blade].pnode)
178 return blade;
179 BUG();
180}
181
182struct redir_addr {
183 unsigned long redirect;
184 unsigned long alias;
185};
186
187#define DEST_SHIFT UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_SHFT
188
189static __initdata struct redir_addr redir_addrs[] = {
190 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR, UVH_SI_ALIAS0_OVERLAY_CONFIG},
191 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR, UVH_SI_ALIAS1_OVERLAY_CONFIG},
192 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_SI_ALIAS2_OVERLAY_CONFIG},
193};
194
195static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
196{
197 union uvh_si_alias0_overlay_config_u alias;
198 union uvh_rh_gam_alias210_redirect_config_2_mmr_u redirect;
199 int i;
200
201 for (i = 0; i < ARRAY_SIZE(redir_addrs); i++) {
202 alias.v = uv_read_local_mmr(redir_addrs[i].alias);
203 if (alias.s.base == 0) {
204 *size = (1UL << alias.s.m_alias);
205 redirect.v = uv_read_local_mmr(redir_addrs[i].redirect);
206 *base = (unsigned long)redirect.s.dest_base << DEST_SHIFT;
207 return;
208 }
209 }
210 BUG();
211}
212
213static __init void map_low_mmrs(void)
214{
215 init_extra_mapping_uc(UV_GLOBAL_MMR32_BASE, UV_GLOBAL_MMR32_SIZE);
216 init_extra_mapping_uc(UV_LOCAL_MMR_BASE, UV_LOCAL_MMR_SIZE);
217}
218
219enum map_type {map_wb, map_uc};
220
221static void map_high(char *id, unsigned long base, int shift, enum map_type map_type)
222{
223 unsigned long bytes, paddr;
224
225 paddr = base << shift;
226 bytes = (1UL << shift);
227 printk(KERN_INFO "UV: Map %s_HI 0x%lx - 0x%lx\n", id, paddr,
228 paddr + bytes);
229 if (map_type == map_uc)
230 init_extra_mapping_uc(paddr, bytes);
231 else
232 init_extra_mapping_wb(paddr, bytes);
233
234}
235static __init void map_gru_high(int max_pnode)
236{
237 union uvh_rh_gam_gru_overlay_config_mmr_u gru;
238 int shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT;
239
240 gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR);
241 if (gru.s.enable)
242 map_high("GRU", gru.s.base, shift, map_wb);
243}
244
245static __init void map_config_high(int max_pnode)
246{
247 union uvh_rh_gam_cfg_overlay_config_mmr_u cfg;
248 int shift = UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_BASE_SHFT;
249
250 cfg.v = uv_read_local_mmr(UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR);
251 if (cfg.s.enable)
252 map_high("CONFIG", cfg.s.base, shift, map_uc);
253}
254
255static __init void map_mmr_high(int max_pnode)
256{
257 union uvh_rh_gam_mmr_overlay_config_mmr_u mmr;
258 int shift = UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_BASE_SHFT;
259
260 mmr.v = uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR);
261 if (mmr.s.enable)
262 map_high("MMR", mmr.s.base, shift, map_uc);
263}
264
265static __init void map_mmioh_high(int max_pnode)
266{
267 union uvh_rh_gam_mmioh_overlay_config_mmr_u mmioh;
268 int shift = UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_BASE_SHFT;
269
270 mmioh.v = uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR);
271 if (mmioh.s.enable)
272 map_high("MMIOH", mmioh.s.base, shift, map_uc);
273}
274
170static __init void uv_system_init(void) 275static __init void uv_system_init(void)
171{ 276{
172 union uvh_si_addr_map_config_u m_n_config; 277 union uvh_si_addr_map_config_u m_n_config;
173 int bytes, nid, cpu, lcpu, nasid, last_nasid, blade; 278 union uvh_node_id_u node_id;
174 unsigned long mmr_base; 279 unsigned long gnode_upper, lowmem_redir_base, lowmem_redir_size;
280 int bytes, nid, cpu, lcpu, pnode, blade, i, j, m_val, n_val;
281 int max_pnode = 0;
282 unsigned long mmr_base, present;
283
284 map_low_mmrs();
175 285
176 m_n_config.v = uv_read_local_mmr(UVH_SI_ADDR_MAP_CONFIG); 286 m_n_config.v = uv_read_local_mmr(UVH_SI_ADDR_MAP_CONFIG);
287 m_val = m_n_config.s.m_skt;
288 n_val = m_n_config.s.n_skt;
177 mmr_base = 289 mmr_base =
178 uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) & 290 uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
179 ~UV_MMR_ENABLE; 291 ~UV_MMR_ENABLE;
180 printk(KERN_DEBUG "UV: global MMR base 0x%lx\n", mmr_base); 292 printk(KERN_DEBUG "UV: global MMR base 0x%lx\n", mmr_base);
181 293
182 last_nasid = -1; 294 for(i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++)
183 for_each_possible_cpu(cpu) { 295 uv_possible_blades +=
184 nid = cpu_to_node(cpu); 296 hweight64(uv_read_local_mmr( UVH_NODE_PRESENT_TABLE + i * 8));
185 nasid = uv_apicid_to_nasid(per_cpu(x86_cpu_to_apicid, cpu));
186 if (nasid != last_nasid)
187 uv_possible_blades++;
188 last_nasid = nasid;
189 }
190 printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades()); 297 printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades());
191 298
192 bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades(); 299 bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades();
193 uv_blade_info = alloc_bootmem_pages(bytes); 300 uv_blade_info = alloc_bootmem_pages(bytes);
194 301
302 get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size);
303
195 bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes(); 304 bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes();
196 uv_node_to_blade = alloc_bootmem_pages(bytes); 305 uv_node_to_blade = alloc_bootmem_pages(bytes);
197 memset(uv_node_to_blade, 255, bytes); 306 memset(uv_node_to_blade, 255, bytes);
@@ -200,43 +309,62 @@ static __init void uv_system_init(void)
200 uv_cpu_to_blade = alloc_bootmem_pages(bytes); 309 uv_cpu_to_blade = alloc_bootmem_pages(bytes);
201 memset(uv_cpu_to_blade, 255, bytes); 310 memset(uv_cpu_to_blade, 255, bytes);
202 311
203 last_nasid = -1; 312 blade = 0;
204 blade = -1; 313 for (i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++) {
205 lcpu = -1; 314 present = uv_read_local_mmr(UVH_NODE_PRESENT_TABLE + i * 8);
206 for_each_possible_cpu(cpu) { 315 for (j = 0; j < 64; j++) {
207 nid = cpu_to_node(cpu); 316 if (!test_bit(j, &present))
208 nasid = uv_apicid_to_nasid(per_cpu(x86_cpu_to_apicid, cpu)); 317 continue;
209 if (nasid != last_nasid) { 318 uv_blade_info[blade].pnode = (i * 64 + j);
210 blade++; 319 uv_blade_info[blade].nr_possible_cpus = 0;
211 lcpu = -1;
212 uv_blade_info[blade].nr_posible_cpus = 0;
213 uv_blade_info[blade].nr_online_cpus = 0; 320 uv_blade_info[blade].nr_online_cpus = 0;
321 blade++;
214 } 322 }
215 last_nasid = nasid; 323 }
216 lcpu++;
217 324
218 uv_cpu_hub_info(cpu)->m_val = m_n_config.s.m_skt; 325 node_id.v = uv_read_local_mmr(UVH_NODE_ID);
219 uv_cpu_hub_info(cpu)->n_val = m_n_config.s.n_skt; 326 gnode_upper = (((unsigned long)node_id.s.node_id) &
327 ~((1 << n_val) - 1)) << m_val;
328
329 for_each_present_cpu(cpu) {
330 nid = cpu_to_node(cpu);
331 pnode = uv_apicid_to_pnode(per_cpu(x86_cpu_to_apicid, cpu));
332 blade = boot_pnode_to_blade(pnode);
333 lcpu = uv_blade_info[blade].nr_possible_cpus;
334 uv_blade_info[blade].nr_possible_cpus++;
335
336 uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base;
337 uv_cpu_hub_info(cpu)->lowmem_remap_top =
338 lowmem_redir_base + lowmem_redir_size;
339 uv_cpu_hub_info(cpu)->m_val = m_val;
340 uv_cpu_hub_info(cpu)->n_val = m_val;
220 uv_cpu_hub_info(cpu)->numa_blade_id = blade; 341 uv_cpu_hub_info(cpu)->numa_blade_id = blade;
221 uv_cpu_hub_info(cpu)->blade_processor_id = lcpu; 342 uv_cpu_hub_info(cpu)->blade_processor_id = lcpu;
222 uv_cpu_hub_info(cpu)->local_nasid = nasid; 343 uv_cpu_hub_info(cpu)->pnode = pnode;
223 uv_cpu_hub_info(cpu)->gnode_upper = 344 uv_cpu_hub_info(cpu)->pnode_mask = (1 << n_val) - 1;
224 nasid & ~((1 << uv_hub_info->n_val) - 1); 345 uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
346 uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
225 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base; 347 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
226 uv_cpu_hub_info(cpu)->coherency_domain_number = 0;/* ZZZ */ 348 uv_cpu_hub_info(cpu)->coherency_domain_number = 0;/* ZZZ */
227 uv_blade_info[blade].nasid = nasid;
228 uv_blade_info[blade].nr_posible_cpus++;
229 uv_node_to_blade[nid] = blade; 349 uv_node_to_blade[nid] = blade;
230 uv_cpu_to_blade[cpu] = blade; 350 uv_cpu_to_blade[cpu] = blade;
351 max_pnode = max(pnode, max_pnode);
231 352
232 printk(KERN_DEBUG "UV cpu %d, apicid 0x%x, nasid %d, nid %d\n", 353 printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, "
233 cpu, per_cpu(x86_cpu_to_apicid, cpu), nasid, nid); 354 "lcpu %d, blade %d\n",
234 printk(KERN_DEBUG "UV lcpu %d, blade %d\n", lcpu, blade); 355 cpu, per_cpu(x86_cpu_to_apicid, cpu), pnode, nid,
356 lcpu, blade);
235 } 357 }
358
359 map_gru_high(max_pnode);
360 map_mmr_high(max_pnode);
361 map_config_high(max_pnode);
362 map_mmioh_high(max_pnode);
236} 363}
237 364
238/* 365/*
239 * Called on each cpu to initialize the per_cpu UV data area. 366 * Called on each cpu to initialize the per_cpu UV data area.
367 * ZZZ hotplug not supported yet
240 */ 368 */
241void __cpuinit uv_cpu_init(void) 369void __cpuinit uv_cpu_init(void)
242{ 370{
@@ -246,5 +374,5 @@ void __cpuinit uv_cpu_init(void)
246 uv_blade_info[uv_numa_blade_id()].nr_online_cpus++; 374 uv_blade_info[uv_numa_blade_id()].nr_online_cpus++;
247 375
248 if (get_uv_system_type() == UV_NON_UNIQUE_APIC) 376 if (get_uv_system_type() == UV_NON_UNIQUE_APIC)
249 set_x2apic_extra_bits(uv_hub_info->local_nasid); 377 set_x2apic_extra_bits(uv_hub_info->pnode);
250} 378}
diff --git a/arch/x86/kernel/head.c b/arch/x86/kernel/head.c
new file mode 100644
index 000000000000..3e66bd364a9d
--- /dev/null
+++ b/arch/x86/kernel/head.c
@@ -0,0 +1,55 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3
4#include <asm/setup.h>
5#include <asm/bios_ebda.h>
6
7#define BIOS_LOWMEM_KILOBYTES 0x413
8
9/*
10 * The BIOS places the EBDA/XBDA at the top of conventional
11 * memory, and usually decreases the reported amount of
12 * conventional memory (int 0x12) too. This also contains a
13 * workaround for Dell systems that neglect to reserve EBDA.
14 * The same workaround also avoids a problem with the AMD768MPX
15 * chipset: reserve a page before VGA to prevent PCI prefetch
16 * into it (errata #56). Usually the page is reserved anyways,
17 * unless you have no PS/2 mouse plugged in.
18 */
19void __init reserve_ebda_region(void)
20{
21 unsigned int lowmem, ebda_addr;
22
23 /* To determine the position of the EBDA and the */
24 /* end of conventional memory, we need to look at */
25 /* the BIOS data area. In a paravirtual environment */
26 /* that area is absent. We'll just have to assume */
27 /* that the paravirt case can handle memory setup */
28 /* correctly, without our help. */
29 if (paravirt_enabled())
30 return;
31
32 /* end of low (conventional) memory */
33 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
34 lowmem <<= 10;
35
36 /* start of EBDA area */
37 ebda_addr = get_bios_ebda();
38
39 /* Fixup: bios puts an EBDA in the top 64K segment */
40 /* of conventional memory, but does not adjust lowmem. */
41 if ((lowmem - ebda_addr) <= 0x10000)
42 lowmem = ebda_addr;
43
44 /* Fixup: bios does not report an EBDA at all. */
45 /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
46 if ((ebda_addr == 0) && (lowmem >= 0x9f000))
47 lowmem = 0x9f000;
48
49 /* Paranoia: should never happen, but... */
50 if ((lowmem == 0) || (lowmem >= 0x100000))
51 lowmem = 0x9f000;
52
53 /* reserve all memory between lowmem and the 1MB mark */
54 reserve_early_overlap_ok(lowmem, 0x100000, "BIOS reserved");
55}
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 3db059058927..fa1d25dd83e3 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -8,7 +8,34 @@
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/start_kernel.h> 9#include <linux/start_kernel.h>
10 10
11#include <asm/setup.h>
12#include <asm/sections.h>
13#include <asm/e820.h>
14#include <asm/bios_ebda.h>
15
11void __init i386_start_kernel(void) 16void __init i386_start_kernel(void)
12{ 17{
18 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
19
20#ifdef CONFIG_BLK_DEV_INITRD
21 /* Reserve INITRD */
22 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
23 u64 ramdisk_image = boot_params.hdr.ramdisk_image;
24 u64 ramdisk_size = boot_params.hdr.ramdisk_size;
25 u64 ramdisk_end = ramdisk_image + ramdisk_size;
26 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
27 }
28#endif
29 reserve_early(init_pg_tables_start, init_pg_tables_end,
30 "INIT_PG_TABLE");
31
32 reserve_ebda_region();
33
34 /*
35 * At this point everything still needed from the boot loader
36 * or BIOS or kernel text should be early reserved or marked not
37 * RAM in e820. All other memory is free game.
38 */
39
13 start_kernel(); 40 start_kernel();
14} 41}
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index e25c57b8aa84..c97819829146 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -25,6 +25,20 @@
25#include <asm/e820.h> 25#include <asm/e820.h>
26#include <asm/bios_ebda.h> 26#include <asm/bios_ebda.h>
27 27
28/* boot cpu pda */
29static struct x8664_pda _boot_cpu_pda __read_mostly;
30
31#ifdef CONFIG_SMP
32/*
33 * We install an empty cpu_pda pointer table to indicate to early users
34 * (numa_set_node) that the cpu_pda pointer table for cpus other than
35 * the boot cpu is not yet setup.
36 */
37static struct x8664_pda *__cpu_pda[NR_CPUS] __initdata;
38#else
39static struct x8664_pda *__cpu_pda[NR_CPUS] __read_mostly;
40#endif
41
28static void __init zap_identity_mappings(void) 42static void __init zap_identity_mappings(void)
29{ 43{
30 pgd_t *pgd = pgd_offset_k(0UL); 44 pgd_t *pgd = pgd_offset_k(0UL);
@@ -51,74 +65,6 @@ static void __init copy_bootdata(char *real_mode_data)
51 } 65 }
52} 66}
53 67
54#define BIOS_LOWMEM_KILOBYTES 0x413
55
56/*
57 * The BIOS places the EBDA/XBDA at the top of conventional
58 * memory, and usually decreases the reported amount of
59 * conventional memory (int 0x12) too. This also contains a
60 * workaround for Dell systems that neglect to reserve EBDA.
61 * The same workaround also avoids a problem with the AMD768MPX
62 * chipset: reserve a page before VGA to prevent PCI prefetch
63 * into it (errata #56). Usually the page is reserved anyways,
64 * unless you have no PS/2 mouse plugged in.
65 */
66static void __init reserve_ebda_region(void)
67{
68 unsigned int lowmem, ebda_addr;
69
70 /* To determine the position of the EBDA and the */
71 /* end of conventional memory, we need to look at */
72 /* the BIOS data area. In a paravirtual environment */
73 /* that area is absent. We'll just have to assume */
74 /* that the paravirt case can handle memory setup */
75 /* correctly, without our help. */
76 if (paravirt_enabled())
77 return;
78
79 /* end of low (conventional) memory */
80 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
81 lowmem <<= 10;
82
83 /* start of EBDA area */
84 ebda_addr = get_bios_ebda();
85
86 /* Fixup: bios puts an EBDA in the top 64K segment */
87 /* of conventional memory, but does not adjust lowmem. */
88 if ((lowmem - ebda_addr) <= 0x10000)
89 lowmem = ebda_addr;
90
91 /* Fixup: bios does not report an EBDA at all. */
92 /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
93 if ((ebda_addr == 0) && (lowmem >= 0x9f000))
94 lowmem = 0x9f000;
95
96 /* Paranoia: should never happen, but... */
97 if ((lowmem == 0) || (lowmem >= 0x100000))
98 lowmem = 0x9f000;
99
100 /* reserve all memory between lowmem and the 1MB mark */
101 reserve_early(lowmem, 0x100000, "BIOS reserved");
102}
103
104static void __init reserve_setup_data(void)
105{
106 struct setup_data *data;
107 unsigned long pa_data;
108 char buf[32];
109
110 if (boot_params.hdr.version < 0x0209)
111 return;
112 pa_data = boot_params.hdr.setup_data;
113 while (pa_data) {
114 data = early_ioremap(pa_data, sizeof(*data));
115 sprintf(buf, "setup data %x", data->type);
116 reserve_early(pa_data, pa_data+sizeof(*data)+data->len, buf);
117 pa_data = data->next;
118 early_iounmap(data, sizeof(*data));
119 }
120}
121
122void __init x86_64_start_kernel(char * real_mode_data) 68void __init x86_64_start_kernel(char * real_mode_data)
123{ 69{
124 int i; 70 int i;
@@ -156,10 +102,17 @@ void __init x86_64_start_kernel(char * real_mode_data)
156 102
157 early_printk("Kernel alive\n"); 103 early_printk("Kernel alive\n");
158 104
159 for (i = 0; i < NR_CPUS; i++) 105 _cpu_pda = __cpu_pda;
160 cpu_pda(i) = &boot_cpu_pda[i]; 106 cpu_pda(0) = &_boot_cpu_pda;
161
162 pda_init(0); 107 pda_init(0);
108
109 early_printk("Kernel really alive\n");
110
111 x86_64_start_reservations(real_mode_data);
112}
113
114void __init x86_64_start_reservations(char *real_mode_data)
115{
163 copy_bootdata(__va(real_mode_data)); 116 copy_bootdata(__va(real_mode_data));
164 117
165 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS"); 118 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
@@ -175,7 +128,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
175#endif 128#endif
176 129
177 reserve_ebda_region(); 130 reserve_ebda_region();
178 reserve_setup_data();
179 131
180 /* 132 /*
181 * At this point everything still needed from the boot loader 133 * At this point everything still needed from the boot loader
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index f7357cc0162c..f67e93441caf 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -194,6 +194,7 @@ default_entry:
194 xorl %ebx,%ebx /* %ebx is kept at zero */ 194 xorl %ebx,%ebx /* %ebx is kept at zero */
195 195
196 movl $pa(pg0), %edi 196 movl $pa(pg0), %edi
197 movl %edi, pa(init_pg_tables_start)
197 movl $pa(swapper_pg_pmd), %edx 198 movl $pa(swapper_pg_pmd), %edx
198 movl $PTE_ATTR, %eax 199 movl $PTE_ATTR, %eax
19910: 20010:
@@ -219,6 +220,8 @@ default_entry:
219 jb 10b 220 jb 10b
2201: 2211:
221 movl %edi,pa(init_pg_tables_end) 222 movl %edi,pa(init_pg_tables_end)
223 shrl $12, %eax
224 movl %eax, pa(max_pfn_mapped)
222 225
223 /* Do early initialization of the fixmap area */ 226 /* Do early initialization of the fixmap area */
224 movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax 227 movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax
@@ -228,6 +231,7 @@ default_entry:
228page_pde_offset = (__PAGE_OFFSET >> 20); 231page_pde_offset = (__PAGE_OFFSET >> 20);
229 232
230 movl $pa(pg0), %edi 233 movl $pa(pg0), %edi
234 movl %edi, pa(init_pg_tables_start)
231 movl $pa(swapper_pg_dir), %edx 235 movl $pa(swapper_pg_dir), %edx
232 movl $PTE_ATTR, %eax 236 movl $PTE_ATTR, %eax
23310: 23710:
@@ -249,6 +253,8 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
249 cmpl %ebp,%eax 253 cmpl %ebp,%eax
250 jb 10b 254 jb 10b
251 movl %edi,pa(init_pg_tables_end) 255 movl %edi,pa(init_pg_tables_end)
256 shrl $12, %eax
257 movl %eax, pa(max_pfn_mapped)
252 258
253 /* Do early initialization of the fixmap area */ 259 /* Do early initialization of the fixmap area */
254 movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax 260 movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax
@@ -446,10 +452,13 @@ is386: movl $2,%ecx # set MP
446 je 1f 452 je 1f
447 movl $(__KERNEL_PERCPU), %eax 453 movl $(__KERNEL_PERCPU), %eax
448 movl %eax,%fs # set this cpu's percpu 454 movl %eax,%fs # set this cpu's percpu
449 jmp initialize_secondary # all other CPUs call initialize_secondary 455 movl (stack_start), %esp
4501: 4561:
451#endif /* CONFIG_SMP */ 457#endif /* CONFIG_SMP */
452 jmp i386_start_kernel 458 jmp *(initial_code)
459.align 4
460ENTRY(initial_code)
461 .long i386_start_kernel
453 462
454/* 463/*
455 * We depend on ET to be correct. This checks for 287/387. 464 * We depend on ET to be correct. This checks for 287/387.
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index b817974ef942..b07ac7b217cb 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -18,6 +18,7 @@
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/msr.h> 19#include <asm/msr.h>
20#include <asm/cache.h> 20#include <asm/cache.h>
21#include <asm/processor-flags.h>
21 22
22#ifdef CONFIG_PARAVIRT 23#ifdef CONFIG_PARAVIRT
23#include <asm/asm-offsets.h> 24#include <asm/asm-offsets.h>
@@ -31,6 +32,13 @@
31 * 32 *
32 */ 33 */
33 34
35#define pud_index(x) (((x) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
36
37L4_PAGE_OFFSET = pgd_index(__PAGE_OFFSET)
38L3_PAGE_OFFSET = pud_index(__PAGE_OFFSET)
39L4_START_KERNEL = pgd_index(__START_KERNEL_map)
40L3_START_KERNEL = pud_index(__START_KERNEL_map)
41
34 .text 42 .text
35 .section .text.head 43 .section .text.head
36 .code64 44 .code64
@@ -76,8 +84,8 @@ startup_64:
76 /* Fixup the physical addresses in the page table 84 /* Fixup the physical addresses in the page table
77 */ 85 */
78 addq %rbp, init_level4_pgt + 0(%rip) 86 addq %rbp, init_level4_pgt + 0(%rip)
79 addq %rbp, init_level4_pgt + (258*8)(%rip) 87 addq %rbp, init_level4_pgt + (L4_PAGE_OFFSET*8)(%rip)
80 addq %rbp, init_level4_pgt + (511*8)(%rip) 88 addq %rbp, init_level4_pgt + (L4_START_KERNEL*8)(%rip)
81 89
82 addq %rbp, level3_ident_pgt + 0(%rip) 90 addq %rbp, level3_ident_pgt + 0(%rip)
83 91
@@ -154,9 +162,7 @@ ENTRY(secondary_startup_64)
154 */ 162 */
155 163
156 /* Enable PAE mode and PGE */ 164 /* Enable PAE mode and PGE */
157 xorq %rax, %rax 165 movl $(X86_CR4_PAE | X86_CR4_PGE), %eax
158 btsq $5, %rax
159 btsq $7, %rax
160 movq %rax, %cr4 166 movq %rax, %cr4
161 167
162 /* Setup early boot stage 4 level pagetables. */ 168 /* Setup early boot stage 4 level pagetables. */
@@ -184,19 +190,15 @@ ENTRY(secondary_startup_64)
1841: wrmsr /* Make changes effective */ 1901: wrmsr /* Make changes effective */
185 191
186 /* Setup cr0 */ 192 /* Setup cr0 */
187#define CR0_PM 1 /* protected mode */ 193#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
188#define CR0_MP (1<<1) 194 X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
189#define CR0_ET (1<<4) 195 X86_CR0_PG)
190#define CR0_NE (1<<5) 196 movl $CR0_STATE, %eax
191#define CR0_WP (1<<16)
192#define CR0_AM (1<<18)
193#define CR0_PAGING (1<<31)
194 movl $CR0_PM|CR0_MP|CR0_ET|CR0_NE|CR0_WP|CR0_AM|CR0_PAGING,%eax
195 /* Make changes effective */ 197 /* Make changes effective */
196 movq %rax, %cr0 198 movq %rax, %cr0
197 199
198 /* Setup a boot time stack */ 200 /* Setup a boot time stack */
199 movq init_rsp(%rip),%rsp 201 movq stack_start(%rip),%rsp
200 202
201 /* zero EFLAGS after setting rsp */ 203 /* zero EFLAGS after setting rsp */
202 pushq $0 204 pushq $0
@@ -208,7 +210,7 @@ ENTRY(secondary_startup_64)
208 * addresses where we're currently running on. We have to do that here 210 * addresses where we're currently running on. We have to do that here
209 * because in 32bit we couldn't load a 64bit linear address. 211 * because in 32bit we couldn't load a 64bit linear address.
210 */ 212 */
211 lgdt cpu_gdt_descr(%rip) 213 lgdt early_gdt_descr(%rip)
212 214
213 /* set up data segments. actually 0 would do too */ 215 /* set up data segments. actually 0 would do too */
214 movl $__KERNEL_DS,%eax 216 movl $__KERNEL_DS,%eax
@@ -257,8 +259,9 @@ ENTRY(secondary_startup_64)
257 .quad x86_64_start_kernel 259 .quad x86_64_start_kernel
258 __FINITDATA 260 __FINITDATA
259 261
260 ENTRY(init_rsp) 262 ENTRY(stack_start)
261 .quad init_thread_union+THREAD_SIZE-8 263 .quad init_thread_union+THREAD_SIZE-8
264 .word 0
262 265
263bad_address: 266bad_address:
264 jmp bad_address 267 jmp bad_address
@@ -327,11 +330,11 @@ early_idt_ripmsg:
327ENTRY(name) 330ENTRY(name)
328 331
329/* Automate the creation of 1 to 1 mapping pmd entries */ 332/* Automate the creation of 1 to 1 mapping pmd entries */
330#define PMDS(START, PERM, COUNT) \ 333#define PMDS(START, PERM, COUNT) \
331 i = 0 ; \ 334 i = 0 ; \
332 .rept (COUNT) ; \ 335 .rept (COUNT) ; \
333 .quad (START) + (i << 21) + (PERM) ; \ 336 .quad (START) + (i << PMD_SHIFT) + (PERM) ; \
334 i = i + 1 ; \ 337 i = i + 1 ; \
335 .endr 338 .endr
336 339
337 /* 340 /*
@@ -342,9 +345,9 @@ ENTRY(name)
342 */ 345 */
343NEXT_PAGE(init_level4_pgt) 346NEXT_PAGE(init_level4_pgt)
344 .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE 347 .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE
345 .fill 257,8,0 348 .org init_level4_pgt + L4_PAGE_OFFSET*8, 0
346 .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE 349 .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE
347 .fill 252,8,0 350 .org init_level4_pgt + L4_START_KERNEL*8, 0
348 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ 351 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */
349 .quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE 352 .quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE
350 353
@@ -353,7 +356,7 @@ NEXT_PAGE(level3_ident_pgt)
353 .fill 511,8,0 356 .fill 511,8,0
354 357
355NEXT_PAGE(level3_kernel_pgt) 358NEXT_PAGE(level3_kernel_pgt)
356 .fill 510,8,0 359 .fill L3_START_KERNEL,8,0
357 /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */ 360 /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */
358 .quad level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE 361 .quad level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE
359 .quad level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE 362 .quad level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
@@ -384,7 +387,7 @@ NEXT_PAGE(level2_kernel_pgt)
384 * If you want to increase this then increase MODULES_VADDR 387 * If you want to increase this then increase MODULES_VADDR
385 * too.) 388 * too.)
386 */ 389 */
387 PMDS(0, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, 390 PMDS(0, __PAGE_KERNEL_LARGE_EXEC,
388 KERNEL_IMAGE_SIZE/PMD_SIZE) 391 KERNEL_IMAGE_SIZE/PMD_SIZE)
389 392
390NEXT_PAGE(level2_spare_pgt) 393NEXT_PAGE(level2_spare_pgt)
@@ -395,54 +398,16 @@ NEXT_PAGE(level2_spare_pgt)
395 398
396 .data 399 .data
397 .align 16 400 .align 16
398 .globl cpu_gdt_descr 401 .globl early_gdt_descr
399cpu_gdt_descr: 402early_gdt_descr:
400 .word gdt_end-cpu_gdt_table-1 403 .word GDT_ENTRIES*8-1
401gdt: 404 .quad per_cpu__gdt_page
402 .quad cpu_gdt_table
403#ifdef CONFIG_SMP
404 .rept NR_CPUS-1
405 .word 0
406 .quad 0
407 .endr
408#endif
409 405
410ENTRY(phys_base) 406ENTRY(phys_base)
411 /* This must match the first entry in level2_kernel_pgt */ 407 /* This must match the first entry in level2_kernel_pgt */
412 .quad 0x0000000000000000 408 .quad 0x0000000000000000
413 409
414/* We need valid kernel segments for data and code in long mode too
415 * IRET will check the segment types kkeil 2000/10/28
416 * Also sysret mandates a special GDT layout
417 */
418
419 .section .data.page_aligned, "aw"
420 .align PAGE_SIZE
421
422/* The TLS descriptors are currently at a different place compared to i386.
423 Hopefully nobody expects them at a fixed place (Wine?) */
424 410
425ENTRY(cpu_gdt_table)
426 .quad 0x0000000000000000 /* NULL descriptor */
427 .quad 0x00cf9b000000ffff /* __KERNEL32_CS */
428 .quad 0x00af9b000000ffff /* __KERNEL_CS */
429 .quad 0x00cf93000000ffff /* __KERNEL_DS */
430 .quad 0x00cffb000000ffff /* __USER32_CS */
431 .quad 0x00cff3000000ffff /* __USER_DS, __USER32_DS */
432 .quad 0x00affb000000ffff /* __USER_CS */
433 .quad 0x0 /* unused */
434 .quad 0,0 /* TSS */
435 .quad 0,0 /* LDT */
436 .quad 0,0,0 /* three TLS descriptors */
437 .quad 0x0000f40000000000 /* node/CPU stored in limit */
438gdt_end:
439 /* asm/segment.h:GDT_ENTRIES must match this */
440 /* This should be a multiple of the cache line size */
441 /* GDTs of other CPUs are now dynamically allocated */
442
443 /* zero the remaining page */
444 .fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
445
446 .section .bss, "aw", @nobits 411 .section .bss, "aw", @nobits
447 .align L1_CACHE_BYTES 412 .align L1_CACHE_BYTES
448ENTRY(idt_table) 413ENTRY(idt_table)
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 9b5cfcdfc426..0ea6a19bfdfe 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -17,7 +17,7 @@
17 17
18/* FSEC = 10^-15 18/* FSEC = 10^-15
19 NSEC = 10^-9 */ 19 NSEC = 10^-9 */
20#define FSEC_PER_NSEC 1000000 20#define FSEC_PER_NSEC 1000000L
21 21
22/* 22/*
23 * HPET address is set in acpi/boot.c, when an ACPI entry exists 23 * HPET address is set in acpi/boot.c, when an ACPI entry exists
@@ -36,26 +36,15 @@ static inline void hpet_writel(unsigned long d, unsigned long a)
36} 36}
37 37
38#ifdef CONFIG_X86_64 38#ifdef CONFIG_X86_64
39
40#include <asm/pgtable.h> 39#include <asm/pgtable.h>
41 40#endif
42static inline void hpet_set_mapping(void)
43{
44 set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
45 __set_fixmap(VSYSCALL_HPET, hpet_address, PAGE_KERNEL_VSYSCALL_NOCACHE);
46 hpet_virt_address = (void __iomem *)fix_to_virt(FIX_HPET_BASE);
47}
48
49static inline void hpet_clear_mapping(void)
50{
51 hpet_virt_address = NULL;
52}
53
54#else
55 41
56static inline void hpet_set_mapping(void) 42static inline void hpet_set_mapping(void)
57{ 43{
58 hpet_virt_address = ioremap_nocache(hpet_address, HPET_MMAP_SIZE); 44 hpet_virt_address = ioremap_nocache(hpet_address, HPET_MMAP_SIZE);
45#ifdef CONFIG_X86_64
46 __set_fixmap(VSYSCALL_HPET, hpet_address, PAGE_KERNEL_VSYSCALL_NOCACHE);
47#endif
59} 48}
60 49
61static inline void hpet_clear_mapping(void) 50static inline void hpet_clear_mapping(void)
@@ -63,7 +52,6 @@ static inline void hpet_clear_mapping(void)
63 iounmap(hpet_virt_address); 52 iounmap(hpet_virt_address);
64 hpet_virt_address = NULL; 53 hpet_virt_address = NULL;
65} 54}
66#endif
67 55
68/* 56/*
69 * HPET command line enable / disable 57 * HPET command line enable / disable
@@ -206,20 +194,19 @@ static void hpet_enable_legacy_int(void)
206 194
207static void hpet_legacy_clockevent_register(void) 195static void hpet_legacy_clockevent_register(void)
208{ 196{
209 uint64_t hpet_freq;
210
211 /* Start HPET legacy interrupts */ 197 /* Start HPET legacy interrupts */
212 hpet_enable_legacy_int(); 198 hpet_enable_legacy_int();
213 199
214 /* 200 /*
215 * The period is a femto seconds value. We need to calculate the 201 * The mult factor is defined as (include/linux/clockchips.h)
216 * scaled math multiplication factor for nanosecond to hpet tick 202 * mult/2^shift = cyc/ns (in contrast to ns/cyc in clocksource.h)
217 * conversion. 203 * hpet_period is in units of femtoseconds (per cycle), so
204 * mult/2^shift = cyc/ns = 10^6/hpet_period
205 * mult = (10^6 * 2^shift)/hpet_period
206 * mult = (FSEC_PER_NSEC << hpet_clockevent.shift)/hpet_period
218 */ 207 */
219 hpet_freq = 1000000000000000ULL; 208 hpet_clockevent.mult = div_sc((unsigned long) FSEC_PER_NSEC,
220 do_div(hpet_freq, hpet_period); 209 hpet_period, hpet_clockevent.shift);
221 hpet_clockevent.mult = div_sc((unsigned long) hpet_freq,
222 NSEC_PER_SEC, hpet_clockevent.shift);
223 /* Calculate the min / max delta */ 210 /* Calculate the min / max delta */
224 hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF, 211 hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF,
225 &hpet_clockevent); 212 &hpet_clockevent);
@@ -324,7 +311,7 @@ static struct clocksource clocksource_hpet = {
324 311
325static int hpet_clocksource_register(void) 312static int hpet_clocksource_register(void)
326{ 313{
327 u64 tmp, start, now; 314 u64 start, now;
328 cycle_t t1; 315 cycle_t t1;
329 316
330 /* Start the counter */ 317 /* Start the counter */
@@ -351,21 +338,15 @@ static int hpet_clocksource_register(void)
351 return -ENODEV; 338 return -ENODEV;
352 } 339 }
353 340
354 /* Initialize and register HPET clocksource 341 /*
355 * 342 * The definition of mult is (include/linux/clocksource.h)
356 * hpet period is in femto seconds per cycle 343 * mult/2^shift = ns/cyc and hpet_period is in units of fsec/cyc
357 * so we need to convert this to ns/cyc units 344 * so we first need to convert hpet_period to ns/cyc units:
358 * approximated by mult/2^shift 345 * mult/2^shift = ns/cyc = hpet_period/10^6
359 * 346 * mult = (hpet_period * 2^shift)/10^6
360 * fsec/cyc * 1nsec/1000000fsec = nsec/cyc = mult/2^shift 347 * mult = (hpet_period << shift)/FSEC_PER_NSEC
361 * fsec/cyc * 1ns/1000000fsec * 2^shift = mult
362 * fsec/cyc * 2^shift * 1nsec/1000000fsec = mult
363 * (fsec/cyc << shift)/1000000 = mult
364 * (hpet_period << shift)/FSEC_PER_NSEC = mult
365 */ 348 */
366 tmp = (u64)hpet_period << HPET_SHIFT; 349 clocksource_hpet.mult = div_sc(hpet_period, FSEC_PER_NSEC, HPET_SHIFT);
367 do_div(tmp, FSEC_PER_NSEC);
368 clocksource_hpet.mult = (u32)tmp;
369 350
370 clocksource_register(&clocksource_hpet); 351 clocksource_register(&clocksource_hpet);
371 352
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index deb43785e923..dd7ebee446af 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
+++ b/arch/x86/kernel/i386_ksyms_32.c
@@ -1,7 +1,14 @@
1#include <linux/module.h> 1#include <linux/module.h>
2
2#include <asm/checksum.h> 3#include <asm/checksum.h>
3#include <asm/desc.h>
4#include <asm/pgtable.h> 4#include <asm/pgtable.h>
5#include <asm/desc.h>
6#include <asm/ftrace.h>
7
8#ifdef CONFIG_FTRACE
9/* mcount is defined in assembly */
10EXPORT_SYMBOL(mcount);
11#endif
5 12
6/* Networking helper routines. */ 13/* Networking helper routines. */
7EXPORT_SYMBOL(csum_partial_copy_generic); 14EXPORT_SYMBOL(csum_partial_copy_generic);
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 95e80e5033c3..eb9ddd8efb82 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -162,7 +162,7 @@ int xfpregs_get(struct task_struct *target, const struct user_regset *regset,
162 int ret; 162 int ret;
163 163
164 if (!cpu_has_fxsr) 164 if (!cpu_has_fxsr)
165 return -EIO; 165 return -ENODEV;
166 166
167 ret = init_fpu(target); 167 ret = init_fpu(target);
168 if (ret) 168 if (ret)
@@ -179,7 +179,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,
179 int ret; 179 int ret;
180 180
181 if (!cpu_has_fxsr) 181 if (!cpu_has_fxsr)
182 return -EIO; 182 return -ENODEV;
183 183
184 ret = init_fpu(target); 184 ret = init_fpu(target);
185 if (ret) 185 if (ret)
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259.c
index fe631967d625..dc92b49d9204 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259.c
@@ -1,8 +1,10 @@
1#include <linux/linkage.h>
1#include <linux/errno.h> 2#include <linux/errno.h>
2#include <linux/signal.h> 3#include <linux/signal.h>
3#include <linux/sched.h> 4#include <linux/sched.h>
4#include <linux/ioport.h> 5#include <linux/ioport.h>
5#include <linux/interrupt.h> 6#include <linux/interrupt.h>
7#include <linux/timex.h>
6#include <linux/slab.h> 8#include <linux/slab.h>
7#include <linux/random.h> 9#include <linux/random.h>
8#include <linux/init.h> 10#include <linux/init.h>
@@ -10,10 +12,12 @@
10#include <linux/sysdev.h> 12#include <linux/sysdev.h>
11#include <linux/bitops.h> 13#include <linux/bitops.h>
12 14
15#include <asm/acpi.h>
13#include <asm/atomic.h> 16#include <asm/atomic.h>
14#include <asm/system.h> 17#include <asm/system.h>
15#include <asm/io.h> 18#include <asm/io.h>
16#include <asm/timer.h> 19#include <asm/timer.h>
20#include <asm/hw_irq.h>
17#include <asm/pgtable.h> 21#include <asm/pgtable.h>
18#include <asm/delay.h> 22#include <asm/delay.h>
19#include <asm/desc.h> 23#include <asm/desc.h>
@@ -32,7 +36,7 @@ static int i8259A_auto_eoi;
32DEFINE_SPINLOCK(i8259A_lock); 36DEFINE_SPINLOCK(i8259A_lock);
33static void mask_and_ack_8259A(unsigned int); 37static void mask_and_ack_8259A(unsigned int);
34 38
35static struct irq_chip i8259A_chip = { 39struct irq_chip i8259A_chip = {
36 .name = "XT-PIC", 40 .name = "XT-PIC",
37 .mask = disable_8259A_irq, 41 .mask = disable_8259A_irq,
38 .disable = disable_8259A_irq, 42 .disable = disable_8259A_irq,
@@ -125,14 +129,14 @@ static inline int i8259A_irq_real(unsigned int irq)
125 int irqmask = 1<<irq; 129 int irqmask = 1<<irq;
126 130
127 if (irq < 8) { 131 if (irq < 8) {
128 outb(0x0B,PIC_MASTER_CMD); /* ISR register */ 132 outb(0x0B, PIC_MASTER_CMD); /* ISR register */
129 value = inb(PIC_MASTER_CMD) & irqmask; 133 value = inb(PIC_MASTER_CMD) & irqmask;
130 outb(0x0A,PIC_MASTER_CMD); /* back to the IRR register */ 134 outb(0x0A, PIC_MASTER_CMD); /* back to the IRR register */
131 return value; 135 return value;
132 } 136 }
133 outb(0x0B,PIC_SLAVE_CMD); /* ISR register */ 137 outb(0x0B, PIC_SLAVE_CMD); /* ISR register */
134 value = inb(PIC_SLAVE_CMD) & (irqmask >> 8); 138 value = inb(PIC_SLAVE_CMD) & (irqmask >> 8);
135 outb(0x0A,PIC_SLAVE_CMD); /* back to the IRR register */ 139 outb(0x0A, PIC_SLAVE_CMD); /* back to the IRR register */
136 return value; 140 return value;
137} 141}
138 142
@@ -171,12 +175,14 @@ handle_real_irq:
171 if (irq & 8) { 175 if (irq & 8) {
172 inb(PIC_SLAVE_IMR); /* DUMMY - (do we need this?) */ 176 inb(PIC_SLAVE_IMR); /* DUMMY - (do we need this?) */
173 outb(cached_slave_mask, PIC_SLAVE_IMR); 177 outb(cached_slave_mask, PIC_SLAVE_IMR);
174 outb(0x60+(irq&7),PIC_SLAVE_CMD);/* 'Specific EOI' to slave */ 178 /* 'Specific EOI' to slave */
175 outb(0x60+PIC_CASCADE_IR,PIC_MASTER_CMD); /* 'Specific EOI' to master-IRQ2 */ 179 outb(0x60+(irq&7), PIC_SLAVE_CMD);
180 /* 'Specific EOI' to master-IRQ2 */
181 outb(0x60+PIC_CASCADE_IR, PIC_MASTER_CMD);
176 } else { 182 } else {
177 inb(PIC_MASTER_IMR); /* DUMMY - (do we need this?) */ 183 inb(PIC_MASTER_IMR); /* DUMMY - (do we need this?) */
178 outb(cached_master_mask, PIC_MASTER_IMR); 184 outb(cached_master_mask, PIC_MASTER_IMR);
179 outb(0x60+irq,PIC_MASTER_CMD); /* 'Specific EOI to master */ 185 outb(0x60+irq, PIC_MASTER_CMD); /* 'Specific EOI to master */
180 } 186 }
181 spin_unlock_irqrestore(&i8259A_lock, flags); 187 spin_unlock_irqrestore(&i8259A_lock, flags);
182 return; 188 return;
@@ -199,7 +205,8 @@ spurious_8259A_irq:
199 * lets ACK and report it. [once per IRQ] 205 * lets ACK and report it. [once per IRQ]
200 */ 206 */
201 if (!(spurious_irq_mask & irqmask)) { 207 if (!(spurious_irq_mask & irqmask)) {
202 printk(KERN_DEBUG "spurious 8259A interrupt: IRQ%d.\n", irq); 208 printk(KERN_DEBUG
209 "spurious 8259A interrupt: IRQ%d.\n", irq);
203 spurious_irq_mask |= irqmask; 210 spurious_irq_mask |= irqmask;
204 } 211 }
205 atomic_inc(&irq_err_count); 212 atomic_inc(&irq_err_count);
@@ -290,17 +297,28 @@ void init_8259A(int auto_eoi)
290 * outb_pic - this has to work on a wide range of PC hardware. 297 * outb_pic - this has to work on a wide range of PC hardware.
291 */ 298 */
292 outb_pic(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */ 299 outb_pic(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */
293 outb_pic(0x20 + 0, PIC_MASTER_IMR); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */ 300
294 outb_pic(1U << PIC_CASCADE_IR, PIC_MASTER_IMR); /* 8259A-1 (the master) has a slave on IR2 */ 301 /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 on x86-64,
302 to 0x20-0x27 on i386 */
303 outb_pic(IRQ0_VECTOR, PIC_MASTER_IMR);
304
305 /* 8259A-1 (the master) has a slave on IR2 */
306 outb_pic(1U << PIC_CASCADE_IR, PIC_MASTER_IMR);
307
295 if (auto_eoi) /* master does Auto EOI */ 308 if (auto_eoi) /* master does Auto EOI */
296 outb_pic(MASTER_ICW4_DEFAULT | PIC_ICW4_AEOI, PIC_MASTER_IMR); 309 outb_pic(MASTER_ICW4_DEFAULT | PIC_ICW4_AEOI, PIC_MASTER_IMR);
297 else /* master expects normal EOI */ 310 else /* master expects normal EOI */
298 outb_pic(MASTER_ICW4_DEFAULT, PIC_MASTER_IMR); 311 outb_pic(MASTER_ICW4_DEFAULT, PIC_MASTER_IMR);
299 312
300 outb_pic(0x11, PIC_SLAVE_CMD); /* ICW1: select 8259A-2 init */ 313 outb_pic(0x11, PIC_SLAVE_CMD); /* ICW1: select 8259A-2 init */
301 outb_pic(0x20 + 8, PIC_SLAVE_IMR); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */ 314
302 outb_pic(PIC_CASCADE_IR, PIC_SLAVE_IMR); /* 8259A-2 is a slave on master's IR2 */ 315 /* ICW2: 8259A-2 IR0-7 mapped to IRQ8_VECTOR */
303 outb_pic(SLAVE_ICW4_DEFAULT, PIC_SLAVE_IMR); /* (slave's support for AEOI in flat mode is to be investigated) */ 316 outb_pic(IRQ8_VECTOR, PIC_SLAVE_IMR);
317 /* 8259A-2 is a slave on master's IR2 */
318 outb_pic(PIC_CASCADE_IR, PIC_SLAVE_IMR);
319 /* (slave's support for AEOI in flat mode is to be investigated) */
320 outb_pic(SLAVE_ICW4_DEFAULT, PIC_SLAVE_IMR);
321
304 if (auto_eoi) 322 if (auto_eoi)
305 /* 323 /*
306 * In AEOI mode we just have to mask the interrupt 324 * In AEOI mode we just have to mask the interrupt
@@ -317,93 +335,3 @@ void init_8259A(int auto_eoi)
317 335
318 spin_unlock_irqrestore(&i8259A_lock, flags); 336 spin_unlock_irqrestore(&i8259A_lock, flags);
319} 337}
320
321/*
322 * Note that on a 486, we don't want to do a SIGFPE on an irq13
323 * as the irq is unreliable, and exception 16 works correctly
324 * (ie as explained in the intel literature). On a 386, you
325 * can't use exception 16 due to bad IBM design, so we have to
326 * rely on the less exact irq13.
327 *
328 * Careful.. Not only is IRQ13 unreliable, but it is also
329 * leads to races. IBM designers who came up with it should
330 * be shot.
331 */
332
333
334static irqreturn_t math_error_irq(int cpl, void *dev_id)
335{
336 extern void math_error(void __user *);
337 outb(0,0xF0);
338 if (ignore_fpu_irq || !boot_cpu_data.hard_math)
339 return IRQ_NONE;
340 math_error((void __user *)get_irq_regs()->ip);
341 return IRQ_HANDLED;
342}
343
344/*
345 * New motherboards sometimes make IRQ 13 be a PCI interrupt,
346 * so allow interrupt sharing.
347 */
348static struct irqaction fpu_irq = {
349 .handler = math_error_irq,
350 .mask = CPU_MASK_NONE,
351 .name = "fpu",
352};
353
354void __init init_ISA_irqs (void)
355{
356 int i;
357
358#ifdef CONFIG_X86_LOCAL_APIC
359 init_bsp_APIC();
360#endif
361 init_8259A(0);
362
363 /*
364 * 16 old-style INTA-cycle interrupts:
365 */
366 for (i = 0; i < 16; i++) {
367 set_irq_chip_and_handler_name(i, &i8259A_chip,
368 handle_level_irq, "XT");
369 }
370}
371
372/* Overridden in paravirt.c */
373void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
374
375void __init native_init_IRQ(void)
376{
377 int i;
378
379 /* all the set up before the call gates are initialised */
380 pre_intr_init_hook();
381
382 /*
383 * Cover the whole vector space, no vector can escape
384 * us. (some of these will be overridden and become
385 * 'special' SMP interrupts)
386 */
387 for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
388 int vector = FIRST_EXTERNAL_VECTOR + i;
389 if (i >= NR_IRQS)
390 break;
391 /* SYSCALL_VECTOR was reserved in trap_init. */
392 if (!test_bit(vector, used_vectors))
393 set_intr_gate(vector, interrupt[i]);
394 }
395
396 /* setup after call gates are initialised (usually add in
397 * the architecture specific gates)
398 */
399 intr_init_hook();
400
401 /*
402 * External FPU? Set up irq13 if so, for
403 * original braindamaged IBM FERR coupling.
404 */
405 if (boot_cpu_data.hard_math && !cpu_has_fpu)
406 setup_irq(FPU_IRQ, &fpu_irq);
407
408 irq_ctx_init(smp_processor_id());
409}
diff --git a/arch/x86/kernel/i8259_64.c b/arch/x86/kernel/i8259_64.c
deleted file mode 100644
index fa57a1568508..000000000000
--- a/arch/x86/kernel/i8259_64.c
+++ /dev/null
@@ -1,512 +0,0 @@
1#include <linux/linkage.h>
2#include <linux/errno.h>
3#include <linux/signal.h>
4#include <linux/sched.h>
5#include <linux/ioport.h>
6#include <linux/interrupt.h>
7#include <linux/timex.h>
8#include <linux/slab.h>
9#include <linux/random.h>
10#include <linux/init.h>
11#include <linux/kernel_stat.h>
12#include <linux/sysdev.h>
13#include <linux/bitops.h>
14
15#include <asm/acpi.h>
16#include <asm/atomic.h>
17#include <asm/system.h>
18#include <asm/io.h>
19#include <asm/hw_irq.h>
20#include <asm/pgtable.h>
21#include <asm/delay.h>
22#include <asm/desc.h>
23#include <asm/apic.h>
24#include <asm/i8259.h>
25
26/*
27 * Common place to define all x86 IRQ vectors
28 *
29 * This builds up the IRQ handler stubs using some ugly macros in irq.h
30 *
31 * These macros create the low-level assembly IRQ routines that save
32 * register context and call do_IRQ(). do_IRQ() then does all the
33 * operations that are needed to keep the AT (or SMP IOAPIC)
34 * interrupt-controller happy.
35 */
36
37#define BI(x,y) \
38 BUILD_IRQ(x##y)
39
40#define BUILD_16_IRQS(x) \
41 BI(x,0) BI(x,1) BI(x,2) BI(x,3) \
42 BI(x,4) BI(x,5) BI(x,6) BI(x,7) \
43 BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
44 BI(x,c) BI(x,d) BI(x,e) BI(x,f)
45
46/*
47 * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
48 * (these are usually mapped to vectors 0x30-0x3f)
49 */
50
51/*
52 * The IO-APIC gives us many more interrupt sources. Most of these
53 * are unused but an SMP system is supposed to have enough memory ...
54 * sometimes (mostly wrt. hw bugs) we get corrupted vectors all
55 * across the spectrum, so we really want to be prepared to get all
56 * of these. Plus, more powerful systems might have more than 64
57 * IO-APIC registers.
58 *
59 * (these are usually mapped into the 0x30-0xff vector range)
60 */
61 BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3)
62BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7)
63BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb)
64BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xe) BUILD_16_IRQS(0xf)
65
66#undef BUILD_16_IRQS
67#undef BI
68
69
70#define IRQ(x,y) \
71 IRQ##x##y##_interrupt
72
73#define IRQLIST_16(x) \
74 IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
75 IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
76 IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
77 IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
78
79/* for the irq vectors */
80static void (*__initdata interrupt[NR_VECTORS - FIRST_EXTERNAL_VECTOR])(void) = {
81 IRQLIST_16(0x2), IRQLIST_16(0x3),
82 IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
83 IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
84 IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf)
85};
86
87#undef IRQ
88#undef IRQLIST_16
89
90/*
91 * This is the 'legacy' 8259A Programmable Interrupt Controller,
92 * present in the majority of PC/AT boxes.
93 * plus some generic x86 specific things if generic specifics makes
94 * any sense at all.
95 * this file should become arch/i386/kernel/irq.c when the old irq.c
96 * moves to arch independent land
97 */
98
99static int i8259A_auto_eoi;
100DEFINE_SPINLOCK(i8259A_lock);
101static void mask_and_ack_8259A(unsigned int);
102
103static struct irq_chip i8259A_chip = {
104 .name = "XT-PIC",
105 .mask = disable_8259A_irq,
106 .disable = disable_8259A_irq,
107 .unmask = enable_8259A_irq,
108 .mask_ack = mask_and_ack_8259A,
109};
110
111/*
112 * 8259A PIC functions to handle ISA devices:
113 */
114
115/*
116 * This contains the irq mask for both 8259A irq controllers,
117 */
118unsigned int cached_irq_mask = 0xffff;
119
120/*
121 * Not all IRQs can be routed through the IO-APIC, eg. on certain (older)
122 * boards the timer interrupt is not really connected to any IO-APIC pin,
123 * it's fed to the master 8259A's IR0 line only.
124 *
125 * Any '1' bit in this mask means the IRQ is routed through the IO-APIC.
126 * this 'mixed mode' IRQ handling costs nothing because it's only used
127 * at IRQ setup time.
128 */
129unsigned long io_apic_irqs;
130
131void disable_8259A_irq(unsigned int irq)
132{
133 unsigned int mask = 1 << irq;
134 unsigned long flags;
135
136 spin_lock_irqsave(&i8259A_lock, flags);
137 cached_irq_mask |= mask;
138 if (irq & 8)
139 outb(cached_slave_mask, PIC_SLAVE_IMR);
140 else
141 outb(cached_master_mask, PIC_MASTER_IMR);
142 spin_unlock_irqrestore(&i8259A_lock, flags);
143}
144
145void enable_8259A_irq(unsigned int irq)
146{
147 unsigned int mask = ~(1 << irq);
148 unsigned long flags;
149
150 spin_lock_irqsave(&i8259A_lock, flags);
151 cached_irq_mask &= mask;
152 if (irq & 8)
153 outb(cached_slave_mask, PIC_SLAVE_IMR);
154 else
155 outb(cached_master_mask, PIC_MASTER_IMR);
156 spin_unlock_irqrestore(&i8259A_lock, flags);
157}
158
159int i8259A_irq_pending(unsigned int irq)
160{
161 unsigned int mask = 1<<irq;
162 unsigned long flags;
163 int ret;
164
165 spin_lock_irqsave(&i8259A_lock, flags);
166 if (irq < 8)
167 ret = inb(PIC_MASTER_CMD) & mask;
168 else
169 ret = inb(PIC_SLAVE_CMD) & (mask >> 8);
170 spin_unlock_irqrestore(&i8259A_lock, flags);
171
172 return ret;
173}
174
175void make_8259A_irq(unsigned int irq)
176{
177 disable_irq_nosync(irq);
178 io_apic_irqs &= ~(1<<irq);
179 set_irq_chip_and_handler_name(irq, &i8259A_chip, handle_level_irq,
180 "XT");
181 enable_irq(irq);
182}
183
184/*
185 * This function assumes to be called rarely. Switching between
186 * 8259A registers is slow.
187 * This has to be protected by the irq controller spinlock
188 * before being called.
189 */
190static inline int i8259A_irq_real(unsigned int irq)
191{
192 int value;
193 int irqmask = 1<<irq;
194
195 if (irq < 8) {
196 outb(0x0B,PIC_MASTER_CMD); /* ISR register */
197 value = inb(PIC_MASTER_CMD) & irqmask;
198 outb(0x0A,PIC_MASTER_CMD); /* back to the IRR register */
199 return value;
200 }
201 outb(0x0B,PIC_SLAVE_CMD); /* ISR register */
202 value = inb(PIC_SLAVE_CMD) & (irqmask >> 8);
203 outb(0x0A,PIC_SLAVE_CMD); /* back to the IRR register */
204 return value;
205}
206
207/*
208 * Careful! The 8259A is a fragile beast, it pretty
209 * much _has_ to be done exactly like this (mask it
210 * first, _then_ send the EOI, and the order of EOI
211 * to the two 8259s is important!
212 */
213static void mask_and_ack_8259A(unsigned int irq)
214{
215 unsigned int irqmask = 1 << irq;
216 unsigned long flags;
217
218 spin_lock_irqsave(&i8259A_lock, flags);
219 /*
220 * Lightweight spurious IRQ detection. We do not want
221 * to overdo spurious IRQ handling - it's usually a sign
222 * of hardware problems, so we only do the checks we can
223 * do without slowing down good hardware unnecessarily.
224 *
225 * Note that IRQ7 and IRQ15 (the two spurious IRQs
226 * usually resulting from the 8259A-1|2 PICs) occur
227 * even if the IRQ is masked in the 8259A. Thus we
228 * can check spurious 8259A IRQs without doing the
229 * quite slow i8259A_irq_real() call for every IRQ.
230 * This does not cover 100% of spurious interrupts,
231 * but should be enough to warn the user that there
232 * is something bad going on ...
233 */
234 if (cached_irq_mask & irqmask)
235 goto spurious_8259A_irq;
236 cached_irq_mask |= irqmask;
237
238handle_real_irq:
239 if (irq & 8) {
240 inb(PIC_SLAVE_IMR); /* DUMMY - (do we need this?) */
241 outb(cached_slave_mask, PIC_SLAVE_IMR);
242 /* 'Specific EOI' to slave */
243 outb(0x60+(irq&7),PIC_SLAVE_CMD);
244 /* 'Specific EOI' to master-IRQ2 */
245 outb(0x60+PIC_CASCADE_IR,PIC_MASTER_CMD);
246 } else {
247 inb(PIC_MASTER_IMR); /* DUMMY - (do we need this?) */
248 outb(cached_master_mask, PIC_MASTER_IMR);
249 /* 'Specific EOI' to master */
250 outb(0x60+irq,PIC_MASTER_CMD);
251 }
252 spin_unlock_irqrestore(&i8259A_lock, flags);
253 return;
254
255spurious_8259A_irq:
256 /*
257 * this is the slow path - should happen rarely.
258 */
259 if (i8259A_irq_real(irq))
260 /*
261 * oops, the IRQ _is_ in service according to the
262 * 8259A - not spurious, go handle it.
263 */
264 goto handle_real_irq;
265
266 {
267 static int spurious_irq_mask;
268 /*
269 * At this point we can be sure the IRQ is spurious,
270 * lets ACK and report it. [once per IRQ]
271 */
272 if (!(spurious_irq_mask & irqmask)) {
273 printk(KERN_DEBUG
274 "spurious 8259A interrupt: IRQ%d.\n", irq);
275 spurious_irq_mask |= irqmask;
276 }
277 atomic_inc(&irq_err_count);
278 /*
279 * Theoretically we do not have to handle this IRQ,
280 * but in Linux this does not cause problems and is
281 * simpler for us.
282 */
283 goto handle_real_irq;
284 }
285}
286
287static char irq_trigger[2];
288/**
289 * ELCR registers (0x4d0, 0x4d1) control edge/level of IRQ
290 */
291static void restore_ELCR(char *trigger)
292{
293 outb(trigger[0], 0x4d0);
294 outb(trigger[1], 0x4d1);
295}
296
297static void save_ELCR(char *trigger)
298{
299 /* IRQ 0,1,2,8,13 are marked as reserved */
300 trigger[0] = inb(0x4d0) & 0xF8;
301 trigger[1] = inb(0x4d1) & 0xDE;
302}
303
304static int i8259A_resume(struct sys_device *dev)
305{
306 init_8259A(i8259A_auto_eoi);
307 restore_ELCR(irq_trigger);
308 return 0;
309}
310
311static int i8259A_suspend(struct sys_device *dev, pm_message_t state)
312{
313 save_ELCR(irq_trigger);
314 return 0;
315}
316
317static int i8259A_shutdown(struct sys_device *dev)
318{
319 /* Put the i8259A into a quiescent state that
320 * the kernel initialization code can get it
321 * out of.
322 */
323 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
324 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-1 */
325 return 0;
326}
327
328static struct sysdev_class i8259_sysdev_class = {
329 .name = "i8259",
330 .suspend = i8259A_suspend,
331 .resume = i8259A_resume,
332 .shutdown = i8259A_shutdown,
333};
334
335static struct sys_device device_i8259A = {
336 .id = 0,
337 .cls = &i8259_sysdev_class,
338};
339
340static int __init i8259A_init_sysfs(void)
341{
342 int error = sysdev_class_register(&i8259_sysdev_class);
343 if (!error)
344 error = sysdev_register(&device_i8259A);
345 return error;
346}
347
348device_initcall(i8259A_init_sysfs);
349
350void init_8259A(int auto_eoi)
351{
352 unsigned long flags;
353
354 i8259A_auto_eoi = auto_eoi;
355
356 spin_lock_irqsave(&i8259A_lock, flags);
357
358 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
359 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */
360
361 /*
362 * outb_pic - this has to work on a wide range of PC hardware.
363 */
364 outb_pic(0x11, PIC_MASTER_CMD); /* ICW1: select 8259A-1 init */
365 /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 */
366 outb_pic(IRQ0_VECTOR, PIC_MASTER_IMR);
367 /* 8259A-1 (the master) has a slave on IR2 */
368 outb_pic(0x04, PIC_MASTER_IMR);
369 if (auto_eoi) /* master does Auto EOI */
370 outb_pic(MASTER_ICW4_DEFAULT | PIC_ICW4_AEOI, PIC_MASTER_IMR);
371 else /* master expects normal EOI */
372 outb_pic(MASTER_ICW4_DEFAULT, PIC_MASTER_IMR);
373
374 outb_pic(0x11, PIC_SLAVE_CMD); /* ICW1: select 8259A-2 init */
375 /* ICW2: 8259A-2 IR0-7 mapped to 0x38-0x3f */
376 outb_pic(IRQ8_VECTOR, PIC_SLAVE_IMR);
377 /* 8259A-2 is a slave on master's IR2 */
378 outb_pic(PIC_CASCADE_IR, PIC_SLAVE_IMR);
379 /* (slave's support for AEOI in flat mode is to be investigated) */
380 outb_pic(SLAVE_ICW4_DEFAULT, PIC_SLAVE_IMR);
381
382 if (auto_eoi)
383 /*
384 * In AEOI mode we just have to mask the interrupt
385 * when acking.
386 */
387 i8259A_chip.mask_ack = disable_8259A_irq;
388 else
389 i8259A_chip.mask_ack = mask_and_ack_8259A;
390
391 udelay(100); /* wait for 8259A to initialize */
392
393 outb(cached_master_mask, PIC_MASTER_IMR); /* restore master IRQ mask */
394 outb(cached_slave_mask, PIC_SLAVE_IMR); /* restore slave IRQ mask */
395
396 spin_unlock_irqrestore(&i8259A_lock, flags);
397}
398
399
400
401
402/*
403 * IRQ2 is cascade interrupt to second interrupt controller
404 */
405
406static struct irqaction irq2 = {
407 .handler = no_action,
408 .mask = CPU_MASK_NONE,
409 .name = "cascade",
410};
411DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
412 [0 ... IRQ0_VECTOR - 1] = -1,
413 [IRQ0_VECTOR] = 0,
414 [IRQ1_VECTOR] = 1,
415 [IRQ2_VECTOR] = 2,
416 [IRQ3_VECTOR] = 3,
417 [IRQ4_VECTOR] = 4,
418 [IRQ5_VECTOR] = 5,
419 [IRQ6_VECTOR] = 6,
420 [IRQ7_VECTOR] = 7,
421 [IRQ8_VECTOR] = 8,
422 [IRQ9_VECTOR] = 9,
423 [IRQ10_VECTOR] = 10,
424 [IRQ11_VECTOR] = 11,
425 [IRQ12_VECTOR] = 12,
426 [IRQ13_VECTOR] = 13,
427 [IRQ14_VECTOR] = 14,
428 [IRQ15_VECTOR] = 15,
429 [IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1
430};
431
432void __init init_ISA_irqs (void)
433{
434 int i;
435
436 init_bsp_APIC();
437 init_8259A(0);
438
439 for (i = 0; i < NR_IRQS; i++) {
440 irq_desc[i].status = IRQ_DISABLED;
441 irq_desc[i].action = NULL;
442 irq_desc[i].depth = 1;
443
444 if (i < 16) {
445 /*
446 * 16 old-style INTA-cycle interrupts:
447 */
448 set_irq_chip_and_handler_name(i, &i8259A_chip,
449 handle_level_irq, "XT");
450 } else {
451 /*
452 * 'high' PCI IRQs filled in on demand
453 */
454 irq_desc[i].chip = &no_irq_chip;
455 }
456 }
457}
458
459void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
460
461void __init native_init_IRQ(void)
462{
463 int i;
464
465 init_ISA_irqs();
466 /*
467 * Cover the whole vector space, no vector can escape
468 * us. (some of these will be overridden and become
469 * 'special' SMP interrupts)
470 */
471 for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
472 int vector = FIRST_EXTERNAL_VECTOR + i;
473 if (vector != IA32_SYSCALL_VECTOR)
474 set_intr_gate(vector, interrupt[i]);
475 }
476
477#ifdef CONFIG_SMP
478 /*
479 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
480 * IPI, driven by wakeup.
481 */
482 set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
483
484 /* IPIs for invalidation */
485 set_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
486 set_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
487 set_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
488 set_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
489 set_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
490 set_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
491 set_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
492 set_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
493
494 /* IPI for generic function call */
495 set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
496
497 /* Low priority IPI to cleanup after moving an irq */
498 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
499#endif
500 set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
501 set_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
502
503 /* self generated IPI for local APIC timer */
504 set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
505
506 /* IPI vectors for APIC spurious and error interrupts */
507 set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
508 set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
509
510 if (!acpi_ioapic)
511 setup_irq(2, &irq2);
512}
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 4dc8600d9d20..603261a5885c 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -25,6 +25,7 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/sched.h> 27#include <linux/sched.h>
28#include <linux/bootmem.h>
28#include <linux/mc146818rtc.h> 29#include <linux/mc146818rtc.h>
29#include <linux/compiler.h> 30#include <linux/compiler.h>
30#include <linux/acpi.h> 31#include <linux/acpi.h>
@@ -58,7 +59,7 @@ static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
58static DEFINE_SPINLOCK(ioapic_lock); 59static DEFINE_SPINLOCK(ioapic_lock);
59static DEFINE_SPINLOCK(vector_lock); 60static DEFINE_SPINLOCK(vector_lock);
60 61
61int timer_over_8254 __initdata = 1; 62int timer_through_8259 __initdata;
62 63
63/* 64/*
64 * Is the SiS APIC rmw bug present ? 65 * Is the SiS APIC rmw bug present ?
@@ -72,15 +73,21 @@ int sis_apic_bug = -1;
72int nr_ioapic_registers[MAX_IO_APICS]; 73int nr_ioapic_registers[MAX_IO_APICS];
73 74
74/* I/O APIC entries */ 75/* I/O APIC entries */
75struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS]; 76struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
76int nr_ioapics; 77int nr_ioapics;
77 78
78/* MP IRQ source entries */ 79/* MP IRQ source entries */
79struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; 80struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
80 81
81/* # of MP IRQ source entries */ 82/* # of MP IRQ source entries */
82int mp_irq_entries; 83int mp_irq_entries;
83 84
85#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
86int mp_bus_id_to_type[MAX_MP_BUSSES];
87#endif
88
89DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
90
84static int disable_timer_pin_1 __initdata; 91static int disable_timer_pin_1 __initdata;
85 92
86/* 93/*
@@ -110,7 +117,7 @@ struct io_apic {
110static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) 117static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx)
111{ 118{
112 return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) 119 return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx)
113 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK); 120 + (mp_ioapics[idx].mp_apicaddr & ~PAGE_MASK);
114} 121}
115 122
116static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) 123static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
@@ -239,7 +246,7 @@ static void __init replace_pin_at_irq(unsigned int irq,
239 } 246 }
240} 247}
241 248
242static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, unsigned long disable) 249static void __modify_IO_APIC_irq(unsigned int irq, unsigned long enable, unsigned long disable)
243{ 250{
244 struct irq_pin_list *entry = irq_2_pin + irq; 251 struct irq_pin_list *entry = irq_2_pin + irq;
245 unsigned int pin, reg; 252 unsigned int pin, reg;
@@ -259,30 +266,32 @@ static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, unsign
259} 266}
260 267
261/* mask = 1 */ 268/* mask = 1 */
262static void __mask_IO_APIC_irq (unsigned int irq) 269static void __mask_IO_APIC_irq(unsigned int irq)
263{ 270{
264 __modify_IO_APIC_irq(irq, 0x00010000, 0); 271 __modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED, 0);
265} 272}
266 273
267/* mask = 0 */ 274/* mask = 0 */
268static void __unmask_IO_APIC_irq (unsigned int irq) 275static void __unmask_IO_APIC_irq(unsigned int irq)
269{ 276{
270 __modify_IO_APIC_irq(irq, 0, 0x00010000); 277 __modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_MASKED);
271} 278}
272 279
273/* mask = 1, trigger = 0 */ 280/* mask = 1, trigger = 0 */
274static void __mask_and_edge_IO_APIC_irq (unsigned int irq) 281static void __mask_and_edge_IO_APIC_irq(unsigned int irq)
275{ 282{
276 __modify_IO_APIC_irq(irq, 0x00010000, 0x00008000); 283 __modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED,
284 IO_APIC_REDIR_LEVEL_TRIGGER);
277} 285}
278 286
279/* mask = 0, trigger = 1 */ 287/* mask = 0, trigger = 1 */
280static void __unmask_and_level_IO_APIC_irq (unsigned int irq) 288static void __unmask_and_level_IO_APIC_irq(unsigned int irq)
281{ 289{
282 __modify_IO_APIC_irq(irq, 0x00008000, 0x00010000); 290 __modify_IO_APIC_irq(irq, IO_APIC_REDIR_LEVEL_TRIGGER,
291 IO_APIC_REDIR_MASKED);
283} 292}
284 293
285static void mask_IO_APIC_irq (unsigned int irq) 294static void mask_IO_APIC_irq(unsigned int irq)
286{ 295{
287 unsigned long flags; 296 unsigned long flags;
288 297
@@ -291,7 +300,7 @@ static void mask_IO_APIC_irq (unsigned int irq)
291 spin_unlock_irqrestore(&ioapic_lock, flags); 300 spin_unlock_irqrestore(&ioapic_lock, flags);
292} 301}
293 302
294static void unmask_IO_APIC_irq (unsigned int irq) 303static void unmask_IO_APIC_irq(unsigned int irq)
295{ 304{
296 unsigned long flags; 305 unsigned long flags;
297 306
@@ -303,7 +312,7 @@ static void unmask_IO_APIC_irq (unsigned int irq)
303static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin) 312static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
304{ 313{
305 struct IO_APIC_route_entry entry; 314 struct IO_APIC_route_entry entry;
306 315
307 /* Check delivery_mode to be sure we're not clearing an SMI pin */ 316 /* Check delivery_mode to be sure we're not clearing an SMI pin */
308 entry = ioapic_read_entry(apic, pin); 317 entry = ioapic_read_entry(apic, pin);
309 if (entry.delivery_mode == dest_SMI) 318 if (entry.delivery_mode == dest_SMI)
@@ -315,7 +324,7 @@ static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
315 ioapic_mask_entry(apic, pin); 324 ioapic_mask_entry(apic, pin);
316} 325}
317 326
318static void clear_IO_APIC (void) 327static void clear_IO_APIC(void)
319{ 328{
320 int apic, pin; 329 int apic, pin;
321 330
@@ -332,7 +341,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
332 struct irq_pin_list *entry = irq_2_pin + irq; 341 struct irq_pin_list *entry = irq_2_pin + irq;
333 unsigned int apicid_value; 342 unsigned int apicid_value;
334 cpumask_t tmp; 343 cpumask_t tmp;
335 344
336 cpus_and(tmp, cpumask, cpu_online_map); 345 cpus_and(tmp, cpumask, cpu_online_map);
337 if (cpus_empty(tmp)) 346 if (cpus_empty(tmp))
338 tmp = TARGET_CPUS; 347 tmp = TARGET_CPUS;
@@ -361,7 +370,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
361# include <linux/kernel_stat.h> /* kstat */ 370# include <linux/kernel_stat.h> /* kstat */
362# include <linux/slab.h> /* kmalloc() */ 371# include <linux/slab.h> /* kmalloc() */
363# include <linux/timer.h> 372# include <linux/timer.h>
364 373
365#define IRQBALANCE_CHECK_ARCH -999 374#define IRQBALANCE_CHECK_ARCH -999
366#define MAX_BALANCED_IRQ_INTERVAL (5*HZ) 375#define MAX_BALANCED_IRQ_INTERVAL (5*HZ)
367#define MIN_BALANCED_IRQ_INTERVAL (HZ/2) 376#define MIN_BALANCED_IRQ_INTERVAL (HZ/2)
@@ -373,14 +382,14 @@ static int physical_balance __read_mostly;
373static long balanced_irq_interval __read_mostly = MAX_BALANCED_IRQ_INTERVAL; 382static long balanced_irq_interval __read_mostly = MAX_BALANCED_IRQ_INTERVAL;
374 383
375static struct irq_cpu_info { 384static struct irq_cpu_info {
376 unsigned long * last_irq; 385 unsigned long *last_irq;
377 unsigned long * irq_delta; 386 unsigned long *irq_delta;
378 unsigned long irq; 387 unsigned long irq;
379} irq_cpu_data[NR_CPUS]; 388} irq_cpu_data[NR_CPUS];
380 389
381#define CPU_IRQ(cpu) (irq_cpu_data[cpu].irq) 390#define CPU_IRQ(cpu) (irq_cpu_data[cpu].irq)
382#define LAST_CPU_IRQ(cpu,irq) (irq_cpu_data[cpu].last_irq[irq]) 391#define LAST_CPU_IRQ(cpu, irq) (irq_cpu_data[cpu].last_irq[irq])
383#define IRQ_DELTA(cpu,irq) (irq_cpu_data[cpu].irq_delta[irq]) 392#define IRQ_DELTA(cpu, irq) (irq_cpu_data[cpu].irq_delta[irq])
384 393
385#define IDLE_ENOUGH(cpu,now) \ 394#define IDLE_ENOUGH(cpu,now) \
386 (idle_cpu(cpu) && ((now) - per_cpu(irq_stat, (cpu)).idle_timestamp > 1)) 395 (idle_cpu(cpu) && ((now) - per_cpu(irq_stat, (cpu)).idle_timestamp > 1))
@@ -419,8 +428,8 @@ inside:
419 if (cpu == -1) 428 if (cpu == -1)
420 cpu = NR_CPUS-1; 429 cpu = NR_CPUS-1;
421 } 430 }
422 } while (!cpu_online(cpu) || !IRQ_ALLOWED(cpu,allowed_mask) || 431 } while (!cpu_online(cpu) || !IRQ_ALLOWED(cpu, allowed_mask) ||
423 (search_idle && !IDLE_ENOUGH(cpu,now))); 432 (search_idle && !IDLE_ENOUGH(cpu, now)));
424 433
425 return cpu; 434 return cpu;
426} 435}
@@ -430,15 +439,14 @@ static inline void balance_irq(int cpu, int irq)
430 unsigned long now = jiffies; 439 unsigned long now = jiffies;
431 cpumask_t allowed_mask; 440 cpumask_t allowed_mask;
432 unsigned int new_cpu; 441 unsigned int new_cpu;
433 442
434 if (irqbalance_disabled) 443 if (irqbalance_disabled)
435 return; 444 return;
436 445
437 cpus_and(allowed_mask, cpu_online_map, balance_irq_affinity[irq]); 446 cpus_and(allowed_mask, cpu_online_map, balance_irq_affinity[irq]);
438 new_cpu = move(cpu, allowed_mask, now, 1); 447 new_cpu = move(cpu, allowed_mask, now, 1);
439 if (cpu != new_cpu) { 448 if (cpu != new_cpu)
440 set_pending_irq(irq, cpumask_of_cpu(new_cpu)); 449 set_pending_irq(irq, cpumask_of_cpu(new_cpu));
441 }
442} 450}
443 451
444static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold) 452static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold)
@@ -450,14 +458,14 @@ static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold)
450 if (!irq_desc[j].action) 458 if (!irq_desc[j].action)
451 continue; 459 continue;
452 /* Is it a significant load ? */ 460 /* Is it a significant load ? */
453 if (IRQ_DELTA(CPU_TO_PACKAGEINDEX(i),j) < 461 if (IRQ_DELTA(CPU_TO_PACKAGEINDEX(i), j) <
454 useful_load_threshold) 462 useful_load_threshold)
455 continue; 463 continue;
456 balance_irq(i, j); 464 balance_irq(i, j);
457 } 465 }
458 } 466 }
459 balanced_irq_interval = max((long)MIN_BALANCED_IRQ_INTERVAL, 467 balanced_irq_interval = max((long)MIN_BALANCED_IRQ_INTERVAL,
460 balanced_irq_interval - BALANCED_IRQ_LESS_DELTA); 468 balanced_irq_interval - BALANCED_IRQ_LESS_DELTA);
461 return; 469 return;
462} 470}
463 471
@@ -486,22 +494,22 @@ static void do_irq_balance(void)
486 /* Is this an active IRQ or balancing disabled ? */ 494 /* Is this an active IRQ or balancing disabled ? */
487 if (!irq_desc[j].action || irq_balancing_disabled(j)) 495 if (!irq_desc[j].action || irq_balancing_disabled(j))
488 continue; 496 continue;
489 if ( package_index == i ) 497 if (package_index == i)
490 IRQ_DELTA(package_index,j) = 0; 498 IRQ_DELTA(package_index, j) = 0;
491 /* Determine the total count per processor per IRQ */ 499 /* Determine the total count per processor per IRQ */
492 value_now = (unsigned long) kstat_cpu(i).irqs[j]; 500 value_now = (unsigned long) kstat_cpu(i).irqs[j];
493 501
494 /* Determine the activity per processor per IRQ */ 502 /* Determine the activity per processor per IRQ */
495 delta = value_now - LAST_CPU_IRQ(i,j); 503 delta = value_now - LAST_CPU_IRQ(i, j);
496 504
497 /* Update last_cpu_irq[][] for the next time */ 505 /* Update last_cpu_irq[][] for the next time */
498 LAST_CPU_IRQ(i,j) = value_now; 506 LAST_CPU_IRQ(i, j) = value_now;
499 507
500 /* Ignore IRQs whose rate is less than the clock */ 508 /* Ignore IRQs whose rate is less than the clock */
501 if (delta < useful_load_threshold) 509 if (delta < useful_load_threshold)
502 continue; 510 continue;
503 /* update the load for the processor or package total */ 511 /* update the load for the processor or package total */
504 IRQ_DELTA(package_index,j) += delta; 512 IRQ_DELTA(package_index, j) += delta;
505 513
506 /* Keep track of the higher numbered sibling as well */ 514 /* Keep track of the higher numbered sibling as well */
507 if (i != package_index) 515 if (i != package_index)
@@ -527,7 +535,8 @@ static void do_irq_balance(void)
527 max_cpu_irq = ULONG_MAX; 535 max_cpu_irq = ULONG_MAX;
528 536
529tryanothercpu: 537tryanothercpu:
530 /* Look for heaviest loaded processor. 538 /*
539 * Look for heaviest loaded processor.
531 * We may come back to get the next heaviest loaded processor. 540 * We may come back to get the next heaviest loaded processor.
532 * Skip processors with trivial loads. 541 * Skip processors with trivial loads.
533 */ 542 */
@@ -536,7 +545,7 @@ tryanothercpu:
536 for_each_online_cpu(i) { 545 for_each_online_cpu(i) {
537 if (i != CPU_TO_PACKAGEINDEX(i)) 546 if (i != CPU_TO_PACKAGEINDEX(i))
538 continue; 547 continue;
539 if (max_cpu_irq <= CPU_IRQ(i)) 548 if (max_cpu_irq <= CPU_IRQ(i))
540 continue; 549 continue;
541 if (tmp_cpu_irq < CPU_IRQ(i)) { 550 if (tmp_cpu_irq < CPU_IRQ(i)) {
542 tmp_cpu_irq = CPU_IRQ(i); 551 tmp_cpu_irq = CPU_IRQ(i);
@@ -545,8 +554,9 @@ tryanothercpu:
545 } 554 }
546 555
547 if (tmp_loaded == -1) { 556 if (tmp_loaded == -1) {
548 /* In the case of small number of heavy interrupt sources, 557 /*
549 * loading some of the cpus too much. We use Ingo's original 558 * In the case of small number of heavy interrupt sources,
559 * loading some of the cpus too much. We use Ingo's original
550 * approach to rotate them around. 560 * approach to rotate them around.
551 */ 561 */
552 if (!first_attempt && imbalance >= useful_load_threshold) { 562 if (!first_attempt && imbalance >= useful_load_threshold) {
@@ -555,13 +565,14 @@ tryanothercpu:
555 } 565 }
556 goto not_worth_the_effort; 566 goto not_worth_the_effort;
557 } 567 }
558 568
559 first_attempt = 0; /* heaviest search */ 569 first_attempt = 0; /* heaviest search */
560 max_cpu_irq = tmp_cpu_irq; /* load */ 570 max_cpu_irq = tmp_cpu_irq; /* load */
561 max_loaded = tmp_loaded; /* processor */ 571 max_loaded = tmp_loaded; /* processor */
562 imbalance = (max_cpu_irq - min_cpu_irq) / 2; 572 imbalance = (max_cpu_irq - min_cpu_irq) / 2;
563 573
564 /* if imbalance is less than approx 10% of max load, then 574 /*
575 * if imbalance is less than approx 10% of max load, then
565 * observe diminishing returns action. - quit 576 * observe diminishing returns action. - quit
566 */ 577 */
567 if (imbalance < (max_cpu_irq >> 3)) 578 if (imbalance < (max_cpu_irq >> 3))
@@ -577,26 +588,25 @@ tryanotherirq:
577 /* Is this an active IRQ? */ 588 /* Is this an active IRQ? */
578 if (!irq_desc[j].action) 589 if (!irq_desc[j].action)
579 continue; 590 continue;
580 if (imbalance <= IRQ_DELTA(max_loaded,j)) 591 if (imbalance <= IRQ_DELTA(max_loaded, j))
581 continue; 592 continue;
582 /* Try to find the IRQ that is closest to the imbalance 593 /* Try to find the IRQ that is closest to the imbalance
583 * without going over. 594 * without going over.
584 */ 595 */
585 if (move_this_load < IRQ_DELTA(max_loaded,j)) { 596 if (move_this_load < IRQ_DELTA(max_loaded, j)) {
586 move_this_load = IRQ_DELTA(max_loaded,j); 597 move_this_load = IRQ_DELTA(max_loaded, j);
587 selected_irq = j; 598 selected_irq = j;
588 } 599 }
589 } 600 }
590 if (selected_irq == -1) { 601 if (selected_irq == -1)
591 goto tryanothercpu; 602 goto tryanothercpu;
592 }
593 603
594 imbalance = move_this_load; 604 imbalance = move_this_load;
595 605
596 /* For physical_balance case, we accumulated both load 606 /* For physical_balance case, we accumulated both load
597 * values in the one of the siblings cpu_irq[], 607 * values in the one of the siblings cpu_irq[],
598 * to use the same code for physical and logical processors 608 * to use the same code for physical and logical processors
599 * as much as possible. 609 * as much as possible.
600 * 610 *
601 * NOTE: the cpu_irq[] array holds the sum of the load for 611 * NOTE: the cpu_irq[] array holds the sum of the load for
602 * sibling A and sibling B in the slot for the lowest numbered 612 * sibling A and sibling B in the slot for the lowest numbered
@@ -625,11 +635,11 @@ tryanotherirq:
625 /* mark for change destination */ 635 /* mark for change destination */
626 set_pending_irq(selected_irq, cpumask_of_cpu(min_loaded)); 636 set_pending_irq(selected_irq, cpumask_of_cpu(min_loaded));
627 637
628 /* Since we made a change, come back sooner to 638 /* Since we made a change, come back sooner to
629 * check for more variation. 639 * check for more variation.
630 */ 640 */
631 balanced_irq_interval = max((long)MIN_BALANCED_IRQ_INTERVAL, 641 balanced_irq_interval = max((long)MIN_BALANCED_IRQ_INTERVAL,
632 balanced_irq_interval - BALANCED_IRQ_LESS_DELTA); 642 balanced_irq_interval - BALANCED_IRQ_LESS_DELTA);
633 return; 643 return;
634 } 644 }
635 goto tryanotherirq; 645 goto tryanotherirq;
@@ -640,7 +650,7 @@ not_worth_the_effort:
640 * upward 650 * upward
641 */ 651 */
642 balanced_irq_interval = min((long)MAX_BALANCED_IRQ_INTERVAL, 652 balanced_irq_interval = min((long)MAX_BALANCED_IRQ_INTERVAL,
643 balanced_irq_interval + BALANCED_IRQ_MORE_DELTA); 653 balanced_irq_interval + BALANCED_IRQ_MORE_DELTA);
644 return; 654 return;
645} 655}
646 656
@@ -679,13 +689,13 @@ static int __init balanced_irq_init(void)
679 cpumask_t tmp; 689 cpumask_t tmp;
680 690
681 cpus_shift_right(tmp, cpu_online_map, 2); 691 cpus_shift_right(tmp, cpu_online_map, 2);
682 c = &boot_cpu_data; 692 c = &boot_cpu_data;
683 /* When not overwritten by the command line ask subarchitecture. */ 693 /* When not overwritten by the command line ask subarchitecture. */
684 if (irqbalance_disabled == IRQBALANCE_CHECK_ARCH) 694 if (irqbalance_disabled == IRQBALANCE_CHECK_ARCH)
685 irqbalance_disabled = NO_BALANCE_IRQ; 695 irqbalance_disabled = NO_BALANCE_IRQ;
686 if (irqbalance_disabled) 696 if (irqbalance_disabled)
687 return 0; 697 return 0;
688 698
689 /* disable irqbalance completely if there is only one processor online */ 699 /* disable irqbalance completely if there is only one processor online */
690 if (num_online_cpus() < 2) { 700 if (num_online_cpus() < 2) {
691 irqbalance_disabled = 1; 701 irqbalance_disabled = 1;
@@ -699,16 +709,14 @@ static int __init balanced_irq_init(void)
699 physical_balance = 1; 709 physical_balance = 1;
700 710
701 for_each_online_cpu(i) { 711 for_each_online_cpu(i) {
702 irq_cpu_data[i].irq_delta = kmalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL); 712 irq_cpu_data[i].irq_delta = kzalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL);
703 irq_cpu_data[i].last_irq = kmalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL); 713 irq_cpu_data[i].last_irq = kzalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL);
704 if (irq_cpu_data[i].irq_delta == NULL || irq_cpu_data[i].last_irq == NULL) { 714 if (irq_cpu_data[i].irq_delta == NULL || irq_cpu_data[i].last_irq == NULL) {
705 printk(KERN_ERR "balanced_irq_init: out of memory"); 715 printk(KERN_ERR "balanced_irq_init: out of memory");
706 goto failed; 716 goto failed;
707 } 717 }
708 memset(irq_cpu_data[i].irq_delta,0,sizeof(unsigned long) * NR_IRQS);
709 memset(irq_cpu_data[i].last_irq,0,sizeof(unsigned long) * NR_IRQS);
710 } 718 }
711 719
712 printk(KERN_INFO "Starting balanced_irq\n"); 720 printk(KERN_INFO "Starting balanced_irq\n");
713 if (!IS_ERR(kthread_run(balanced_irq, NULL, "kirqd"))) 721 if (!IS_ERR(kthread_run(balanced_irq, NULL, "kirqd")))
714 return 0; 722 return 0;
@@ -801,10 +809,10 @@ static int find_irq_entry(int apic, int pin, int type)
801 int i; 809 int i;
802 810
803 for (i = 0; i < mp_irq_entries; i++) 811 for (i = 0; i < mp_irq_entries; i++)
804 if (mp_irqs[i].mpc_irqtype == type && 812 if (mp_irqs[i].mp_irqtype == type &&
805 (mp_irqs[i].mpc_dstapic == mp_ioapics[apic].mpc_apicid || 813 (mp_irqs[i].mp_dstapic == mp_ioapics[apic].mp_apicid ||
806 mp_irqs[i].mpc_dstapic == MP_APIC_ALL) && 814 mp_irqs[i].mp_dstapic == MP_APIC_ALL) &&
807 mp_irqs[i].mpc_dstirq == pin) 815 mp_irqs[i].mp_dstirq == pin)
808 return i; 816 return i;
809 817
810 return -1; 818 return -1;
@@ -818,13 +826,13 @@ static int __init find_isa_irq_pin(int irq, int type)
818 int i; 826 int i;
819 827
820 for (i = 0; i < mp_irq_entries; i++) { 828 for (i = 0; i < mp_irq_entries; i++) {
821 int lbus = mp_irqs[i].mpc_srcbus; 829 int lbus = mp_irqs[i].mp_srcbus;
822 830
823 if (test_bit(lbus, mp_bus_not_pci) && 831 if (test_bit(lbus, mp_bus_not_pci) &&
824 (mp_irqs[i].mpc_irqtype == type) && 832 (mp_irqs[i].mp_irqtype == type) &&
825 (mp_irqs[i].mpc_srcbusirq == irq)) 833 (mp_irqs[i].mp_srcbusirq == irq))
826 834
827 return mp_irqs[i].mpc_dstirq; 835 return mp_irqs[i].mp_dstirq;
828 } 836 }
829 return -1; 837 return -1;
830} 838}
@@ -834,17 +842,17 @@ static int __init find_isa_irq_apic(int irq, int type)
834 int i; 842 int i;
835 843
836 for (i = 0; i < mp_irq_entries; i++) { 844 for (i = 0; i < mp_irq_entries; i++) {
837 int lbus = mp_irqs[i].mpc_srcbus; 845 int lbus = mp_irqs[i].mp_srcbus;
838 846
839 if (test_bit(lbus, mp_bus_not_pci) && 847 if (test_bit(lbus, mp_bus_not_pci) &&
840 (mp_irqs[i].mpc_irqtype == type) && 848 (mp_irqs[i].mp_irqtype == type) &&
841 (mp_irqs[i].mpc_srcbusirq == irq)) 849 (mp_irqs[i].mp_srcbusirq == irq))
842 break; 850 break;
843 } 851 }
844 if (i < mp_irq_entries) { 852 if (i < mp_irq_entries) {
845 int apic; 853 int apic;
846 for(apic = 0; apic < nr_ioapics; apic++) { 854 for (apic = 0; apic < nr_ioapics; apic++) {
847 if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic) 855 if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic)
848 return apic; 856 return apic;
849 } 857 }
850 } 858 }
@@ -864,28 +872,28 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
864 872
865 apic_printk(APIC_DEBUG, "querying PCI -> IRQ mapping bus:%d, " 873 apic_printk(APIC_DEBUG, "querying PCI -> IRQ mapping bus:%d, "
866 "slot:%d, pin:%d.\n", bus, slot, pin); 874 "slot:%d, pin:%d.\n", bus, slot, pin);
867 if (mp_bus_id_to_pci_bus[bus] == -1) { 875 if (test_bit(bus, mp_bus_not_pci)) {
868 printk(KERN_WARNING "PCI BIOS passed nonexistent PCI bus %d!\n", bus); 876 printk(KERN_WARNING "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
869 return -1; 877 return -1;
870 } 878 }
871 for (i = 0; i < mp_irq_entries; i++) { 879 for (i = 0; i < mp_irq_entries; i++) {
872 int lbus = mp_irqs[i].mpc_srcbus; 880 int lbus = mp_irqs[i].mp_srcbus;
873 881
874 for (apic = 0; apic < nr_ioapics; apic++) 882 for (apic = 0; apic < nr_ioapics; apic++)
875 if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic || 883 if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic ||
876 mp_irqs[i].mpc_dstapic == MP_APIC_ALL) 884 mp_irqs[i].mp_dstapic == MP_APIC_ALL)
877 break; 885 break;
878 886
879 if (!test_bit(lbus, mp_bus_not_pci) && 887 if (!test_bit(lbus, mp_bus_not_pci) &&
880 !mp_irqs[i].mpc_irqtype && 888 !mp_irqs[i].mp_irqtype &&
881 (bus == lbus) && 889 (bus == lbus) &&
882 (slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) { 890 (slot == ((mp_irqs[i].mp_srcbusirq >> 2) & 0x1f))) {
883 int irq = pin_2_irq(i,apic,mp_irqs[i].mpc_dstirq); 891 int irq = pin_2_irq(i, apic, mp_irqs[i].mp_dstirq);
884 892
885 if (!(apic || IO_APIC_IRQ(irq))) 893 if (!(apic || IO_APIC_IRQ(irq)))
886 continue; 894 continue;
887 895
888 if (pin == (mp_irqs[i].mpc_srcbusirq & 3)) 896 if (pin == (mp_irqs[i].mp_srcbusirq & 3))
889 return irq; 897 return irq;
890 /* 898 /*
891 * Use the first all-but-pin matching entry as a 899 * Use the first all-but-pin matching entry as a
@@ -900,7 +908,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
900EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector); 908EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
901 909
902/* 910/*
903 * This function currently is only a helper for the i386 smp boot process where 911 * This function currently is only a helper for the i386 smp boot process where
904 * we need to reprogram the ioredtbls to cater for the cpus which have come online 912 * we need to reprogram the ioredtbls to cater for the cpus which have come online
905 * so mask in all cases should simply be TARGET_CPUS 913 * so mask in all cases should simply be TARGET_CPUS
906 */ 914 */
@@ -952,7 +960,7 @@ static int EISA_ELCR(unsigned int irq)
952 * EISA conforming in the MP table, that means its trigger type must 960 * EISA conforming in the MP table, that means its trigger type must
953 * be read in from the ELCR */ 961 * be read in from the ELCR */
954 962
955#define default_EISA_trigger(idx) (EISA_ELCR(mp_irqs[idx].mpc_srcbusirq)) 963#define default_EISA_trigger(idx) (EISA_ELCR(mp_irqs[idx].mp_srcbusirq))
956#define default_EISA_polarity(idx) default_ISA_polarity(idx) 964#define default_EISA_polarity(idx) default_ISA_polarity(idx)
957 965
958/* PCI interrupts are always polarity one level triggered, 966/* PCI interrupts are always polarity one level triggered,
@@ -969,118 +977,115 @@ static int EISA_ELCR(unsigned int irq)
969 977
970static int MPBIOS_polarity(int idx) 978static int MPBIOS_polarity(int idx)
971{ 979{
972 int bus = mp_irqs[idx].mpc_srcbus; 980 int bus = mp_irqs[idx].mp_srcbus;
973 int polarity; 981 int polarity;
974 982
975 /* 983 /*
976 * Determine IRQ line polarity (high active or low active): 984 * Determine IRQ line polarity (high active or low active):
977 */ 985 */
978 switch (mp_irqs[idx].mpc_irqflag & 3) 986 switch (mp_irqs[idx].mp_irqflag & 3) {
987 case 0: /* conforms, ie. bus-type dependent polarity */
979 { 988 {
980 case 0: /* conforms, ie. bus-type dependent polarity */ 989 polarity = test_bit(bus, mp_bus_not_pci)?
981 { 990 default_ISA_polarity(idx):
982 polarity = test_bit(bus, mp_bus_not_pci)? 991 default_PCI_polarity(idx);
983 default_ISA_polarity(idx): 992 break;
984 default_PCI_polarity(idx); 993 }
985 break; 994 case 1: /* high active */
986 } 995 {
987 case 1: /* high active */ 996 polarity = 0;
988 { 997 break;
989 polarity = 0; 998 }
990 break; 999 case 2: /* reserved */
991 } 1000 {
992 case 2: /* reserved */ 1001 printk(KERN_WARNING "broken BIOS!!\n");
993 { 1002 polarity = 1;
994 printk(KERN_WARNING "broken BIOS!!\n"); 1003 break;
995 polarity = 1; 1004 }
996 break; 1005 case 3: /* low active */
997 } 1006 {
998 case 3: /* low active */ 1007 polarity = 1;
999 { 1008 break;
1000 polarity = 1; 1009 }
1001 break; 1010 default: /* invalid */
1002 } 1011 {
1003 default: /* invalid */ 1012 printk(KERN_WARNING "broken BIOS!!\n");
1004 { 1013 polarity = 1;
1005 printk(KERN_WARNING "broken BIOS!!\n"); 1014 break;
1006 polarity = 1; 1015 }
1007 break;
1008 }
1009 } 1016 }
1010 return polarity; 1017 return polarity;
1011} 1018}
1012 1019
1013static int MPBIOS_trigger(int idx) 1020static int MPBIOS_trigger(int idx)
1014{ 1021{
1015 int bus = mp_irqs[idx].mpc_srcbus; 1022 int bus = mp_irqs[idx].mp_srcbus;
1016 int trigger; 1023 int trigger;
1017 1024
1018 /* 1025 /*
1019 * Determine IRQ trigger mode (edge or level sensitive): 1026 * Determine IRQ trigger mode (edge or level sensitive):
1020 */ 1027 */
1021 switch ((mp_irqs[idx].mpc_irqflag>>2) & 3) 1028 switch ((mp_irqs[idx].mp_irqflag>>2) & 3) {
1029 case 0: /* conforms, ie. bus-type dependent */
1022 { 1030 {
1023 case 0: /* conforms, ie. bus-type dependent */ 1031 trigger = test_bit(bus, mp_bus_not_pci)?
1024 { 1032 default_ISA_trigger(idx):
1025 trigger = test_bit(bus, mp_bus_not_pci)? 1033 default_PCI_trigger(idx);
1026 default_ISA_trigger(idx):
1027 default_PCI_trigger(idx);
1028#if defined(CONFIG_EISA) || defined(CONFIG_MCA) 1034#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
1029 switch (mp_bus_id_to_type[bus]) 1035 switch (mp_bus_id_to_type[bus]) {
1030 { 1036 case MP_BUS_ISA: /* ISA pin */
1031 case MP_BUS_ISA: /* ISA pin */ 1037 {
1032 { 1038 /* set before the switch */
1033 /* set before the switch */
1034 break;
1035 }
1036 case MP_BUS_EISA: /* EISA pin */
1037 {
1038 trigger = default_EISA_trigger(idx);
1039 break;
1040 }
1041 case MP_BUS_PCI: /* PCI pin */
1042 {
1043 /* set before the switch */
1044 break;
1045 }
1046 case MP_BUS_MCA: /* MCA pin */
1047 {
1048 trigger = default_MCA_trigger(idx);
1049 break;
1050 }
1051 default:
1052 {
1053 printk(KERN_WARNING "broken BIOS!!\n");
1054 trigger = 1;
1055 break;
1056 }
1057 }
1058#endif
1059 break; 1039 break;
1060 } 1040 }
1061 case 1: /* edge */ 1041 case MP_BUS_EISA: /* EISA pin */
1062 { 1042 {
1063 trigger = 0; 1043 trigger = default_EISA_trigger(idx);
1064 break; 1044 break;
1065 } 1045 }
1066 case 2: /* reserved */ 1046 case MP_BUS_PCI: /* PCI pin */
1067 { 1047 {
1068 printk(KERN_WARNING "broken BIOS!!\n"); 1048 /* set before the switch */
1069 trigger = 1;
1070 break; 1049 break;
1071 } 1050 }
1072 case 3: /* level */ 1051 case MP_BUS_MCA: /* MCA pin */
1073 { 1052 {
1074 trigger = 1; 1053 trigger = default_MCA_trigger(idx);
1075 break; 1054 break;
1076 } 1055 }
1077 default: /* invalid */ 1056 default:
1078 { 1057 {
1079 printk(KERN_WARNING "broken BIOS!!\n"); 1058 printk(KERN_WARNING "broken BIOS!!\n");
1080 trigger = 0; 1059 trigger = 1;
1081 break; 1060 break;
1082 } 1061 }
1083 } 1062 }
1063#endif
1064 break;
1065 }
1066 case 1: /* edge */
1067 {
1068 trigger = 0;
1069 break;
1070 }
1071 case 2: /* reserved */
1072 {
1073 printk(KERN_WARNING "broken BIOS!!\n");
1074 trigger = 1;
1075 break;
1076 }
1077 case 3: /* level */
1078 {
1079 trigger = 1;
1080 break;
1081 }
1082 default: /* invalid */
1083 {
1084 printk(KERN_WARNING "broken BIOS!!\n");
1085 trigger = 0;
1086 break;
1087 }
1088 }
1084 return trigger; 1089 return trigger;
1085} 1090}
1086 1091
@@ -1097,16 +1102,16 @@ static inline int irq_trigger(int idx)
1097static int pin_2_irq(int idx, int apic, int pin) 1102static int pin_2_irq(int idx, int apic, int pin)
1098{ 1103{
1099 int irq, i; 1104 int irq, i;
1100 int bus = mp_irqs[idx].mpc_srcbus; 1105 int bus = mp_irqs[idx].mp_srcbus;
1101 1106
1102 /* 1107 /*
1103 * Debugging check, we are in big trouble if this message pops up! 1108 * Debugging check, we are in big trouble if this message pops up!
1104 */ 1109 */
1105 if (mp_irqs[idx].mpc_dstirq != pin) 1110 if (mp_irqs[idx].mp_dstirq != pin)
1106 printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); 1111 printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n");
1107 1112
1108 if (test_bit(bus, mp_bus_not_pci)) 1113 if (test_bit(bus, mp_bus_not_pci))
1109 irq = mp_irqs[idx].mpc_srcbusirq; 1114 irq = mp_irqs[idx].mp_srcbusirq;
1110 else { 1115 else {
1111 /* 1116 /*
1112 * PCI IRQs are mapped in order 1117 * PCI IRQs are mapped in order
@@ -1148,8 +1153,8 @@ static inline int IO_APIC_irq_trigger(int irq)
1148 1153
1149 for (apic = 0; apic < nr_ioapics; apic++) { 1154 for (apic = 0; apic < nr_ioapics; apic++) {
1150 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { 1155 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
1151 idx = find_irq_entry(apic,pin,mp_INT); 1156 idx = find_irq_entry(apic, pin, mp_INT);
1152 if ((idx != -1) && (irq == pin_2_irq(idx,apic,pin))) 1157 if ((idx != -1) && (irq == pin_2_irq(idx, apic, pin)))
1153 return irq_trigger(idx); 1158 return irq_trigger(idx);
1154 } 1159 }
1155 } 1160 }
@@ -1164,7 +1169,7 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }
1164 1169
1165static int __assign_irq_vector(int irq) 1170static int __assign_irq_vector(int irq)
1166{ 1171{
1167 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; 1172 static int current_vector = FIRST_DEVICE_VECTOR, current_offset;
1168 int vector, offset; 1173 int vector, offset;
1169 1174
1170 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); 1175 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
@@ -1176,7 +1181,7 @@ static int __assign_irq_vector(int irq)
1176 offset = current_offset; 1181 offset = current_offset;
1177next: 1182next:
1178 vector += 8; 1183 vector += 8;
1179 if (vector >= FIRST_SYSTEM_VECTOR) { 1184 if (vector >= first_system_vector) {
1180 offset = (offset + 1) % 8; 1185 offset = (offset + 1) % 8;
1181 vector = FIRST_DEVICE_VECTOR + offset; 1186 vector = FIRST_DEVICE_VECTOR + offset;
1182 } 1187 }
@@ -1203,6 +1208,11 @@ static int assign_irq_vector(int irq)
1203 1208
1204 return vector; 1209 return vector;
1205} 1210}
1211
1212void setup_vector_irq(int cpu)
1213{
1214}
1215
1206static struct irq_chip ioapic_chip; 1216static struct irq_chip ioapic_chip;
1207 1217
1208#define IOAPIC_AUTO -1 1218#define IOAPIC_AUTO -1
@@ -1237,25 +1247,25 @@ static void __init setup_IO_APIC_irqs(void)
1237 /* 1247 /*
1238 * add it to the IO-APIC irq-routing table: 1248 * add it to the IO-APIC irq-routing table:
1239 */ 1249 */
1240 memset(&entry,0,sizeof(entry)); 1250 memset(&entry, 0, sizeof(entry));
1241 1251
1242 entry.delivery_mode = INT_DELIVERY_MODE; 1252 entry.delivery_mode = INT_DELIVERY_MODE;
1243 entry.dest_mode = INT_DEST_MODE; 1253 entry.dest_mode = INT_DEST_MODE;
1244 entry.mask = 0; /* enable IRQ */ 1254 entry.mask = 0; /* enable IRQ */
1245 entry.dest.logical.logical_dest = 1255 entry.dest.logical.logical_dest =
1246 cpu_mask_to_apicid(TARGET_CPUS); 1256 cpu_mask_to_apicid(TARGET_CPUS);
1247 1257
1248 idx = find_irq_entry(apic,pin,mp_INT); 1258 idx = find_irq_entry(apic, pin, mp_INT);
1249 if (idx == -1) { 1259 if (idx == -1) {
1250 if (first_notcon) { 1260 if (first_notcon) {
1251 apic_printk(APIC_VERBOSE, KERN_DEBUG 1261 apic_printk(APIC_VERBOSE, KERN_DEBUG
1252 " IO-APIC (apicid-pin) %d-%d", 1262 " IO-APIC (apicid-pin) %d-%d",
1253 mp_ioapics[apic].mpc_apicid, 1263 mp_ioapics[apic].mp_apicid,
1254 pin); 1264 pin);
1255 first_notcon = 0; 1265 first_notcon = 0;
1256 } else 1266 } else
1257 apic_printk(APIC_VERBOSE, ", %d-%d", 1267 apic_printk(APIC_VERBOSE, ", %d-%d",
1258 mp_ioapics[apic].mpc_apicid, pin); 1268 mp_ioapics[apic].mp_apicid, pin);
1259 continue; 1269 continue;
1260 } 1270 }
1261 1271
@@ -1289,7 +1299,7 @@ static void __init setup_IO_APIC_irqs(void)
1289 vector = assign_irq_vector(irq); 1299 vector = assign_irq_vector(irq);
1290 entry.vector = vector; 1300 entry.vector = vector;
1291 ioapic_register_intr(irq, vector, IOAPIC_AUTO); 1301 ioapic_register_intr(irq, vector, IOAPIC_AUTO);
1292 1302
1293 if (!apic && (irq < 16)) 1303 if (!apic && (irq < 16))
1294 disable_8259A_irq(irq); 1304 disable_8259A_irq(irq);
1295 } 1305 }
@@ -1302,25 +1312,21 @@ static void __init setup_IO_APIC_irqs(void)
1302} 1312}
1303 1313
1304/* 1314/*
1305 * Set up the 8259A-master output pin: 1315 * Set up the timer pin, possibly with the 8259A-master behind.
1306 */ 1316 */
1307static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, int vector) 1317static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin,
1318 int vector)
1308{ 1319{
1309 struct IO_APIC_route_entry entry; 1320 struct IO_APIC_route_entry entry;
1310 1321
1311 memset(&entry,0,sizeof(entry)); 1322 memset(&entry, 0, sizeof(entry));
1312
1313 disable_8259A_irq(0);
1314
1315 /* mask LVT0 */
1316 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
1317 1323
1318 /* 1324 /*
1319 * We use logical delivery to get the timer IRQ 1325 * We use logical delivery to get the timer IRQ
1320 * to the first CPU. 1326 * to the first CPU.
1321 */ 1327 */
1322 entry.dest_mode = INT_DEST_MODE; 1328 entry.dest_mode = INT_DEST_MODE;
1323 entry.mask = 0; /* unmask IRQ now */ 1329 entry.mask = 1; /* mask IRQ now */
1324 entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); 1330 entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
1325 entry.delivery_mode = INT_DELIVERY_MODE; 1331 entry.delivery_mode = INT_DELIVERY_MODE;
1326 entry.polarity = 0; 1332 entry.polarity = 0;
@@ -1329,17 +1335,14 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
1329 1335
1330 /* 1336 /*
1331 * The timer IRQ doesn't have to know that behind the 1337 * The timer IRQ doesn't have to know that behind the
1332 * scene we have a 8259A-master in AEOI mode ... 1338 * scene we may have a 8259A-master in AEOI mode ...
1333 */ 1339 */
1334 irq_desc[0].chip = &ioapic_chip; 1340 ioapic_register_intr(0, vector, IOAPIC_EDGE);
1335 set_irq_handler(0, handle_edge_irq);
1336 1341
1337 /* 1342 /*
1338 * Add it to the IO-APIC irq-routing table: 1343 * Add it to the IO-APIC irq-routing table:
1339 */ 1344 */
1340 ioapic_write_entry(apic, pin, entry); 1345 ioapic_write_entry(apic, pin, entry);
1341
1342 enable_8259A_irq(0);
1343} 1346}
1344 1347
1345void __init print_IO_APIC(void) 1348void __init print_IO_APIC(void)
@@ -1354,10 +1357,10 @@ void __init print_IO_APIC(void)
1354 if (apic_verbosity == APIC_QUIET) 1357 if (apic_verbosity == APIC_QUIET)
1355 return; 1358 return;
1356 1359
1357 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); 1360 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
1358 for (i = 0; i < nr_ioapics; i++) 1361 for (i = 0; i < nr_ioapics; i++)
1359 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", 1362 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
1360 mp_ioapics[i].mpc_apicid, nr_ioapic_registers[i]); 1363 mp_ioapics[i].mp_apicid, nr_ioapic_registers[i]);
1361 1364
1362 /* 1365 /*
1363 * We are a bit conservative about what we expect. We have to 1366 * We are a bit conservative about what we expect. We have to
@@ -1376,7 +1379,7 @@ void __init print_IO_APIC(void)
1376 reg_03.raw = io_apic_read(apic, 3); 1379 reg_03.raw = io_apic_read(apic, 3);
1377 spin_unlock_irqrestore(&ioapic_lock, flags); 1380 spin_unlock_irqrestore(&ioapic_lock, flags);
1378 1381
1379 printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mpc_apicid); 1382 printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid);
1380 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); 1383 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw);
1381 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); 1384 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID);
1382 printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); 1385 printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type);
@@ -1459,7 +1462,7 @@ void __init print_IO_APIC(void)
1459 1462
1460#if 0 1463#if 0
1461 1464
1462static void print_APIC_bitfield (int base) 1465static void print_APIC_bitfield(int base)
1463{ 1466{
1464 unsigned int v; 1467 unsigned int v;
1465 int i, j; 1468 int i, j;
@@ -1480,7 +1483,7 @@ static void print_APIC_bitfield (int base)
1480 } 1483 }
1481} 1484}
1482 1485
1483void /*__init*/ print_local_APIC(void * dummy) 1486void /*__init*/ print_local_APIC(void *dummy)
1484{ 1487{
1485 unsigned int v, ver, maxlvt; 1488 unsigned int v, ver, maxlvt;
1486 1489
@@ -1489,6 +1492,7 @@ void /*__init*/ print_local_APIC(void * dummy)
1489 1492
1490 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", 1493 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
1491 smp_processor_id(), hard_smp_processor_id()); 1494 smp_processor_id(), hard_smp_processor_id());
1495 v = apic_read(APIC_ID);
1492 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, 1496 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v,
1493 GET_APIC_ID(read_apic_id())); 1497 GET_APIC_ID(read_apic_id()));
1494 v = apic_read(APIC_LVR); 1498 v = apic_read(APIC_LVR);
@@ -1563,7 +1567,7 @@ void /*__init*/ print_local_APIC(void * dummy)
1563 printk("\n"); 1567 printk("\n");
1564} 1568}
1565 1569
1566void print_all_local_APICs (void) 1570void print_all_local_APICs(void)
1567{ 1571{
1568 on_each_cpu(print_local_APIC, NULL, 1, 1); 1572 on_each_cpu(print_local_APIC, NULL, 1, 1);
1569} 1573}
@@ -1586,11 +1590,11 @@ void /*__init*/ print_PIC(void)
1586 v = inb(0xa0) << 8 | inb(0x20); 1590 v = inb(0xa0) << 8 | inb(0x20);
1587 printk(KERN_DEBUG "... PIC IRR: %04x\n", v); 1591 printk(KERN_DEBUG "... PIC IRR: %04x\n", v);
1588 1592
1589 outb(0x0b,0xa0); 1593 outb(0x0b, 0xa0);
1590 outb(0x0b,0x20); 1594 outb(0x0b, 0x20);
1591 v = inb(0xa0) << 8 | inb(0x20); 1595 v = inb(0xa0) << 8 | inb(0x20);
1592 outb(0x0a,0xa0); 1596 outb(0x0a, 0xa0);
1593 outb(0x0a,0x20); 1597 outb(0x0a, 0x20);
1594 1598
1595 spin_unlock_irqrestore(&i8259A_lock, flags); 1599 spin_unlock_irqrestore(&i8259A_lock, flags);
1596 1600
@@ -1626,7 +1630,7 @@ static void __init enable_IO_APIC(void)
1626 spin_unlock_irqrestore(&ioapic_lock, flags); 1630 spin_unlock_irqrestore(&ioapic_lock, flags);
1627 nr_ioapic_registers[apic] = reg_01.bits.entries+1; 1631 nr_ioapic_registers[apic] = reg_01.bits.entries+1;
1628 } 1632 }
1629 for(apic = 0; apic < nr_ioapics; apic++) { 1633 for (apic = 0; apic < nr_ioapics; apic++) {
1630 int pin; 1634 int pin;
1631 /* See if any of the pins is in ExtINT mode */ 1635 /* See if any of the pins is in ExtINT mode */
1632 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { 1636 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
@@ -1716,7 +1720,6 @@ void disable_IO_APIC(void)
1716 * by Matt Domsch <Matt_Domsch@dell.com> Tue Dec 21 12:25:05 CST 1999 1720 * by Matt Domsch <Matt_Domsch@dell.com> Tue Dec 21 12:25:05 CST 1999
1717 */ 1721 */
1718 1722
1719#ifndef CONFIG_X86_NUMAQ
1720static void __init setup_ioapic_ids_from_mpc(void) 1723static void __init setup_ioapic_ids_from_mpc(void)
1721{ 1724{
1722 union IO_APIC_reg_00 reg_00; 1725 union IO_APIC_reg_00 reg_00;
@@ -1726,6 +1729,11 @@ static void __init setup_ioapic_ids_from_mpc(void)
1726 unsigned char old_id; 1729 unsigned char old_id;
1727 unsigned long flags; 1730 unsigned long flags;
1728 1731
1732#ifdef CONFIG_X86_NUMAQ
1733 if (found_numaq)
1734 return;
1735#endif
1736
1729 /* 1737 /*
1730 * Don't check I/O APIC IDs for xAPIC systems. They have 1738 * Don't check I/O APIC IDs for xAPIC systems. They have
1731 * no meaning without the serial APIC bus. 1739 * no meaning without the serial APIC bus.
@@ -1748,15 +1756,15 @@ static void __init setup_ioapic_ids_from_mpc(void)
1748 spin_lock_irqsave(&ioapic_lock, flags); 1756 spin_lock_irqsave(&ioapic_lock, flags);
1749 reg_00.raw = io_apic_read(apic, 0); 1757 reg_00.raw = io_apic_read(apic, 0);
1750 spin_unlock_irqrestore(&ioapic_lock, flags); 1758 spin_unlock_irqrestore(&ioapic_lock, flags);
1751
1752 old_id = mp_ioapics[apic].mpc_apicid;
1753 1759
1754 if (mp_ioapics[apic].mpc_apicid >= get_physical_broadcast()) { 1760 old_id = mp_ioapics[apic].mp_apicid;
1761
1762 if (mp_ioapics[apic].mp_apicid >= get_physical_broadcast()) {
1755 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", 1763 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
1756 apic, mp_ioapics[apic].mpc_apicid); 1764 apic, mp_ioapics[apic].mp_apicid);
1757 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", 1765 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
1758 reg_00.bits.ID); 1766 reg_00.bits.ID);
1759 mp_ioapics[apic].mpc_apicid = reg_00.bits.ID; 1767 mp_ioapics[apic].mp_apicid = reg_00.bits.ID;
1760 } 1768 }
1761 1769
1762 /* 1770 /*
@@ -1765,9 +1773,9 @@ static void __init setup_ioapic_ids_from_mpc(void)
1765 * 'stuck on smp_invalidate_needed IPI wait' messages. 1773 * 'stuck on smp_invalidate_needed IPI wait' messages.
1766 */ 1774 */
1767 if (check_apicid_used(phys_id_present_map, 1775 if (check_apicid_used(phys_id_present_map,
1768 mp_ioapics[apic].mpc_apicid)) { 1776 mp_ioapics[apic].mp_apicid)) {
1769 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", 1777 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
1770 apic, mp_ioapics[apic].mpc_apicid); 1778 apic, mp_ioapics[apic].mp_apicid);
1771 for (i = 0; i < get_physical_broadcast(); i++) 1779 for (i = 0; i < get_physical_broadcast(); i++)
1772 if (!physid_isset(i, phys_id_present_map)) 1780 if (!physid_isset(i, phys_id_present_map))
1773 break; 1781 break;
@@ -1776,13 +1784,13 @@ static void __init setup_ioapic_ids_from_mpc(void)
1776 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", 1784 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
1777 i); 1785 i);
1778 physid_set(i, phys_id_present_map); 1786 physid_set(i, phys_id_present_map);
1779 mp_ioapics[apic].mpc_apicid = i; 1787 mp_ioapics[apic].mp_apicid = i;
1780 } else { 1788 } else {
1781 physid_mask_t tmp; 1789 physid_mask_t tmp;
1782 tmp = apicid_to_cpu_present(mp_ioapics[apic].mpc_apicid); 1790 tmp = apicid_to_cpu_present(mp_ioapics[apic].mp_apicid);
1783 apic_printk(APIC_VERBOSE, "Setting %d in the " 1791 apic_printk(APIC_VERBOSE, "Setting %d in the "
1784 "phys_id_present_map\n", 1792 "phys_id_present_map\n",
1785 mp_ioapics[apic].mpc_apicid); 1793 mp_ioapics[apic].mp_apicid);
1786 physids_or(phys_id_present_map, phys_id_present_map, tmp); 1794 physids_or(phys_id_present_map, phys_id_present_map, tmp);
1787 } 1795 }
1788 1796
@@ -1791,21 +1799,21 @@ static void __init setup_ioapic_ids_from_mpc(void)
1791 * We need to adjust the IRQ routing table 1799 * We need to adjust the IRQ routing table
1792 * if the ID changed. 1800 * if the ID changed.
1793 */ 1801 */
1794 if (old_id != mp_ioapics[apic].mpc_apicid) 1802 if (old_id != mp_ioapics[apic].mp_apicid)
1795 for (i = 0; i < mp_irq_entries; i++) 1803 for (i = 0; i < mp_irq_entries; i++)
1796 if (mp_irqs[i].mpc_dstapic == old_id) 1804 if (mp_irqs[i].mp_dstapic == old_id)
1797 mp_irqs[i].mpc_dstapic 1805 mp_irqs[i].mp_dstapic
1798 = mp_ioapics[apic].mpc_apicid; 1806 = mp_ioapics[apic].mp_apicid;
1799 1807
1800 /* 1808 /*
1801 * Read the right value from the MPC table and 1809 * Read the right value from the MPC table and
1802 * write it into the ID register. 1810 * write it into the ID register.
1803 */ 1811 */
1804 apic_printk(APIC_VERBOSE, KERN_INFO 1812 apic_printk(APIC_VERBOSE, KERN_INFO
1805 "...changing IO-APIC physical APIC ID to %d ...", 1813 "...changing IO-APIC physical APIC ID to %d ...",
1806 mp_ioapics[apic].mpc_apicid); 1814 mp_ioapics[apic].mp_apicid);
1807 1815
1808 reg_00.bits.ID = mp_ioapics[apic].mpc_apicid; 1816 reg_00.bits.ID = mp_ioapics[apic].mp_apicid;
1809 spin_lock_irqsave(&ioapic_lock, flags); 1817 spin_lock_irqsave(&ioapic_lock, flags);
1810 io_apic_write(apic, 0, reg_00.raw); 1818 io_apic_write(apic, 0, reg_00.raw);
1811 spin_unlock_irqrestore(&ioapic_lock, flags); 1819 spin_unlock_irqrestore(&ioapic_lock, flags);
@@ -1816,15 +1824,12 @@ static void __init setup_ioapic_ids_from_mpc(void)
1816 spin_lock_irqsave(&ioapic_lock, flags); 1824 spin_lock_irqsave(&ioapic_lock, flags);
1817 reg_00.raw = io_apic_read(apic, 0); 1825 reg_00.raw = io_apic_read(apic, 0);
1818 spin_unlock_irqrestore(&ioapic_lock, flags); 1826 spin_unlock_irqrestore(&ioapic_lock, flags);
1819 if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) 1827 if (reg_00.bits.ID != mp_ioapics[apic].mp_apicid)
1820 printk("could not set ID!\n"); 1828 printk("could not set ID!\n");
1821 else 1829 else
1822 apic_printk(APIC_VERBOSE, " ok.\n"); 1830 apic_printk(APIC_VERBOSE, " ok.\n");
1823 } 1831 }
1824} 1832}
1825#else
1826static void __init setup_ioapic_ids_from_mpc(void) { }
1827#endif
1828 1833
1829int no_timer_check __initdata; 1834int no_timer_check __initdata;
1830 1835
@@ -2015,12 +2020,12 @@ static inline void init_IO_APIC_traps(void)
2015 * The local APIC irq-chip implementation: 2020 * The local APIC irq-chip implementation:
2016 */ 2021 */
2017 2022
2018static void ack_apic(unsigned int irq) 2023static void ack_lapic_irq(unsigned int irq)
2019{ 2024{
2020 ack_APIC_irq(); 2025 ack_APIC_irq();
2021} 2026}
2022 2027
2023static void mask_lapic_irq (unsigned int irq) 2028static void mask_lapic_irq(unsigned int irq)
2024{ 2029{
2025 unsigned long v; 2030 unsigned long v;
2026 2031
@@ -2028,7 +2033,7 @@ static void mask_lapic_irq (unsigned int irq)
2028 apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED); 2033 apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED);
2029} 2034}
2030 2035
2031static void unmask_lapic_irq (unsigned int irq) 2036static void unmask_lapic_irq(unsigned int irq)
2032{ 2037{
2033 unsigned long v; 2038 unsigned long v;
2034 2039
@@ -2037,23 +2042,31 @@ static void unmask_lapic_irq (unsigned int irq)
2037} 2042}
2038 2043
2039static struct irq_chip lapic_chip __read_mostly = { 2044static struct irq_chip lapic_chip __read_mostly = {
2040 .name = "local-APIC-edge", 2045 .name = "local-APIC",
2041 .mask = mask_lapic_irq, 2046 .mask = mask_lapic_irq,
2042 .unmask = unmask_lapic_irq, 2047 .unmask = unmask_lapic_irq,
2043 .eoi = ack_apic, 2048 .ack = ack_lapic_irq,
2044}; 2049};
2045 2050
2051static void lapic_register_intr(int irq, int vector)
2052{
2053 irq_desc[irq].status &= ~IRQ_LEVEL;
2054 set_irq_chip_and_handler_name(irq, &lapic_chip, handle_edge_irq,
2055 "edge");
2056 set_intr_gate(vector, interrupt[irq]);
2057}
2058
2046static void __init setup_nmi(void) 2059static void __init setup_nmi(void)
2047{ 2060{
2048 /* 2061 /*
2049 * Dirty trick to enable the NMI watchdog ... 2062 * Dirty trick to enable the NMI watchdog ...
2050 * We put the 8259A master into AEOI mode and 2063 * We put the 8259A master into AEOI mode and
2051 * unmask on all local APICs LVT0 as NMI. 2064 * unmask on all local APICs LVT0 as NMI.
2052 * 2065 *
2053 * The idea to use the 8259A in AEOI mode ('8259A Virtual Wire') 2066 * The idea to use the 8259A in AEOI mode ('8259A Virtual Wire')
2054 * is from Maciej W. Rozycki - so we do not have to EOI from 2067 * is from Maciej W. Rozycki - so we do not have to EOI from
2055 * the NMI handler or the timer interrupt. 2068 * the NMI handler or the timer interrupt.
2056 */ 2069 */
2057 apic_printk(APIC_VERBOSE, KERN_INFO "activating NMI Watchdog ..."); 2070 apic_printk(APIC_VERBOSE, KERN_INFO "activating NMI Watchdog ...");
2058 2071
2059 enable_NMI_through_LVT0(); 2072 enable_NMI_through_LVT0();
@@ -2129,11 +2142,16 @@ static inline void __init unlock_ExtINT_logic(void)
2129static inline void __init check_timer(void) 2142static inline void __init check_timer(void)
2130{ 2143{
2131 int apic1, pin1, apic2, pin2; 2144 int apic1, pin1, apic2, pin2;
2145 int no_pin1 = 0;
2132 int vector; 2146 int vector;
2147 unsigned int ver;
2133 unsigned long flags; 2148 unsigned long flags;
2134 2149
2135 local_irq_save(flags); 2150 local_irq_save(flags);
2136 2151
2152 ver = apic_read(APIC_LVR);
2153 ver = GET_APIC_VERSION(ver);
2154
2137 /* 2155 /*
2138 * get/set the timer IRQ vector: 2156 * get/set the timer IRQ vector:
2139 */ 2157 */
@@ -2142,17 +2160,17 @@ static inline void __init check_timer(void)
2142 set_intr_gate(vector, interrupt[0]); 2160 set_intr_gate(vector, interrupt[0]);
2143 2161
2144 /* 2162 /*
2145 * Subtle, code in do_timer_interrupt() expects an AEOI 2163 * As IRQ0 is to be enabled in the 8259A, the virtual
2146 * mode for the 8259A whenever interrupts are routed 2164 * wire has to be disabled in the local APIC. Also
2147 * through I/O APICs. Also IRQ0 has to be enabled in 2165 * timer interrupts need to be acknowledged manually in
2148 * the 8259A which implies the virtual wire has to be 2166 * the 8259A for the i82489DX when using the NMI
2149 * disabled in the local APIC. 2167 * watchdog as that APIC treats NMIs as level-triggered.
2168 * The AEOI mode will finish them in the 8259A
2169 * automatically.
2150 */ 2170 */
2151 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 2171 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
2152 init_8259A(1); 2172 init_8259A(1);
2153 timer_ack = 1; 2173 timer_ack = (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver));
2154 if (timer_over_8254 > 0)
2155 enable_8259A_irq(0);
2156 2174
2157 pin1 = find_isa_irq_pin(0, mp_INT); 2175 pin1 = find_isa_irq_pin(0, mp_INT);
2158 apic1 = find_isa_irq_apic(0, mp_INT); 2176 apic1 = find_isa_irq_apic(0, mp_INT);
@@ -2162,14 +2180,33 @@ static inline void __init check_timer(void)
2162 printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", 2180 printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
2163 vector, apic1, pin1, apic2, pin2); 2181 vector, apic1, pin1, apic2, pin2);
2164 2182
2183 /*
2184 * Some BIOS writers are clueless and report the ExtINTA
2185 * I/O APIC input from the cascaded 8259A as the timer
2186 * interrupt input. So just in case, if only one pin
2187 * was found above, try it both directly and through the
2188 * 8259A.
2189 */
2190 if (pin1 == -1) {
2191 pin1 = pin2;
2192 apic1 = apic2;
2193 no_pin1 = 1;
2194 } else if (pin2 == -1) {
2195 pin2 = pin1;
2196 apic2 = apic1;
2197 }
2198
2165 if (pin1 != -1) { 2199 if (pin1 != -1) {
2166 /* 2200 /*
2167 * Ok, does IRQ0 through the IOAPIC work? 2201 * Ok, does IRQ0 through the IOAPIC work?
2168 */ 2202 */
2203 if (no_pin1) {
2204 add_pin_to_irq(0, apic1, pin1);
2205 setup_timer_IRQ0_pin(apic1, pin1, vector);
2206 }
2169 unmask_IO_APIC_irq(0); 2207 unmask_IO_APIC_irq(0);
2170 if (timer_irq_works()) { 2208 if (timer_irq_works()) {
2171 if (nmi_watchdog == NMI_IO_APIC) { 2209 if (nmi_watchdog == NMI_IO_APIC) {
2172 disable_8259A_irq(0);
2173 setup_nmi(); 2210 setup_nmi();
2174 enable_8259A_irq(0); 2211 enable_8259A_irq(0);
2175 } 2212 }
@@ -2178,45 +2215,47 @@ static inline void __init check_timer(void)
2178 goto out; 2215 goto out;
2179 } 2216 }
2180 clear_IO_APIC_pin(apic1, pin1); 2217 clear_IO_APIC_pin(apic1, pin1);
2181 printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to " 2218 if (!no_pin1)
2182 "IO-APIC\n"); 2219 printk(KERN_ERR "..MP-BIOS bug: "
2183 } 2220 "8254 timer not connected to IO-APIC\n");
2184 2221
2185 printk(KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... "); 2222 printk(KERN_INFO "...trying to set up timer (IRQ0) "
2186 if (pin2 != -1) { 2223 "through the 8259A ... ");
2187 printk("\n..... (found pin %d) ...", pin2); 2224 printk("\n..... (found pin %d) ...", pin2);
2188 /* 2225 /*
2189 * legacy devices should be connected to IO APIC #0 2226 * legacy devices should be connected to IO APIC #0
2190 */ 2227 */
2191 setup_ExtINT_IRQ0_pin(apic2, pin2, vector); 2228 replace_pin_at_irq(0, apic1, pin1, apic2, pin2);
2229 setup_timer_IRQ0_pin(apic2, pin2, vector);
2230 unmask_IO_APIC_irq(0);
2231 enable_8259A_irq(0);
2192 if (timer_irq_works()) { 2232 if (timer_irq_works()) {
2193 printk("works.\n"); 2233 printk("works.\n");
2194 if (pin1 != -1) 2234 timer_through_8259 = 1;
2195 replace_pin_at_irq(0, apic1, pin1, apic2, pin2);
2196 else
2197 add_pin_to_irq(0, apic2, pin2);
2198 if (nmi_watchdog == NMI_IO_APIC) { 2235 if (nmi_watchdog == NMI_IO_APIC) {
2236 disable_8259A_irq(0);
2199 setup_nmi(); 2237 setup_nmi();
2238 enable_8259A_irq(0);
2200 } 2239 }
2201 goto out; 2240 goto out;
2202 } 2241 }
2203 /* 2242 /*
2204 * Cleanup, just in case ... 2243 * Cleanup, just in case ...
2205 */ 2244 */
2245 disable_8259A_irq(0);
2206 clear_IO_APIC_pin(apic2, pin2); 2246 clear_IO_APIC_pin(apic2, pin2);
2247 printk(" failed.\n");
2207 } 2248 }
2208 printk(" failed.\n");
2209 2249
2210 if (nmi_watchdog == NMI_IO_APIC) { 2250 if (nmi_watchdog == NMI_IO_APIC) {
2211 printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n"); 2251 printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
2212 nmi_watchdog = 0; 2252 nmi_watchdog = NMI_NONE;
2213 } 2253 }
2254 timer_ack = 0;
2214 2255
2215 printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ..."); 2256 printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
2216 2257
2217 disable_8259A_irq(0); 2258 lapic_register_intr(0, vector);
2218 set_irq_chip_and_handler_name(0, &lapic_chip, handle_fasteoi_irq,
2219 "fasteoi");
2220 apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */ 2259 apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */
2221 enable_8259A_irq(0); 2260 enable_8259A_irq(0);
2222 2261
@@ -2224,12 +2263,12 @@ static inline void __init check_timer(void)
2224 printk(" works.\n"); 2263 printk(" works.\n");
2225 goto out; 2264 goto out;
2226 } 2265 }
2266 disable_8259A_irq(0);
2227 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); 2267 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
2228 printk(" failed.\n"); 2268 printk(" failed.\n");
2229 2269
2230 printk(KERN_INFO "...trying to set up timer as ExtINT IRQ..."); 2270 printk(KERN_INFO "...trying to set up timer as ExtINT IRQ...");
2231 2271
2232 timer_ack = 0;
2233 init_8259A(0); 2272 init_8259A(0);
2234 make_8259A_irq(0); 2273 make_8259A_irq(0);
2235 apic_write_around(APIC_LVT0, APIC_DM_EXTINT); 2274 apic_write_around(APIC_LVT0, APIC_DM_EXTINT);
@@ -2248,11 +2287,21 @@ out:
2248} 2287}
2249 2288
2250/* 2289/*
2251 * 2290 * Traditionally ISA IRQ2 is the cascade IRQ, and is not available
2252 * IRQ's that are handled by the PIC in the MPS IOAPIC case. 2291 * to devices. However there may be an I/O APIC pin available for
2253 * - IRQ2 is the cascade IRQ, and cannot be a io-apic IRQ. 2292 * this interrupt regardless. The pin may be left unconnected, but
2254 * Linux doesn't really care, as it's not actually used 2293 * typically it will be reused as an ExtINT cascade interrupt for
2255 * for any interrupt handling anyway. 2294 * the master 8259A. In the MPS case such a pin will normally be
2295 * reported as an ExtINT interrupt in the MP table. With ACPI
2296 * there is no provision for ExtINT interrupts, and in the absence
2297 * of an override it would be treated as an ordinary ISA I/O APIC
2298 * interrupt, that is edge-triggered and unmasked by default. We
2299 * used to do this, but it caused problems on some systems because
2300 * of the NMI watchdog and sometimes IRQ0 of the 8254 timer using
2301 * the same ExtINT cascade interrupt to drive the local APIC of the
2302 * bootstrap processor. Therefore we refrain from routing IRQ2 to
2303 * the I/O APIC in all cases now. No actual device should request
2304 * it anyway. --macro
2256 */ 2305 */
2257#define PIC_IRQS (1 << PIC_CASCADE_IR) 2306#define PIC_IRQS (1 << PIC_CASCADE_IR)
2258 2307
@@ -2261,15 +2310,12 @@ void __init setup_IO_APIC(void)
2261 int i; 2310 int i;
2262 2311
2263 /* Reserve all the system vectors. */ 2312 /* Reserve all the system vectors. */
2264 for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++) 2313 for (i = first_system_vector; i < NR_VECTORS; i++)
2265 set_bit(i, used_vectors); 2314 set_bit(i, used_vectors);
2266 2315
2267 enable_IO_APIC(); 2316 enable_IO_APIC();
2268 2317
2269 if (acpi_ioapic) 2318 io_apic_irqs = ~PIC_IRQS;
2270 io_apic_irqs = ~0; /* all IRQs go through IOAPIC */
2271 else
2272 io_apic_irqs = ~PIC_IRQS;
2273 2319
2274 printk("ENABLING IO-APIC IRQs\n"); 2320 printk("ENABLING IO-APIC IRQs\n");
2275 2321
@@ -2286,28 +2332,14 @@ void __init setup_IO_APIC(void)
2286 print_IO_APIC(); 2332 print_IO_APIC();
2287} 2333}
2288 2334
2289static int __init setup_disable_8254_timer(char *s)
2290{
2291 timer_over_8254 = -1;
2292 return 1;
2293}
2294static int __init setup_enable_8254_timer(char *s)
2295{
2296 timer_over_8254 = 2;
2297 return 1;
2298}
2299
2300__setup("disable_8254_timer", setup_disable_8254_timer);
2301__setup("enable_8254_timer", setup_enable_8254_timer);
2302
2303/* 2335/*
2304 * Called after all the initialization is done. If we didnt find any 2336 * Called after all the initialization is done. If we didnt find any
2305 * APIC bugs then we can allow the modify fast path 2337 * APIC bugs then we can allow the modify fast path
2306 */ 2338 */
2307 2339
2308static int __init io_apic_bug_finalize(void) 2340static int __init io_apic_bug_finalize(void)
2309{ 2341{
2310 if(sis_apic_bug == -1) 2342 if (sis_apic_bug == -1)
2311 sis_apic_bug = 0; 2343 sis_apic_bug = 0;
2312 return 0; 2344 return 0;
2313} 2345}
@@ -2318,17 +2350,17 @@ struct sysfs_ioapic_data {
2318 struct sys_device dev; 2350 struct sys_device dev;
2319 struct IO_APIC_route_entry entry[0]; 2351 struct IO_APIC_route_entry entry[0];
2320}; 2352};
2321static struct sysfs_ioapic_data * mp_ioapic_data[MAX_IO_APICS]; 2353static struct sysfs_ioapic_data *mp_ioapic_data[MAX_IO_APICS];
2322 2354
2323static int ioapic_suspend(struct sys_device *dev, pm_message_t state) 2355static int ioapic_suspend(struct sys_device *dev, pm_message_t state)
2324{ 2356{
2325 struct IO_APIC_route_entry *entry; 2357 struct IO_APIC_route_entry *entry;
2326 struct sysfs_ioapic_data *data; 2358 struct sysfs_ioapic_data *data;
2327 int i; 2359 int i;
2328 2360
2329 data = container_of(dev, struct sysfs_ioapic_data, dev); 2361 data = container_of(dev, struct sysfs_ioapic_data, dev);
2330 entry = data->entry; 2362 entry = data->entry;
2331 for (i = 0; i < nr_ioapic_registers[dev->id]; i ++) 2363 for (i = 0; i < nr_ioapic_registers[dev->id]; i++)
2332 entry[i] = ioapic_read_entry(dev->id, i); 2364 entry[i] = ioapic_read_entry(dev->id, i);
2333 2365
2334 return 0; 2366 return 0;
@@ -2341,18 +2373,18 @@ static int ioapic_resume(struct sys_device *dev)
2341 unsigned long flags; 2373 unsigned long flags;
2342 union IO_APIC_reg_00 reg_00; 2374 union IO_APIC_reg_00 reg_00;
2343 int i; 2375 int i;
2344 2376
2345 data = container_of(dev, struct sysfs_ioapic_data, dev); 2377 data = container_of(dev, struct sysfs_ioapic_data, dev);
2346 entry = data->entry; 2378 entry = data->entry;
2347 2379
2348 spin_lock_irqsave(&ioapic_lock, flags); 2380 spin_lock_irqsave(&ioapic_lock, flags);
2349 reg_00.raw = io_apic_read(dev->id, 0); 2381 reg_00.raw = io_apic_read(dev->id, 0);
2350 if (reg_00.bits.ID != mp_ioapics[dev->id].mpc_apicid) { 2382 if (reg_00.bits.ID != mp_ioapics[dev->id].mp_apicid) {
2351 reg_00.bits.ID = mp_ioapics[dev->id].mpc_apicid; 2383 reg_00.bits.ID = mp_ioapics[dev->id].mp_apicid;
2352 io_apic_write(dev->id, 0, reg_00.raw); 2384 io_apic_write(dev->id, 0, reg_00.raw);
2353 } 2385 }
2354 spin_unlock_irqrestore(&ioapic_lock, flags); 2386 spin_unlock_irqrestore(&ioapic_lock, flags);
2355 for (i = 0; i < nr_ioapic_registers[dev->id]; i ++) 2387 for (i = 0; i < nr_ioapic_registers[dev->id]; i++)
2356 ioapic_write_entry(dev->id, i, entry[i]); 2388 ioapic_write_entry(dev->id, i, entry[i]);
2357 2389
2358 return 0; 2390 return 0;
@@ -2366,24 +2398,23 @@ static struct sysdev_class ioapic_sysdev_class = {
2366 2398
2367static int __init ioapic_init_sysfs(void) 2399static int __init ioapic_init_sysfs(void)
2368{ 2400{
2369 struct sys_device * dev; 2401 struct sys_device *dev;
2370 int i, size, error = 0; 2402 int i, size, error = 0;
2371 2403
2372 error = sysdev_class_register(&ioapic_sysdev_class); 2404 error = sysdev_class_register(&ioapic_sysdev_class);
2373 if (error) 2405 if (error)
2374 return error; 2406 return error;
2375 2407
2376 for (i = 0; i < nr_ioapics; i++ ) { 2408 for (i = 0; i < nr_ioapics; i++) {
2377 size = sizeof(struct sys_device) + nr_ioapic_registers[i] 2409 size = sizeof(struct sys_device) + nr_ioapic_registers[i]
2378 * sizeof(struct IO_APIC_route_entry); 2410 * sizeof(struct IO_APIC_route_entry);
2379 mp_ioapic_data[i] = kmalloc(size, GFP_KERNEL); 2411 mp_ioapic_data[i] = kzalloc(size, GFP_KERNEL);
2380 if (!mp_ioapic_data[i]) { 2412 if (!mp_ioapic_data[i]) {
2381 printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); 2413 printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i);
2382 continue; 2414 continue;
2383 } 2415 }
2384 memset(mp_ioapic_data[i], 0, size);
2385 dev = &mp_ioapic_data[i]->dev; 2416 dev = &mp_ioapic_data[i]->dev;
2386 dev->id = i; 2417 dev->id = i;
2387 dev->cls = &ioapic_sysdev_class; 2418 dev->cls = &ioapic_sysdev_class;
2388 error = sysdev_register(dev); 2419 error = sysdev_register(dev);
2389 if (error) { 2420 if (error) {
@@ -2458,7 +2489,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
2458 msg->address_lo = 2489 msg->address_lo =
2459 MSI_ADDR_BASE_LO | 2490 MSI_ADDR_BASE_LO |
2460 ((INT_DEST_MODE == 0) ? 2491 ((INT_DEST_MODE == 0) ?
2461 MSI_ADDR_DEST_MODE_PHYSICAL: 2492MSI_ADDR_DEST_MODE_PHYSICAL:
2462 MSI_ADDR_DEST_MODE_LOGICAL) | 2493 MSI_ADDR_DEST_MODE_LOGICAL) |
2463 ((INT_DELIVERY_MODE != dest_LowestPrio) ? 2494 ((INT_DELIVERY_MODE != dest_LowestPrio) ?
2464 MSI_ADDR_REDIRECTION_CPU: 2495 MSI_ADDR_REDIRECTION_CPU:
@@ -2469,7 +2500,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
2469 MSI_DATA_TRIGGER_EDGE | 2500 MSI_DATA_TRIGGER_EDGE |
2470 MSI_DATA_LEVEL_ASSERT | 2501 MSI_DATA_LEVEL_ASSERT |
2471 ((INT_DELIVERY_MODE != dest_LowestPrio) ? 2502 ((INT_DELIVERY_MODE != dest_LowestPrio) ?
2472 MSI_DATA_DELIVERY_FIXED: 2503MSI_DATA_DELIVERY_FIXED:
2473 MSI_DATA_DELIVERY_LOWPRI) | 2504 MSI_DATA_DELIVERY_LOWPRI) |
2474 MSI_DATA_VECTOR(vector); 2505 MSI_DATA_VECTOR(vector);
2475 } 2506 }
@@ -2640,12 +2671,12 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
2640#endif /* CONFIG_HT_IRQ */ 2671#endif /* CONFIG_HT_IRQ */
2641 2672
2642/* -------------------------------------------------------------------------- 2673/* --------------------------------------------------------------------------
2643 ACPI-based IOAPIC Configuration 2674 ACPI-based IOAPIC Configuration
2644 -------------------------------------------------------------------------- */ 2675 -------------------------------------------------------------------------- */
2645 2676
2646#ifdef CONFIG_ACPI 2677#ifdef CONFIG_ACPI
2647 2678
2648int __init io_apic_get_unique_id (int ioapic, int apic_id) 2679int __init io_apic_get_unique_id(int ioapic, int apic_id)
2649{ 2680{
2650 union IO_APIC_reg_00 reg_00; 2681 union IO_APIC_reg_00 reg_00;
2651 static physid_mask_t apic_id_map = PHYSID_MASK_NONE; 2682 static physid_mask_t apic_id_map = PHYSID_MASK_NONE;
@@ -2654,10 +2685,10 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
2654 int i = 0; 2685 int i = 0;
2655 2686
2656 /* 2687 /*
2657 * The P4 platform supports up to 256 APIC IDs on two separate APIC 2688 * The P4 platform supports up to 256 APIC IDs on two separate APIC
2658 * buses (one for LAPICs, one for IOAPICs), where predecessors only 2689 * buses (one for LAPICs, one for IOAPICs), where predecessors only
2659 * supports up to 16 on one shared APIC bus. 2690 * supports up to 16 on one shared APIC bus.
2660 * 2691 *
2661 * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full 2692 * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full
2662 * advantage of new APIC bus architecture. 2693 * advantage of new APIC bus architecture.
2663 */ 2694 */
@@ -2676,7 +2707,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
2676 } 2707 }
2677 2708
2678 /* 2709 /*
2679 * Every APIC in a system must have a unique ID or we get lots of nice 2710 * Every APIC in a system must have a unique ID or we get lots of nice
2680 * 'stuck on smp_invalidate_needed IPI wait' messages. 2711 * 'stuck on smp_invalidate_needed IPI wait' messages.
2681 */ 2712 */
2682 if (check_apicid_used(apic_id_map, apic_id)) { 2713 if (check_apicid_used(apic_id_map, apic_id)) {
@@ -2693,7 +2724,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
2693 "trying %d\n", ioapic, apic_id, i); 2724 "trying %d\n", ioapic, apic_id, i);
2694 2725
2695 apic_id = i; 2726 apic_id = i;
2696 } 2727 }
2697 2728
2698 tmp = apicid_to_cpu_present(apic_id); 2729 tmp = apicid_to_cpu_present(apic_id);
2699 physids_or(apic_id_map, apic_id_map, tmp); 2730 physids_or(apic_id_map, apic_id_map, tmp);
@@ -2720,7 +2751,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
2720} 2751}
2721 2752
2722 2753
2723int __init io_apic_get_version (int ioapic) 2754int __init io_apic_get_version(int ioapic)
2724{ 2755{
2725 union IO_APIC_reg_01 reg_01; 2756 union IO_APIC_reg_01 reg_01;
2726 unsigned long flags; 2757 unsigned long flags;
@@ -2733,7 +2764,7 @@ int __init io_apic_get_version (int ioapic)
2733} 2764}
2734 2765
2735 2766
2736int __init io_apic_get_redir_entries (int ioapic) 2767int __init io_apic_get_redir_entries(int ioapic)
2737{ 2768{
2738 union IO_APIC_reg_01 reg_01; 2769 union IO_APIC_reg_01 reg_01;
2739 unsigned long flags; 2770 unsigned long flags;
@@ -2746,7 +2777,7 @@ int __init io_apic_get_redir_entries (int ioapic)
2746} 2777}
2747 2778
2748 2779
2749int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) 2780int io_apic_set_pci_routing(int ioapic, int pin, int irq, int edge_level, int active_high_low)
2750{ 2781{
2751 struct IO_APIC_route_entry entry; 2782 struct IO_APIC_route_entry entry;
2752 2783
@@ -2762,7 +2793,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2762 * corresponding device driver registers for this IRQ. 2793 * corresponding device driver registers for this IRQ.
2763 */ 2794 */
2764 2795
2765 memset(&entry,0,sizeof(entry)); 2796 memset(&entry, 0, sizeof(entry));
2766 2797
2767 entry.delivery_mode = INT_DELIVERY_MODE; 2798 entry.delivery_mode = INT_DELIVERY_MODE;
2768 entry.dest_mode = INT_DEST_MODE; 2799 entry.dest_mode = INT_DEST_MODE;
@@ -2781,7 +2812,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2781 2812
2782 apic_printk(APIC_DEBUG, KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry " 2813 apic_printk(APIC_DEBUG, KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry "
2783 "(%d-%d -> 0x%x -> IRQ %d Mode:%i Active:%i)\n", ioapic, 2814 "(%d-%d -> 0x%x -> IRQ %d Mode:%i Active:%i)\n", ioapic,
2784 mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, 2815 mp_ioapics[ioapic].mp_apicid, pin, entry.vector, irq,
2785 edge_level, active_high_low); 2816 edge_level, active_high_low);
2786 2817
2787 ioapic_register_intr(irq, entry.vector, edge_level); 2818 ioapic_register_intr(irq, entry.vector, edge_level);
@@ -2802,8 +2833,8 @@ int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2802 return -1; 2833 return -1;
2803 2834
2804 for (i = 0; i < mp_irq_entries; i++) 2835 for (i = 0; i < mp_irq_entries; i++)
2805 if (mp_irqs[i].mpc_irqtype == mp_INT && 2836 if (mp_irqs[i].mp_irqtype == mp_INT &&
2806 mp_irqs[i].mpc_srcbusirq == bus_irq) 2837 mp_irqs[i].mp_srcbusirq == bus_irq)
2807 break; 2838 break;
2808 if (i >= mp_irq_entries) 2839 if (i >= mp_irq_entries)
2809 return -1; 2840 return -1;
@@ -2836,3 +2867,34 @@ static int __init parse_noapic(char *arg)
2836 return 0; 2867 return 0;
2837} 2868}
2838early_param("noapic", parse_noapic); 2869early_param("noapic", parse_noapic);
2870
2871void __init ioapic_init_mappings(void)
2872{
2873 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
2874 int i;
2875
2876 for (i = 0; i < nr_ioapics; i++) {
2877 if (smp_found_config) {
2878 ioapic_phys = mp_ioapics[i].mp_apicaddr;
2879 if (!ioapic_phys) {
2880 printk(KERN_ERR
2881 "WARNING: bogus zero IO-APIC "
2882 "address found in MPTABLE, "
2883 "disabling IO/APIC support!\n");
2884 smp_found_config = 0;
2885 skip_ioapic_setup = 1;
2886 goto fake_ioapic_page;
2887 }
2888 } else {
2889fake_ioapic_page:
2890 ioapic_phys = (unsigned long)
2891 alloc_bootmem_pages(PAGE_SIZE);
2892 ioapic_phys = __pa(ioapic_phys);
2893 }
2894 set_fixmap_nocache(idx, ioapic_phys);
2895 printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
2896 __fix_to_virt(idx), ioapic_phys);
2897 idx++;
2898 }
2899}
2900
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index ef1a8dfcc529..b16ef029cf88 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -61,7 +61,7 @@ struct irq_cfg {
61}; 61};
62 62
63/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */ 63/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
64struct irq_cfg irq_cfg[NR_IRQS] __read_mostly = { 64static struct irq_cfg irq_cfg[NR_IRQS] __read_mostly = {
65 [0] = { .domain = CPU_MASK_ALL, .vector = IRQ0_VECTOR, }, 65 [0] = { .domain = CPU_MASK_ALL, .vector = IRQ0_VECTOR, },
66 [1] = { .domain = CPU_MASK_ALL, .vector = IRQ1_VECTOR, }, 66 [1] = { .domain = CPU_MASK_ALL, .vector = IRQ1_VECTOR, },
67 [2] = { .domain = CPU_MASK_ALL, .vector = IRQ2_VECTOR, }, 67 [2] = { .domain = CPU_MASK_ALL, .vector = IRQ2_VECTOR, },
@@ -82,6 +82,10 @@ struct irq_cfg irq_cfg[NR_IRQS] __read_mostly = {
82 82
83static int assign_irq_vector(int irq, cpumask_t mask); 83static int assign_irq_vector(int irq, cpumask_t mask);
84 84
85int first_system_vector = 0xfe;
86
87char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
88
85#define __apicdebuginit __init 89#define __apicdebuginit __init
86 90
87int sis_apic_bug; /* not actually supported, dummy for compile */ 91int sis_apic_bug; /* not actually supported, dummy for compile */
@@ -90,7 +94,7 @@ static int no_timer_check;
90 94
91static int disable_timer_pin_1 __initdata; 95static int disable_timer_pin_1 __initdata;
92 96
93int timer_over_8254 __initdata = 1; 97int timer_through_8259 __initdata;
94 98
95/* Where if anywhere is the i8259 connect in external int mode */ 99/* Where if anywhere is the i8259 connect in external int mode */
96static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; 100static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
@@ -104,15 +108,17 @@ DEFINE_SPINLOCK(vector_lock);
104int nr_ioapic_registers[MAX_IO_APICS]; 108int nr_ioapic_registers[MAX_IO_APICS];
105 109
106/* I/O APIC entries */ 110/* I/O APIC entries */
107struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS]; 111struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
108int nr_ioapics; 112int nr_ioapics;
109 113
110/* MP IRQ source entries */ 114/* MP IRQ source entries */
111struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; 115struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
112 116
113/* # of MP IRQ source entries */ 117/* # of MP IRQ source entries */
114int mp_irq_entries; 118int mp_irq_entries;
115 119
120DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
121
116/* 122/*
117 * Rough estimation of how many shared IRQs there are, can 123 * Rough estimation of how many shared IRQs there are, can
118 * be changed anytime. 124 * be changed anytime.
@@ -140,7 +146,7 @@ struct io_apic {
140static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) 146static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx)
141{ 147{
142 return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) 148 return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx)
143 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK); 149 + (mp_ioapics[idx].mp_apicaddr & ~PAGE_MASK);
144} 150}
145 151
146static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) 152static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
@@ -183,7 +189,7 @@ static bool io_apic_level_ack_pending(unsigned int irq)
183 break; 189 break;
184 reg = io_apic_read(entry->apic, 0x10 + pin*2); 190 reg = io_apic_read(entry->apic, 0x10 + pin*2);
185 /* Is the remote IRR bit set? */ 191 /* Is the remote IRR bit set? */
186 if ((reg >> 14) & 1) { 192 if (reg & IO_APIC_REDIR_REMOTE_IRR) {
187 spin_unlock_irqrestore(&ioapic_lock, flags); 193 spin_unlock_irqrestore(&ioapic_lock, flags);
188 return true; 194 return true;
189 } 195 }
@@ -298,7 +304,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
298 break; 304 break;
299 io_apic_write(apic, 0x11 + pin*2, dest); 305 io_apic_write(apic, 0x11 + pin*2, dest);
300 reg = io_apic_read(apic, 0x10 + pin*2); 306 reg = io_apic_read(apic, 0x10 + pin*2);
301 reg &= ~0x000000ff; 307 reg &= ~IO_APIC_REDIR_VECTOR_MASK;
302 reg |= vector; 308 reg |= vector;
303 io_apic_modify(apic, reg); 309 io_apic_modify(apic, reg);
304 if (!entry->next) 310 if (!entry->next)
@@ -360,16 +366,37 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)
360 entry->pin = pin; 366 entry->pin = pin;
361} 367}
362 368
369/*
370 * Reroute an IRQ to a different pin.
371 */
372static void __init replace_pin_at_irq(unsigned int irq,
373 int oldapic, int oldpin,
374 int newapic, int newpin)
375{
376 struct irq_pin_list *entry = irq_2_pin + irq;
377
378 while (1) {
379 if (entry->apic == oldapic && entry->pin == oldpin) {
380 entry->apic = newapic;
381 entry->pin = newpin;
382 }
383 if (!entry->next)
384 break;
385 entry = irq_2_pin + entry->next;
386 }
387}
388
363 389
364#define DO_ACTION(name,R,ACTION, FINAL) \ 390#define DO_ACTION(name,R,ACTION, FINAL) \
365 \ 391 \
366 static void name##_IO_APIC_irq (unsigned int irq) \ 392 static void name##_IO_APIC_irq (unsigned int irq) \
367 __DO_ACTION(R, ACTION, FINAL) 393 __DO_ACTION(R, ACTION, FINAL)
368 394
369DO_ACTION( __mask, 0, |= 0x00010000, io_apic_sync(entry->apic) ) 395/* mask = 1 */
370 /* mask = 1 */ 396DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, io_apic_sync(entry->apic))
371DO_ACTION( __unmask, 0, &= 0xfffeffff, ) 397
372 /* mask = 0 */ 398/* mask = 0 */
399DO_ACTION(__unmask, 0, &= ~IO_APIC_REDIR_MASKED, )
373 400
374static void mask_IO_APIC_irq (unsigned int irq) 401static void mask_IO_APIC_irq (unsigned int irq)
375{ 402{
@@ -430,20 +457,6 @@ static int __init disable_timer_pin_setup(char *arg)
430} 457}
431__setup("disable_timer_pin_1", disable_timer_pin_setup); 458__setup("disable_timer_pin_1", disable_timer_pin_setup);
432 459
433static int __init setup_disable_8254_timer(char *s)
434{
435 timer_over_8254 = -1;
436 return 1;
437}
438static int __init setup_enable_8254_timer(char *s)
439{
440 timer_over_8254 = 2;
441 return 1;
442}
443
444__setup("disable_8254_timer", setup_disable_8254_timer);
445__setup("enable_8254_timer", setup_enable_8254_timer);
446
447 460
448/* 461/*
449 * Find the IRQ entry number of a certain pin. 462 * Find the IRQ entry number of a certain pin.
@@ -453,10 +466,10 @@ static int find_irq_entry(int apic, int pin, int type)
453 int i; 466 int i;
454 467
455 for (i = 0; i < mp_irq_entries; i++) 468 for (i = 0; i < mp_irq_entries; i++)
456 if (mp_irqs[i].mpc_irqtype == type && 469 if (mp_irqs[i].mp_irqtype == type &&
457 (mp_irqs[i].mpc_dstapic == mp_ioapics[apic].mpc_apicid || 470 (mp_irqs[i].mp_dstapic == mp_ioapics[apic].mp_apicid ||
458 mp_irqs[i].mpc_dstapic == MP_APIC_ALL) && 471 mp_irqs[i].mp_dstapic == MP_APIC_ALL) &&
459 mp_irqs[i].mpc_dstirq == pin) 472 mp_irqs[i].mp_dstirq == pin)
460 return i; 473 return i;
461 474
462 return -1; 475 return -1;
@@ -470,13 +483,13 @@ static int __init find_isa_irq_pin(int irq, int type)
470 int i; 483 int i;
471 484
472 for (i = 0; i < mp_irq_entries; i++) { 485 for (i = 0; i < mp_irq_entries; i++) {
473 int lbus = mp_irqs[i].mpc_srcbus; 486 int lbus = mp_irqs[i].mp_srcbus;
474 487
475 if (test_bit(lbus, mp_bus_not_pci) && 488 if (test_bit(lbus, mp_bus_not_pci) &&
476 (mp_irqs[i].mpc_irqtype == type) && 489 (mp_irqs[i].mp_irqtype == type) &&
477 (mp_irqs[i].mpc_srcbusirq == irq)) 490 (mp_irqs[i].mp_srcbusirq == irq))
478 491
479 return mp_irqs[i].mpc_dstirq; 492 return mp_irqs[i].mp_dstirq;
480 } 493 }
481 return -1; 494 return -1;
482} 495}
@@ -486,17 +499,17 @@ static int __init find_isa_irq_apic(int irq, int type)
486 int i; 499 int i;
487 500
488 for (i = 0; i < mp_irq_entries; i++) { 501 for (i = 0; i < mp_irq_entries; i++) {
489 int lbus = mp_irqs[i].mpc_srcbus; 502 int lbus = mp_irqs[i].mp_srcbus;
490 503
491 if (test_bit(lbus, mp_bus_not_pci) && 504 if (test_bit(lbus, mp_bus_not_pci) &&
492 (mp_irqs[i].mpc_irqtype == type) && 505 (mp_irqs[i].mp_irqtype == type) &&
493 (mp_irqs[i].mpc_srcbusirq == irq)) 506 (mp_irqs[i].mp_srcbusirq == irq))
494 break; 507 break;
495 } 508 }
496 if (i < mp_irq_entries) { 509 if (i < mp_irq_entries) {
497 int apic; 510 int apic;
498 for(apic = 0; apic < nr_ioapics; apic++) { 511 for(apic = 0; apic < nr_ioapics; apic++) {
499 if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic) 512 if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic)
500 return apic; 513 return apic;
501 } 514 }
502 } 515 }
@@ -516,28 +529,28 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
516 529
517 apic_printk(APIC_DEBUG, "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", 530 apic_printk(APIC_DEBUG, "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n",
518 bus, slot, pin); 531 bus, slot, pin);
519 if (mp_bus_id_to_pci_bus[bus] == -1) { 532 if (test_bit(bus, mp_bus_not_pci)) {
520 apic_printk(APIC_VERBOSE, "PCI BIOS passed nonexistent PCI bus %d!\n", bus); 533 apic_printk(APIC_VERBOSE, "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
521 return -1; 534 return -1;
522 } 535 }
523 for (i = 0; i < mp_irq_entries; i++) { 536 for (i = 0; i < mp_irq_entries; i++) {
524 int lbus = mp_irqs[i].mpc_srcbus; 537 int lbus = mp_irqs[i].mp_srcbus;
525 538
526 for (apic = 0; apic < nr_ioapics; apic++) 539 for (apic = 0; apic < nr_ioapics; apic++)
527 if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic || 540 if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic ||
528 mp_irqs[i].mpc_dstapic == MP_APIC_ALL) 541 mp_irqs[i].mp_dstapic == MP_APIC_ALL)
529 break; 542 break;
530 543
531 if (!test_bit(lbus, mp_bus_not_pci) && 544 if (!test_bit(lbus, mp_bus_not_pci) &&
532 !mp_irqs[i].mpc_irqtype && 545 !mp_irqs[i].mp_irqtype &&
533 (bus == lbus) && 546 (bus == lbus) &&
534 (slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) { 547 (slot == ((mp_irqs[i].mp_srcbusirq >> 2) & 0x1f))) {
535 int irq = pin_2_irq(i,apic,mp_irqs[i].mpc_dstirq); 548 int irq = pin_2_irq(i,apic,mp_irqs[i].mp_dstirq);
536 549
537 if (!(apic || IO_APIC_IRQ(irq))) 550 if (!(apic || IO_APIC_IRQ(irq)))
538 continue; 551 continue;
539 552
540 if (pin == (mp_irqs[i].mpc_srcbusirq & 3)) 553 if (pin == (mp_irqs[i].mp_srcbusirq & 3))
541 return irq; 554 return irq;
542 /* 555 /*
543 * Use the first all-but-pin matching entry as a 556 * Use the first all-but-pin matching entry as a
@@ -565,13 +578,13 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
565 578
566static int MPBIOS_polarity(int idx) 579static int MPBIOS_polarity(int idx)
567{ 580{
568 int bus = mp_irqs[idx].mpc_srcbus; 581 int bus = mp_irqs[idx].mp_srcbus;
569 int polarity; 582 int polarity;
570 583
571 /* 584 /*
572 * Determine IRQ line polarity (high active or low active): 585 * Determine IRQ line polarity (high active or low active):
573 */ 586 */
574 switch (mp_irqs[idx].mpc_irqflag & 3) 587 switch (mp_irqs[idx].mp_irqflag & 3)
575 { 588 {
576 case 0: /* conforms, ie. bus-type dependent polarity */ 589 case 0: /* conforms, ie. bus-type dependent polarity */
577 if (test_bit(bus, mp_bus_not_pci)) 590 if (test_bit(bus, mp_bus_not_pci))
@@ -607,13 +620,13 @@ static int MPBIOS_polarity(int idx)
607 620
608static int MPBIOS_trigger(int idx) 621static int MPBIOS_trigger(int idx)
609{ 622{
610 int bus = mp_irqs[idx].mpc_srcbus; 623 int bus = mp_irqs[idx].mp_srcbus;
611 int trigger; 624 int trigger;
612 625
613 /* 626 /*
614 * Determine IRQ trigger mode (edge or level sensitive): 627 * Determine IRQ trigger mode (edge or level sensitive):
615 */ 628 */
616 switch ((mp_irqs[idx].mpc_irqflag>>2) & 3) 629 switch ((mp_irqs[idx].mp_irqflag>>2) & 3)
617 { 630 {
618 case 0: /* conforms, ie. bus-type dependent */ 631 case 0: /* conforms, ie. bus-type dependent */
619 if (test_bit(bus, mp_bus_not_pci)) 632 if (test_bit(bus, mp_bus_not_pci))
@@ -660,16 +673,16 @@ static inline int irq_trigger(int idx)
660static int pin_2_irq(int idx, int apic, int pin) 673static int pin_2_irq(int idx, int apic, int pin)
661{ 674{
662 int irq, i; 675 int irq, i;
663 int bus = mp_irqs[idx].mpc_srcbus; 676 int bus = mp_irqs[idx].mp_srcbus;
664 677
665 /* 678 /*
666 * Debugging check, we are in big trouble if this message pops up! 679 * Debugging check, we are in big trouble if this message pops up!
667 */ 680 */
668 if (mp_irqs[idx].mpc_dstirq != pin) 681 if (mp_irqs[idx].mp_dstirq != pin)
669 printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); 682 printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n");
670 683
671 if (test_bit(bus, mp_bus_not_pci)) { 684 if (test_bit(bus, mp_bus_not_pci)) {
672 irq = mp_irqs[idx].mpc_srcbusirq; 685 irq = mp_irqs[idx].mp_srcbusirq;
673 } else { 686 } else {
674 /* 687 /*
675 * PCI IRQs are mapped in order 688 * PCI IRQs are mapped in order
@@ -730,7 +743,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask)
730 offset = current_offset; 743 offset = current_offset;
731next: 744next:
732 vector += 8; 745 vector += 8;
733 if (vector >= FIRST_SYSTEM_VECTOR) { 746 if (vector >= first_system_vector) {
734 /* If we run out of vectors on large boxen, must share them. */ 747 /* If we run out of vectors on large boxen, must share them. */
735 offset = (offset + 1) % 8; 748 offset = (offset + 1) % 8;
736 vector = FIRST_DEVICE_VECTOR + offset; 749 vector = FIRST_DEVICE_VECTOR + offset;
@@ -788,7 +801,7 @@ static void __clear_irq_vector(int irq)
788 cpus_clear(cfg->domain); 801 cpus_clear(cfg->domain);
789} 802}
790 803
791void __setup_vector_irq(int cpu) 804static void __setup_vector_irq(int cpu)
792{ 805{
793 /* Initialize vector_irq on a new cpu */ 806 /* Initialize vector_irq on a new cpu */
794 /* This function must be called with vector_lock held */ 807 /* This function must be called with vector_lock held */
@@ -811,6 +824,13 @@ void __setup_vector_irq(int cpu)
811 } 824 }
812} 825}
813 826
827void setup_vector_irq(int cpu)
828{
829 spin_lock(&vector_lock);
830 __setup_vector_irq(smp_processor_id());
831 spin_unlock(&vector_lock);
832}
833
814 834
815static struct irq_chip ioapic_chip; 835static struct irq_chip ioapic_chip;
816 836
@@ -846,7 +866,7 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
846 apic_printk(APIC_VERBOSE,KERN_DEBUG 866 apic_printk(APIC_VERBOSE,KERN_DEBUG
847 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " 867 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
848 "IRQ %d Mode:%i Active:%i)\n", 868 "IRQ %d Mode:%i Active:%i)\n",
849 apic, mp_ioapics[apic].mpc_apicid, pin, cfg->vector, 869 apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector,
850 irq, trigger, polarity); 870 irq, trigger, polarity);
851 871
852 /* 872 /*
@@ -887,10 +907,10 @@ static void __init setup_IO_APIC_irqs(void)
887 idx = find_irq_entry(apic,pin,mp_INT); 907 idx = find_irq_entry(apic,pin,mp_INT);
888 if (idx == -1) { 908 if (idx == -1) {
889 if (first_notcon) { 909 if (first_notcon) {
890 apic_printk(APIC_VERBOSE, KERN_DEBUG " IO-APIC (apicid-pin) %d-%d", mp_ioapics[apic].mpc_apicid, pin); 910 apic_printk(APIC_VERBOSE, KERN_DEBUG " IO-APIC (apicid-pin) %d-%d", mp_ioapics[apic].mp_apicid, pin);
891 first_notcon = 0; 911 first_notcon = 0;
892 } else 912 } else
893 apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mpc_apicid, pin); 913 apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mp_apicid, pin);
894 continue; 914 continue;
895 } 915 }
896 if (!first_notcon) { 916 if (!first_notcon) {
@@ -911,26 +931,21 @@ static void __init setup_IO_APIC_irqs(void)
911} 931}
912 932
913/* 933/*
914 * Set up the 8259A-master output pin as broadcast to all 934 * Set up the timer pin, possibly with the 8259A-master behind.
915 * CPUs.
916 */ 935 */
917static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, int vector) 936static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin,
937 int vector)
918{ 938{
919 struct IO_APIC_route_entry entry; 939 struct IO_APIC_route_entry entry;
920 940
921 memset(&entry, 0, sizeof(entry)); 941 memset(&entry, 0, sizeof(entry));
922 942
923 disable_8259A_irq(0);
924
925 /* mask LVT0 */
926 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
927
928 /* 943 /*
929 * We use logical delivery to get the timer IRQ 944 * We use logical delivery to get the timer IRQ
930 * to the first CPU. 945 * to the first CPU.
931 */ 946 */
932 entry.dest_mode = INT_DEST_MODE; 947 entry.dest_mode = INT_DEST_MODE;
933 entry.mask = 0; /* unmask IRQ now */ 948 entry.mask = 1; /* mask IRQ now */
934 entry.dest = cpu_mask_to_apicid(TARGET_CPUS); 949 entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
935 entry.delivery_mode = INT_DELIVERY_MODE; 950 entry.delivery_mode = INT_DELIVERY_MODE;
936 entry.polarity = 0; 951 entry.polarity = 0;
@@ -939,7 +954,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
939 954
940 /* 955 /*
941 * The timer IRQ doesn't have to know that behind the 956 * The timer IRQ doesn't have to know that behind the
942 * scene we have a 8259A-master in AEOI mode ... 957 * scene we may have a 8259A-master in AEOI mode ...
943 */ 958 */
944 set_irq_chip_and_handler_name(0, &ioapic_chip, handle_edge_irq, "edge"); 959 set_irq_chip_and_handler_name(0, &ioapic_chip, handle_edge_irq, "edge");
945 960
@@ -947,8 +962,6 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
947 * Add it to the IO-APIC irq-routing table: 962 * Add it to the IO-APIC irq-routing table:
948 */ 963 */
949 ioapic_write_entry(apic, pin, entry); 964 ioapic_write_entry(apic, pin, entry);
950
951 enable_8259A_irq(0);
952} 965}
953 966
954void __apicdebuginit print_IO_APIC(void) 967void __apicdebuginit print_IO_APIC(void)
@@ -965,7 +978,7 @@ void __apicdebuginit print_IO_APIC(void)
965 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); 978 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
966 for (i = 0; i < nr_ioapics; i++) 979 for (i = 0; i < nr_ioapics; i++)
967 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", 980 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
968 mp_ioapics[i].mpc_apicid, nr_ioapic_registers[i]); 981 mp_ioapics[i].mp_apicid, nr_ioapic_registers[i]);
969 982
970 /* 983 /*
971 * We are a bit conservative about what we expect. We have to 984 * We are a bit conservative about what we expect. We have to
@@ -983,7 +996,7 @@ void __apicdebuginit print_IO_APIC(void)
983 spin_unlock_irqrestore(&ioapic_lock, flags); 996 spin_unlock_irqrestore(&ioapic_lock, flags);
984 997
985 printk("\n"); 998 printk("\n");
986 printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mpc_apicid); 999 printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid);
987 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); 1000 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw);
988 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); 1001 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID);
989 1002
@@ -1077,6 +1090,7 @@ void __apicdebuginit print_local_APIC(void * dummy)
1077 1090
1078 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", 1091 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
1079 smp_processor_id(), hard_smp_processor_id()); 1092 smp_processor_id(), hard_smp_processor_id());
1093 v = apic_read(APIC_ID);
1080 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(read_apic_id())); 1094 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(read_apic_id()));
1081 v = apic_read(APIC_LVR); 1095 v = apic_read(APIC_LVR);
1082 printk(KERN_INFO "... APIC VERSION: %08x\n", v); 1096 printk(KERN_INFO "... APIC VERSION: %08x\n", v);
@@ -1540,7 +1554,7 @@ static inline void init_IO_APIC_traps(void)
1540 } 1554 }
1541} 1555}
1542 1556
1543static void enable_lapic_irq (unsigned int irq) 1557static void unmask_lapic_irq(unsigned int irq)
1544{ 1558{
1545 unsigned long v; 1559 unsigned long v;
1546 1560
@@ -1548,7 +1562,7 @@ static void enable_lapic_irq (unsigned int irq)
1548 apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED); 1562 apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED);
1549} 1563}
1550 1564
1551static void disable_lapic_irq (unsigned int irq) 1565static void mask_lapic_irq(unsigned int irq)
1552{ 1566{
1553 unsigned long v; 1567 unsigned long v;
1554 1568
@@ -1561,19 +1575,20 @@ static void ack_lapic_irq (unsigned int irq)
1561 ack_APIC_irq(); 1575 ack_APIC_irq();
1562} 1576}
1563 1577
1564static void end_lapic_irq (unsigned int i) { /* nothing */ } 1578static struct irq_chip lapic_chip __read_mostly = {
1565 1579 .name = "local-APIC",
1566static struct hw_interrupt_type lapic_irq_type __read_mostly = { 1580 .mask = mask_lapic_irq,
1567 .name = "local-APIC", 1581 .unmask = unmask_lapic_irq,
1568 .typename = "local-APIC-edge", 1582 .ack = ack_lapic_irq,
1569 .startup = NULL, /* startup_irq() not used for IRQ0 */
1570 .shutdown = NULL, /* shutdown_irq() not used for IRQ0 */
1571 .enable = enable_lapic_irq,
1572 .disable = disable_lapic_irq,
1573 .ack = ack_lapic_irq,
1574 .end = end_lapic_irq,
1575}; 1583};
1576 1584
1585static void lapic_register_intr(int irq)
1586{
1587 irq_desc[irq].status &= ~IRQ_LEVEL;
1588 set_irq_chip_and_handler_name(irq, &lapic_chip, handle_edge_irq,
1589 "edge");
1590}
1591
1577static void __init setup_nmi(void) 1592static void __init setup_nmi(void)
1578{ 1593{
1579 /* 1594 /*
@@ -1659,6 +1674,7 @@ static inline void __init check_timer(void)
1659 struct irq_cfg *cfg = irq_cfg + 0; 1674 struct irq_cfg *cfg = irq_cfg + 0;
1660 int apic1, pin1, apic2, pin2; 1675 int apic1, pin1, apic2, pin2;
1661 unsigned long flags; 1676 unsigned long flags;
1677 int no_pin1 = 0;
1662 1678
1663 local_irq_save(flags); 1679 local_irq_save(flags);
1664 1680
@@ -1669,16 +1685,11 @@ static inline void __init check_timer(void)
1669 assign_irq_vector(0, TARGET_CPUS); 1685 assign_irq_vector(0, TARGET_CPUS);
1670 1686
1671 /* 1687 /*
1672 * Subtle, code in do_timer_interrupt() expects an AEOI 1688 * As IRQ0 is to be enabled in the 8259A, the virtual
1673 * mode for the 8259A whenever interrupts are routed 1689 * wire has to be disabled in the local APIC.
1674 * through I/O APICs. Also IRQ0 has to be enabled in
1675 * the 8259A which implies the virtual wire has to be
1676 * disabled in the local APIC.
1677 */ 1690 */
1678 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 1691 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
1679 init_8259A(1); 1692 init_8259A(1);
1680 if (timer_over_8254 > 0)
1681 enable_8259A_irq(0);
1682 1693
1683 pin1 = find_isa_irq_pin(0, mp_INT); 1694 pin1 = find_isa_irq_pin(0, mp_INT);
1684 apic1 = find_isa_irq_apic(0, mp_INT); 1695 apic1 = find_isa_irq_apic(0, mp_INT);
@@ -1688,15 +1699,33 @@ static inline void __init check_timer(void)
1688 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", 1699 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
1689 cfg->vector, apic1, pin1, apic2, pin2); 1700 cfg->vector, apic1, pin1, apic2, pin2);
1690 1701
1702 /*
1703 * Some BIOS writers are clueless and report the ExtINTA
1704 * I/O APIC input from the cascaded 8259A as the timer
1705 * interrupt input. So just in case, if only one pin
1706 * was found above, try it both directly and through the
1707 * 8259A.
1708 */
1709 if (pin1 == -1) {
1710 pin1 = pin2;
1711 apic1 = apic2;
1712 no_pin1 = 1;
1713 } else if (pin2 == -1) {
1714 pin2 = pin1;
1715 apic2 = apic1;
1716 }
1717
1691 if (pin1 != -1) { 1718 if (pin1 != -1) {
1692 /* 1719 /*
1693 * Ok, does IRQ0 through the IOAPIC work? 1720 * Ok, does IRQ0 through the IOAPIC work?
1694 */ 1721 */
1722 if (no_pin1) {
1723 add_pin_to_irq(0, apic1, pin1);
1724 setup_timer_IRQ0_pin(apic1, pin1, cfg->vector);
1725 }
1695 unmask_IO_APIC_irq(0); 1726 unmask_IO_APIC_irq(0);
1696 if (!no_timer_check && timer_irq_works()) { 1727 if (!no_timer_check && timer_irq_works()) {
1697 nmi_watchdog_default();
1698 if (nmi_watchdog == NMI_IO_APIC) { 1728 if (nmi_watchdog == NMI_IO_APIC) {
1699 disable_8259A_irq(0);
1700 setup_nmi(); 1729 setup_nmi();
1701 enable_8259A_irq(0); 1730 enable_8259A_irq(0);
1702 } 1731 }
@@ -1705,43 +1734,48 @@ static inline void __init check_timer(void)
1705 goto out; 1734 goto out;
1706 } 1735 }
1707 clear_IO_APIC_pin(apic1, pin1); 1736 clear_IO_APIC_pin(apic1, pin1);
1708 apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not " 1737 if (!no_pin1)
1709 "connected to IO-APIC\n"); 1738 apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: "
1710 } 1739 "8254 timer not connected to IO-APIC\n");
1711 1740
1712 apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) " 1741 apic_printk(APIC_VERBOSE,KERN_INFO
1713 "through the 8259A ... "); 1742 "...trying to set up timer (IRQ0) "
1714 if (pin2 != -1) { 1743 "through the 8259A ... ");
1715 apic_printk(APIC_VERBOSE,"\n..... (found apic %d pin %d) ...", 1744 apic_printk(APIC_VERBOSE,"\n..... (found apic %d pin %d) ...",
1716 apic2, pin2); 1745 apic2, pin2);
1717 /* 1746 /*
1718 * legacy devices should be connected to IO APIC #0 1747 * legacy devices should be connected to IO APIC #0
1719 */ 1748 */
1720 setup_ExtINT_IRQ0_pin(apic2, pin2, cfg->vector); 1749 replace_pin_at_irq(0, apic1, pin1, apic2, pin2);
1750 setup_timer_IRQ0_pin(apic2, pin2, cfg->vector);
1751 unmask_IO_APIC_irq(0);
1752 enable_8259A_irq(0);
1721 if (timer_irq_works()) { 1753 if (timer_irq_works()) {
1722 apic_printk(APIC_VERBOSE," works.\n"); 1754 apic_printk(APIC_VERBOSE," works.\n");
1723 nmi_watchdog_default(); 1755 timer_through_8259 = 1;
1724 if (nmi_watchdog == NMI_IO_APIC) { 1756 if (nmi_watchdog == NMI_IO_APIC) {
1757 disable_8259A_irq(0);
1725 setup_nmi(); 1758 setup_nmi();
1759 enable_8259A_irq(0);
1726 } 1760 }
1727 goto out; 1761 goto out;
1728 } 1762 }
1729 /* 1763 /*
1730 * Cleanup, just in case ... 1764 * Cleanup, just in case ...
1731 */ 1765 */
1766 disable_8259A_irq(0);
1732 clear_IO_APIC_pin(apic2, pin2); 1767 clear_IO_APIC_pin(apic2, pin2);
1768 apic_printk(APIC_VERBOSE," failed.\n");
1733 } 1769 }
1734 apic_printk(APIC_VERBOSE," failed.\n");
1735 1770
1736 if (nmi_watchdog == NMI_IO_APIC) { 1771 if (nmi_watchdog == NMI_IO_APIC) {
1737 printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n"); 1772 printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
1738 nmi_watchdog = 0; 1773 nmi_watchdog = NMI_NONE;
1739 } 1774 }
1740 1775
1741 apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ..."); 1776 apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
1742 1777
1743 disable_8259A_irq(0); 1778 lapic_register_intr(0);
1744 irq_desc[0].chip = &lapic_irq_type;
1745 apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */ 1779 apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */
1746 enable_8259A_irq(0); 1780 enable_8259A_irq(0);
1747 1781
@@ -1749,6 +1783,7 @@ static inline void __init check_timer(void)
1749 apic_printk(APIC_VERBOSE," works.\n"); 1783 apic_printk(APIC_VERBOSE," works.\n");
1750 goto out; 1784 goto out;
1751 } 1785 }
1786 disable_8259A_irq(0);
1752 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector); 1787 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
1753 apic_printk(APIC_VERBOSE," failed.\n"); 1788 apic_printk(APIC_VERBOSE," failed.\n");
1754 1789
@@ -1778,11 +1813,21 @@ static int __init notimercheck(char *s)
1778__setup("no_timer_check", notimercheck); 1813__setup("no_timer_check", notimercheck);
1779 1814
1780/* 1815/*
1781 * 1816 * Traditionally ISA IRQ2 is the cascade IRQ, and is not available
1782 * IRQs that are handled by the PIC in the MPS IOAPIC case. 1817 * to devices. However there may be an I/O APIC pin available for
1783 * - IRQ2 is the cascade IRQ, and cannot be a io-apic IRQ. 1818 * this interrupt regardless. The pin may be left unconnected, but
1784 * Linux doesn't really care, as it's not actually used 1819 * typically it will be reused as an ExtINT cascade interrupt for
1785 * for any interrupt handling anyway. 1820 * the master 8259A. In the MPS case such a pin will normally be
1821 * reported as an ExtINT interrupt in the MP table. With ACPI
1822 * there is no provision for ExtINT interrupts, and in the absence
1823 * of an override it would be treated as an ordinary ISA I/O APIC
1824 * interrupt, that is edge-triggered and unmasked by default. We
1825 * used to do this, but it caused problems on some systems because
1826 * of the NMI watchdog and sometimes IRQ0 of the 8254 timer using
1827 * the same ExtINT cascade interrupt to drive the local APIC of the
1828 * bootstrap processor. Therefore we refrain from routing IRQ2 to
1829 * the I/O APIC in all cases now. No actual device should request
1830 * it anyway. --macro
1786 */ 1831 */
1787#define PIC_IRQS (1<<2) 1832#define PIC_IRQS (1<<2)
1788 1833
@@ -1793,10 +1838,7 @@ void __init setup_IO_APIC(void)
1793 * calling enable_IO_APIC() is moved to setup_local_APIC for BP 1838 * calling enable_IO_APIC() is moved to setup_local_APIC for BP
1794 */ 1839 */
1795 1840
1796 if (acpi_ioapic) 1841 io_apic_irqs = ~PIC_IRQS;
1797 io_apic_irqs = ~0; /* all IRQs go through IOAPIC */
1798 else
1799 io_apic_irqs = ~PIC_IRQS;
1800 1842
1801 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); 1843 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
1802 1844
@@ -1841,8 +1883,8 @@ static int ioapic_resume(struct sys_device *dev)
1841 1883
1842 spin_lock_irqsave(&ioapic_lock, flags); 1884 spin_lock_irqsave(&ioapic_lock, flags);
1843 reg_00.raw = io_apic_read(dev->id, 0); 1885 reg_00.raw = io_apic_read(dev->id, 0);
1844 if (reg_00.bits.ID != mp_ioapics[dev->id].mpc_apicid) { 1886 if (reg_00.bits.ID != mp_ioapics[dev->id].mp_apicid) {
1845 reg_00.bits.ID = mp_ioapics[dev->id].mpc_apicid; 1887 reg_00.bits.ID = mp_ioapics[dev->id].mp_apicid;
1846 io_apic_write(dev->id, 0, reg_00.raw); 1888 io_apic_write(dev->id, 0, reg_00.raw);
1847 } 1889 }
1848 spin_unlock_irqrestore(&ioapic_lock, flags); 1890 spin_unlock_irqrestore(&ioapic_lock, flags);
@@ -2242,8 +2284,8 @@ int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2242 return -1; 2284 return -1;
2243 2285
2244 for (i = 0; i < mp_irq_entries; i++) 2286 for (i = 0; i < mp_irq_entries; i++)
2245 if (mp_irqs[i].mpc_irqtype == mp_INT && 2287 if (mp_irqs[i].mp_irqtype == mp_INT &&
2246 mp_irqs[i].mpc_srcbusirq == bus_irq) 2288 mp_irqs[i].mp_srcbusirq == bus_irq)
2247 break; 2289 break;
2248 if (i >= mp_irq_entries) 2290 if (i >= mp_irq_entries)
2249 return -1; 2291 return -1;
@@ -2336,7 +2378,7 @@ void __init ioapic_init_mappings(void)
2336 ioapic_res = ioapic_setup_resources(); 2378 ioapic_res = ioapic_setup_resources();
2337 for (i = 0; i < nr_ioapics; i++) { 2379 for (i = 0; i < nr_ioapics; i++) {
2338 if (smp_found_config) { 2380 if (smp_found_config) {
2339 ioapic_phys = mp_ioapics[i].mpc_apicaddr; 2381 ioapic_phys = mp_ioapics[i].mp_apicaddr;
2340 } else { 2382 } else {
2341 ioapic_phys = (unsigned long) 2383 ioapic_phys = (unsigned long)
2342 alloc_bootmem_pages(PAGE_SIZE); 2384 alloc_bootmem_pages(PAGE_SIZE);
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/ipi.c
index c0df7b89ca23..9d98cda39ad9 100644
--- a/arch/x86/kernel/ipi.c
+++ b/arch/x86/kernel/ipi.c
@@ -8,7 +8,6 @@
8#include <linux/kernel_stat.h> 8#include <linux/kernel_stat.h>
9#include <linux/mc146818rtc.h> 9#include <linux/mc146818rtc.h>
10#include <linux/cache.h> 10#include <linux/cache.h>
11#include <linux/interrupt.h>
12#include <linux/cpu.h> 11#include <linux/cpu.h>
13#include <linux/module.h> 12#include <linux/module.h>
14 13
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 147352df28b9..47a6f6f12478 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -48,6 +48,29 @@ void ack_bad_irq(unsigned int irq)
48#endif 48#endif
49} 49}
50 50
51#ifdef CONFIG_DEBUG_STACKOVERFLOW
52/* Debugging check for stack overflow: is there less than 1KB free? */
53static int check_stack_overflow(void)
54{
55 long sp;
56
57 __asm__ __volatile__("andl %%esp,%0" :
58 "=r" (sp) : "0" (THREAD_SIZE - 1));
59
60 return sp < (sizeof(struct thread_info) + STACK_WARN);
61}
62
63static void print_stack_overflow(void)
64{
65 printk(KERN_WARNING "low stack detected by irq handler\n");
66 dump_stack();
67}
68
69#else
70static inline int check_stack_overflow(void) { return 0; }
71static inline void print_stack_overflow(void) { }
72#endif
73
51#ifdef CONFIG_4KSTACKS 74#ifdef CONFIG_4KSTACKS
52/* 75/*
53 * per-CPU IRQ handling contexts (thread information and stack) 76 * per-CPU IRQ handling contexts (thread information and stack)
@@ -59,48 +82,29 @@ union irq_ctx {
59 82
60static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly; 83static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
61static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly; 84static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
62#endif
63 85
64/* 86static char softirq_stack[NR_CPUS * THREAD_SIZE]
65 * do_IRQ handles all normal device IRQ's (the special 87 __attribute__((__section__(".bss.page_aligned")));
66 * SMP cross-CPU interrupts have their own specific
67 * handlers).
68 */
69unsigned int do_IRQ(struct pt_regs *regs)
70{
71 struct pt_regs *old_regs;
72 /* high bit used in ret_from_ code */
73 int irq = ~regs->orig_ax;
74 struct irq_desc *desc = irq_desc + irq;
75#ifdef CONFIG_4KSTACKS
76 union irq_ctx *curctx, *irqctx;
77 u32 *isp;
78#endif
79 88
80 if (unlikely((unsigned)irq >= NR_IRQS)) { 89static char hardirq_stack[NR_CPUS * THREAD_SIZE]
81 printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 90 __attribute__((__section__(".bss.page_aligned")));
82 __func__, irq);
83 BUG();
84 }
85 91
86 old_regs = set_irq_regs(regs); 92static void call_on_stack(void *func, void *stack)
87 irq_enter(); 93{
88#ifdef CONFIG_DEBUG_STACKOVERFLOW 94 asm volatile("xchgl %%ebx,%%esp \n"
89 /* Debugging check for stack overflow: is there less than 1KB free? */ 95 "call *%%edi \n"
90 { 96 "movl %%ebx,%%esp \n"
91 long sp; 97 : "=b" (stack)
92 98 : "0" (stack),
93 __asm__ __volatile__("andl %%esp,%0" : 99 "D"(func)
94 "=r" (sp) : "0" (THREAD_SIZE - 1)); 100 : "memory", "cc", "edx", "ecx", "eax");
95 if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) { 101}
96 printk("do_IRQ: stack overflow: %ld\n",
97 sp - sizeof(struct thread_info));
98 dump_stack();
99 }
100 }
101#endif
102 102
103#ifdef CONFIG_4KSTACKS 103static inline int
104execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq)
105{
106 union irq_ctx *curctx, *irqctx;
107 u32 *isp, arg1, arg2;
104 108
105 curctx = (union irq_ctx *) current_thread_info(); 109 curctx = (union irq_ctx *) current_thread_info();
106 irqctx = hardirq_ctx[smp_processor_id()]; 110 irqctx = hardirq_ctx[smp_processor_id()];
@@ -111,52 +115,39 @@ unsigned int do_IRQ(struct pt_regs *regs)
111 * handler) we can't do that and just have to keep using the 115 * handler) we can't do that and just have to keep using the
112 * current stack (which is the irq stack already after all) 116 * current stack (which is the irq stack already after all)
113 */ 117 */
114 if (curctx != irqctx) { 118 if (unlikely(curctx == irqctx))
115 int arg1, arg2, bx; 119 return 0;
116
117 /* build the stack frame on the IRQ stack */
118 isp = (u32*) ((char*)irqctx + sizeof(*irqctx));
119 irqctx->tinfo.task = curctx->tinfo.task;
120 irqctx->tinfo.previous_esp = current_stack_pointer;
121 120
122 /* 121 /* build the stack frame on the IRQ stack */
123 * Copy the softirq bits in preempt_count so that the 122 isp = (u32 *) ((char*)irqctx + sizeof(*irqctx));
124 * softirq checks work in the hardirq context. 123 irqctx->tinfo.task = curctx->tinfo.task;
125 */ 124 irqctx->tinfo.previous_esp = current_stack_pointer;
126 irqctx->tinfo.preempt_count =
127 (irqctx->tinfo.preempt_count & ~SOFTIRQ_MASK) |
128 (curctx->tinfo.preempt_count & SOFTIRQ_MASK);
129
130 asm volatile(
131 " xchgl %%ebx,%%esp \n"
132 " call *%%edi \n"
133 " movl %%ebx,%%esp \n"
134 : "=a" (arg1), "=d" (arg2), "=b" (bx)
135 : "0" (irq), "1" (desc), "2" (isp),
136 "D" (desc->handle_irq)
137 : "memory", "cc", "ecx"
138 );
139 } else
140#endif
141 desc->handle_irq(irq, desc);
142 125
143 irq_exit(); 126 /*
144 set_irq_regs(old_regs); 127 * Copy the softirq bits in preempt_count so that the
128 * softirq checks work in the hardirq context.
129 */
130 irqctx->tinfo.preempt_count =
131 (irqctx->tinfo.preempt_count & ~SOFTIRQ_MASK) |
132 (curctx->tinfo.preempt_count & SOFTIRQ_MASK);
133
134 if (unlikely(overflow))
135 call_on_stack(print_stack_overflow, isp);
136
137 asm volatile("xchgl %%ebx,%%esp \n"
138 "call *%%edi \n"
139 "movl %%ebx,%%esp \n"
140 : "=a" (arg1), "=d" (arg2), "=b" (isp)
141 : "0" (irq), "1" (desc), "2" (isp),
142 "D" (desc->handle_irq)
143 : "memory", "cc", "ecx");
145 return 1; 144 return 1;
146} 145}
147 146
148#ifdef CONFIG_4KSTACKS
149
150static char softirq_stack[NR_CPUS * THREAD_SIZE]
151 __attribute__((__section__(".bss.page_aligned")));
152
153static char hardirq_stack[NR_CPUS * THREAD_SIZE]
154 __attribute__((__section__(".bss.page_aligned")));
155
156/* 147/*
157 * allocate per-cpu stacks for hardirq and for softirq processing 148 * allocate per-cpu stacks for hardirq and for softirq processing
158 */ 149 */
159void irq_ctx_init(int cpu) 150void __cpuinit irq_ctx_init(int cpu)
160{ 151{
161 union irq_ctx *irqctx; 152 union irq_ctx *irqctx;
162 153
@@ -164,25 +155,25 @@ void irq_ctx_init(int cpu)
164 return; 155 return;
165 156
166 irqctx = (union irq_ctx*) &hardirq_stack[cpu*THREAD_SIZE]; 157 irqctx = (union irq_ctx*) &hardirq_stack[cpu*THREAD_SIZE];
167 irqctx->tinfo.task = NULL; 158 irqctx->tinfo.task = NULL;
168 irqctx->tinfo.exec_domain = NULL; 159 irqctx->tinfo.exec_domain = NULL;
169 irqctx->tinfo.cpu = cpu; 160 irqctx->tinfo.cpu = cpu;
170 irqctx->tinfo.preempt_count = HARDIRQ_OFFSET; 161 irqctx->tinfo.preempt_count = HARDIRQ_OFFSET;
171 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); 162 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
172 163
173 hardirq_ctx[cpu] = irqctx; 164 hardirq_ctx[cpu] = irqctx;
174 165
175 irqctx = (union irq_ctx*) &softirq_stack[cpu*THREAD_SIZE]; 166 irqctx = (union irq_ctx*) &softirq_stack[cpu*THREAD_SIZE];
176 irqctx->tinfo.task = NULL; 167 irqctx->tinfo.task = NULL;
177 irqctx->tinfo.exec_domain = NULL; 168 irqctx->tinfo.exec_domain = NULL;
178 irqctx->tinfo.cpu = cpu; 169 irqctx->tinfo.cpu = cpu;
179 irqctx->tinfo.preempt_count = 0; 170 irqctx->tinfo.preempt_count = 0;
180 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); 171 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
181 172
182 softirq_ctx[cpu] = irqctx; 173 softirq_ctx[cpu] = irqctx;
183 174
184 printk("CPU %u irqstacks, hard=%p soft=%p\n", 175 printk(KERN_DEBUG "CPU %u irqstacks, hard=%p soft=%p\n",
185 cpu,hardirq_ctx[cpu],softirq_ctx[cpu]); 176 cpu,hardirq_ctx[cpu],softirq_ctx[cpu]);
186} 177}
187 178
188void irq_ctx_exit(int cpu) 179void irq_ctx_exit(int cpu)
@@ -211,25 +202,56 @@ asmlinkage void do_softirq(void)
211 /* build the stack frame on the softirq stack */ 202 /* build the stack frame on the softirq stack */
212 isp = (u32*) ((char*)irqctx + sizeof(*irqctx)); 203 isp = (u32*) ((char*)irqctx + sizeof(*irqctx));
213 204
214 asm volatile( 205 call_on_stack(__do_softirq, isp);
215 " xchgl %%ebx,%%esp \n"
216 " call __do_softirq \n"
217 " movl %%ebx,%%esp \n"
218 : "=b"(isp)
219 : "0"(isp)
220 : "memory", "cc", "edx", "ecx", "eax"
221 );
222 /* 206 /*
223 * Shouldnt happen, we returned above if in_interrupt(): 207 * Shouldnt happen, we returned above if in_interrupt():
224 */ 208 */
225 WARN_ON_ONCE(softirq_count()); 209 WARN_ON_ONCE(softirq_count());
226 } 210 }
227 211
228 local_irq_restore(flags); 212 local_irq_restore(flags);
229} 213}
214
215#else
216static inline int
217execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) { return 0; }
230#endif 218#endif
231 219
232/* 220/*
221 * do_IRQ handles all normal device IRQ's (the special
222 * SMP cross-CPU interrupts have their own specific
223 * handlers).
224 */
225unsigned int do_IRQ(struct pt_regs *regs)
226{
227 struct pt_regs *old_regs;
228 /* high bit used in ret_from_ code */
229 int overflow, irq = ~regs->orig_ax;
230 struct irq_desc *desc = irq_desc + irq;
231
232 if (unlikely((unsigned)irq >= NR_IRQS)) {
233 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
234 __func__, irq);
235 BUG();
236 }
237
238 old_regs = set_irq_regs(regs);
239 irq_enter();
240
241 overflow = check_stack_overflow();
242
243 if (!execute_on_irq_stack(overflow, desc, irq)) {
244 if (unlikely(overflow))
245 print_stack_overflow();
246 desc->handle_irq(irq, desc);
247 }
248
249 irq_exit();
250 set_irq_regs(old_regs);
251 return 1;
252}
253
254/*
233 * Interrupt statistics: 255 * Interrupt statistics:
234 */ 256 */
235 257
@@ -313,16 +335,20 @@ skip:
313 per_cpu(irq_stat,j).irq_tlb_count); 335 per_cpu(irq_stat,j).irq_tlb_count);
314 seq_printf(p, " TLB shootdowns\n"); 336 seq_printf(p, " TLB shootdowns\n");
315#endif 337#endif
338#ifdef CONFIG_X86_MCE
316 seq_printf(p, "TRM: "); 339 seq_printf(p, "TRM: ");
317 for_each_online_cpu(j) 340 for_each_online_cpu(j)
318 seq_printf(p, "%10u ", 341 seq_printf(p, "%10u ",
319 per_cpu(irq_stat,j).irq_thermal_count); 342 per_cpu(irq_stat,j).irq_thermal_count);
320 seq_printf(p, " Thermal event interrupts\n"); 343 seq_printf(p, " Thermal event interrupts\n");
344#endif
345#ifdef CONFIG_X86_LOCAL_APIC
321 seq_printf(p, "SPU: "); 346 seq_printf(p, "SPU: ");
322 for_each_online_cpu(j) 347 for_each_online_cpu(j)
323 seq_printf(p, "%10u ", 348 seq_printf(p, "%10u ",
324 per_cpu(irq_stat,j).irq_spurious_count); 349 per_cpu(irq_stat,j).irq_spurious_count);
325 seq_printf(p, " Spurious interrupts\n"); 350 seq_printf(p, " Spurious interrupts\n");
351#endif
326 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); 352 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
327#if defined(CONFIG_X86_IO_APIC) 353#if defined(CONFIG_X86_IO_APIC)
328 seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); 354 seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
@@ -331,6 +357,40 @@ skip:
331 return 0; 357 return 0;
332} 358}
333 359
360/*
361 * /proc/stat helpers
362 */
363u64 arch_irq_stat_cpu(unsigned int cpu)
364{
365 u64 sum = nmi_count(cpu);
366
367#ifdef CONFIG_X86_LOCAL_APIC
368 sum += per_cpu(irq_stat, cpu).apic_timer_irqs;
369#endif
370#ifdef CONFIG_SMP
371 sum += per_cpu(irq_stat, cpu).irq_resched_count;
372 sum += per_cpu(irq_stat, cpu).irq_call_count;
373 sum += per_cpu(irq_stat, cpu).irq_tlb_count;
374#endif
375#ifdef CONFIG_X86_MCE
376 sum += per_cpu(irq_stat, cpu).irq_thermal_count;
377#endif
378#ifdef CONFIG_X86_LOCAL_APIC
379 sum += per_cpu(irq_stat, cpu).irq_spurious_count;
380#endif
381 return sum;
382}
383
384u64 arch_irq_stat(void)
385{
386 u64 sum = atomic_read(&irq_err_count);
387
388#ifdef CONFIG_X86_IO_APIC
389 sum += atomic_read(&irq_mis_count);
390#endif
391 return sum;
392}
393
334#ifdef CONFIG_HOTPLUG_CPU 394#ifdef CONFIG_HOTPLUG_CPU
335#include <mach_apic.h> 395#include <mach_apic.h>
336 396
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 3aac15466a91..1f78b238d8d2 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -135,6 +135,7 @@ skip:
135 seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count); 135 seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count);
136 seq_printf(p, " TLB shootdowns\n"); 136 seq_printf(p, " TLB shootdowns\n");
137#endif 137#endif
138#ifdef CONFIG_X86_MCE
138 seq_printf(p, "TRM: "); 139 seq_printf(p, "TRM: ");
139 for_each_online_cpu(j) 140 for_each_online_cpu(j)
140 seq_printf(p, "%10u ", cpu_pda(j)->irq_thermal_count); 141 seq_printf(p, "%10u ", cpu_pda(j)->irq_thermal_count);
@@ -143,6 +144,7 @@ skip:
143 for_each_online_cpu(j) 144 for_each_online_cpu(j)
144 seq_printf(p, "%10u ", cpu_pda(j)->irq_threshold_count); 145 seq_printf(p, "%10u ", cpu_pda(j)->irq_threshold_count);
145 seq_printf(p, " Threshold APIC interrupts\n"); 146 seq_printf(p, " Threshold APIC interrupts\n");
147#endif
146 seq_printf(p, "SPU: "); 148 seq_printf(p, "SPU: ");
147 for_each_online_cpu(j) 149 for_each_online_cpu(j)
148 seq_printf(p, "%10u ", cpu_pda(j)->irq_spurious_count); 150 seq_printf(p, "%10u ", cpu_pda(j)->irq_spurious_count);
@@ -153,6 +155,32 @@ skip:
153} 155}
154 156
155/* 157/*
158 * /proc/stat helpers
159 */
160u64 arch_irq_stat_cpu(unsigned int cpu)
161{
162 u64 sum = cpu_pda(cpu)->__nmi_count;
163
164 sum += cpu_pda(cpu)->apic_timer_irqs;
165#ifdef CONFIG_SMP
166 sum += cpu_pda(cpu)->irq_resched_count;
167 sum += cpu_pda(cpu)->irq_call_count;
168 sum += cpu_pda(cpu)->irq_tlb_count;
169#endif
170#ifdef CONFIG_X86_MCE
171 sum += cpu_pda(cpu)->irq_thermal_count;
172 sum += cpu_pda(cpu)->irq_threshold_count;
173#endif
174 sum += cpu_pda(cpu)->irq_spurious_count;
175 return sum;
176}
177
178u64 arch_irq_stat(void)
179{
180 return atomic_read(&irq_err_count);
181}
182
183/*
156 * do_IRQ handles all normal device IRQ's (the special 184 * do_IRQ handles all normal device IRQ's (the special
157 * SMP cross-CPU interrupts have their own specific 185 * SMP cross-CPU interrupts have their own specific
158 * handlers). 186 * handlers).
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c
new file mode 100644
index 000000000000..d66914287ee1
--- /dev/null
+++ b/arch/x86/kernel/irqinit_32.c
@@ -0,0 +1,114 @@
1#include <linux/errno.h>
2#include <linux/signal.h>
3#include <linux/sched.h>
4#include <linux/ioport.h>
5#include <linux/interrupt.h>
6#include <linux/slab.h>
7#include <linux/random.h>
8#include <linux/init.h>
9#include <linux/kernel_stat.h>
10#include <linux/sysdev.h>
11#include <linux/bitops.h>
12
13#include <asm/atomic.h>
14#include <asm/system.h>
15#include <asm/io.h>
16#include <asm/timer.h>
17#include <asm/pgtable.h>
18#include <asm/delay.h>
19#include <asm/desc.h>
20#include <asm/apic.h>
21#include <asm/arch_hooks.h>
22#include <asm/i8259.h>
23
24
25
26/*
27 * Note that on a 486, we don't want to do a SIGFPE on an irq13
28 * as the irq is unreliable, and exception 16 works correctly
29 * (ie as explained in the intel literature). On a 386, you
30 * can't use exception 16 due to bad IBM design, so we have to
31 * rely on the less exact irq13.
32 *
33 * Careful.. Not only is IRQ13 unreliable, but it is also
34 * leads to races. IBM designers who came up with it should
35 * be shot.
36 */
37
38
39static irqreturn_t math_error_irq(int cpl, void *dev_id)
40{
41 extern void math_error(void __user *);
42 outb(0,0xF0);
43 if (ignore_fpu_irq || !boot_cpu_data.hard_math)
44 return IRQ_NONE;
45 math_error((void __user *)get_irq_regs()->ip);
46 return IRQ_HANDLED;
47}
48
49/*
50 * New motherboards sometimes make IRQ 13 be a PCI interrupt,
51 * so allow interrupt sharing.
52 */
53static struct irqaction fpu_irq = {
54 .handler = math_error_irq,
55 .mask = CPU_MASK_NONE,
56 .name = "fpu",
57};
58
59void __init init_ISA_irqs (void)
60{
61 int i;
62
63#ifdef CONFIG_X86_LOCAL_APIC
64 init_bsp_APIC();
65#endif
66 init_8259A(0);
67
68 /*
69 * 16 old-style INTA-cycle interrupts:
70 */
71 for (i = 0; i < 16; i++) {
72 set_irq_chip_and_handler_name(i, &i8259A_chip,
73 handle_level_irq, "XT");
74 }
75}
76
77/* Overridden in paravirt.c */
78void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
79
80void __init native_init_IRQ(void)
81{
82 int i;
83
84 /* all the set up before the call gates are initialised */
85 pre_intr_init_hook();
86
87 /*
88 * Cover the whole vector space, no vector can escape
89 * us. (some of these will be overridden and become
90 * 'special' SMP interrupts)
91 */
92 for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
93 int vector = FIRST_EXTERNAL_VECTOR + i;
94 if (i >= NR_IRQS)
95 break;
96 /* SYSCALL_VECTOR was reserved in trap_init. */
97 if (!test_bit(vector, used_vectors))
98 set_intr_gate(vector, interrupt[i]);
99 }
100
101 /* setup after call gates are initialised (usually add in
102 * the architecture specific gates)
103 */
104 intr_init_hook();
105
106 /*
107 * External FPU? Set up irq13 if so, for
108 * original braindamaged IBM FERR coupling.
109 */
110 if (boot_cpu_data.hard_math && !cpu_has_fpu)
111 setup_irq(FPU_IRQ, &fpu_irq);
112
113 irq_ctx_init(smp_processor_id());
114}
diff --git a/arch/x86/kernel/irqinit_64.c b/arch/x86/kernel/irqinit_64.c
new file mode 100644
index 000000000000..31f49e8f46a7
--- /dev/null
+++ b/arch/x86/kernel/irqinit_64.c
@@ -0,0 +1,217 @@
1#include <linux/linkage.h>
2#include <linux/errno.h>
3#include <linux/signal.h>
4#include <linux/sched.h>
5#include <linux/ioport.h>
6#include <linux/interrupt.h>
7#include <linux/timex.h>
8#include <linux/slab.h>
9#include <linux/random.h>
10#include <linux/init.h>
11#include <linux/kernel_stat.h>
12#include <linux/sysdev.h>
13#include <linux/bitops.h>
14
15#include <asm/acpi.h>
16#include <asm/atomic.h>
17#include <asm/system.h>
18#include <asm/io.h>
19#include <asm/hw_irq.h>
20#include <asm/pgtable.h>
21#include <asm/delay.h>
22#include <asm/desc.h>
23#include <asm/apic.h>
24#include <asm/i8259.h>
25
26/*
27 * Common place to define all x86 IRQ vectors
28 *
29 * This builds up the IRQ handler stubs using some ugly macros in irq.h
30 *
31 * These macros create the low-level assembly IRQ routines that save
32 * register context and call do_IRQ(). do_IRQ() then does all the
33 * operations that are needed to keep the AT (or SMP IOAPIC)
34 * interrupt-controller happy.
35 */
36
37#define IRQ_NAME2(nr) nr##_interrupt(void)
38#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
39
40/*
41 * SMP has a few special interrupts for IPI messages
42 */
43
44#define BUILD_IRQ(nr) \
45 asmlinkage void IRQ_NAME(nr); \
46 asm("\n.p2align\n" \
47 "IRQ" #nr "_interrupt:\n\t" \
48 "push $~(" #nr ") ; " \
49 "jmp common_interrupt");
50
51#define BI(x,y) \
52 BUILD_IRQ(x##y)
53
54#define BUILD_16_IRQS(x) \
55 BI(x,0) BI(x,1) BI(x,2) BI(x,3) \
56 BI(x,4) BI(x,5) BI(x,6) BI(x,7) \
57 BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
58 BI(x,c) BI(x,d) BI(x,e) BI(x,f)
59
60/*
61 * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
62 * (these are usually mapped to vectors 0x30-0x3f)
63 */
64
65/*
66 * The IO-APIC gives us many more interrupt sources. Most of these
67 * are unused but an SMP system is supposed to have enough memory ...
68 * sometimes (mostly wrt. hw bugs) we get corrupted vectors all
69 * across the spectrum, so we really want to be prepared to get all
70 * of these. Plus, more powerful systems might have more than 64
71 * IO-APIC registers.
72 *
73 * (these are usually mapped into the 0x30-0xff vector range)
74 */
75 BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3)
76BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7)
77BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb)
78BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xe) BUILD_16_IRQS(0xf)
79
80#undef BUILD_16_IRQS
81#undef BI
82
83
84#define IRQ(x,y) \
85 IRQ##x##y##_interrupt
86
87#define IRQLIST_16(x) \
88 IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
89 IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
90 IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
91 IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
92
93/* for the irq vectors */
94static void (*__initdata interrupt[NR_VECTORS - FIRST_EXTERNAL_VECTOR])(void) = {
95 IRQLIST_16(0x2), IRQLIST_16(0x3),
96 IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
97 IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
98 IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf)
99};
100
101#undef IRQ
102#undef IRQLIST_16
103
104
105
106
107/*
108 * IRQ2 is cascade interrupt to second interrupt controller
109 */
110
111static struct irqaction irq2 = {
112 .handler = no_action,
113 .mask = CPU_MASK_NONE,
114 .name = "cascade",
115};
116DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
117 [0 ... IRQ0_VECTOR - 1] = -1,
118 [IRQ0_VECTOR] = 0,
119 [IRQ1_VECTOR] = 1,
120 [IRQ2_VECTOR] = 2,
121 [IRQ3_VECTOR] = 3,
122 [IRQ4_VECTOR] = 4,
123 [IRQ5_VECTOR] = 5,
124 [IRQ6_VECTOR] = 6,
125 [IRQ7_VECTOR] = 7,
126 [IRQ8_VECTOR] = 8,
127 [IRQ9_VECTOR] = 9,
128 [IRQ10_VECTOR] = 10,
129 [IRQ11_VECTOR] = 11,
130 [IRQ12_VECTOR] = 12,
131 [IRQ13_VECTOR] = 13,
132 [IRQ14_VECTOR] = 14,
133 [IRQ15_VECTOR] = 15,
134 [IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1
135};
136
137static void __init init_ISA_irqs (void)
138{
139 int i;
140
141 init_bsp_APIC();
142 init_8259A(0);
143
144 for (i = 0; i < NR_IRQS; i++) {
145 irq_desc[i].status = IRQ_DISABLED;
146 irq_desc[i].action = NULL;
147 irq_desc[i].depth = 1;
148
149 if (i < 16) {
150 /*
151 * 16 old-style INTA-cycle interrupts:
152 */
153 set_irq_chip_and_handler_name(i, &i8259A_chip,
154 handle_level_irq, "XT");
155 } else {
156 /*
157 * 'high' PCI IRQs filled in on demand
158 */
159 irq_desc[i].chip = &no_irq_chip;
160 }
161 }
162}
163
164void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
165
166void __init native_init_IRQ(void)
167{
168 int i;
169
170 init_ISA_irqs();
171 /*
172 * Cover the whole vector space, no vector can escape
173 * us. (some of these will be overridden and become
174 * 'special' SMP interrupts)
175 */
176 for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
177 int vector = FIRST_EXTERNAL_VECTOR + i;
178 if (vector != IA32_SYSCALL_VECTOR)
179 set_intr_gate(vector, interrupt[i]);
180 }
181
182#ifdef CONFIG_SMP
183 /*
184 * The reschedule interrupt is a CPU-to-CPU reschedule-helper
185 * IPI, driven by wakeup.
186 */
187 alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
188
189 /* IPIs for invalidation */
190 alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
191 alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
192 alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
193 alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
194 alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
195 alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
196 alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
197 alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
198
199 /* IPI for generic function call */
200 alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
201
202 /* Low priority IPI to cleanup after moving an irq */
203 set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
204#endif
205 alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
206 alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
207
208 /* self generated IPI for local APIC timer */
209 alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
210
211 /* IPI vectors for APIC spurious and error interrupts */
212 alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
213 alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
214
215 if (!acpi_ioapic)
216 setup_irq(2, &irq2);
217}
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index 0224c3637c73..21f2bae98c15 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -20,9 +20,9 @@
20#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
21 21
22#ifdef CONFIG_SMP 22#ifdef CONFIG_SMP
23static void flush_ldt(void *null) 23static void flush_ldt(void *current_mm)
24{ 24{
25 if (current->active_mm) 25 if (current->active_mm == current_mm)
26 load_LDT(&current->active_mm->context); 26 load_LDT(&current->active_mm->context);
27} 27}
28#endif 28#endif
@@ -68,7 +68,7 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
68 load_LDT(pc); 68 load_LDT(pc);
69 mask = cpumask_of_cpu(smp_processor_id()); 69 mask = cpumask_of_cpu(smp_processor_id());
70 if (!cpus_equal(current->mm->cpu_vm_mask, mask)) 70 if (!cpus_equal(current->mm->cpu_vm_mask, mask))
71 smp_call_function(flush_ldt, NULL, 1, 1); 71 smp_call_function(flush_ldt, current->mm, 1, 1);
72 preempt_enable(); 72 preempt_enable();
73#else 73#else
74 load_LDT(pc); 74 load_LDT(pc);
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index d0b234c9fc31..8864230d55af 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -11,6 +11,8 @@
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/numa.h> 13#include <linux/numa.h>
14#include <linux/ftrace.h>
15
14#include <asm/pgtable.h> 16#include <asm/pgtable.h>
15#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
16#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
@@ -39,7 +41,7 @@ static void set_idt(void *newidt, __u16 limit)
39 curidt.address = (unsigned long)newidt; 41 curidt.address = (unsigned long)newidt;
40 42
41 load_idt(&curidt); 43 load_idt(&curidt);
42}; 44}
43 45
44 46
45static void set_gdt(void *newgdt, __u16 limit) 47static void set_gdt(void *newgdt, __u16 limit)
@@ -51,7 +53,7 @@ static void set_gdt(void *newgdt, __u16 limit)
51 curgdt.address = (unsigned long)newgdt; 53 curgdt.address = (unsigned long)newgdt;
52 54
53 load_gdt(&curgdt); 55 load_gdt(&curgdt);
54}; 56}
55 57
56static void load_segments(void) 58static void load_segments(void)
57{ 59{
@@ -107,6 +109,8 @@ NORET_TYPE void machine_kexec(struct kimage *image)
107 unsigned long page_list[PAGES_NR]; 109 unsigned long page_list[PAGES_NR];
108 void *control_page; 110 void *control_page;
109 111
112 tracer_disable();
113
110 /* Interrupts aren't acceptable while we reboot */ 114 /* Interrupts aren't acceptable while we reboot */
111 local_irq_disable(); 115 local_irq_disable();
112 116
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 576a03db4511..9dd9262693a3 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -11,6 +11,8 @@
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/reboot.h> 12#include <linux/reboot.h>
13#include <linux/numa.h> 13#include <linux/numa.h>
14#include <linux/ftrace.h>
15
14#include <asm/pgtable.h> 16#include <asm/pgtable.h>
15#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
16#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
@@ -110,7 +112,7 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
110{ 112{
111 pgd_t *level4p; 113 pgd_t *level4p;
112 level4p = (pgd_t *)__va(start_pgtable); 114 level4p = (pgd_t *)__va(start_pgtable);
113 return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT); 115 return init_level4_page(image, level4p, 0, max_pfn << PAGE_SHIFT);
114} 116}
115 117
116static void set_idt(void *newidt, u16 limit) 118static void set_idt(void *newidt, u16 limit)
@@ -184,6 +186,8 @@ NORET_TYPE void machine_kexec(struct kimage *image)
184 unsigned long page_list[PAGES_NR]; 186 unsigned long page_list[PAGES_NR];
185 void *control_page; 187 void *control_page;
186 188
189 tracer_disable();
190
187 /* Interrupts aren't acceptable while we reboot */ 191 /* Interrupts aren't acceptable while we reboot */
188 local_irq_disable(); 192 local_irq_disable();
189 193
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c
index 69729e38b78a..f47ba8156f3e 100644
--- a/arch/x86/kernel/microcode.c
+++ b/arch/x86/kernel/microcode.c
@@ -5,13 +5,14 @@
5 * 2006 Shaohua Li <shaohua.li@intel.com> 5 * 2006 Shaohua Li <shaohua.li@intel.com>
6 * 6 *
7 * This driver allows to upgrade microcode on Intel processors 7 * This driver allows to upgrade microcode on Intel processors
8 * belonging to IA-32 family - PentiumPro, Pentium II, 8 * belonging to IA-32 family - PentiumPro, Pentium II,
9 * Pentium III, Xeon, Pentium 4, etc. 9 * Pentium III, Xeon, Pentium 4, etc.
10 * 10 *
11 * Reference: Section 8.10 of Volume III, Intel Pentium 4 Manual, 11 * Reference: Section 8.11 of Volume 3a, IA-32 Intel? Architecture
12 * Order Number 245472 or free download from: 12 * Software Developer's Manual
13 * 13 * Order Number 253668 or free download from:
14 * http://developer.intel.com/design/pentium4/manuals/245472.htm 14 *
15 * http://developer.intel.com/design/pentium4/manuals/253668.htm
15 * 16 *
16 * For more information, go to http://www.urbanmyth.org/microcode 17 * For more information, go to http://www.urbanmyth.org/microcode
17 * 18 *
@@ -58,12 +59,12 @@
58 * nature of implementation. 59 * nature of implementation.
59 * 1.11 22 Mar 2002 Tigran Aivazian <tigran@veritas.com> 60 * 1.11 22 Mar 2002 Tigran Aivazian <tigran@veritas.com>
60 * Fix the panic when writing zero-length microcode chunk. 61 * Fix the panic when writing zero-length microcode chunk.
61 * 1.12 29 Sep 2003 Nitin Kamble <nitin.a.kamble@intel.com>, 62 * 1.12 29 Sep 2003 Nitin Kamble <nitin.a.kamble@intel.com>,
62 * Jun Nakajima <jun.nakajima@intel.com> 63 * Jun Nakajima <jun.nakajima@intel.com>
63 * Support for the microcode updates in the new format. 64 * Support for the microcode updates in the new format.
64 * 1.13 10 Oct 2003 Tigran Aivazian <tigran@veritas.com> 65 * 1.13 10 Oct 2003 Tigran Aivazian <tigran@veritas.com>
65 * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl 66 * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl
66 * because we no longer hold a copy of applied microcode 67 * because we no longer hold a copy of applied microcode
67 * in kernel memory. 68 * in kernel memory.
68 * 1.14 25 Jun 2004 Tigran Aivazian <tigran@veritas.com> 69 * 1.14 25 Jun 2004 Tigran Aivazian <tigran@veritas.com>
69 * Fix sigmatch() macro to handle old CPUs with pf == 0. 70 * Fix sigmatch() macro to handle old CPUs with pf == 0.
@@ -75,6 +76,7 @@
75#include <linux/kernel.h> 76#include <linux/kernel.h>
76#include <linux/init.h> 77#include <linux/init.h>
77#include <linux/sched.h> 78#include <linux/sched.h>
79#include <linux/smp_lock.h>
78#include <linux/cpumask.h> 80#include <linux/cpumask.h>
79#include <linux/module.h> 81#include <linux/module.h>
80#include <linux/slab.h> 82#include <linux/slab.h>
@@ -320,11 +322,11 @@ static void apply_microcode(int cpu)
320 return; 322 return;
321 323
322 /* serialize access to the physical write to MSR 0x79 */ 324 /* serialize access to the physical write to MSR 0x79 */
323 spin_lock_irqsave(&microcode_update_lock, flags); 325 spin_lock_irqsave(&microcode_update_lock, flags);
324 326
325 /* write microcode via MSR 0x79 */ 327 /* write microcode via MSR 0x79 */
326 wrmsr(MSR_IA32_UCODE_WRITE, 328 wrmsr(MSR_IA32_UCODE_WRITE,
327 (unsigned long) uci->mc->bits, 329 (unsigned long) uci->mc->bits,
328 (unsigned long) uci->mc->bits >> 16 >> 16); 330 (unsigned long) uci->mc->bits >> 16 >> 16);
329 wrmsr(MSR_IA32_UCODE_REV, 0, 0); 331 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
330 332
@@ -341,7 +343,7 @@ static void apply_microcode(int cpu)
341 return; 343 return;
342 } 344 }
343 printk(KERN_INFO "microcode: CPU%d updated from revision " 345 printk(KERN_INFO "microcode: CPU%d updated from revision "
344 "0x%x to 0x%x, date = %08x \n", 346 "0x%x to 0x%x, date = %08x \n",
345 cpu_num, uci->rev, val[1], uci->mc->hdr.date); 347 cpu_num, uci->rev, val[1], uci->mc->hdr.date);
346 uci->rev = val[1]; 348 uci->rev = val[1];
347} 349}
@@ -422,6 +424,7 @@ out:
422 424
423static int microcode_open (struct inode *unused1, struct file *unused2) 425static int microcode_open (struct inode *unused1, struct file *unused2)
424{ 426{
427 cycle_kernel_lock();
425 return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; 428 return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
426} 429}
427 430
@@ -534,7 +537,7 @@ static int cpu_request_microcode(int cpu)
534 c->x86, c->x86_model, c->x86_mask); 537 c->x86, c->x86_model, c->x86_mask);
535 error = request_firmware(&firmware, name, &microcode_pdev->dev); 538 error = request_firmware(&firmware, name, &microcode_pdev->dev);
536 if (error) { 539 if (error) {
537 pr_debug("microcode: ucode data file %s load failed\n", name); 540 pr_debug("microcode: data file %s load failed\n", name);
538 return error; 541 return error;
539 } 542 }
540 buf = firmware->data; 543 buf = firmware->data;
@@ -805,6 +808,9 @@ static int __init microcode_init (void)
805{ 808{
806 int error; 809 int error;
807 810
811 printk(KERN_INFO
812 "IA-32 Microcode Update Driver: v" MICROCODE_VERSION " <tigran@aivazian.fsnet.co.uk>\n");
813
808 error = microcode_dev_init(); 814 error = microcode_dev_init();
809 if (error) 815 if (error)
810 return error; 816 return error;
@@ -825,9 +831,6 @@ static int __init microcode_init (void)
825 } 831 }
826 832
827 register_hotcpu_notifier(&mc_cpu_notifier); 833 register_hotcpu_notifier(&mc_cpu_notifier);
828
829 printk(KERN_INFO
830 "IA-32 Microcode Update Driver: v" MICROCODE_VERSION " <tigran@aivazian.fsnet.co.uk>\n");
831 return 0; 834 return 0;
832} 835}
833 836
diff --git a/arch/x86/kernel/mmconf-fam10h_64.c b/arch/x86/kernel/mmconf-fam10h_64.c
index edc5fbfe85c0..fdfdc550b366 100644
--- a/arch/x86/kernel/mmconf-fam10h_64.c
+++ b/arch/x86/kernel/mmconf-fam10h_64.c
@@ -12,6 +12,7 @@
12#include <asm/io.h> 12#include <asm/io.h>
13#include <asm/msr.h> 13#include <asm/msr.h>
14#include <asm/acpi.h> 14#include <asm/acpi.h>
15#include <asm/mmconfig.h>
15 16
16#include "../pci/pci.h" 17#include "../pci/pci.h"
17 18
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 404683b94e79..3b25e49380c6 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -25,6 +25,8 @@
25#include <asm/proto.h> 25#include <asm/proto.h>
26#include <asm/acpi.h> 26#include <asm/acpi.h>
27#include <asm/bios_ebda.h> 27#include <asm/bios_ebda.h>
28#include <asm/e820.h>
29#include <asm/trampoline.h>
28 30
29#include <mach_apic.h> 31#include <mach_apic.h>
30#ifdef CONFIG_X86_32 32#ifdef CONFIG_X86_32
@@ -32,28 +34,6 @@
32#include <mach_mpparse.h> 34#include <mach_mpparse.h>
33#endif 35#endif
34 36
35/* Have we found an MP table */
36int smp_found_config;
37
38/*
39 * Various Linux-internal data structures created from the
40 * MP-table.
41 */
42#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
43int mp_bus_id_to_type[MAX_MP_BUSSES];
44#endif
45
46DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
47int mp_bus_id_to_pci_bus[MAX_MP_BUSSES] = {[0 ... MAX_MP_BUSSES - 1] = -1 };
48
49static int mp_current_pci_id;
50
51int pic_mode;
52
53/*
54 * Intel MP BIOS table parsing routines:
55 */
56
57/* 37/*
58 * Checksum an MP configuration block. 38 * Checksum an MP configuration block.
59 */ 39 */
@@ -69,15 +49,73 @@ static int __init mpf_checksum(unsigned char *mp, int len)
69} 49}
70 50
71#ifdef CONFIG_X86_NUMAQ 51#ifdef CONFIG_X86_NUMAQ
52int found_numaq;
72/* 53/*
73 * Have to match translation table entries to main table entries by counter 54 * Have to match translation table entries to main table entries by counter
74 * hence the mpc_record variable .... can't see a less disgusting way of 55 * hence the mpc_record variable .... can't see a less disgusting way of
75 * doing this .... 56 * doing this ....
76 */ 57 */
58struct mpc_config_translation {
59 unsigned char mpc_type;
60 unsigned char trans_len;
61 unsigned char trans_type;
62 unsigned char trans_quad;
63 unsigned char trans_global;
64 unsigned char trans_local;
65 unsigned short trans_reserved;
66};
67
77 68
78static int mpc_record; 69static int mpc_record;
79static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] 70static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY]
80 __cpuinitdata; 71 __cpuinitdata;
72
73static inline int generate_logical_apicid(int quad, int phys_apicid)
74{
75 return (quad << 4) + (phys_apicid ? phys_apicid << 1 : 1);
76}
77
78
79static inline int mpc_apic_id(struct mpc_config_processor *m,
80 struct mpc_config_translation *translation_record)
81{
82 int quad = translation_record->trans_quad;
83 int logical_apicid = generate_logical_apicid(quad, m->mpc_apicid);
84
85 printk(KERN_DEBUG "Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n",
86 m->mpc_apicid,
87 (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
88 (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
89 m->mpc_apicver, quad, logical_apicid);
90 return logical_apicid;
91}
92
93int mp_bus_id_to_node[MAX_MP_BUSSES];
94
95int mp_bus_id_to_local[MAX_MP_BUSSES];
96
97static void mpc_oem_bus_info(struct mpc_config_bus *m, char *name,
98 struct mpc_config_translation *translation)
99{
100 int quad = translation->trans_quad;
101 int local = translation->trans_local;
102
103 mp_bus_id_to_node[m->mpc_busid] = quad;
104 mp_bus_id_to_local[m->mpc_busid] = local;
105 printk(KERN_INFO "Bus #%d is %s (node %d)\n",
106 m->mpc_busid, name, quad);
107}
108
109int quad_local_to_mp_bus_id [NR_CPUS/4][4];
110static void mpc_oem_pci_bus(struct mpc_config_bus *m,
111 struct mpc_config_translation *translation)
112{
113 int quad = translation->trans_quad;
114 int local = translation->trans_local;
115
116 quad_local_to_mp_bus_id[quad][local] = m->mpc_busid;
117}
118
81#endif 119#endif
82 120
83static void __cpuinit MP_processor_info(struct mpc_config_processor *m) 121static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
@@ -90,7 +128,10 @@ static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
90 return; 128 return;
91 } 129 }
92#ifdef CONFIG_X86_NUMAQ 130#ifdef CONFIG_X86_NUMAQ
93 apicid = mpc_apic_id(m, translation_table[mpc_record]); 131 if (found_numaq)
132 apicid = mpc_apic_id(m, translation_table[mpc_record]);
133 else
134 apicid = m->mpc_apicid;
94#else 135#else
95 apicid = m->mpc_apicid; 136 apicid = m->mpc_apicid;
96#endif 137#endif
@@ -103,17 +144,18 @@ static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
103 generic_processor_info(apicid, m->mpc_apicver); 144 generic_processor_info(apicid, m->mpc_apicver);
104} 145}
105 146
147#ifdef CONFIG_X86_IO_APIC
106static void __init MP_bus_info(struct mpc_config_bus *m) 148static void __init MP_bus_info(struct mpc_config_bus *m)
107{ 149{
108 char str[7]; 150 char str[7];
109
110 memcpy(str, m->mpc_bustype, 6); 151 memcpy(str, m->mpc_bustype, 6);
111 str[6] = 0; 152 str[6] = 0;
112 153
113#ifdef CONFIG_X86_NUMAQ 154#ifdef CONFIG_X86_NUMAQ
114 mpc_oem_bus_info(m, str, translation_table[mpc_record]); 155 if (found_numaq)
156 mpc_oem_bus_info(m, str, translation_table[mpc_record]);
115#else 157#else
116 Dprintk("Bus #%d is %s\n", m->mpc_busid, str); 158 printk(KERN_INFO "Bus #%d is %s\n", m->mpc_busid, str);
117#endif 159#endif
118 160
119#if MAX_MP_BUSSES < 256 161#if MAX_MP_BUSSES < 256
@@ -132,11 +174,10 @@ static void __init MP_bus_info(struct mpc_config_bus *m)
132#endif 174#endif
133 } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) { 175 } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) {
134#ifdef CONFIG_X86_NUMAQ 176#ifdef CONFIG_X86_NUMAQ
135 mpc_oem_pci_bus(m, translation_table[mpc_record]); 177 if (found_numaq)
178 mpc_oem_pci_bus(m, translation_table[mpc_record]);
136#endif 179#endif
137 clear_bit(m->mpc_busid, mp_bus_not_pci); 180 clear_bit(m->mpc_busid, mp_bus_not_pci);
138 mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id;
139 mp_current_pci_id++;
140#if defined(CONFIG_EISA) || defined (CONFIG_MCA) 181#if defined(CONFIG_EISA) || defined (CONFIG_MCA)
141 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI; 182 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI;
142 } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA) - 1) == 0) { 183 } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA) - 1) == 0) {
@@ -147,6 +188,7 @@ static void __init MP_bus_info(struct mpc_config_bus *m)
147 } else 188 } else
148 printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str); 189 printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str);
149} 190}
191#endif
150 192
151#ifdef CONFIG_X86_IO_APIC 193#ifdef CONFIG_X86_IO_APIC
152 194
@@ -176,18 +218,89 @@ static void __init MP_ioapic_info(struct mpc_config_ioapic *m)
176 if (bad_ioapic(m->mpc_apicaddr)) 218 if (bad_ioapic(m->mpc_apicaddr))
177 return; 219 return;
178 220
179 mp_ioapics[nr_ioapics] = *m; 221 mp_ioapics[nr_ioapics].mp_apicaddr = m->mpc_apicaddr;
222 mp_ioapics[nr_ioapics].mp_apicid = m->mpc_apicid;
223 mp_ioapics[nr_ioapics].mp_type = m->mpc_type;
224 mp_ioapics[nr_ioapics].mp_apicver = m->mpc_apicver;
225 mp_ioapics[nr_ioapics].mp_flags = m->mpc_flags;
180 nr_ioapics++; 226 nr_ioapics++;
181} 227}
182 228
183static void __init MP_intsrc_info(struct mpc_config_intsrc *m) 229static void print_MP_intsrc_info(struct mpc_config_intsrc *m)
184{ 230{
185 mp_irqs[mp_irq_entries] = *m; 231 printk(KERN_CONT "Int: type %d, pol %d, trig %d, bus %02x,"
186 Dprintk("Int: type %d, pol %d, trig %d, bus %d,"
187 " IRQ %02x, APIC ID %x, APIC INT %02x\n", 232 " IRQ %02x, APIC ID %x, APIC INT %02x\n",
188 m->mpc_irqtype, m->mpc_irqflag & 3, 233 m->mpc_irqtype, m->mpc_irqflag & 3,
189 (m->mpc_irqflag >> 2) & 3, m->mpc_srcbus, 234 (m->mpc_irqflag >> 2) & 3, m->mpc_srcbus,
190 m->mpc_srcbusirq, m->mpc_dstapic, m->mpc_dstirq); 235 m->mpc_srcbusirq, m->mpc_dstapic, m->mpc_dstirq);
236}
237
238static void __init print_mp_irq_info(struct mp_config_intsrc *mp_irq)
239{
240 printk(KERN_CONT "Int: type %d, pol %d, trig %d, bus %02x,"
241 " IRQ %02x, APIC ID %x, APIC INT %02x\n",
242 mp_irq->mp_irqtype, mp_irq->mp_irqflag & 3,
243 (mp_irq->mp_irqflag >> 2) & 3, mp_irq->mp_srcbus,
244 mp_irq->mp_srcbusirq, mp_irq->mp_dstapic, mp_irq->mp_dstirq);
245}
246
247static void __init assign_to_mp_irq(struct mpc_config_intsrc *m,
248 struct mp_config_intsrc *mp_irq)
249{
250 mp_irq->mp_dstapic = m->mpc_dstapic;
251 mp_irq->mp_type = m->mpc_type;
252 mp_irq->mp_irqtype = m->mpc_irqtype;
253 mp_irq->mp_irqflag = m->mpc_irqflag;
254 mp_irq->mp_srcbus = m->mpc_srcbus;
255 mp_irq->mp_srcbusirq = m->mpc_srcbusirq;
256 mp_irq->mp_dstirq = m->mpc_dstirq;
257}
258
259static void __init assign_to_mpc_intsrc(struct mp_config_intsrc *mp_irq,
260 struct mpc_config_intsrc *m)
261{
262 m->mpc_dstapic = mp_irq->mp_dstapic;
263 m->mpc_type = mp_irq->mp_type;
264 m->mpc_irqtype = mp_irq->mp_irqtype;
265 m->mpc_irqflag = mp_irq->mp_irqflag;
266 m->mpc_srcbus = mp_irq->mp_srcbus;
267 m->mpc_srcbusirq = mp_irq->mp_srcbusirq;
268 m->mpc_dstirq = mp_irq->mp_dstirq;
269}
270
271static int __init mp_irq_mpc_intsrc_cmp(struct mp_config_intsrc *mp_irq,
272 struct mpc_config_intsrc *m)
273{
274 if (mp_irq->mp_dstapic != m->mpc_dstapic)
275 return 1;
276 if (mp_irq->mp_type != m->mpc_type)
277 return 2;
278 if (mp_irq->mp_irqtype != m->mpc_irqtype)
279 return 3;
280 if (mp_irq->mp_irqflag != m->mpc_irqflag)
281 return 4;
282 if (mp_irq->mp_srcbus != m->mpc_srcbus)
283 return 5;
284 if (mp_irq->mp_srcbusirq != m->mpc_srcbusirq)
285 return 6;
286 if (mp_irq->mp_dstirq != m->mpc_dstirq)
287 return 7;
288
289 return 0;
290}
291
292static void __init MP_intsrc_info(struct mpc_config_intsrc *m)
293{
294 int i;
295
296 print_MP_intsrc_info(m);
297
298 for (i = 0; i < mp_irq_entries; i++) {
299 if (!mp_irq_mpc_intsrc_cmp(&mp_irqs[i], m))
300 return;
301 }
302
303 assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]);
191 if (++mp_irq_entries == MAX_IRQ_SOURCES) 304 if (++mp_irq_entries == MAX_IRQ_SOURCES)
192 panic("Max # of irq sources exceeded!!\n"); 305 panic("Max # of irq sources exceeded!!\n");
193} 306}
@@ -196,7 +309,7 @@ static void __init MP_intsrc_info(struct mpc_config_intsrc *m)
196 309
197static void __init MP_lintsrc_info(struct mpc_config_lintsrc *m) 310static void __init MP_lintsrc_info(struct mpc_config_lintsrc *m)
198{ 311{
199 Dprintk("Lint: type %d, pol %d, trig %d, bus %d," 312 printk(KERN_INFO "Lint: type %d, pol %d, trig %d, bus %02x,"
200 " IRQ %02x, APIC ID %x, APIC LINT %02x\n", 313 " IRQ %02x, APIC ID %x, APIC LINT %02x\n",
201 m->mpc_irqtype, m->mpc_irqflag & 3, 314 m->mpc_irqtype, m->mpc_irqflag & 3,
202 (m->mpc_irqflag >> 2) & 3, m->mpc_srcbusid, 315 (m->mpc_irqflag >> 2) & 3, m->mpc_srcbusid,
@@ -266,11 +379,14 @@ static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable,
266 } 379 }
267} 380}
268 381
269static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 382void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem,
270 char *productid) 383 char *productid)
271{ 384{
272 if (strncmp(oem, "IBM NUMA", 8)) 385 if (strncmp(oem, "IBM NUMA", 8))
273 printk("Warning! May not be a NUMA-Q system!\n"); 386 printk("Warning! Not a NUMA-Q system!\n");
387 else
388 found_numaq = 1;
389
274 if (mpc->mpc_oemptr) 390 if (mpc->mpc_oemptr)
275 smp_read_mpc_oem((struct mp_config_oemtable *)mpc->mpc_oemptr, 391 smp_read_mpc_oem((struct mp_config_oemtable *)mpc->mpc_oemptr,
276 mpc->mpc_oemsize); 392 mpc->mpc_oemsize);
@@ -281,12 +397,9 @@ static inline void mps_oem_check(struct mp_config_table *mpc, char *oem,
281 * Read/parse the MPC 397 * Read/parse the MPC
282 */ 398 */
283 399
284static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early) 400static int __init smp_check_mpc(struct mp_config_table *mpc, char *oem,
401 char *str)
285{ 402{
286 char str[16];
287 char oem[10];
288 int count = sizeof(*mpc);
289 unsigned char *mpt = ((unsigned char *)mpc) + count;
290 403
291 if (memcmp(mpc->mpc_signature, MPC_SIGNATURE, 4)) { 404 if (memcmp(mpc->mpc_signature, MPC_SIGNATURE, 4)) {
292 printk(KERN_ERR "MPTABLE: bad signature [%c%c%c%c]!\n", 405 printk(KERN_ERR "MPTABLE: bad signature [%c%c%c%c]!\n",
@@ -309,19 +422,42 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early)
309 } 422 }
310 memcpy(oem, mpc->mpc_oem, 8); 423 memcpy(oem, mpc->mpc_oem, 8);
311 oem[8] = 0; 424 oem[8] = 0;
312 printk(KERN_INFO "MPTABLE: OEM ID: %s ", oem); 425 printk(KERN_INFO "MPTABLE: OEM ID: %s\n", oem);
313 426
314 memcpy(str, mpc->mpc_productid, 12); 427 memcpy(str, mpc->mpc_productid, 12);
315 str[12] = 0; 428 str[12] = 0;
316 printk("Product ID: %s ", str);
317 429
318#ifdef CONFIG_X86_32 430 printk(KERN_INFO "MPTABLE: Product ID: %s\n", str);
319 mps_oem_check(mpc, oem, str);
320#endif
321 printk(KERN_INFO "MPTABLE: Product ID: %s ", str);
322 431
323 printk(KERN_INFO "MPTABLE: APIC at: 0x%X\n", mpc->mpc_lapic); 432 printk(KERN_INFO "MPTABLE: APIC at: 0x%X\n", mpc->mpc_lapic);
324 433
434 return 1;
435}
436
437static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early)
438{
439 char str[16];
440 char oem[10];
441
442 int count = sizeof(*mpc);
443 unsigned char *mpt = ((unsigned char *)mpc) + count;
444
445 if (!smp_check_mpc(mpc, oem, str))
446 return 0;
447
448#ifdef CONFIG_X86_32
449 /*
450 * need to make sure summit and es7000's mps_oem_check is safe to be
451 * called early via genericarch 's mps_oem_check
452 */
453 if (early) {
454#ifdef CONFIG_X86_NUMAQ
455 numaq_mps_oem_check(mpc, oem, str);
456#endif
457 } else
458 mps_oem_check(mpc, oem, str);
459#endif
460
325 /* save the local APIC address, it might be non-default */ 461 /* save the local APIC address, it might be non-default */
326 if (!acpi_lapic) 462 if (!acpi_lapic)
327 mp_lapic_addr = mpc->mpc_lapic; 463 mp_lapic_addr = mpc->mpc_lapic;
@@ -352,7 +488,9 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early)
352 { 488 {
353 struct mpc_config_bus *m = 489 struct mpc_config_bus *m =
354 (struct mpc_config_bus *)mpt; 490 (struct mpc_config_bus *)mpt;
491#ifdef CONFIG_X86_IO_APIC
355 MP_bus_info(m); 492 MP_bus_info(m);
493#endif
356 mpt += sizeof(*m); 494 mpt += sizeof(*m);
357 count += sizeof(*m); 495 count += sizeof(*m);
358 break; 496 break;
@@ -402,6 +540,11 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early)
402 ++mpc_record; 540 ++mpc_record;
403#endif 541#endif
404 } 542 }
543
544#ifdef CONFIG_X86_GENERICARCH
545 generic_bigsmp_probe();
546#endif
547
405 setup_apic_routing(); 548 setup_apic_routing();
406 if (!num_processors) 549 if (!num_processors)
407 printk(KERN_ERR "MPTABLE: no processors registered!\n"); 550 printk(KERN_ERR "MPTABLE: no processors registered!\n");
@@ -427,7 +570,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type)
427 intsrc.mpc_type = MP_INTSRC; 570 intsrc.mpc_type = MP_INTSRC;
428 intsrc.mpc_irqflag = 0; /* conforming */ 571 intsrc.mpc_irqflag = 0; /* conforming */
429 intsrc.mpc_srcbus = 0; 572 intsrc.mpc_srcbus = 0;
430 intsrc.mpc_dstapic = mp_ioapics[0].mpc_apicid; 573 intsrc.mpc_dstapic = mp_ioapics[0].mp_apicid;
431 574
432 intsrc.mpc_irqtype = mp_INT; 575 intsrc.mpc_irqtype = mp_INT;
433 576
@@ -488,40 +631,11 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type)
488 MP_intsrc_info(&intsrc); 631 MP_intsrc_info(&intsrc);
489} 632}
490 633
491#endif
492 634
493static inline void __init construct_default_ISA_mptable(int mpc_default_type) 635static void construct_ioapic_table(int mpc_default_type)
494{ 636{
495 struct mpc_config_processor processor;
496 struct mpc_config_bus bus;
497#ifdef CONFIG_X86_IO_APIC
498 struct mpc_config_ioapic ioapic; 637 struct mpc_config_ioapic ioapic;
499#endif 638 struct mpc_config_bus bus;
500 struct mpc_config_lintsrc lintsrc;
501 int linttypes[2] = { mp_ExtINT, mp_NMI };
502 int i;
503
504 /*
505 * local APIC has default address
506 */
507 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
508
509 /*
510 * 2 CPUs, numbered 0 & 1.
511 */
512 processor.mpc_type = MP_PROCESSOR;
513 /* Either an integrated APIC or a discrete 82489DX. */
514 processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01;
515 processor.mpc_cpuflag = CPU_ENABLED;
516 processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) |
517 (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask;
518 processor.mpc_featureflag = boot_cpu_data.x86_capability[0];
519 processor.mpc_reserved[0] = 0;
520 processor.mpc_reserved[1] = 0;
521 for (i = 0; i < 2; i++) {
522 processor.mpc_apicid = i;
523 MP_processor_info(&processor);
524 }
525 639
526 bus.mpc_type = MP_BUS; 640 bus.mpc_type = MP_BUS;
527 bus.mpc_busid = 0; 641 bus.mpc_busid = 0;
@@ -550,7 +664,6 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
550 MP_bus_info(&bus); 664 MP_bus_info(&bus);
551 } 665 }
552 666
553#ifdef CONFIG_X86_IO_APIC
554 ioapic.mpc_type = MP_IOAPIC; 667 ioapic.mpc_type = MP_IOAPIC;
555 ioapic.mpc_apicid = 2; 668 ioapic.mpc_apicid = 2;
556 ioapic.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; 669 ioapic.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01;
@@ -562,7 +675,42 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
562 * We set up most of the low 16 IO-APIC pins according to MPS rules. 675 * We set up most of the low 16 IO-APIC pins according to MPS rules.
563 */ 676 */
564 construct_default_ioirq_mptable(mpc_default_type); 677 construct_default_ioirq_mptable(mpc_default_type);
678}
679#else
680static inline void construct_ioapic_table(int mpc_default_type) { }
565#endif 681#endif
682
683static inline void __init construct_default_ISA_mptable(int mpc_default_type)
684{
685 struct mpc_config_processor processor;
686 struct mpc_config_lintsrc lintsrc;
687 int linttypes[2] = { mp_ExtINT, mp_NMI };
688 int i;
689
690 /*
691 * local APIC has default address
692 */
693 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
694
695 /*
696 * 2 CPUs, numbered 0 & 1.
697 */
698 processor.mpc_type = MP_PROCESSOR;
699 /* Either an integrated APIC or a discrete 82489DX. */
700 processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01;
701 processor.mpc_cpuflag = CPU_ENABLED;
702 processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) |
703 (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask;
704 processor.mpc_featureflag = boot_cpu_data.x86_capability[0];
705 processor.mpc_reserved[0] = 0;
706 processor.mpc_reserved[1] = 0;
707 for (i = 0; i < 2; i++) {
708 processor.mpc_apicid = i;
709 MP_processor_info(&processor);
710 }
711
712 construct_ioapic_table(mpc_default_type);
713
566 lintsrc.mpc_type = MP_LINTSRC; 714 lintsrc.mpc_type = MP_LINTSRC;
567 lintsrc.mpc_irqflag = 0; /* conforming */ 715 lintsrc.mpc_irqflag = 0; /* conforming */
568 lintsrc.mpc_srcbusid = 0; 716 lintsrc.mpc_srcbusid = 0;
@@ -578,12 +726,22 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
578static struct intel_mp_floating *mpf_found; 726static struct intel_mp_floating *mpf_found;
579 727
580/* 728/*
729 * Machine specific quirk for finding the SMP config before other setup
730 * activities destroy the table:
731 */
732int (*mach_get_smp_config_quirk)(unsigned int early);
733
734/*
581 * Scan the memory blocks for an SMP configuration block. 735 * Scan the memory blocks for an SMP configuration block.
582 */ 736 */
583static void __init __get_smp_config(unsigned early) 737static void __init __get_smp_config(unsigned int early)
584{ 738{
585 struct intel_mp_floating *mpf = mpf_found; 739 struct intel_mp_floating *mpf = mpf_found;
586 740
741 if (mach_get_smp_config_quirk) {
742 if (mach_get_smp_config_quirk(early))
743 return;
744 }
587 if (acpi_lapic && early) 745 if (acpi_lapic && early)
588 return; 746 return;
589 /* 747 /*
@@ -600,7 +758,7 @@ static void __init __get_smp_config(unsigned early)
600 758
601 printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", 759 printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n",
602 mpf->mpf_specification); 760 mpf->mpf_specification);
603#ifdef CONFIG_X86_32 761#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32)
604 if (mpf->mpf_feature2 & (1 << 7)) { 762 if (mpf->mpf_feature2 & (1 << 7)) {
605 printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); 763 printk(KERN_INFO " IMCR and PIC compatibility mode.\n");
606 pic_mode = 1; 764 pic_mode = 1;
@@ -632,7 +790,9 @@ static void __init __get_smp_config(unsigned early)
632 * override the defaults. 790 * override the defaults.
633 */ 791 */
634 if (!smp_read_mpc(phys_to_virt(mpf->mpf_physptr), early)) { 792 if (!smp_read_mpc(phys_to_virt(mpf->mpf_physptr), early)) {
793#ifdef CONFIG_X86_LOCAL_APIC
635 smp_found_config = 0; 794 smp_found_config = 0;
795#endif
636 printk(KERN_ERR 796 printk(KERN_ERR
637 "BIOS bug, MP table errors detected!...\n"); 797 "BIOS bug, MP table errors detected!...\n");
638 printk(KERN_ERR "... disabling SMP support. " 798 printk(KERN_ERR "... disabling SMP support. "
@@ -689,7 +849,7 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
689 unsigned int *bp = phys_to_virt(base); 849 unsigned int *bp = phys_to_virt(base);
690 struct intel_mp_floating *mpf; 850 struct intel_mp_floating *mpf;
691 851
692 Dprintk("Scan SMP from %p for %ld bytes.\n", bp, length); 852 printk(KERN_DEBUG "Scan SMP from %p for %ld bytes.\n", bp, length);
693 BUILD_BUG_ON(sizeof(*mpf) != 16); 853 BUILD_BUG_ON(sizeof(*mpf) != 16);
694 854
695 while (length > 0) { 855 while (length > 0) {
@@ -699,15 +859,21 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
699 !mpf_checksum((unsigned char *)bp, 16) && 859 !mpf_checksum((unsigned char *)bp, 16) &&
700 ((mpf->mpf_specification == 1) 860 ((mpf->mpf_specification == 1)
701 || (mpf->mpf_specification == 4))) { 861 || (mpf->mpf_specification == 4))) {
702 862#ifdef CONFIG_X86_LOCAL_APIC
703 smp_found_config = 1; 863 smp_found_config = 1;
864#endif
704 mpf_found = mpf; 865 mpf_found = mpf;
705#ifdef CONFIG_X86_32 866
706 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n", 867 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
707 mpf, virt_to_phys(mpf)); 868 mpf, virt_to_phys(mpf));
708 reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE, 869
870 if (!reserve)
871 return 1;
872 reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
709 BOOTMEM_DEFAULT); 873 BOOTMEM_DEFAULT);
710 if (mpf->mpf_physptr) { 874 if (mpf->mpf_physptr) {
875 unsigned long size = PAGE_SIZE;
876#ifdef CONFIG_X86_32
711 /* 877 /*
712 * We cannot access to MPC table to compute 878 * We cannot access to MPC table to compute
713 * table size yet, as only few megabytes from 879 * table size yet, as only few megabytes from
@@ -717,24 +883,15 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
717 * PAGE_SIZE from mpg->mpf_physptr yields BUG() 883 * PAGE_SIZE from mpg->mpf_physptr yields BUG()
718 * in reserve_bootmem. 884 * in reserve_bootmem.
719 */ 885 */
720 unsigned long size = PAGE_SIZE;
721 unsigned long end = max_low_pfn * PAGE_SIZE; 886 unsigned long end = max_low_pfn * PAGE_SIZE;
722 if (mpf->mpf_physptr + size > end) 887 if (mpf->mpf_physptr + size > end)
723 size = end - mpf->mpf_physptr; 888 size = end - mpf->mpf_physptr;
724 reserve_bootmem(mpf->mpf_physptr, size, 889#endif
890 reserve_bootmem_generic(mpf->mpf_physptr, size,
725 BOOTMEM_DEFAULT); 891 BOOTMEM_DEFAULT);
726 } 892 }
727 893
728#else 894 return 1;
729 if (!reserve)
730 return 1;
731
732 reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE);
733 if (mpf->mpf_physptr)
734 reserve_bootmem_generic(mpf->mpf_physptr,
735 PAGE_SIZE);
736#endif
737 return 1;
738 } 895 }
739 bp += 4; 896 bp += 4;
740 length -= 16; 897 length -= 16;
@@ -742,10 +899,16 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
742 return 0; 899 return 0;
743} 900}
744 901
745static void __init __find_smp_config(unsigned reserve) 902int (*mach_find_smp_config_quirk)(unsigned int reserve);
903
904static void __init __find_smp_config(unsigned int reserve)
746{ 905{
747 unsigned int address; 906 unsigned int address;
748 907
908 if (mach_find_smp_config_quirk) {
909 if (mach_find_smp_config_quirk(reserve))
910 return;
911 }
749 /* 912 /*
750 * FIXME: Linux assumes you have 640K of base ram.. 913 * FIXME: Linux assumes you have 640K of base ram..
751 * this continues the error... 914 * this continues the error...
@@ -790,298 +953,294 @@ void __init find_smp_config(void)
790 __find_smp_config(1); 953 __find_smp_config(1);
791} 954}
792 955
793/* -------------------------------------------------------------------------- 956#ifdef CONFIG_X86_IO_APIC
794 ACPI-based MP Configuration 957static u8 __initdata irq_used[MAX_IRQ_SOURCES];
795 -------------------------------------------------------------------------- */
796 958
797/* 959static int __init get_MP_intsrc_index(struct mpc_config_intsrc *m)
798 * Keep this outside and initialized to 0, for !CONFIG_ACPI builds: 960{
799 */ 961 int i;
800int es7000_plat;
801 962
802#ifdef CONFIG_ACPI 963 if (m->mpc_irqtype != mp_INT)
964 return 0;
803 965
804#ifdef CONFIG_X86_IO_APIC 966 if (m->mpc_irqflag != 0x0f)
967 return 0;
805 968
806#define MP_ISA_BUS 0 969 /* not legacy */
807 970
808extern struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS]; 971 for (i = 0; i < mp_irq_entries; i++) {
972 if (mp_irqs[i].mp_irqtype != mp_INT)
973 continue;
809 974
810static int mp_find_ioapic(int gsi) 975 if (mp_irqs[i].mp_irqflag != 0x0f)
811{ 976 continue;
812 int i = 0;
813 977
814 /* Find the IOAPIC that manages this GSI. */ 978 if (mp_irqs[i].mp_srcbus != m->mpc_srcbus)
815 for (i = 0; i < nr_ioapics; i++) { 979 continue;
816 if ((gsi >= mp_ioapic_routing[i].gsi_base) 980 if (mp_irqs[i].mp_srcbusirq != m->mpc_srcbusirq)
817 && (gsi <= mp_ioapic_routing[i].gsi_end)) 981 continue;
818 return i; 982 if (irq_used[i]) {
983 /* already claimed */
984 return -2;
985 }
986 irq_used[i] = 1;
987 return i;
819 } 988 }
820 989
821 printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); 990 /* not found */
822 return -1; 991 return -1;
823} 992}
824 993
825static u8 __init uniq_ioapic_id(u8 id) 994#define SPARE_SLOT_NUM 20
826{ 995
827#ifdef CONFIG_X86_32 996static struct mpc_config_intsrc __initdata *m_spare[SPARE_SLOT_NUM];
828 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
829 !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
830 return io_apic_get_unique_id(nr_ioapics, id);
831 else
832 return id;
833#else
834 int i;
835 DECLARE_BITMAP(used, 256);
836 bitmap_zero(used, 256);
837 for (i = 0; i < nr_ioapics; i++) {
838 struct mpc_config_ioapic *ia = &mp_ioapics[i];
839 __set_bit(ia->mpc_apicid, used);
840 }
841 if (!test_bit(id, used))
842 return id;
843 return find_first_zero_bit(used, 256);
844#endif 997#endif
845}
846 998
847void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) 999static int __init replace_intsrc_all(struct mp_config_table *mpc,
1000 unsigned long mpc_new_phys,
1001 unsigned long mpc_new_length)
848{ 1002{
849 int idx = 0; 1003#ifdef CONFIG_X86_IO_APIC
850 1004 int i;
851 if (bad_ioapic(address)) 1005 int nr_m_spare = 0;
852 return; 1006#endif
853 1007
854 idx = nr_ioapics; 1008 int count = sizeof(*mpc);
1009 unsigned char *mpt = ((unsigned char *)mpc) + count;
855 1010
856 mp_ioapics[idx].mpc_type = MP_IOAPIC; 1011 printk(KERN_INFO "mpc_length %x\n", mpc->mpc_length);
857 mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE; 1012 while (count < mpc->mpc_length) {
858 mp_ioapics[idx].mpc_apicaddr = address; 1013 switch (*mpt) {
1014 case MP_PROCESSOR:
1015 {
1016 struct mpc_config_processor *m =
1017 (struct mpc_config_processor *)mpt;
1018 mpt += sizeof(*m);
1019 count += sizeof(*m);
1020 break;
1021 }
1022 case MP_BUS:
1023 {
1024 struct mpc_config_bus *m =
1025 (struct mpc_config_bus *)mpt;
1026 mpt += sizeof(*m);
1027 count += sizeof(*m);
1028 break;
1029 }
1030 case MP_IOAPIC:
1031 {
1032 mpt += sizeof(struct mpc_config_ioapic);
1033 count += sizeof(struct mpc_config_ioapic);
1034 break;
1035 }
1036 case MP_INTSRC:
1037 {
1038#ifdef CONFIG_X86_IO_APIC
1039 struct mpc_config_intsrc *m =
1040 (struct mpc_config_intsrc *)mpt;
859 1041
860 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); 1042 printk(KERN_INFO "OLD ");
861 mp_ioapics[idx].mpc_apicid = uniq_ioapic_id(id); 1043 print_MP_intsrc_info(m);
862#ifdef CONFIG_X86_32 1044 i = get_MP_intsrc_index(m);
863 mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); 1045 if (i > 0) {
864#else 1046 assign_to_mpc_intsrc(&mp_irqs[i], m);
865 mp_ioapics[idx].mpc_apicver = 0; 1047 printk(KERN_INFO "NEW ");
1048 print_mp_irq_info(&mp_irqs[i]);
1049 } else if (!i) {
1050 /* legacy, do nothing */
1051 } else if (nr_m_spare < SPARE_SLOT_NUM) {
1052 /*
1053 * not found (-1), or duplicated (-2)
1054 * are invalid entries,
1055 * we need to use the slot later
1056 */
1057 m_spare[nr_m_spare] = m;
1058 nr_m_spare++;
1059 }
866#endif 1060#endif
867 /* 1061 mpt += sizeof(struct mpc_config_intsrc);
868 * Build basic GSI lookup table to facilitate gsi->io_apic lookups 1062 count += sizeof(struct mpc_config_intsrc);
869 * and to prevent reprogramming of IOAPIC pins (PCI GSIs). 1063 break;
870 */ 1064 }
871 mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mpc_apicid; 1065 case MP_LINTSRC:
872 mp_ioapic_routing[idx].gsi_base = gsi_base; 1066 {
873 mp_ioapic_routing[idx].gsi_end = gsi_base + 1067 struct mpc_config_lintsrc *m =
874 io_apic_get_redir_entries(idx); 1068 (struct mpc_config_lintsrc *)mpt;
875 1069 mpt += sizeof(*m);
876 printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " 1070 count += sizeof(*m);
877 "GSI %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, 1071 break;
878 mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, 1072 }
879 mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end); 1073 default:
880 1074 /* wrong mptable */
881 nr_ioapics++; 1075 printk(KERN_ERR "Your mptable is wrong, contact your HW vendor!\n");
882} 1076 printk(KERN_ERR "type %x\n", *mpt);
1077 print_hex_dump(KERN_ERR, " ", DUMP_PREFIX_ADDRESS, 16,
1078 1, mpc, mpc->mpc_length, 1);
1079 goto out;
1080 }
1081 }
883 1082
884void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) 1083#ifdef CONFIG_X86_IO_APIC
885{ 1084 for (i = 0; i < mp_irq_entries; i++) {
886 struct mpc_config_intsrc intsrc; 1085 if (irq_used[i])
887 int ioapic = -1; 1086 continue;
888 int pin = -1;
889 1087
890 /* 1088 if (mp_irqs[i].mp_irqtype != mp_INT)
891 * Convert 'gsi' to 'ioapic.pin'. 1089 continue;
892 */
893 ioapic = mp_find_ioapic(gsi);
894 if (ioapic < 0)
895 return;
896 pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
897 1090
898 /* 1091 if (mp_irqs[i].mp_irqflag != 0x0f)
899 * TBD: This check is for faulty timer entries, where the override 1092 continue;
900 * erroneously sets the trigger to level, resulting in a HUGE
901 * increase of timer interrupts!
902 */
903 if ((bus_irq == 0) && (trigger == 3))
904 trigger = 1;
905 1093
906 intsrc.mpc_type = MP_INTSRC; 1094 if (nr_m_spare > 0) {
907 intsrc.mpc_irqtype = mp_INT; 1095 printk(KERN_INFO "*NEW* found ");
908 intsrc.mpc_irqflag = (trigger << 2) | polarity; 1096 nr_m_spare--;
909 intsrc.mpc_srcbus = MP_ISA_BUS; 1097 assign_to_mpc_intsrc(&mp_irqs[i], m_spare[nr_m_spare]);
910 intsrc.mpc_srcbusirq = bus_irq; /* IRQ */ 1098 m_spare[nr_m_spare] = NULL;
911 intsrc.mpc_dstapic = mp_ioapics[ioapic].mpc_apicid; /* APIC ID */ 1099 } else {
912 intsrc.mpc_dstirq = pin; /* INTIN# */ 1100 struct mpc_config_intsrc *m =
1101 (struct mpc_config_intsrc *)mpt;
1102 count += sizeof(struct mpc_config_intsrc);
1103 if (!mpc_new_phys) {
1104 printk(KERN_INFO "No spare slots, try to append...take your risk, new mpc_length %x\n", count);
1105 } else {
1106 if (count <= mpc_new_length)
1107 printk(KERN_INFO "No spare slots, try to append..., new mpc_length %x\n", count);
1108 else {
1109 printk(KERN_ERR "mpc_new_length %lx is too small\n", mpc_new_length);
1110 goto out;
1111 }
1112 }
1113 assign_to_mpc_intsrc(&mp_irqs[i], m);
1114 mpc->mpc_length = count;
1115 mpt += sizeof(struct mpc_config_intsrc);
1116 }
1117 print_mp_irq_info(&mp_irqs[i]);
1118 }
1119#endif
1120out:
1121 /* update checksum */
1122 mpc->mpc_checksum = 0;
1123 mpc->mpc_checksum -= mpf_checksum((unsigned char *)mpc,
1124 mpc->mpc_length);
913 1125
914 MP_intsrc_info(&intsrc); 1126 return 0;
915} 1127}
916 1128
917void __init mp_config_acpi_legacy_irqs(void) 1129static int __initdata enable_update_mptable;
918{
919 struct mpc_config_intsrc intsrc;
920 int i = 0;
921 int ioapic = -1;
922 1130
923#if defined (CONFIG_MCA) || defined (CONFIG_EISA) 1131static int __init update_mptable_setup(char *str)
924 /* 1132{
925 * Fabricate the legacy ISA bus (bus #31). 1133 enable_update_mptable = 1;
926 */ 1134 return 0;
927 mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA; 1135}
928#endif 1136early_param("update_mptable", update_mptable_setup);
929 set_bit(MP_ISA_BUS, mp_bus_not_pci);
930 Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
931 1137
932 /* 1138static unsigned long __initdata mpc_new_phys;
933 * Older generations of ES7000 have no legacy identity mappings 1139static unsigned long mpc_new_length __initdata = 4096;
934 */
935 if (es7000_plat == 1)
936 return;
937 1140
938 /* 1141/* alloc_mptable or alloc_mptable=4k */
939 * Locate the IOAPIC that manages the ISA IRQs (0-15). 1142static int __initdata alloc_mptable;
940 */ 1143static int __init parse_alloc_mptable_opt(char *p)
941 ioapic = mp_find_ioapic(0); 1144{
942 if (ioapic < 0) 1145 enable_update_mptable = 1;
943 return; 1146 alloc_mptable = 1;
1147 if (!p)
1148 return 0;
1149 mpc_new_length = memparse(p, &p);
1150 return 0;
1151}
1152early_param("alloc_mptable", parse_alloc_mptable_opt);
944 1153
945 intsrc.mpc_type = MP_INTSRC; 1154void __init early_reserve_e820_mpc_new(void)
946 intsrc.mpc_irqflag = 0; /* Conforming */ 1155{
947 intsrc.mpc_srcbus = MP_ISA_BUS; 1156 if (enable_update_mptable && alloc_mptable) {
948#ifdef CONFIG_X86_IO_APIC 1157 u64 startt = 0;
949 intsrc.mpc_dstapic = mp_ioapics[ioapic].mpc_apicid; 1158#ifdef CONFIG_X86_TRAMPOLINE
1159 startt = TRAMPOLINE_BASE;
950#endif 1160#endif
951 /* 1161 mpc_new_phys = early_reserve_e820(startt, mpc_new_length, 4);
952 * Use the default configuration for the IRQs 0-15. Unless
953 * overridden by (MADT) interrupt source override entries.
954 */
955 for (i = 0; i < 16; i++) {
956 int idx;
957
958 for (idx = 0; idx < mp_irq_entries; idx++) {
959 struct mpc_config_intsrc *irq = mp_irqs + idx;
960
961 /* Do we already have a mapping for this ISA IRQ? */
962 if (irq->mpc_srcbus == MP_ISA_BUS
963 && irq->mpc_srcbusirq == i)
964 break;
965
966 /* Do we already have a mapping for this IOAPIC pin */
967 if ((irq->mpc_dstapic == intsrc.mpc_dstapic) &&
968 (irq->mpc_dstirq == i))
969 break;
970 }
971
972 if (idx != mp_irq_entries) {
973 printk(KERN_DEBUG "ACPI: IRQ%d used by override.\n", i);
974 continue; /* IRQ already used */
975 }
976
977 intsrc.mpc_irqtype = mp_INT;
978 intsrc.mpc_srcbusirq = i; /* Identity mapped */
979 intsrc.mpc_dstirq = i;
980
981 MP_intsrc_info(&intsrc);
982 } 1162 }
983} 1163}
984 1164
985int mp_register_gsi(u32 gsi, int triggering, int polarity) 1165static int __init update_mp_table(void)
986{ 1166{
987 int ioapic; 1167 char str[16];
988 int ioapic_pin; 1168 char oem[10];
989#ifdef CONFIG_X86_32 1169 struct intel_mp_floating *mpf;
990#define MAX_GSI_NUM 4096 1170 struct mp_config_table *mpc;
991#define IRQ_COMPRESSION_START 64 1171 struct mp_config_table *mpc_new;
1172
1173 if (!enable_update_mptable)
1174 return 0;
1175
1176 mpf = mpf_found;
1177 if (!mpf)
1178 return 0;
992 1179
993 static int pci_irq = IRQ_COMPRESSION_START;
994 /* 1180 /*
995 * Mapping between Global System Interrupts, which 1181 * Now see if we need to go further.
996 * represent all possible interrupts, and IRQs
997 * assigned to actual devices.
998 */ 1182 */
999 static int gsi_to_irq[MAX_GSI_NUM]; 1183 if (mpf->mpf_feature1 != 0)
1000#else 1184 return 0;
1001
1002 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
1003 return gsi;
1004#endif
1005 1185
1006 /* Don't set up the ACPI SCI because it's already set up */ 1186 if (!mpf->mpf_physptr)
1007 if (acpi_gbl_FADT.sci_interrupt == gsi) 1187 return 0;
1008 return gsi;
1009 1188
1010 ioapic = mp_find_ioapic(gsi); 1189 mpc = phys_to_virt(mpf->mpf_physptr);
1011 if (ioapic < 0) {
1012 printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);
1013 return gsi;
1014 }
1015 1190
1016 ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base; 1191 if (!smp_check_mpc(mpc, oem, str))
1192 return 0;
1017 1193
1018#ifdef CONFIG_X86_32 1194 printk(KERN_INFO "mpf: %lx\n", virt_to_phys(mpf));
1019 if (ioapic_renumber_irq) 1195 printk(KERN_INFO "mpf_physptr: %x\n", mpf->mpf_physptr);
1020 gsi = ioapic_renumber_irq(ioapic, gsi);
1021#endif
1022 1196
1023 /* 1197 if (mpc_new_phys && mpc->mpc_length > mpc_new_length) {
1024 * Avoid pin reprogramming. PRTs typically include entries 1198 mpc_new_phys = 0;
1025 * with redundant pin->gsi mappings (but unique PCI devices); 1199 printk(KERN_INFO "mpc_new_length is %ld, please use alloc_mptable=8k\n",
1026 * we only program the IOAPIC on the first. 1200 mpc_new_length);
1027 */
1028 if (ioapic_pin > MP_MAX_IOAPIC_PIN) {
1029 printk(KERN_ERR "Invalid reference to IOAPIC pin "
1030 "%d-%d\n", mp_ioapic_routing[ioapic].apic_id,
1031 ioapic_pin);
1032 return gsi;
1033 } 1201 }
1034 if (test_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) { 1202
1035 Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", 1203 if (!mpc_new_phys) {
1036 mp_ioapic_routing[ioapic].apic_id, ioapic_pin); 1204 unsigned char old, new;
1037#ifdef CONFIG_X86_32 1205 /* check if we can change the postion */
1038 return (gsi < IRQ_COMPRESSION_START ? gsi : gsi_to_irq[gsi]); 1206 mpc->mpc_checksum = 0;
1039#else 1207 old = mpf_checksum((unsigned char *)mpc, mpc->mpc_length);
1040 return gsi; 1208 mpc->mpc_checksum = 0xff;
1041#endif 1209 new = mpf_checksum((unsigned char *)mpc, mpc->mpc_length);
1210 if (old == new) {
1211 printk(KERN_INFO "mpc is readonly, please try alloc_mptable instead\n");
1212 return 0;
1213 }
1214 printk(KERN_INFO "use in-positon replacing\n");
1215 } else {
1216 mpf->mpf_physptr = mpc_new_phys;
1217 mpc_new = phys_to_virt(mpc_new_phys);
1218 memcpy(mpc_new, mpc, mpc->mpc_length);
1219 mpc = mpc_new;
1220 /* check if we can modify that */
1221 if (mpc_new_phys - mpf->mpf_physptr) {
1222 struct intel_mp_floating *mpf_new;
1223 /* steal 16 bytes from [0, 1k) */
1224 printk(KERN_INFO "mpf new: %x\n", 0x400 - 16);
1225 mpf_new = phys_to_virt(0x400 - 16);
1226 memcpy(mpf_new, mpf, 16);
1227 mpf = mpf_new;
1228 mpf->mpf_physptr = mpc_new_phys;
1229 }
1230 mpf->mpf_checksum = 0;
1231 mpf->mpf_checksum -= mpf_checksum((unsigned char *)mpf, 16);
1232 printk(KERN_INFO "mpf_physptr new: %x\n", mpf->mpf_physptr);
1042 } 1233 }
1043 1234
1044 set_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed);
1045#ifdef CONFIG_X86_32
1046 /* 1235 /*
1047 * For GSI >= 64, use IRQ compression 1236 * only replace the one with mp_INT and
1237 * MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
1238 * already in mp_irqs , stored by ... and mp_config_acpi_gsi,
1239 * may need pci=routeirq for all coverage
1048 */ 1240 */
1049 if ((gsi >= IRQ_COMPRESSION_START) 1241 replace_intsrc_all(mpc, mpc_new_phys, mpc_new_length);
1050 && (triggering == ACPI_LEVEL_SENSITIVE)) { 1242
1051 /* 1243 return 0;
1052 * For PCI devices assign IRQs in order, avoiding gaps
1053 * due to unused I/O APIC pins.
1054 */
1055 int irq = gsi;
1056 if (gsi < MAX_GSI_NUM) {
1057 /*
1058 * Retain the VIA chipset work-around (gsi > 15), but
1059 * avoid a problem where the 8254 timer (IRQ0) is setup
1060 * via an override (so it's not on pin 0 of the ioapic),
1061 * and at the same time, the pin 0 interrupt is a PCI
1062 * type. The gsi > 15 test could cause these two pins
1063 * to be shared as IRQ0, and they are not shareable.
1064 * So test for this condition, and if necessary, avoid
1065 * the pin collision.
1066 */
1067 gsi = pci_irq++;
1068 /*
1069 * Don't assign IRQ used by ACPI SCI
1070 */
1071 if (gsi == acpi_gbl_FADT.sci_interrupt)
1072 gsi = pci_irq++;
1073 gsi_to_irq[irq] = gsi;
1074 } else {
1075 printk(KERN_ERR "GSI %u is too high\n", gsi);
1076 return gsi;
1077 }
1078 }
1079#endif
1080 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
1081 triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
1082 polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
1083 return gsi;
1084} 1244}
1085 1245
1086#endif /* CONFIG_X86_IO_APIC */ 1246late_initcall(update_mp_table);
1087#endif /* CONFIG_ACPI */
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 1f3abe048e93..a153b3905f60 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -117,12 +117,20 @@ static int msr_open(struct inode *inode, struct file *file)
117{ 117{
118 unsigned int cpu = iminor(file->f_path.dentry->d_inode); 118 unsigned int cpu = iminor(file->f_path.dentry->d_inode);
119 struct cpuinfo_x86 *c = &cpu_data(cpu); 119 struct cpuinfo_x86 *c = &cpu_data(cpu);
120 int ret = 0;
120 121
121 if (cpu >= NR_CPUS || !cpu_online(cpu)) 122 lock_kernel();
122 return -ENXIO; /* No such CPU */ 123 cpu = iminor(file->f_path.dentry->d_inode);
123 if (!cpu_has(c, X86_FEATURE_MSR))
124 return -EIO; /* MSR not supported */
125 124
125 if (cpu >= NR_CPUS || !cpu_online(cpu)) {
126 ret = -ENXIO; /* No such CPU */
127 goto out;
128 }
129 c = &cpu_data(cpu);
130 if (!cpu_has(c, X86_FEATURE_MSR))
131 ret = -EIO; /* MSR not supported */
132out:
133 unlock_kernel();
126 return 0; 134 return 0;
127} 135}
128 136
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi.c
index 84160f74eeb0..716b89284be0 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi.c
@@ -11,10 +11,13 @@
11 * Mikael Pettersson : PM converted to driver model. Disable/enable API. 11 * Mikael Pettersson : PM converted to driver model. Disable/enable API.
12 */ 12 */
13 13
14#include <asm/apic.h>
15
16#include <linux/nmi.h>
17#include <linux/mm.h>
14#include <linux/delay.h> 18#include <linux/delay.h>
15#include <linux/interrupt.h> 19#include <linux/interrupt.h>
16#include <linux/module.h> 20#include <linux/module.h>
17#include <linux/nmi.h>
18#include <linux/sysdev.h> 21#include <linux/sysdev.h>
19#include <linux/sysctl.h> 22#include <linux/sysctl.h>
20#include <linux/percpu.h> 23#include <linux/percpu.h>
@@ -22,12 +25,18 @@
22#include <linux/cpumask.h> 25#include <linux/cpumask.h>
23#include <linux/kernel_stat.h> 26#include <linux/kernel_stat.h>
24#include <linux/kdebug.h> 27#include <linux/kdebug.h>
25#include <linux/slab.h> 28#include <linux/smp.h>
26 29
30#include <asm/i8259.h>
31#include <asm/io_apic.h>
27#include <asm/smp.h> 32#include <asm/smp.h>
28#include <asm/nmi.h> 33#include <asm/nmi.h>
34#include <asm/proto.h>
35#include <asm/timer.h>
29 36
30#include "mach_traps.h" 37#include <asm/mce.h>
38
39#include <mach_traps.h>
31 40
32int unknown_nmi_panic; 41int unknown_nmi_panic;
33int nmi_watchdog_enabled; 42int nmi_watchdog_enabled;
@@ -41,28 +50,65 @@ static cpumask_t backtrace_mask = CPU_MASK_NONE;
41 * 0: the lapic NMI watchdog is disabled, but can be enabled 50 * 0: the lapic NMI watchdog is disabled, but can be enabled
42 */ 51 */
43atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */ 52atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */
53EXPORT_SYMBOL(nmi_active);
44 54
45unsigned int nmi_watchdog = NMI_DEFAULT; 55unsigned int nmi_watchdog = NMI_NONE;
46static unsigned int nmi_hz = HZ; 56EXPORT_SYMBOL(nmi_watchdog);
47 57
58static int panic_on_timeout;
59
60static unsigned int nmi_hz = HZ;
48static DEFINE_PER_CPU(short, wd_enabled); 61static DEFINE_PER_CPU(short, wd_enabled);
62static int endflag __initdata;
49 63
50static int endflag __initdata = 0; 64static inline unsigned int get_nmi_count(int cpu)
65{
66#ifdef CONFIG_X86_64
67 return cpu_pda(cpu)->__nmi_count;
68#else
69 return nmi_count(cpu);
70#endif
71}
72
73static inline int mce_in_progress(void)
74{
75#if defined(CONFIG_X86_64) && defined(CONFIG_X86_MCE)
76 return atomic_read(&mce_entry) > 0;
77#endif
78 return 0;
79}
80
81/*
82 * Take the local apic timer and PIT/HPET into account. We don't
83 * know which one is active, when we have highres/dyntick on
84 */
85static inline unsigned int get_timer_irqs(int cpu)
86{
87#ifdef CONFIG_X86_64
88 return read_pda(apic_timer_irqs) + read_pda(irq0_irqs);
89#else
90 return per_cpu(irq_stat, cpu).apic_timer_irqs +
91 per_cpu(irq_stat, cpu).irq0_irqs;
92#endif
93}
51 94
52#ifdef CONFIG_SMP 95#ifdef CONFIG_SMP
53/* The performance counters used by NMI_LOCAL_APIC don't trigger when 96/*
97 * The performance counters used by NMI_LOCAL_APIC don't trigger when
54 * the CPU is idle. To make sure the NMI watchdog really ticks on all 98 * the CPU is idle. To make sure the NMI watchdog really ticks on all
55 * CPUs during the test make them busy. 99 * CPUs during the test make them busy.
56 */ 100 */
57static __init void nmi_cpu_busy(void *data) 101static __init void nmi_cpu_busy(void *data)
58{ 102{
59 local_irq_enable_in_hardirq(); 103 local_irq_enable_in_hardirq();
60 /* Intentionally don't use cpu_relax here. This is 104 /*
61 to make sure that the performance counter really ticks, 105 * Intentionally don't use cpu_relax here. This is
62 even if there is a simulator or similar that catches the 106 * to make sure that the performance counter really ticks,
63 pause instruction. On a real HT machine this is fine because 107 * even if there is a simulator or similar that catches the
64 all other CPUs are busy with "useless" delay loops and don't 108 * pause instruction. On a real HT machine this is fine because
65 care if they get somewhat less cycles. */ 109 * all other CPUs are busy with "useless" delay loops and don't
110 * care if they get somewhat less cycles.
111 */
66 while (endflag == 0) 112 while (endflag == 0)
67 mb(); 113 mb();
68} 114}
@@ -73,15 +119,12 @@ int __init check_nmi_watchdog(void)
73 unsigned int *prev_nmi_count; 119 unsigned int *prev_nmi_count;
74 int cpu; 120 int cpu;
75 121
76 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED)) 122 if (!nmi_watchdog_active() || !atomic_read(&nmi_active))
77 return 0;
78
79 if (!atomic_read(&nmi_active))
80 return 0; 123 return 0;
81 124
82 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); 125 prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(int), GFP_KERNEL);
83 if (!prev_nmi_count) 126 if (!prev_nmi_count)
84 return -1; 127 goto error;
85 128
86 printk(KERN_INFO "Testing NMI watchdog ... "); 129 printk(KERN_INFO "Testing NMI watchdog ... ");
87 130
@@ -91,25 +134,19 @@ int __init check_nmi_watchdog(void)
91#endif 134#endif
92 135
93 for_each_possible_cpu(cpu) 136 for_each_possible_cpu(cpu)
94 prev_nmi_count[cpu] = nmi_count(cpu); 137 prev_nmi_count[cpu] = get_nmi_count(cpu);
95 local_irq_enable(); 138 local_irq_enable();
96 mdelay((20*1000)/nmi_hz); // wait 20 ticks 139 mdelay((20 * 1000) / nmi_hz); /* wait 20 ticks */
97 140
98 for_each_possible_cpu(cpu) { 141 for_each_online_cpu(cpu) {
99#ifdef CONFIG_SMP
100 /* Check cpu_callin_map here because that is set
101 after the timer is started. */
102 if (!cpu_isset(cpu, cpu_callin_map))
103 continue;
104#endif
105 if (!per_cpu(wd_enabled, cpu)) 142 if (!per_cpu(wd_enabled, cpu))
106 continue; 143 continue;
107 if (nmi_count(cpu) - prev_nmi_count[cpu] <= 5) { 144 if (get_nmi_count(cpu) - prev_nmi_count[cpu] <= 5) {
108 printk(KERN_WARNING "WARNING: CPU#%d: NMI " 145 printk(KERN_WARNING "WARNING: CPU#%d: NMI "
109 "appears to be stuck (%d->%d)!\n", 146 "appears to be stuck (%d->%d)!\n",
110 cpu, 147 cpu,
111 prev_nmi_count[cpu], 148 prev_nmi_count[cpu],
112 nmi_count(cpu)); 149 get_nmi_count(cpu));
113 per_cpu(wd_enabled, cpu) = 0; 150 per_cpu(wd_enabled, cpu) = 0;
114 atomic_dec(&nmi_active); 151 atomic_dec(&nmi_active);
115 } 152 }
@@ -118,37 +155,53 @@ int __init check_nmi_watchdog(void)
118 if (!atomic_read(&nmi_active)) { 155 if (!atomic_read(&nmi_active)) {
119 kfree(prev_nmi_count); 156 kfree(prev_nmi_count);
120 atomic_set(&nmi_active, -1); 157 atomic_set(&nmi_active, -1);
121 return -1; 158 goto error;
122 } 159 }
123 printk("OK.\n"); 160 printk("OK.\n");
124 161
125 /* now that we know it works we can reduce NMI frequency to 162 /*
126 something more reasonable; makes a difference in some configs */ 163 * now that we know it works we can reduce NMI frequency to
164 * something more reasonable; makes a difference in some configs
165 */
127 if (nmi_watchdog == NMI_LOCAL_APIC) 166 if (nmi_watchdog == NMI_LOCAL_APIC)
128 nmi_hz = lapic_adjust_nmi_hz(1); 167 nmi_hz = lapic_adjust_nmi_hz(1);
129 168
130 kfree(prev_nmi_count); 169 kfree(prev_nmi_count);
131 return 0; 170 return 0;
171error:
172 if (nmi_watchdog == NMI_IO_APIC && !timer_through_8259)
173 disable_8259A_irq(0);
174#ifdef CONFIG_X86_32
175 timer_ack = 0;
176#endif
177 return -1;
132} 178}
133 179
134static int __init setup_nmi_watchdog(char *str) 180static int __init setup_nmi_watchdog(char *str)
135{ 181{
136 int nmi; 182 unsigned int nmi;
183
184 if (!strncmp(str, "panic", 5)) {
185 panic_on_timeout = 1;
186 str = strchr(str, ',');
187 if (!str)
188 return 1;
189 ++str;
190 }
137 191
138 get_option(&str, &nmi); 192 get_option(&str, &nmi);
139 193
140 if ((nmi >= NMI_INVALID) || (nmi < NMI_NONE)) 194 if (nmi >= NMI_INVALID)
141 return 0; 195 return 0;
142 196
143 nmi_watchdog = nmi; 197 nmi_watchdog = nmi;
144 return 1; 198 return 1;
145} 199}
146
147__setup("nmi_watchdog=", setup_nmi_watchdog); 200__setup("nmi_watchdog=", setup_nmi_watchdog);
148 201
149 202/*
150/* Suspend/resume support */ 203 * Suspend/resume support
151 204 */
152#ifdef CONFIG_PM 205#ifdef CONFIG_PM
153 206
154static int nmi_pm_active; /* nmi_active before suspend */ 207static int nmi_pm_active; /* nmi_active before suspend */
@@ -172,7 +225,6 @@ static int lapic_nmi_resume(struct sys_device *dev)
172 return 0; 225 return 0;
173} 226}
174 227
175
176static struct sysdev_class nmi_sysclass = { 228static struct sysdev_class nmi_sysclass = {
177 .name = "lapic_nmi", 229 .name = "lapic_nmi",
178 .resume = lapic_nmi_resume, 230 .resume = lapic_nmi_resume,
@@ -188,7 +240,8 @@ static int __init init_lapic_nmi_sysfs(void)
188{ 240{
189 int error; 241 int error;
190 242
191 /* should really be a BUG_ON but b/c this is an 243 /*
244 * should really be a BUG_ON but b/c this is an
192 * init call, it just doesn't work. -dcz 245 * init call, it just doesn't work. -dcz
193 */ 246 */
194 if (nmi_watchdog != NMI_LOCAL_APIC) 247 if (nmi_watchdog != NMI_LOCAL_APIC)
@@ -202,6 +255,7 @@ static int __init init_lapic_nmi_sysfs(void)
202 error = sysdev_register(&device_lapic_nmi); 255 error = sysdev_register(&device_lapic_nmi);
203 return error; 256 return error;
204} 257}
258
205/* must come after the local APIC's device_initcall() */ 259/* must come after the local APIC's device_initcall() */
206late_initcall(init_lapic_nmi_sysfs); 260late_initcall(init_lapic_nmi_sysfs);
207 261
@@ -223,7 +277,7 @@ void acpi_nmi_enable(void)
223 277
224static void __acpi_nmi_disable(void *__unused) 278static void __acpi_nmi_disable(void *__unused)
225{ 279{
226 apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED); 280 apic_write_around(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
227} 281}
228 282
229/* 283/*
@@ -242,12 +296,13 @@ void setup_apic_nmi_watchdog(void *unused)
242 296
243 /* cheap hack to support suspend/resume */ 297 /* cheap hack to support suspend/resume */
244 /* if cpu0 is not active neither should the other cpus */ 298 /* if cpu0 is not active neither should the other cpus */
245 if ((smp_processor_id() != 0) && (atomic_read(&nmi_active) <= 0)) 299 if (smp_processor_id() != 0 && atomic_read(&nmi_active) <= 0)
246 return; 300 return;
247 301
248 switch (nmi_watchdog) { 302 switch (nmi_watchdog) {
249 case NMI_LOCAL_APIC: 303 case NMI_LOCAL_APIC:
250 __get_cpu_var(wd_enabled) = 1; /* enable it before to avoid race with handler */ 304 /* enable it before to avoid race with handler */
305 __get_cpu_var(wd_enabled) = 1;
251 if (lapic_watchdog_init(nmi_hz) < 0) { 306 if (lapic_watchdog_init(nmi_hz) < 0) {
252 __get_cpu_var(wd_enabled) = 0; 307 __get_cpu_var(wd_enabled) = 0;
253 return; 308 return;
@@ -262,9 +317,8 @@ void setup_apic_nmi_watchdog(void *unused)
262void stop_apic_nmi_watchdog(void *unused) 317void stop_apic_nmi_watchdog(void *unused)
263{ 318{
264 /* only support LOCAL and IO APICs for now */ 319 /* only support LOCAL and IO APICs for now */
265 if ((nmi_watchdog != NMI_LOCAL_APIC) && 320 if (!nmi_watchdog_active())
266 (nmi_watchdog != NMI_IO_APIC)) 321 return;
267 return;
268 if (__get_cpu_var(wd_enabled) == 0) 322 if (__get_cpu_var(wd_enabled) == 0)
269 return; 323 return;
270 if (nmi_watchdog == NMI_LOCAL_APIC) 324 if (nmi_watchdog == NMI_LOCAL_APIC)
@@ -284,26 +338,26 @@ void stop_apic_nmi_watchdog(void *unused)
284 * since NMIs don't listen to _any_ locks, we have to be extremely 338 * since NMIs don't listen to _any_ locks, we have to be extremely
285 * careful not to rely on unsafe variables. The printk might lock 339 * careful not to rely on unsafe variables. The printk might lock
286 * up though, so we have to break up any console locks first ... 340 * up though, so we have to break up any console locks first ...
287 * [when there will be more tty-related locks, break them up 341 * [when there will be more tty-related locks, break them up here too!]
288 * here too!]
289 */ 342 */
290 343
291static unsigned int 344static DEFINE_PER_CPU(unsigned, last_irq_sum);
292 last_irq_sums [NR_CPUS], 345static DEFINE_PER_CPU(local_t, alert_counter);
293 alert_counter [NR_CPUS]; 346static DEFINE_PER_CPU(int, nmi_touch);
294 347
295void touch_nmi_watchdog(void) 348void touch_nmi_watchdog(void)
296{ 349{
297 if (nmi_watchdog > 0) { 350 if (nmi_watchdog_active()) {
298 unsigned cpu; 351 unsigned cpu;
299 352
300 /* 353 /*
301 * Just reset the alert counters, (other CPUs might be 354 * Tell other CPUs to reset their alert counters. We cannot
302 * spinning on locks we hold): 355 * do it ourselves because the alert count increase is not
356 * atomic.
303 */ 357 */
304 for_each_present_cpu(cpu) { 358 for_each_present_cpu(cpu) {
305 if (alert_counter[cpu]) 359 if (per_cpu(nmi_touch, cpu) != 1)
306 alert_counter[cpu] = 0; 360 per_cpu(nmi_touch, cpu) = 1;
307 } 361 }
308 } 362 }
309 363
@@ -314,12 +368,9 @@ void touch_nmi_watchdog(void)
314} 368}
315EXPORT_SYMBOL(touch_nmi_watchdog); 369EXPORT_SYMBOL(touch_nmi_watchdog);
316 370
317extern void die_nmi(struct pt_regs *, const char *msg);
318
319notrace __kprobes int 371notrace __kprobes int
320nmi_watchdog_tick(struct pt_regs *regs, unsigned reason) 372nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
321{ 373{
322
323 /* 374 /*
324 * Since current_thread_info()-> is always on the stack, and we 375 * Since current_thread_info()-> is always on the stack, and we
325 * always switch the stack NMI-atomically, it's safe to use 376 * always switch the stack NMI-atomically, it's safe to use
@@ -337,39 +388,45 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
337 touched = 1; 388 touched = 1;
338 } 389 }
339 390
391 sum = get_timer_irqs(cpu);
392
393 if (__get_cpu_var(nmi_touch)) {
394 __get_cpu_var(nmi_touch) = 0;
395 touched = 1;
396 }
397
340 if (cpu_isset(cpu, backtrace_mask)) { 398 if (cpu_isset(cpu, backtrace_mask)) {
341 static DEFINE_SPINLOCK(lock); /* Serialise the printks */ 399 static DEFINE_SPINLOCK(lock); /* Serialise the printks */
342 400
343 spin_lock(&lock); 401 spin_lock(&lock);
344 printk("NMI backtrace for cpu %d\n", cpu); 402 printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu);
345 dump_stack(); 403 dump_stack();
346 spin_unlock(&lock); 404 spin_unlock(&lock);
347 cpu_clear(cpu, backtrace_mask); 405 cpu_clear(cpu, backtrace_mask);
348 } 406 }
349 407
350 /* 408 /* Could check oops_in_progress here too, but it's safer not to */
351 * Take the local apic timer and PIT/HPET into account. We don't 409 if (mce_in_progress())
352 * know which one is active, when we have highres/dyntick on 410 touched = 1;
353 */
354 sum = per_cpu(irq_stat, cpu).apic_timer_irqs +
355 per_cpu(irq_stat, cpu).irq0_irqs;
356 411
357 /* if the none of the timers isn't firing, this cpu isn't doing much */ 412 /* if the none of the timers isn't firing, this cpu isn't doing much */
358 if (!touched && last_irq_sums[cpu] == sum) { 413 if (!touched && __get_cpu_var(last_irq_sum) == sum) {
359 /* 414 /*
360 * Ayiee, looks like this CPU is stuck ... 415 * Ayiee, looks like this CPU is stuck ...
361 * wait a few IRQs (5 seconds) before doing the oops ... 416 * wait a few IRQs (5 seconds) before doing the oops ...
362 */ 417 */
363 alert_counter[cpu]++; 418 local_inc(&__get_cpu_var(alert_counter));
364 if (alert_counter[cpu] == 5*nmi_hz) 419 if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz)
365 /* 420 /*
366 * die_nmi will return ONLY if NOTIFY_STOP happens.. 421 * die_nmi will return ONLY if NOTIFY_STOP happens..
367 */ 422 */
368 die_nmi(regs, "BUG: NMI Watchdog detected LOCKUP"); 423 die_nmi("BUG: NMI Watchdog detected LOCKUP",
424 regs, panic_on_timeout);
369 } else { 425 } else {
370 last_irq_sums[cpu] = sum; 426 __get_cpu_var(last_irq_sum) = sum;
371 alert_counter[cpu] = 0; 427 local_set(&__get_cpu_var(alert_counter), 0);
372 } 428 }
429
373 /* see if the nmi watchdog went off */ 430 /* see if the nmi watchdog went off */
374 if (!__get_cpu_var(wd_enabled)) 431 if (!__get_cpu_var(wd_enabled))
375 return rc; 432 return rc;
@@ -378,7 +435,8 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
378 rc |= lapic_wd_event(nmi_hz); 435 rc |= lapic_wd_event(nmi_hz);
379 break; 436 break;
380 case NMI_IO_APIC: 437 case NMI_IO_APIC:
381 /* don't know how to accurately check for this. 438 /*
439 * don't know how to accurately check for this.
382 * just assume it was a watchdog timer interrupt 440 * just assume it was a watchdog timer interrupt
383 * This matches the old behaviour. 441 * This matches the old behaviour.
384 */ 442 */
@@ -396,7 +454,7 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
396 char buf[64]; 454 char buf[64];
397 455
398 sprintf(buf, "NMI received for unknown reason %02x\n", reason); 456 sprintf(buf, "NMI received for unknown reason %02x\n", reason);
399 die_nmi(regs, buf); 457 die_nmi(buf, regs, 1); /* Always panic here */
400 return 0; 458 return 0;
401} 459}
402 460
@@ -414,32 +472,26 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
414 if (!!old_state == !!nmi_watchdog_enabled) 472 if (!!old_state == !!nmi_watchdog_enabled)
415 return 0; 473 return 0;
416 474
417 if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) { 475 if (atomic_read(&nmi_active) < 0 || !nmi_watchdog_active()) {
418 printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 476 printk(KERN_WARNING
477 "NMI watchdog is permanently disabled\n");
419 return -EIO; 478 return -EIO;
420 } 479 }
421 480
422 if (nmi_watchdog == NMI_DEFAULT) {
423 if (lapic_watchdog_ok())
424 nmi_watchdog = NMI_LOCAL_APIC;
425 else
426 nmi_watchdog = NMI_IO_APIC;
427 }
428
429 if (nmi_watchdog == NMI_LOCAL_APIC) { 481 if (nmi_watchdog == NMI_LOCAL_APIC) {
430 if (nmi_watchdog_enabled) 482 if (nmi_watchdog_enabled)
431 enable_lapic_nmi_watchdog(); 483 enable_lapic_nmi_watchdog();
432 else 484 else
433 disable_lapic_nmi_watchdog(); 485 disable_lapic_nmi_watchdog();
434 } else { 486 } else {
435 printk( KERN_WARNING 487 printk(KERN_WARNING
436 "NMI watchdog doesn't know what hardware to touch\n"); 488 "NMI watchdog doesn't know what hardware to touch\n");
437 return -EIO; 489 return -EIO;
438 } 490 }
439 return 0; 491 return 0;
440} 492}
441 493
442#endif 494#endif /* CONFIG_SYSCTL */
443 495
444int do_nmi_callback(struct pt_regs *regs, int cpu) 496int do_nmi_callback(struct pt_regs *regs, int cpu)
445{ 497{
@@ -462,6 +514,3 @@ void __trigger_all_cpu_backtrace(void)
462 mdelay(1); 514 mdelay(1);
463 } 515 }
464} 516}
465
466EXPORT_SYMBOL(nmi_active);
467EXPORT_SYMBOL(nmi_watchdog);
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
deleted file mode 100644
index 5a29ded994fa..000000000000
--- a/arch/x86/kernel/nmi_64.c
+++ /dev/null
@@ -1,482 +0,0 @@
1/*
2 * NMI watchdog support on APIC systems
3 *
4 * Started by Ingo Molnar <mingo@redhat.com>
5 *
6 * Fixes:
7 * Mikael Pettersson : AMD K7 support for local APIC NMI watchdog.
8 * Mikael Pettersson : Power Management for local APIC NMI watchdog.
9 * Pavel Machek and
10 * Mikael Pettersson : PM converted to driver model. Disable/enable API.
11 */
12
13#include <linux/nmi.h>
14#include <linux/mm.h>
15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/module.h>
18#include <linux/sysdev.h>
19#include <linux/sysctl.h>
20#include <linux/kprobes.h>
21#include <linux/cpumask.h>
22#include <linux/kdebug.h>
23
24#include <asm/smp.h>
25#include <asm/nmi.h>
26#include <asm/proto.h>
27#include <asm/mce.h>
28
29#include <mach_traps.h>
30
31int unknown_nmi_panic;
32int nmi_watchdog_enabled;
33int panic_on_unrecovered_nmi;
34
35static cpumask_t backtrace_mask = CPU_MASK_NONE;
36
37/* nmi_active:
38 * >0: the lapic NMI watchdog is active, but can be disabled
39 * <0: the lapic NMI watchdog has not been set up, and cannot
40 * be enabled
41 * 0: the lapic NMI watchdog is disabled, but can be enabled
42 */
43atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */
44static int panic_on_timeout;
45
46unsigned int nmi_watchdog = NMI_DEFAULT;
47static unsigned int nmi_hz = HZ;
48
49static DEFINE_PER_CPU(short, wd_enabled);
50
51/* Run after command line and cpu_init init, but before all other checks */
52void nmi_watchdog_default(void)
53{
54 if (nmi_watchdog != NMI_DEFAULT)
55 return;
56 nmi_watchdog = NMI_NONE;
57}
58
59static int endflag __initdata = 0;
60
61#ifdef CONFIG_SMP
62/* The performance counters used by NMI_LOCAL_APIC don't trigger when
63 * the CPU is idle. To make sure the NMI watchdog really ticks on all
64 * CPUs during the test make them busy.
65 */
66static __init void nmi_cpu_busy(void *data)
67{
68 local_irq_enable_in_hardirq();
69 /* Intentionally don't use cpu_relax here. This is
70 to make sure that the performance counter really ticks,
71 even if there is a simulator or similar that catches the
72 pause instruction. On a real HT machine this is fine because
73 all other CPUs are busy with "useless" delay loops and don't
74 care if they get somewhat less cycles. */
75 while (endflag == 0)
76 mb();
77}
78#endif
79
80int __init check_nmi_watchdog(void)
81{
82 int *prev_nmi_count;
83 int cpu;
84
85 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED))
86 return 0;
87
88 if (!atomic_read(&nmi_active))
89 return 0;
90
91 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
92 if (!prev_nmi_count)
93 return -1;
94
95 printk(KERN_INFO "Testing NMI watchdog ... ");
96
97#ifdef CONFIG_SMP
98 if (nmi_watchdog == NMI_LOCAL_APIC)
99 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
100#endif
101
102 for (cpu = 0; cpu < NR_CPUS; cpu++)
103 prev_nmi_count[cpu] = cpu_pda(cpu)->__nmi_count;
104 local_irq_enable();
105 mdelay((20*1000)/nmi_hz); // wait 20 ticks
106
107 for_each_online_cpu(cpu) {
108 if (!per_cpu(wd_enabled, cpu))
109 continue;
110 if (cpu_pda(cpu)->__nmi_count - prev_nmi_count[cpu] <= 5) {
111 printk(KERN_WARNING "WARNING: CPU#%d: NMI "
112 "appears to be stuck (%d->%d)!\n",
113 cpu,
114 prev_nmi_count[cpu],
115 cpu_pda(cpu)->__nmi_count);
116 per_cpu(wd_enabled, cpu) = 0;
117 atomic_dec(&nmi_active);
118 }
119 }
120 endflag = 1;
121 if (!atomic_read(&nmi_active)) {
122 kfree(prev_nmi_count);
123 atomic_set(&nmi_active, -1);
124 return -1;
125 }
126 printk("OK.\n");
127
128 /* now that we know it works we can reduce NMI frequency to
129 something more reasonable; makes a difference in some configs */
130 if (nmi_watchdog == NMI_LOCAL_APIC)
131 nmi_hz = lapic_adjust_nmi_hz(1);
132
133 kfree(prev_nmi_count);
134 return 0;
135}
136
137static int __init setup_nmi_watchdog(char *str)
138{
139 int nmi;
140
141 if (!strncmp(str,"panic",5)) {
142 panic_on_timeout = 1;
143 str = strchr(str, ',');
144 if (!str)
145 return 1;
146 ++str;
147 }
148
149 get_option(&str, &nmi);
150
151 if ((nmi >= NMI_INVALID) || (nmi < NMI_NONE))
152 return 0;
153
154 nmi_watchdog = nmi;
155 return 1;
156}
157
158__setup("nmi_watchdog=", setup_nmi_watchdog);
159
160#ifdef CONFIG_PM
161
162static int nmi_pm_active; /* nmi_active before suspend */
163
164static int lapic_nmi_suspend(struct sys_device *dev, pm_message_t state)
165{
166 /* only CPU0 goes here, other CPUs should be offline */
167 nmi_pm_active = atomic_read(&nmi_active);
168 stop_apic_nmi_watchdog(NULL);
169 BUG_ON(atomic_read(&nmi_active) != 0);
170 return 0;
171}
172
173static int lapic_nmi_resume(struct sys_device *dev)
174{
175 /* only CPU0 goes here, other CPUs should be offline */
176 if (nmi_pm_active > 0) {
177 setup_apic_nmi_watchdog(NULL);
178 touch_nmi_watchdog();
179 }
180 return 0;
181}
182
183static struct sysdev_class nmi_sysclass = {
184 .name = "lapic_nmi",
185 .resume = lapic_nmi_resume,
186 .suspend = lapic_nmi_suspend,
187};
188
189static struct sys_device device_lapic_nmi = {
190 .id = 0,
191 .cls = &nmi_sysclass,
192};
193
194static int __init init_lapic_nmi_sysfs(void)
195{
196 int error;
197
198 /* should really be a BUG_ON but b/c this is an
199 * init call, it just doesn't work. -dcz
200 */
201 if (nmi_watchdog != NMI_LOCAL_APIC)
202 return 0;
203
204 if (atomic_read(&nmi_active) < 0)
205 return 0;
206
207 error = sysdev_class_register(&nmi_sysclass);
208 if (!error)
209 error = sysdev_register(&device_lapic_nmi);
210 return error;
211}
212/* must come after the local APIC's device_initcall() */
213late_initcall(init_lapic_nmi_sysfs);
214
215#endif /* CONFIG_PM */
216
217static void __acpi_nmi_enable(void *__unused)
218{
219 apic_write(APIC_LVT0, APIC_DM_NMI);
220}
221
222/*
223 * Enable timer based NMIs on all CPUs:
224 */
225void acpi_nmi_enable(void)
226{
227 if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
228 on_each_cpu(__acpi_nmi_enable, NULL, 0, 1);
229}
230
231static void __acpi_nmi_disable(void *__unused)
232{
233 apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
234}
235
236/*
237 * Disable timer based NMIs on all CPUs:
238 */
239void acpi_nmi_disable(void)
240{
241 if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
242 on_each_cpu(__acpi_nmi_disable, NULL, 0, 1);
243}
244
245void setup_apic_nmi_watchdog(void *unused)
246{
247 if (__get_cpu_var(wd_enabled))
248 return;
249
250 /* cheap hack to support suspend/resume */
251 /* if cpu0 is not active neither should the other cpus */
252 if ((smp_processor_id() != 0) && (atomic_read(&nmi_active) <= 0))
253 return;
254
255 switch (nmi_watchdog) {
256 case NMI_LOCAL_APIC:
257 __get_cpu_var(wd_enabled) = 1;
258 if (lapic_watchdog_init(nmi_hz) < 0) {
259 __get_cpu_var(wd_enabled) = 0;
260 return;
261 }
262 /* FALL THROUGH */
263 case NMI_IO_APIC:
264 __get_cpu_var(wd_enabled) = 1;
265 atomic_inc(&nmi_active);
266 }
267}
268
269void stop_apic_nmi_watchdog(void *unused)
270{
271 /* only support LOCAL and IO APICs for now */
272 if ((nmi_watchdog != NMI_LOCAL_APIC) &&
273 (nmi_watchdog != NMI_IO_APIC))
274 return;
275 if (__get_cpu_var(wd_enabled) == 0)
276 return;
277 if (nmi_watchdog == NMI_LOCAL_APIC)
278 lapic_watchdog_stop();
279 __get_cpu_var(wd_enabled) = 0;
280 atomic_dec(&nmi_active);
281}
282
283/*
284 * the best way to detect whether a CPU has a 'hard lockup' problem
285 * is to check it's local APIC timer IRQ counts. If they are not
286 * changing then that CPU has some problem.
287 *
288 * as these watchdog NMI IRQs are generated on every CPU, we only
289 * have to check the current processor.
290 */
291
292static DEFINE_PER_CPU(unsigned, last_irq_sum);
293static DEFINE_PER_CPU(local_t, alert_counter);
294static DEFINE_PER_CPU(int, nmi_touch);
295
296void touch_nmi_watchdog(void)
297{
298 if (nmi_watchdog > 0) {
299 unsigned cpu;
300
301 /*
302 * Tell other CPUs to reset their alert counters. We cannot
303 * do it ourselves because the alert count increase is not
304 * atomic.
305 */
306 for_each_present_cpu(cpu) {
307 if (per_cpu(nmi_touch, cpu) != 1)
308 per_cpu(nmi_touch, cpu) = 1;
309 }
310 }
311
312 touch_softlockup_watchdog();
313}
314EXPORT_SYMBOL(touch_nmi_watchdog);
315
316notrace __kprobes int
317nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
318{
319 int sum;
320 int touched = 0;
321 int cpu = smp_processor_id();
322 int rc = 0;
323
324 /* check for other users first */
325 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
326 == NOTIFY_STOP) {
327 rc = 1;
328 touched = 1;
329 }
330
331 sum = read_pda(apic_timer_irqs) + read_pda(irq0_irqs);
332 if (__get_cpu_var(nmi_touch)) {
333 __get_cpu_var(nmi_touch) = 0;
334 touched = 1;
335 }
336
337 if (cpu_isset(cpu, backtrace_mask)) {
338 static DEFINE_SPINLOCK(lock); /* Serialise the printks */
339
340 spin_lock(&lock);
341 printk("NMI backtrace for cpu %d\n", cpu);
342 dump_stack();
343 spin_unlock(&lock);
344 cpu_clear(cpu, backtrace_mask);
345 }
346
347#ifdef CONFIG_X86_MCE
348 /* Could check oops_in_progress here too, but it's safer
349 not too */
350 if (atomic_read(&mce_entry) > 0)
351 touched = 1;
352#endif
353 /* if the apic timer isn't firing, this cpu isn't doing much */
354 if (!touched && __get_cpu_var(last_irq_sum) == sum) {
355 /*
356 * Ayiee, looks like this CPU is stuck ...
357 * wait a few IRQs (5 seconds) before doing the oops ...
358 */
359 local_inc(&__get_cpu_var(alert_counter));
360 if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz)
361 die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs,
362 panic_on_timeout);
363 } else {
364 __get_cpu_var(last_irq_sum) = sum;
365 local_set(&__get_cpu_var(alert_counter), 0);
366 }
367
368 /* see if the nmi watchdog went off */
369 if (!__get_cpu_var(wd_enabled))
370 return rc;
371 switch (nmi_watchdog) {
372 case NMI_LOCAL_APIC:
373 rc |= lapic_wd_event(nmi_hz);
374 break;
375 case NMI_IO_APIC:
376 /* don't know how to accurately check for this.
377 * just assume it was a watchdog timer interrupt
378 * This matches the old behaviour.
379 */
380 rc = 1;
381 break;
382 }
383 return rc;
384}
385
386static unsigned ignore_nmis;
387
388asmlinkage notrace __kprobes void
389do_nmi(struct pt_regs *regs, long error_code)
390{
391 nmi_enter();
392 add_pda(__nmi_count,1);
393 if (!ignore_nmis)
394 default_do_nmi(regs);
395 nmi_exit();
396}
397
398void stop_nmi(void)
399{
400 acpi_nmi_disable();
401 ignore_nmis++;
402}
403
404void restart_nmi(void)
405{
406 ignore_nmis--;
407 acpi_nmi_enable();
408}
409
410#ifdef CONFIG_SYSCTL
411
412static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
413{
414 unsigned char reason = get_nmi_reason();
415 char buf[64];
416
417 sprintf(buf, "NMI received for unknown reason %02x\n", reason);
418 die_nmi(buf, regs, 1); /* Always panic here */
419 return 0;
420}
421
422/*
423 * proc handler for /proc/sys/kernel/nmi
424 */
425int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
426 void __user *buffer, size_t *length, loff_t *ppos)
427{
428 int old_state;
429
430 nmi_watchdog_enabled = (atomic_read(&nmi_active) > 0) ? 1 : 0;
431 old_state = nmi_watchdog_enabled;
432 proc_dointvec(table, write, file, buffer, length, ppos);
433 if (!!old_state == !!nmi_watchdog_enabled)
434 return 0;
435
436 if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) {
437 printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
438 return -EIO;
439 }
440
441 /* if nmi_watchdog is not set yet, then set it */
442 nmi_watchdog_default();
443
444 if (nmi_watchdog == NMI_LOCAL_APIC) {
445 if (nmi_watchdog_enabled)
446 enable_lapic_nmi_watchdog();
447 else
448 disable_lapic_nmi_watchdog();
449 } else {
450 printk( KERN_WARNING
451 "NMI watchdog doesn't know what hardware to touch\n");
452 return -EIO;
453 }
454 return 0;
455}
456
457#endif
458
459int do_nmi_callback(struct pt_regs *regs, int cpu)
460{
461#ifdef CONFIG_SYSCTL
462 if (unknown_nmi_panic)
463 return unknown_nmi_panic_callback(regs, cpu);
464#endif
465 return 0;
466}
467
468void __trigger_all_cpu_backtrace(void)
469{
470 int i;
471
472 backtrace_mask = cpu_online_map;
473 /* Wait for up to 10 seconds for all CPUs to do the backtrace */
474 for (i = 0; i < 10 * 1000; i++) {
475 if (cpus_empty(backtrace_mask))
476 break;
477 mdelay(1);
478 }
479}
480
481EXPORT_SYMBOL(nmi_active);
482EXPORT_SYMBOL(nmi_watchdog);
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index e65281b1634b..5b20a5e7ac28 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -31,6 +31,8 @@
31#include <asm/numaq.h> 31#include <asm/numaq.h>
32#include <asm/topology.h> 32#include <asm/topology.h>
33#include <asm/processor.h> 33#include <asm/processor.h>
34#include <asm/mpspec.h>
35#include <asm/e820.h>
34 36
35#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) 37#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
36 38
@@ -58,6 +60,8 @@ static void __init smp_dump_qct(void)
58 node_end_pfn[node] = MB_TO_PAGES( 60 node_end_pfn[node] = MB_TO_PAGES(
59 eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); 61 eq->hi_shrd_mem_start + eq->hi_shrd_mem_size);
60 62
63 e820_register_active_regions(node, node_start_pfn[node],
64 node_end_pfn[node]);
61 memory_present(node, 65 memory_present(node,
62 node_start_pfn[node], node_end_pfn[node]); 66 node_start_pfn[node], node_end_pfn[node]);
63 node_remap_size[node] = node_memmap_size_bytes(node, 67 node_remap_size[node] = node_memmap_size_bytes(node,
@@ -67,23 +71,35 @@ static void __init smp_dump_qct(void)
67 } 71 }
68} 72}
69 73
70/* 74static __init void early_check_numaq(void)
71 * Unlike Summit, we don't really care to let the NUMA-Q 75{
72 * fall back to flat mode. Don't compile for NUMA-Q 76 /*
73 * unless you really need it! 77 * Find possible boot-time SMP configuration:
74 */ 78 */
79 early_find_smp_config();
80 /*
81 * get boot-time SMP configuration:
82 */
83 if (smp_found_config)
84 early_get_smp_config();
85}
86
75int __init get_memcfg_numaq(void) 87int __init get_memcfg_numaq(void)
76{ 88{
89 early_check_numaq();
90 if (!found_numaq)
91 return 0;
77 smp_dump_qct(); 92 smp_dump_qct();
78 return 1; 93 return 1;
79} 94}
80 95
81static int __init numaq_tsc_disable(void) 96void __init numaq_tsc_disable(void)
82{ 97{
98 if (!found_numaq)
99 return -1;
100
83 if (num_online_nodes() > 1) { 101 if (num_online_nodes() > 1) {
84 printk(KERN_DEBUG "NUMAQ: disabling TSC\n"); 102 printk(KERN_DEBUG "NUMAQ: disabling TSC\n");
85 setup_clear_cpu_cap(X86_FEATURE_TSC); 103 setup_clear_cpu_cap(X86_FEATURE_TSC);
86 } 104 }
87 return 0;
88} 105}
89arch_initcall(numaq_tsc_disable);
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 74f0c5ea2a03..e0f571d58c19 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -30,6 +30,7 @@
30#include <asm/setup.h> 30#include <asm/setup.h>
31#include <asm/arch_hooks.h> 31#include <asm/arch_hooks.h>
32#include <asm/time.h> 32#include <asm/time.h>
33#include <asm/pgalloc.h>
33#include <asm/irq.h> 34#include <asm/irq.h>
34#include <asm/delay.h> 35#include <asm/delay.h>
35#include <asm/fixmap.h> 36#include <asm/fixmap.h>
@@ -139,7 +140,9 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
139 /* If the operation is a nop, then nop the callsite */ 140 /* If the operation is a nop, then nop the callsite */
140 ret = paravirt_patch_nop(); 141 ret = paravirt_patch_nop();
141 else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) || 142 else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) ||
142 type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_syscall_ret)) 143 type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit) ||
144 type == PARAVIRT_PATCH(pv_cpu_ops.usergs_sysret32) ||
145 type == PARAVIRT_PATCH(pv_cpu_ops.usergs_sysret64))
143 /* If operation requires a jmp, then jmp */ 146 /* If operation requires a jmp, then jmp */
144 ret = paravirt_patch_jmp(insnbuf, opfunc, addr, len); 147 ret = paravirt_patch_jmp(insnbuf, opfunc, addr, len);
145 else 148 else
@@ -190,7 +193,9 @@ static void native_flush_tlb_single(unsigned long addr)
190 193
191/* These are in entry.S */ 194/* These are in entry.S */
192extern void native_iret(void); 195extern void native_iret(void);
193extern void native_irq_enable_syscall_ret(void); 196extern void native_irq_enable_sysexit(void);
197extern void native_usergs_sysret32(void);
198extern void native_usergs_sysret64(void);
194 199
195static int __init print_banner(void) 200static int __init print_banner(void)
196{ 201{
@@ -280,7 +285,7 @@ struct pv_time_ops pv_time_ops = {
280 .get_wallclock = native_get_wallclock, 285 .get_wallclock = native_get_wallclock,
281 .set_wallclock = native_set_wallclock, 286 .set_wallclock = native_set_wallclock,
282 .sched_clock = native_sched_clock, 287 .sched_clock = native_sched_clock,
283 .get_cpu_khz = native_calculate_cpu_khz, 288 .get_tsc_khz = native_calibrate_tsc,
284}; 289};
285 290
286struct pv_irq_ops pv_irq_ops = { 291struct pv_irq_ops pv_irq_ops = {
@@ -291,6 +296,9 @@ struct pv_irq_ops pv_irq_ops = {
291 .irq_enable = native_irq_enable, 296 .irq_enable = native_irq_enable,
292 .safe_halt = native_safe_halt, 297 .safe_halt = native_safe_halt,
293 .halt = native_halt, 298 .halt = native_halt,
299#ifdef CONFIG_X86_64
300 .adjust_exception_frame = paravirt_nop,
301#endif
294}; 302};
295 303
296struct pv_cpu_ops pv_cpu_ops = { 304struct pv_cpu_ops pv_cpu_ops = {
@@ -321,12 +329,23 @@ struct pv_cpu_ops pv_cpu_ops = {
321 .store_idt = native_store_idt, 329 .store_idt = native_store_idt,
322 .store_tr = native_store_tr, 330 .store_tr = native_store_tr,
323 .load_tls = native_load_tls, 331 .load_tls = native_load_tls,
332#ifdef CONFIG_X86_64
333 .load_gs_index = native_load_gs_index,
334#endif
324 .write_ldt_entry = native_write_ldt_entry, 335 .write_ldt_entry = native_write_ldt_entry,
325 .write_gdt_entry = native_write_gdt_entry, 336 .write_gdt_entry = native_write_gdt_entry,
326 .write_idt_entry = native_write_idt_entry, 337 .write_idt_entry = native_write_idt_entry,
327 .load_sp0 = native_load_sp0, 338 .load_sp0 = native_load_sp0,
328 339
329 .irq_enable_syscall_ret = native_irq_enable_syscall_ret, 340#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
341 .irq_enable_sysexit = native_irq_enable_sysexit,
342#endif
343#ifdef CONFIG_X86_64
344#ifdef CONFIG_IA32_EMULATION
345 .usergs_sysret32 = native_usergs_sysret32,
346#endif
347 .usergs_sysret64 = native_usergs_sysret64,
348#endif
330 .iret = native_iret, 349 .iret = native_iret,
331 .swapgs = native_swapgs, 350 .swapgs = native_swapgs,
332 351
@@ -366,6 +385,9 @@ struct pv_mmu_ops pv_mmu_ops = {
366 .flush_tlb_single = native_flush_tlb_single, 385 .flush_tlb_single = native_flush_tlb_single,
367 .flush_tlb_others = native_flush_tlb_others, 386 .flush_tlb_others = native_flush_tlb_others,
368 387
388 .pgd_alloc = __paravirt_pgd_alloc,
389 .pgd_free = paravirt_nop,
390
369 .alloc_pte = paravirt_nop, 391 .alloc_pte = paravirt_nop,
370 .alloc_pmd = paravirt_nop, 392 .alloc_pmd = paravirt_nop,
371 .alloc_pmd_clone = paravirt_nop, 393 .alloc_pmd_clone = paravirt_nop,
@@ -380,6 +402,9 @@ struct pv_mmu_ops pv_mmu_ops = {
380 .pte_update = paravirt_nop, 402 .pte_update = paravirt_nop,
381 .pte_update_defer = paravirt_nop, 403 .pte_update_defer = paravirt_nop,
382 404
405 .ptep_modify_prot_start = __ptep_modify_prot_start,
406 .ptep_modify_prot_commit = __ptep_modify_prot_commit,
407
383#ifdef CONFIG_HIGHPTE 408#ifdef CONFIG_HIGHPTE
384 .kmap_atomic_pte = kmap_atomic, 409 .kmap_atomic_pte = kmap_atomic,
385#endif 410#endif
@@ -403,6 +428,7 @@ struct pv_mmu_ops pv_mmu_ops = {
403#endif /* PAGETABLE_LEVELS >= 3 */ 428#endif /* PAGETABLE_LEVELS >= 3 */
404 429
405 .pte_val = native_pte_val, 430 .pte_val = native_pte_val,
431 .pte_flags = native_pte_val,
406 .pgd_val = native_pgd_val, 432 .pgd_val = native_pgd_val,
407 433
408 .make_pte = native_make_pte, 434 .make_pte = native_make_pte,
@@ -416,6 +442,8 @@ struct pv_mmu_ops pv_mmu_ops = {
416 .enter = paravirt_nop, 442 .enter = paravirt_nop,
417 .leave = paravirt_nop, 443 .leave = paravirt_nop,
418 }, 444 },
445
446 .set_fixmap = native_set_fixmap,
419}; 447};
420 448
421EXPORT_SYMBOL_GPL(pv_time_ops); 449EXPORT_SYMBOL_GPL(pv_time_ops);
diff --git a/arch/x86/kernel/paravirt_patch_32.c b/arch/x86/kernel/paravirt_patch_32.c
index 82fc5fcab4f4..58262218781b 100644
--- a/arch/x86/kernel/paravirt_patch_32.c
+++ b/arch/x86/kernel/paravirt_patch_32.c
@@ -5,7 +5,7 @@ DEF_NATIVE(pv_irq_ops, irq_enable, "sti");
5DEF_NATIVE(pv_irq_ops, restore_fl, "push %eax; popf"); 5DEF_NATIVE(pv_irq_ops, restore_fl, "push %eax; popf");
6DEF_NATIVE(pv_irq_ops, save_fl, "pushf; pop %eax"); 6DEF_NATIVE(pv_irq_ops, save_fl, "pushf; pop %eax");
7DEF_NATIVE(pv_cpu_ops, iret, "iret"); 7DEF_NATIVE(pv_cpu_ops, iret, "iret");
8DEF_NATIVE(pv_cpu_ops, irq_enable_syscall_ret, "sti; sysexit"); 8DEF_NATIVE(pv_cpu_ops, irq_enable_sysexit, "sti; sysexit");
9DEF_NATIVE(pv_mmu_ops, read_cr2, "mov %cr2, %eax"); 9DEF_NATIVE(pv_mmu_ops, read_cr2, "mov %cr2, %eax");
10DEF_NATIVE(pv_mmu_ops, write_cr3, "mov %eax, %cr3"); 10DEF_NATIVE(pv_mmu_ops, write_cr3, "mov %eax, %cr3");
11DEF_NATIVE(pv_mmu_ops, read_cr3, "mov %cr3, %eax"); 11DEF_NATIVE(pv_mmu_ops, read_cr3, "mov %cr3, %eax");
@@ -29,7 +29,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
29 PATCH_SITE(pv_irq_ops, restore_fl); 29 PATCH_SITE(pv_irq_ops, restore_fl);
30 PATCH_SITE(pv_irq_ops, save_fl); 30 PATCH_SITE(pv_irq_ops, save_fl);
31 PATCH_SITE(pv_cpu_ops, iret); 31 PATCH_SITE(pv_cpu_ops, iret);
32 PATCH_SITE(pv_cpu_ops, irq_enable_syscall_ret); 32 PATCH_SITE(pv_cpu_ops, irq_enable_sysexit);
33 PATCH_SITE(pv_mmu_ops, read_cr2); 33 PATCH_SITE(pv_mmu_ops, read_cr2);
34 PATCH_SITE(pv_mmu_ops, read_cr3); 34 PATCH_SITE(pv_mmu_ops, read_cr3);
35 PATCH_SITE(pv_mmu_ops, write_cr3); 35 PATCH_SITE(pv_mmu_ops, write_cr3);
diff --git a/arch/x86/kernel/paravirt_patch_64.c b/arch/x86/kernel/paravirt_patch_64.c
index 7d904e138d7e..061d01df9ae6 100644
--- a/arch/x86/kernel/paravirt_patch_64.c
+++ b/arch/x86/kernel/paravirt_patch_64.c
@@ -14,8 +14,9 @@ DEF_NATIVE(pv_mmu_ops, flush_tlb_single, "invlpg (%rdi)");
14DEF_NATIVE(pv_cpu_ops, clts, "clts"); 14DEF_NATIVE(pv_cpu_ops, clts, "clts");
15DEF_NATIVE(pv_cpu_ops, wbinvd, "wbinvd"); 15DEF_NATIVE(pv_cpu_ops, wbinvd, "wbinvd");
16 16
17/* the three commands give us more control to how to return from a syscall */ 17DEF_NATIVE(pv_cpu_ops, irq_enable_sysexit, "swapgs; sti; sysexit");
18DEF_NATIVE(pv_cpu_ops, irq_enable_syscall_ret, "movq %gs:" __stringify(pda_oldrsp) ", %rsp; swapgs; sysretq;"); 18DEF_NATIVE(pv_cpu_ops, usergs_sysret64, "swapgs; sysretq");
19DEF_NATIVE(pv_cpu_ops, usergs_sysret32, "swapgs; sysretl");
19DEF_NATIVE(pv_cpu_ops, swapgs, "swapgs"); 20DEF_NATIVE(pv_cpu_ops, swapgs, "swapgs");
20 21
21unsigned native_patch(u8 type, u16 clobbers, void *ibuf, 22unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
@@ -35,7 +36,9 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
35 PATCH_SITE(pv_irq_ops, irq_enable); 36 PATCH_SITE(pv_irq_ops, irq_enable);
36 PATCH_SITE(pv_irq_ops, irq_disable); 37 PATCH_SITE(pv_irq_ops, irq_disable);
37 PATCH_SITE(pv_cpu_ops, iret); 38 PATCH_SITE(pv_cpu_ops, iret);
38 PATCH_SITE(pv_cpu_ops, irq_enable_syscall_ret); 39 PATCH_SITE(pv_cpu_ops, irq_enable_sysexit);
40 PATCH_SITE(pv_cpu_ops, usergs_sysret32);
41 PATCH_SITE(pv_cpu_ops, usergs_sysret64);
39 PATCH_SITE(pv_cpu_ops, swapgs); 42 PATCH_SITE(pv_cpu_ops, swapgs);
40 PATCH_SITE(pv_mmu_ops, read_cr2); 43 PATCH_SITE(pv_mmu_ops, read_cr2);
41 PATCH_SITE(pv_mmu_ops, read_cr3); 44 PATCH_SITE(pv_mmu_ops, read_cr3);
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index e28ec497e142..6959b5c45df4 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1394,7 +1394,7 @@ void __init detect_calgary(void)
1394 return; 1394 return;
1395 } 1395 }
1396 1396
1397 specified_table_size = determine_tce_table_size(end_pfn * PAGE_SIZE); 1397 specified_table_size = determine_tce_table_size(max_pfn * PAGE_SIZE);
1398 1398
1399 for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) { 1399 for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
1400 struct calgary_bus_info *info = &bus_info[bus]; 1400 struct calgary_bus_info *info = &bus_info[bus];
@@ -1459,7 +1459,7 @@ int __init calgary_iommu_init(void)
1459 if (ret) { 1459 if (ret) {
1460 printk(KERN_ERR "PCI-DMA: Calgary init failed %d, " 1460 printk(KERN_ERR "PCI-DMA: Calgary init failed %d, "
1461 "falling back to no_iommu\n", ret); 1461 "falling back to no_iommu\n", ret);
1462 if (end_pfn > MAX_DMA32_PFN) 1462 if (max_pfn > MAX_DMA32_PFN)
1463 printk(KERN_ERR "WARNING more than 4GB of memory, " 1463 printk(KERN_ERR "WARNING more than 4GB of memory, "
1464 "32bit PCI may malfunction.\n"); 1464 "32bit PCI may malfunction.\n");
1465 return ret; 1465 return ret;
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index dc00a1331ace..8467ec2320f1 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -7,6 +7,7 @@
7#include <asm/dma.h> 7#include <asm/dma.h>
8#include <asm/gart.h> 8#include <asm/gart.h>
9#include <asm/calgary.h> 9#include <asm/calgary.h>
10#include <asm/amd_iommu.h>
10 11
11int forbid_dac __read_mostly; 12int forbid_dac __read_mostly;
12EXPORT_SYMBOL(forbid_dac); 13EXPORT_SYMBOL(forbid_dac);
@@ -74,13 +75,17 @@ early_param("dma32_size", parse_dma32_size_opt);
74void __init dma32_reserve_bootmem(void) 75void __init dma32_reserve_bootmem(void)
75{ 76{
76 unsigned long size, align; 77 unsigned long size, align;
77 if (end_pfn <= MAX_DMA32_PFN) 78 if (max_pfn <= MAX_DMA32_PFN)
78 return; 79 return;
79 80
81 /*
82 * check aperture_64.c allocate_aperture() for reason about
83 * using 512M as goal
84 */
80 align = 64ULL<<20; 85 align = 64ULL<<20;
81 size = round_up(dma32_bootmem_size, align); 86 size = round_up(dma32_bootmem_size, align);
82 dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align, 87 dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align,
83 __pa(MAX_DMA_ADDRESS)); 88 512ULL<<20);
84 if (dma32_bootmem_ptr) 89 if (dma32_bootmem_ptr)
85 dma32_bootmem_size = size; 90 dma32_bootmem_size = size;
86 else 91 else
@@ -88,17 +93,14 @@ void __init dma32_reserve_bootmem(void)
88} 93}
89static void __init dma32_free_bootmem(void) 94static void __init dma32_free_bootmem(void)
90{ 95{
91 int node;
92 96
93 if (end_pfn <= MAX_DMA32_PFN) 97 if (max_pfn <= MAX_DMA32_PFN)
94 return; 98 return;
95 99
96 if (!dma32_bootmem_ptr) 100 if (!dma32_bootmem_ptr)
97 return; 101 return;
98 102
99 for_each_online_node(node) 103 free_bootmem(__pa(dma32_bootmem_ptr), dma32_bootmem_size);
100 free_bootmem_node(NODE_DATA(node), __pa(dma32_bootmem_ptr),
101 dma32_bootmem_size);
102 104
103 dma32_bootmem_ptr = NULL; 105 dma32_bootmem_ptr = NULL;
104 dma32_bootmem_size = 0; 106 dma32_bootmem_size = 0;
@@ -122,6 +124,8 @@ void __init pci_iommu_alloc(void)
122 124
123 detect_intel_iommu(); 125 detect_intel_iommu();
124 126
127 amd_iommu_detect();
128
125#ifdef CONFIG_SWIOTLB 129#ifdef CONFIG_SWIOTLB
126 pci_swiotlb_init(); 130 pci_swiotlb_init();
127#endif 131#endif
@@ -357,7 +361,7 @@ int dma_supported(struct device *dev, u64 mask)
357EXPORT_SYMBOL(dma_supported); 361EXPORT_SYMBOL(dma_supported);
358 362
359/* Allocate DMA memory on node near device */ 363/* Allocate DMA memory on node near device */
360noinline struct page * 364static noinline struct page *
361dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order) 365dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
362{ 366{
363 int node; 367 int node;
@@ -502,6 +506,8 @@ static int __init pci_iommu_init(void)
502 506
503 intel_iommu_init(); 507 intel_iommu_init();
504 508
509 amd_iommu_init();
510
505#ifdef CONFIG_GART_IOMMU 511#ifdef CONFIG_GART_IOMMU
506 gart_iommu_init(); 512 gart_iommu_init();
507#endif 513#endif
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index aa8ec928caa8..c3fe78406d18 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -104,7 +104,6 @@ static unsigned long alloc_iommu(struct device *dev, int size)
104 size, base_index, boundary_size, 0); 104 size, base_index, boundary_size, 0);
105 } 105 }
106 if (offset != -1) { 106 if (offset != -1) {
107 set_bit_string(iommu_gart_bitmap, offset, size);
108 next_bit = offset+size; 107 next_bit = offset+size;
109 if (next_bit >= iommu_pages) { 108 if (next_bit >= iommu_pages) {
110 next_bit = 0; 109 next_bit = 0;
@@ -534,8 +533,8 @@ static __init unsigned read_aperture(struct pci_dev *dev, u32 *size)
534 unsigned aper_size = 0, aper_base_32, aper_order; 533 unsigned aper_size = 0, aper_base_32, aper_order;
535 u64 aper_base; 534 u64 aper_base;
536 535
537 pci_read_config_dword(dev, 0x94, &aper_base_32); 536 pci_read_config_dword(dev, AMD64_GARTAPERTUREBASE, &aper_base_32);
538 pci_read_config_dword(dev, 0x90, &aper_order); 537 pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &aper_order);
539 aper_order = (aper_order >> 1) & 7; 538 aper_order = (aper_order >> 1) & 7;
540 539
541 aper_base = aper_base_32 & 0x7fff; 540 aper_base = aper_base_32 & 0x7fff;
@@ -549,14 +548,63 @@ static __init unsigned read_aperture(struct pci_dev *dev, u32 *size)
549 return aper_base; 548 return aper_base;
550} 549}
551 550
551static void enable_gart_translations(void)
552{
553 int i;
554
555 for (i = 0; i < num_k8_northbridges; i++) {
556 struct pci_dev *dev = k8_northbridges[i];
557
558 enable_gart_translation(dev, __pa(agp_gatt_table));
559 }
560}
561
562/*
563 * If fix_up_north_bridges is set, the north bridges have to be fixed up on
564 * resume in the same way as they are handled in gart_iommu_hole_init().
565 */
566static bool fix_up_north_bridges;
567static u32 aperture_order;
568static u32 aperture_alloc;
569
570void set_up_gart_resume(u32 aper_order, u32 aper_alloc)
571{
572 fix_up_north_bridges = true;
573 aperture_order = aper_order;
574 aperture_alloc = aper_alloc;
575}
576
552static int gart_resume(struct sys_device *dev) 577static int gart_resume(struct sys_device *dev)
553{ 578{
579 printk(KERN_INFO "PCI-DMA: Resuming GART IOMMU\n");
580
581 if (fix_up_north_bridges) {
582 int i;
583
584 printk(KERN_INFO "PCI-DMA: Restoring GART aperture settings\n");
585
586 for (i = 0; i < num_k8_northbridges; i++) {
587 struct pci_dev *dev = k8_northbridges[i];
588
589 /*
590 * Don't enable translations just yet. That is the next
591 * step. Restore the pre-suspend aperture settings.
592 */
593 pci_write_config_dword(dev, AMD64_GARTAPERTURECTL,
594 aperture_order << 1);
595 pci_write_config_dword(dev, AMD64_GARTAPERTUREBASE,
596 aperture_alloc >> 25);
597 }
598 }
599
600 enable_gart_translations();
601
554 return 0; 602 return 0;
555} 603}
556 604
557static int gart_suspend(struct sys_device *dev, pm_message_t state) 605static int gart_suspend(struct sys_device *dev, pm_message_t state)
558{ 606{
559 return -EINVAL; 607 return 0;
560} 608}
561 609
562static struct sysdev_class gart_sysdev_class = { 610static struct sysdev_class gart_sysdev_class = {
@@ -582,6 +630,7 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
582 struct pci_dev *dev; 630 struct pci_dev *dev;
583 void *gatt; 631 void *gatt;
584 int i, error; 632 int i, error;
633 unsigned long start_pfn, end_pfn;
585 634
586 printk(KERN_INFO "PCI-DMA: Disabling AGP.\n"); 635 printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
587 aper_size = aper_base = info->aper_size = 0; 636 aper_size = aper_base = info->aper_size = 0;
@@ -614,31 +663,25 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
614 memset(gatt, 0, gatt_size); 663 memset(gatt, 0, gatt_size);
615 agp_gatt_table = gatt; 664 agp_gatt_table = gatt;
616 665
617 for (i = 0; i < num_k8_northbridges; i++) { 666 enable_gart_translations();
618 u32 gatt_reg;
619 u32 ctl;
620
621 dev = k8_northbridges[i];
622 gatt_reg = __pa(gatt) >> 12;
623 gatt_reg <<= 4;
624 pci_write_config_dword(dev, 0x98, gatt_reg);
625 pci_read_config_dword(dev, 0x90, &ctl);
626
627 ctl |= 1;
628 ctl &= ~((1<<4) | (1<<5));
629
630 pci_write_config_dword(dev, 0x90, ctl);
631 }
632 667
633 error = sysdev_class_register(&gart_sysdev_class); 668 error = sysdev_class_register(&gart_sysdev_class);
634 if (!error) 669 if (!error)
635 error = sysdev_register(&device_gart); 670 error = sysdev_register(&device_gart);
636 if (error) 671 if (error)
637 panic("Could not register gart_sysdev -- would corrupt data on next suspend"); 672 panic("Could not register gart_sysdev -- would corrupt data on next suspend");
673
638 flush_gart(); 674 flush_gart();
639 675
640 printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n", 676 printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",
641 aper_base, aper_size>>10); 677 aper_base, aper_size>>10);
678
679 /* need to map that range */
680 end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
681 if (end_pfn > max_low_pfn_mapped) {
682 start_pfn = (aper_base>>PAGE_SHIFT);
683 init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
684 }
642 return 0; 685 return 0;
643 686
644 nommu: 687 nommu:
@@ -677,11 +720,11 @@ void gart_iommu_shutdown(void)
677 u32 ctl; 720 u32 ctl;
678 721
679 dev = k8_northbridges[i]; 722 dev = k8_northbridges[i];
680 pci_read_config_dword(dev, 0x90, &ctl); 723 pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl);
681 724
682 ctl &= ~1; 725 ctl &= ~GARTEN;
683 726
684 pci_write_config_dword(dev, 0x90, ctl); 727 pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
685 } 728 }
686} 729}
687 730
@@ -716,10 +759,10 @@ void __init gart_iommu_init(void)
716 return; 759 return;
717 760
718 if (no_iommu || 761 if (no_iommu ||
719 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 762 (!force_iommu && max_pfn <= MAX_DMA32_PFN) ||
720 !gart_iommu_aperture || 763 !gart_iommu_aperture ||
721 (no_agp && init_k8_gatt(&info) < 0)) { 764 (no_agp && init_k8_gatt(&info) < 0)) {
722 if (end_pfn > MAX_DMA32_PFN) { 765 if (max_pfn > MAX_DMA32_PFN) {
723 printk(KERN_WARNING "More than 4GB of memory " 766 printk(KERN_WARNING "More than 4GB of memory "
724 "but GART IOMMU not available.\n" 767 "but GART IOMMU not available.\n"
725 KERN_WARNING "falling back to iommu=soft.\n"); 768 KERN_WARNING "falling back to iommu=soft.\n");
@@ -788,10 +831,10 @@ void __init gart_iommu_init(void)
788 wbinvd(); 831 wbinvd();
789 832
790 /* 833 /*
791 * Try to workaround a bug (thanks to BenH) 834 * Try to workaround a bug (thanks to BenH):
792 * Set unmapped entries to a scratch page instead of 0. 835 * Set unmapped entries to a scratch page instead of 0.
793 * Any prefetches that hit unmapped entries won't get an bus abort 836 * Any prefetches that hit unmapped entries won't get an bus abort
794 * then. 837 * then. (P2P bridge may be prefetching on DMA reads).
795 */ 838 */
796 scratch = get_zeroed_page(GFP_KERNEL); 839 scratch = get_zeroed_page(GFP_KERNEL);
797 if (!scratch) 840 if (!scratch)
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index 490da7f4b8d0..82299cd1d04d 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -38,7 +38,7 @@ const struct dma_mapping_ops swiotlb_dma_ops = {
38void __init pci_swiotlb_init(void) 38void __init pci_swiotlb_init(void)
39{ 39{
40 /* don't initialize swiotlb if iommu=off (no_iommu=1) */ 40 /* don't initialize swiotlb if iommu=off (no_iommu=1) */
41 if (!iommu_detected && !no_iommu && end_pfn > MAX_DMA32_PFN) 41 if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN)
42 swiotlb = 1; 42 swiotlb = 1;
43 if (swiotlb_force) 43 if (swiotlb_force)
44 swiotlb = 1; 44 swiotlb = 1;
diff --git a/arch/x86/kernel/probe_roms_32.c b/arch/x86/kernel/probe_roms_32.c
new file mode 100644
index 000000000000..675a48c404a5
--- /dev/null
+++ b/arch/x86/kernel/probe_roms_32.c
@@ -0,0 +1,166 @@
1#include <linux/sched.h>
2#include <linux/mm.h>
3#include <linux/uaccess.h>
4#include <linux/mmzone.h>
5#include <linux/ioport.h>
6#include <linux/seq_file.h>
7#include <linux/console.h>
8#include <linux/init.h>
9#include <linux/edd.h>
10#include <linux/dmi.h>
11#include <linux/pfn.h>
12#include <linux/pci.h>
13#include <asm/pci-direct.h>
14
15
16#include <asm/e820.h>
17#include <asm/mmzone.h>
18#include <asm/setup.h>
19#include <asm/sections.h>
20#include <asm/io.h>
21#include <setup_arch.h>
22
23static struct resource system_rom_resource = {
24 .name = "System ROM",
25 .start = 0xf0000,
26 .end = 0xfffff,
27 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
28};
29
30static struct resource extension_rom_resource = {
31 .name = "Extension ROM",
32 .start = 0xe0000,
33 .end = 0xeffff,
34 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
35};
36
37static struct resource adapter_rom_resources[] = { {
38 .name = "Adapter ROM",
39 .start = 0xc8000,
40 .end = 0,
41 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
42}, {
43 .name = "Adapter ROM",
44 .start = 0,
45 .end = 0,
46 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
47}, {
48 .name = "Adapter ROM",
49 .start = 0,
50 .end = 0,
51 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
52}, {
53 .name = "Adapter ROM",
54 .start = 0,
55 .end = 0,
56 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
57}, {
58 .name = "Adapter ROM",
59 .start = 0,
60 .end = 0,
61 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
62}, {
63 .name = "Adapter ROM",
64 .start = 0,
65 .end = 0,
66 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
67} };
68
69static struct resource video_rom_resource = {
70 .name = "Video ROM",
71 .start = 0xc0000,
72 .end = 0xc7fff,
73 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
74};
75
76#define ROMSIGNATURE 0xaa55
77
78static int __init romsignature(const unsigned char *rom)
79{
80 const unsigned short * const ptr = (const unsigned short *)rom;
81 unsigned short sig;
82
83 return probe_kernel_address(ptr, sig) == 0 && sig == ROMSIGNATURE;
84}
85
86static int __init romchecksum(const unsigned char *rom, unsigned long length)
87{
88 unsigned char sum, c;
89
90 for (sum = 0; length && probe_kernel_address(rom++, c) == 0; length--)
91 sum += c;
92 return !length && !sum;
93}
94
95void __init probe_roms(void)
96{
97 const unsigned char *rom;
98 unsigned long start, length, upper;
99 unsigned char c;
100 int i;
101
102 /* video rom */
103 upper = adapter_rom_resources[0].start;
104 for (start = video_rom_resource.start; start < upper; start += 2048) {
105 rom = isa_bus_to_virt(start);
106 if (!romsignature(rom))
107 continue;
108
109 video_rom_resource.start = start;
110
111 if (probe_kernel_address(rom + 2, c) != 0)
112 continue;
113
114 /* 0 < length <= 0x7f * 512, historically */
115 length = c * 512;
116
117 /* if checksum okay, trust length byte */
118 if (length && romchecksum(rom, length))
119 video_rom_resource.end = start + length - 1;
120
121 request_resource(&iomem_resource, &video_rom_resource);
122 break;
123 }
124
125 start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
126 if (start < upper)
127 start = upper;
128
129 /* system rom */
130 request_resource(&iomem_resource, &system_rom_resource);
131 upper = system_rom_resource.start;
132
133 /* check for extension rom (ignore length byte!) */
134 rom = isa_bus_to_virt(extension_rom_resource.start);
135 if (romsignature(rom)) {
136 length = extension_rom_resource.end - extension_rom_resource.start + 1;
137 if (romchecksum(rom, length)) {
138 request_resource(&iomem_resource, &extension_rom_resource);
139 upper = extension_rom_resource.start;
140 }
141 }
142
143 /* check for adapter roms on 2k boundaries */
144 for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) {
145 rom = isa_bus_to_virt(start);
146 if (!romsignature(rom))
147 continue;
148
149 if (probe_kernel_address(rom + 2, c) != 0)
150 continue;
151
152 /* 0 < length <= 0x7f * 512, historically */
153 length = c * 512;
154
155 /* but accept any length that fits if checksum okay */
156 if (!length || start + length > upper || !romchecksum(rom, length))
157 continue;
158
159 adapter_rom_resources[i].start = start;
160 adapter_rom_resources[i].end = start + length - 1;
161 request_resource(&iomem_resource, &adapter_rom_resources[i]);
162
163 start = adapter_rom_resources[i++].end & ~2047UL;
164 }
165}
166
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index ba370dc8685b..4061d63aabe7 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -6,6 +6,7 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/pm.h> 8#include <linux/pm.h>
9#include <linux/clockchips.h>
9 10
10struct kmem_cache *task_xstate_cachep; 11struct kmem_cache *task_xstate_cachep;
11 12
@@ -45,6 +46,76 @@ void arch_task_cache_init(void)
45 SLAB_PANIC, NULL); 46 SLAB_PANIC, NULL);
46} 47}
47 48
49/*
50 * Idle related variables and functions
51 */
52unsigned long boot_option_idle_override = 0;
53EXPORT_SYMBOL(boot_option_idle_override);
54
55/*
56 * Powermanagement idle function, if any..
57 */
58void (*pm_idle)(void);
59EXPORT_SYMBOL(pm_idle);
60
61#ifdef CONFIG_X86_32
62/*
63 * This halt magic was a workaround for ancient floppy DMA
64 * wreckage. It should be safe to remove.
65 */
66static int hlt_counter;
67void disable_hlt(void)
68{
69 hlt_counter++;
70}
71EXPORT_SYMBOL(disable_hlt);
72
73void enable_hlt(void)
74{
75 hlt_counter--;
76}
77EXPORT_SYMBOL(enable_hlt);
78
79static inline int hlt_use_halt(void)
80{
81 return (!hlt_counter && boot_cpu_data.hlt_works_ok);
82}
83#else
84static inline int hlt_use_halt(void)
85{
86 return 1;
87}
88#endif
89
90/*
91 * We use this if we don't have any better
92 * idle routine..
93 */
94void default_idle(void)
95{
96 if (hlt_use_halt()) {
97 current_thread_info()->status &= ~TS_POLLING;
98 /*
99 * TS_POLLING-cleared state must be visible before we
100 * test NEED_RESCHED:
101 */
102 smp_mb();
103
104 if (!need_resched())
105 safe_halt(); /* enables interrupts racelessly */
106 else
107 local_irq_enable();
108 current_thread_info()->status |= TS_POLLING;
109 } else {
110 local_irq_enable();
111 /* loop is done by the caller */
112 cpu_relax();
113 }
114}
115#ifdef CONFIG_APM_MODULE
116EXPORT_SYMBOL(default_idle);
117#endif
118
48static void do_nothing(void *unused) 119static void do_nothing(void *unused)
49{ 120{
50} 121}
@@ -122,44 +193,129 @@ static void poll_idle(void)
122 * 193 *
123 * idle=mwait overrides this decision and forces the usage of mwait. 194 * idle=mwait overrides this decision and forces the usage of mwait.
124 */ 195 */
196
197#define MWAIT_INFO 0x05
198#define MWAIT_ECX_EXTENDED_INFO 0x01
199#define MWAIT_EDX_C1 0xf0
200
125static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c) 201static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
126{ 202{
203 u32 eax, ebx, ecx, edx;
204
127 if (force_mwait) 205 if (force_mwait)
128 return 1; 206 return 1;
129 207
130 if (c->x86_vendor == X86_VENDOR_AMD) { 208 if (c->cpuid_level < MWAIT_INFO)
131 switch(c->x86) { 209 return 0;
132 case 0x10: 210
133 case 0x11: 211 cpuid(MWAIT_INFO, &eax, &ebx, &ecx, &edx);
134 return 0; 212 /* Check, whether EDX has extended info about MWAIT */
135 } 213 if (!(ecx & MWAIT_ECX_EXTENDED_INFO))
136 } 214 return 1;
215
216 /*
217 * edx enumeratios MONITOR/MWAIT extensions. Check, whether
218 * C1 supports MWAIT
219 */
220 return (edx & MWAIT_EDX_C1);
221}
222
223/*
224 * Check for AMD CPUs, which have potentially C1E support
225 */
226static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
227{
228 if (c->x86_vendor != X86_VENDOR_AMD)
229 return 0;
230
231 if (c->x86 < 0x0F)
232 return 0;
233
234 /* Family 0x0f models < rev F do not have C1E */
235 if (c->x86 == 0x0f && c->x86_model < 0x40)
236 return 0;
237
137 return 1; 238 return 1;
138} 239}
139 240
140void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 241/*
242 * C1E aware idle routine. We check for C1E active in the interrupt
243 * pending message MSR. If we detect C1E, then we handle it the same
244 * way as C3 power states (local apic timer and TSC stop)
245 */
246static void c1e_idle(void)
141{ 247{
142 static int selected; 248 static cpumask_t c1e_mask = CPU_MASK_NONE;
249 static int c1e_detected;
143 250
144 if (selected) 251 if (need_resched())
145 return; 252 return;
253
254 if (!c1e_detected) {
255 u32 lo, hi;
256
257 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
258 if (lo & K8_INTP_C1E_ACTIVE_MASK) {
259 c1e_detected = 1;
260 mark_tsc_unstable("TSC halt in C1E");
261 printk(KERN_INFO "System has C1E enabled\n");
262 }
263 }
264
265 if (c1e_detected) {
266 int cpu = smp_processor_id();
267
268 if (!cpu_isset(cpu, c1e_mask)) {
269 cpu_set(cpu, c1e_mask);
270 /*
271 * Force broadcast so ACPI can not interfere. Needs
272 * to run with interrupts enabled as it uses
273 * smp_function_call.
274 */
275 local_irq_enable();
276 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
277 &cpu);
278 printk(KERN_INFO "Switch to broadcast mode on CPU%d\n",
279 cpu);
280 local_irq_disable();
281 }
282 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
283
284 default_idle();
285
286 /*
287 * The switch back from broadcast mode needs to be
288 * called with interrupts disabled.
289 */
290 local_irq_disable();
291 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
292 local_irq_enable();
293 } else
294 default_idle();
295}
296
297void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
298{
146#ifdef CONFIG_X86_SMP 299#ifdef CONFIG_X86_SMP
147 if (pm_idle == poll_idle && smp_num_siblings > 1) { 300 if (pm_idle == poll_idle && smp_num_siblings > 1) {
148 printk(KERN_WARNING "WARNING: polling idle and HT enabled," 301 printk(KERN_WARNING "WARNING: polling idle and HT enabled,"
149 " performance may degrade.\n"); 302 " performance may degrade.\n");
150 } 303 }
151#endif 304#endif
305 if (pm_idle)
306 return;
307
152 if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) { 308 if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) {
153 /* 309 /*
154 * Skip, if setup has overridden idle.
155 * One CPU supports mwait => All CPUs supports mwait 310 * One CPU supports mwait => All CPUs supports mwait
156 */ 311 */
157 if (!pm_idle) { 312 printk(KERN_INFO "using mwait in idle threads.\n");
158 printk(KERN_INFO "using mwait in idle threads.\n"); 313 pm_idle = mwait_idle;
159 pm_idle = mwait_idle; 314 } else if (check_c1e_idle(c)) {
160 } 315 printk(KERN_INFO "using C1E aware idle routine\n");
161 } 316 pm_idle = c1e_idle;
162 selected = 1; 317 } else
318 pm_idle = default_idle;
163} 319}
164 320
165static int __init idle_setup(char *str) 321static int __init idle_setup(char *str)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index e2db9ac5c61c..0c3927accb00 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -58,11 +58,6 @@
58 58
59asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 59asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
60 60
61static int hlt_counter;
62
63unsigned long boot_option_idle_override = 0;
64EXPORT_SYMBOL(boot_option_idle_override);
65
66DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; 61DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
67EXPORT_PER_CPU_SYMBOL(current_task); 62EXPORT_PER_CPU_SYMBOL(current_task);
68 63
@@ -77,57 +72,24 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
77 return ((unsigned long *)tsk->thread.sp)[3]; 72 return ((unsigned long *)tsk->thread.sp)[3];
78} 73}
79 74
80/* 75#ifdef CONFIG_HOTPLUG_CPU
81 * Powermanagement idle function, if any.. 76#include <asm/nmi.h>
82 */
83void (*pm_idle)(void);
84EXPORT_SYMBOL(pm_idle);
85 77
86void disable_hlt(void) 78static void cpu_exit_clear(void)
87{ 79{
88 hlt_counter++; 80 int cpu = raw_smp_processor_id();
89}
90 81
91EXPORT_SYMBOL(disable_hlt); 82 idle_task_exit();
92 83
93void enable_hlt(void) 84 cpu_uninit();
94{ 85 irq_ctx_exit(cpu);
95 hlt_counter--;
96}
97 86
98EXPORT_SYMBOL(enable_hlt); 87 cpu_clear(cpu, cpu_callout_map);
99 88 cpu_clear(cpu, cpu_callin_map);
100/*
101 * We use this if we don't have any better
102 * idle routine..
103 */
104void default_idle(void)
105{
106 if (!hlt_counter && boot_cpu_data.hlt_works_ok) {
107 current_thread_info()->status &= ~TS_POLLING;
108 /*
109 * TS_POLLING-cleared state must be visible before we
110 * test NEED_RESCHED:
111 */
112 smp_mb();
113 89
114 if (!need_resched()) 90 numa_remove_cpu(cpu);
115 safe_halt(); /* enables interrupts racelessly */
116 else
117 local_irq_enable();
118 current_thread_info()->status |= TS_POLLING;
119 } else {
120 local_irq_enable();
121 /* loop is done by the caller */
122 cpu_relax();
123 }
124} 91}
125#ifdef CONFIG_APM_MODULE
126EXPORT_SYMBOL(default_idle);
127#endif
128 92
129#ifdef CONFIG_HOTPLUG_CPU
130#include <asm/nmi.h>
131/* We don't actually take CPU down, just spin without interrupts. */ 93/* We don't actually take CPU down, just spin without interrupts. */
132static inline void play_dead(void) 94static inline void play_dead(void)
133{ 95{
@@ -168,24 +130,22 @@ void cpu_idle(void)
168 while (1) { 130 while (1) {
169 tick_nohz_stop_sched_tick(); 131 tick_nohz_stop_sched_tick();
170 while (!need_resched()) { 132 while (!need_resched()) {
171 void (*idle)(void);
172 133
173 check_pgt_cache(); 134 check_pgt_cache();
174 rmb(); 135 rmb();
175 idle = pm_idle;
176 136
177 if (rcu_pending(cpu)) 137 if (rcu_pending(cpu))
178 rcu_check_callbacks(cpu, 0); 138 rcu_check_callbacks(cpu, 0);
179 139
180 if (!idle)
181 idle = default_idle;
182
183 if (cpu_is_offline(cpu)) 140 if (cpu_is_offline(cpu))
184 play_dead(); 141 play_dead();
185 142
186 local_irq_disable(); 143 local_irq_disable();
187 __get_cpu_var(irq_stat).idle_timestamp = jiffies; 144 __get_cpu_var(irq_stat).idle_timestamp = jiffies;
188 idle(); 145 /* Don't trace irqs off for idle */
146 stop_critical_timings();
147 pm_idle();
148 start_critical_timings();
189 } 149 }
190 tick_nohz_restart_sched_tick(); 150 tick_nohz_restart_sched_tick();
191 preempt_enable_no_resched(); 151 preempt_enable_no_resched();
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index c6eb5c91e5f6..a8e53626ac9a 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -56,15 +56,6 @@ asmlinkage extern void ret_from_fork(void);
56 56
57unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; 57unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED;
58 58
59unsigned long boot_option_idle_override = 0;
60EXPORT_SYMBOL(boot_option_idle_override);
61
62/*
63 * Powermanagement idle function, if any..
64 */
65void (*pm_idle)(void);
66EXPORT_SYMBOL(pm_idle);
67
68static ATOMIC_NOTIFIER_HEAD(idle_notifier); 59static ATOMIC_NOTIFIER_HEAD(idle_notifier);
69 60
70void idle_notifier_register(struct notifier_block *n) 61void idle_notifier_register(struct notifier_block *n)
@@ -94,25 +85,6 @@ void exit_idle(void)
94 __exit_idle(); 85 __exit_idle();
95} 86}
96 87
97/*
98 * We use this if we don't have any better
99 * idle routine..
100 */
101void default_idle(void)
102{
103 current_thread_info()->status &= ~TS_POLLING;
104 /*
105 * TS_POLLING-cleared state must be visible before we
106 * test NEED_RESCHED:
107 */
108 smp_mb();
109 if (!need_resched())
110 safe_halt(); /* enables interrupts racelessly */
111 else
112 local_irq_enable();
113 current_thread_info()->status |= TS_POLLING;
114}
115
116#ifdef CONFIG_HOTPLUG_CPU 88#ifdef CONFIG_HOTPLUG_CPU
117DECLARE_PER_CPU(int, cpu_state); 89DECLARE_PER_CPU(int, cpu_state);
118 90
@@ -150,12 +122,9 @@ void cpu_idle(void)
150 while (1) { 122 while (1) {
151 tick_nohz_stop_sched_tick(); 123 tick_nohz_stop_sched_tick();
152 while (!need_resched()) { 124 while (!need_resched()) {
153 void (*idle)(void);
154 125
155 rmb(); 126 rmb();
156 idle = pm_idle; 127
157 if (!idle)
158 idle = default_idle;
159 if (cpu_is_offline(smp_processor_id())) 128 if (cpu_is_offline(smp_processor_id()))
160 play_dead(); 129 play_dead();
161 /* 130 /*
@@ -165,7 +134,10 @@ void cpu_idle(void)
165 */ 134 */
166 local_irq_disable(); 135 local_irq_disable();
167 enter_idle(); 136 enter_idle();
168 idle(); 137 /* Don't trace irqs off for idle */
138 stop_critical_timings();
139 pm_idle();
140 start_critical_timings();
169 /* In many cases the interrupt that ended idle 141 /* In many cases the interrupt that ended idle
170 has already called exit_idle. But some idle 142 has already called exit_idle. But some idle
171 loops can be woken up without interrupt. */ 143 loops can be woken up without interrupt. */
@@ -366,10 +338,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
366 p->thread.fs = me->thread.fs; 338 p->thread.fs = me->thread.fs;
367 p->thread.gs = me->thread.gs; 339 p->thread.gs = me->thread.gs;
368 340
369 asm("mov %%gs,%0" : "=m" (p->thread.gsindex)); 341 savesegment(gs, p->thread.gsindex);
370 asm("mov %%fs,%0" : "=m" (p->thread.fsindex)); 342 savesegment(fs, p->thread.fsindex);
371 asm("mov %%es,%0" : "=m" (p->thread.es)); 343 savesegment(es, p->thread.es);
372 asm("mov %%ds,%0" : "=m" (p->thread.ds)); 344 savesegment(ds, p->thread.ds);
373 345
374 if (unlikely(test_tsk_thread_flag(me, TIF_IO_BITMAP))) { 346 if (unlikely(test_tsk_thread_flag(me, TIF_IO_BITMAP))) {
375 p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); 347 p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
@@ -408,7 +380,9 @@ out:
408void 380void
409start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp) 381start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
410{ 382{
411 asm volatile("movl %0, %%fs; movl %0, %%es; movl %0, %%ds" :: "r"(0)); 383 loadsegment(fs, 0);
384 loadsegment(es, 0);
385 loadsegment(ds, 0);
412 load_gs_index(0); 386 load_gs_index(0);
413 regs->ip = new_ip; 387 regs->ip = new_ip;
414 regs->sp = new_sp; 388 regs->sp = new_sp;
@@ -567,6 +541,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
567 *next = &next_p->thread; 541 *next = &next_p->thread;
568 int cpu = smp_processor_id(); 542 int cpu = smp_processor_id();
569 struct tss_struct *tss = &per_cpu(init_tss, cpu); 543 struct tss_struct *tss = &per_cpu(init_tss, cpu);
544 unsigned fsindex, gsindex;
570 545
571 /* we're going to use this soon, after a few expensive things */ 546 /* we're going to use this soon, after a few expensive things */
572 if (next_p->fpu_counter>5) 547 if (next_p->fpu_counter>5)
@@ -581,22 +556,38 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
581 * Switch DS and ES. 556 * Switch DS and ES.
582 * This won't pick up thread selector changes, but I guess that is ok. 557 * This won't pick up thread selector changes, but I guess that is ok.
583 */ 558 */
584 asm volatile("mov %%es,%0" : "=m" (prev->es)); 559 savesegment(es, prev->es);
585 if (unlikely(next->es | prev->es)) 560 if (unlikely(next->es | prev->es))
586 loadsegment(es, next->es); 561 loadsegment(es, next->es);
587 562
588 asm volatile ("mov %%ds,%0" : "=m" (prev->ds)); 563 savesegment(ds, prev->ds);
589 if (unlikely(next->ds | prev->ds)) 564 if (unlikely(next->ds | prev->ds))
590 loadsegment(ds, next->ds); 565 loadsegment(ds, next->ds);
591 566
567
568 /* We must save %fs and %gs before load_TLS() because
569 * %fs and %gs may be cleared by load_TLS().
570 *
571 * (e.g. xen_load_tls())
572 */
573 savesegment(fs, fsindex);
574 savesegment(gs, gsindex);
575
592 load_TLS(next, cpu); 576 load_TLS(next, cpu);
593 577
578 /*
579 * Leave lazy mode, flushing any hypercalls made here.
580 * This must be done before restoring TLS segments so
581 * the GDT and LDT are properly updated, and must be
582 * done before math_state_restore, so the TS bit is up
583 * to date.
584 */
585 arch_leave_lazy_cpu_mode();
586
594 /* 587 /*
595 * Switch FS and GS. 588 * Switch FS and GS.
596 */ 589 */
597 { 590 {
598 unsigned fsindex;
599 asm volatile("movl %%fs,%0" : "=r" (fsindex));
600 /* segment register != 0 always requires a reload. 591 /* segment register != 0 always requires a reload.
601 also reload when it has changed. 592 also reload when it has changed.
602 when prev process used 64bit base always reload 593 when prev process used 64bit base always reload
@@ -614,10 +605,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
614 if (next->fs) 605 if (next->fs)
615 wrmsrl(MSR_FS_BASE, next->fs); 606 wrmsrl(MSR_FS_BASE, next->fs);
616 prev->fsindex = fsindex; 607 prev->fsindex = fsindex;
617 } 608
618 {
619 unsigned gsindex;
620 asm volatile("movl %%gs,%0" : "=r" (gsindex));
621 if (unlikely(gsindex | next->gsindex | prev->gs)) { 609 if (unlikely(gsindex | next->gsindex | prev->gs)) {
622 load_gs_index(next->gsindex); 610 load_gs_index(next->gsindex);
623 if (gsindex) 611 if (gsindex)
@@ -798,7 +786,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
798 set_32bit_tls(task, FS_TLS, addr); 786 set_32bit_tls(task, FS_TLS, addr);
799 if (doit) { 787 if (doit) {
800 load_TLS(&task->thread, cpu); 788 load_TLS(&task->thread, cpu);
801 asm volatile("movl %0,%%fs" :: "r"(FS_TLS_SEL)); 789 loadsegment(fs, FS_TLS_SEL);
802 } 790 }
803 task->thread.fsindex = FS_TLS_SEL; 791 task->thread.fsindex = FS_TLS_SEL;
804 task->thread.fs = 0; 792 task->thread.fs = 0;
@@ -808,7 +796,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
808 if (doit) { 796 if (doit) {
809 /* set the selector to 0 to not confuse 797 /* set the selector to 0 to not confuse
810 __switch_to */ 798 __switch_to */
811 asm volatile("movl %0,%%fs" :: "r" (0)); 799 loadsegment(fs, 0);
812 ret = checking_wrmsrl(MSR_FS_BASE, addr); 800 ret = checking_wrmsrl(MSR_FS_BASE, addr);
813 } 801 }
814 } 802 }
@@ -831,7 +819,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
831 if (task->thread.gsindex == GS_TLS_SEL) 819 if (task->thread.gsindex == GS_TLS_SEL)
832 base = read_32bit_tls(task, GS_TLS); 820 base = read_32bit_tls(task, GS_TLS);
833 else if (doit) { 821 else if (doit) {
834 asm("movl %%gs,%0" : "=r" (gsindex)); 822 savesegment(gs, gsindex);
835 if (gsindex) 823 if (gsindex)
836 rdmsrl(MSR_KERNEL_GS_BASE, base); 824 rdmsrl(MSR_KERNEL_GS_BASE, base);
837 else 825 else
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index a7835f282936..77040b6070e1 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -943,13 +943,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
943 return copy_regset_to_user(child, &user_x86_32_view, 943 return copy_regset_to_user(child, &user_x86_32_view,
944 REGSET_XFP, 944 REGSET_XFP,
945 0, sizeof(struct user_fxsr_struct), 945 0, sizeof(struct user_fxsr_struct),
946 datap); 946 datap) ? -EIO : 0;
947 947
948 case PTRACE_SETFPXREGS: /* Set the child extended FPU state. */ 948 case PTRACE_SETFPXREGS: /* Set the child extended FPU state. */
949 return copy_regset_from_user(child, &user_x86_32_view, 949 return copy_regset_from_user(child, &user_x86_32_view,
950 REGSET_XFP, 950 REGSET_XFP,
951 0, sizeof(struct user_fxsr_struct), 951 0, sizeof(struct user_fxsr_struct),
952 datap); 952 datap) ? -EIO : 0;
953#endif 953#endif
954 954
955#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION 955#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index d89a648fe710..79bdcd11c66e 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -65,6 +65,7 @@ static enum {
65 ICH_FORCE_HPET_RESUME, 65 ICH_FORCE_HPET_RESUME,
66 VT8237_FORCE_HPET_RESUME, 66 VT8237_FORCE_HPET_RESUME,
67 NVIDIA_FORCE_HPET_RESUME, 67 NVIDIA_FORCE_HPET_RESUME,
68 ATI_FORCE_HPET_RESUME,
68} force_hpet_resume_type; 69} force_hpet_resume_type;
69 70
70static void __iomem *rcba_base; 71static void __iomem *rcba_base;
@@ -158,6 +159,8 @@ static void ich_force_enable_hpet(struct pci_dev *dev)
158 159
159DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, 160DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0,
160 ich_force_enable_hpet); 161 ich_force_enable_hpet);
162DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0,
163 ich_force_enable_hpet);
161DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, 164DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1,
162 ich_force_enable_hpet); 165 ich_force_enable_hpet);
163DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, 166DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0,
@@ -174,6 +177,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7,
174 177
175static struct pci_dev *cached_dev; 178static struct pci_dev *cached_dev;
176 179
180static void hpet_print_force_info(void)
181{
182 printk(KERN_INFO "HPET not enabled in BIOS. "
183 "You might try hpet=force boot option\n");
184}
185
177static void old_ich_force_hpet_resume(void) 186static void old_ich_force_hpet_resume(void)
178{ 187{
179 u32 val; 188 u32 val;
@@ -253,6 +262,8 @@ static void old_ich_force_enable_hpet_user(struct pci_dev *dev)
253{ 262{
254 if (hpet_force_user) 263 if (hpet_force_user)
255 old_ich_force_enable_hpet(dev); 264 old_ich_force_enable_hpet(dev);
265 else
266 hpet_print_force_info();
256} 267}
257 268
258DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, 269DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0,
@@ -290,8 +301,13 @@ static void vt8237_force_enable_hpet(struct pci_dev *dev)
290{ 301{
291 u32 uninitialized_var(val); 302 u32 uninitialized_var(val);
292 303
293 if (!hpet_force_user || hpet_address || force_hpet_address) 304 if (hpet_address || force_hpet_address)
305 return;
306
307 if (!hpet_force_user) {
308 hpet_print_force_info();
294 return; 309 return;
310 }
295 311
296 pci_read_config_dword(dev, 0x68, &val); 312 pci_read_config_dword(dev, 0x68, &val);
297 /* 313 /*
@@ -330,6 +346,36 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235,
330DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, 346DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
331 vt8237_force_enable_hpet); 347 vt8237_force_enable_hpet);
332 348
349static void ati_force_hpet_resume(void)
350{
351 pci_write_config_dword(cached_dev, 0x14, 0xfed00000);
352 printk(KERN_DEBUG "Force enabled HPET at resume\n");
353}
354
355static void ati_force_enable_hpet(struct pci_dev *dev)
356{
357 u32 uninitialized_var(val);
358
359 if (hpet_address || force_hpet_address)
360 return;
361
362 if (!hpet_force_user) {
363 hpet_print_force_info();
364 return;
365 }
366
367 pci_write_config_dword(dev, 0x14, 0xfed00000);
368 pci_read_config_dword(dev, 0x14, &val);
369 force_hpet_address = val;
370 force_hpet_resume_type = ATI_FORCE_HPET_RESUME;
371 dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at 0x%lx\n",
372 force_hpet_address);
373 cached_dev = dev;
374 return;
375}
376DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS,
377 ati_force_enable_hpet);
378
333/* 379/*
334 * Undocumented chipset feature taken from LinuxBIOS. 380 * Undocumented chipset feature taken from LinuxBIOS.
335 */ 381 */
@@ -343,8 +389,13 @@ static void nvidia_force_enable_hpet(struct pci_dev *dev)
343{ 389{
344 u32 uninitialized_var(val); 390 u32 uninitialized_var(val);
345 391
346 if (!hpet_force_user || hpet_address || force_hpet_address) 392 if (hpet_address || force_hpet_address)
393 return;
394
395 if (!hpet_force_user) {
396 hpet_print_force_info();
347 return; 397 return;
398 }
348 399
349 pci_write_config_dword(dev, 0x44, 0xfed00001); 400 pci_write_config_dword(dev, 0x44, 0xfed00001);
350 pci_read_config_dword(dev, 0x44, &val); 401 pci_read_config_dword(dev, 0x44, &val);
@@ -397,6 +448,9 @@ void force_hpet_resume(void)
397 case NVIDIA_FORCE_HPET_RESUME: 448 case NVIDIA_FORCE_HPET_RESUME:
398 nvidia_force_hpet_resume(); 449 nvidia_force_hpet_resume();
399 return; 450 return;
451 case ATI_FORCE_HPET_RESUME:
452 ati_force_hpet_resume();
453 return;
400 default: 454 default:
401 break; 455 break;
402 } 456 }
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index f6be7d5f82f8..f8a62160e151 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -27,7 +27,7 @@
27void (*pm_power_off)(void); 27void (*pm_power_off)(void);
28EXPORT_SYMBOL(pm_power_off); 28EXPORT_SYMBOL(pm_power_off);
29 29
30static long no_idt[3]; 30static const struct desc_ptr no_idt = {};
31static int reboot_mode; 31static int reboot_mode;
32enum reboot_type reboot_type = BOOT_KBD; 32enum reboot_type reboot_type = BOOT_KBD;
33int reboot_force; 33int reboot_force;
@@ -201,15 +201,15 @@ core_initcall(reboot_init);
201 controller to pulse the CPU reset line, which is more thorough, but 201 controller to pulse the CPU reset line, which is more thorough, but
202 doesn't work with at least one type of 486 motherboard. It is easy 202 doesn't work with at least one type of 486 motherboard. It is easy
203 to stop this code working; hence the copious comments. */ 203 to stop this code working; hence the copious comments. */
204static unsigned long long 204static const unsigned long long
205real_mode_gdt_entries [3] = 205real_mode_gdt_entries [3] =
206{ 206{
207 0x0000000000000000ULL, /* Null descriptor */ 207 0x0000000000000000ULL, /* Null descriptor */
208 0x00009a000000ffffULL, /* 16-bit real-mode 64k code at 0x00000000 */ 208 0x00009b000000ffffULL, /* 16-bit real-mode 64k code at 0x00000000 */
209 0x000092000100ffffULL /* 16-bit real-mode 64k data at 0x00000100 */ 209 0x000093000100ffffULL /* 16-bit real-mode 64k data at 0x00000100 */
210}; 210};
211 211
212static struct desc_ptr 212static const struct desc_ptr
213real_mode_gdt = { sizeof (real_mode_gdt_entries) - 1, (long)real_mode_gdt_entries }, 213real_mode_gdt = { sizeof (real_mode_gdt_entries) - 1, (long)real_mode_gdt_entries },
214real_mode_idt = { 0x3ff, 0 }; 214real_mode_idt = { 0x3ff, 0 };
215 215
@@ -231,7 +231,7 @@ real_mode_idt = { 0x3ff, 0 };
231 231
232 More could be done here to set up the registers as if a CPU reset had 232 More could be done here to set up the registers as if a CPU reset had
233 occurred; hopefully real BIOSs don't assume much. */ 233 occurred; hopefully real BIOSs don't assume much. */
234static unsigned char real_mode_switch [] = 234static const unsigned char real_mode_switch [] =
235{ 235{
236 0x66, 0x0f, 0x20, 0xc0, /* movl %cr0,%eax */ 236 0x66, 0x0f, 0x20, 0xc0, /* movl %cr0,%eax */
237 0x66, 0x83, 0xe0, 0x11, /* andl $0x00000011,%eax */ 237 0x66, 0x83, 0xe0, 0x11, /* andl $0x00000011,%eax */
@@ -245,7 +245,7 @@ static unsigned char real_mode_switch [] =
245 0x24, 0x10, /* f: andb $0x10,al */ 245 0x24, 0x10, /* f: andb $0x10,al */
246 0x66, 0x0f, 0x22, 0xc0 /* movl %eax,%cr0 */ 246 0x66, 0x0f, 0x22, 0xc0 /* movl %eax,%cr0 */
247}; 247};
248static unsigned char jump_to_bios [] = 248static const unsigned char jump_to_bios [] =
249{ 249{
250 0xea, 0x00, 0x00, 0xff, 0xff /* ljmp $0xffff,$0x0000 */ 250 0xea, 0x00, 0x00, 0xff, 0xff /* ljmp $0xffff,$0x0000 */
251}; 251};
@@ -255,7 +255,7 @@ static unsigned char jump_to_bios [] =
255 * specified by the code and length parameters. 255 * specified by the code and length parameters.
256 * We assume that length will aways be less that 100! 256 * We assume that length will aways be less that 100!
257 */ 257 */
258void machine_real_restart(unsigned char *code, int length) 258void machine_real_restart(const unsigned char *code, int length)
259{ 259{
260 local_irq_disable(); 260 local_irq_disable();
261 261
@@ -368,7 +368,7 @@ static void native_machine_emergency_restart(void)
368 } 368 }
369 369
370 case BOOT_TRIPLE: 370 case BOOT_TRIPLE:
371 load_idt((const struct desc_ptr *)&no_idt); 371 load_idt(&no_idt);
372 __asm__ __volatile__("int3"); 372 __asm__ __volatile__("int3");
373 373
374 reboot_type = BOOT_KBD; 374 reboot_type = BOOT_KBD;
diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index dec0b5ec25c2..61a837743fe5 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -49,7 +49,7 @@ struct device_fixup {
49 void (*reboot_fixup)(struct pci_dev *); 49 void (*reboot_fixup)(struct pci_dev *);
50}; 50};
51 51
52static struct device_fixup fixups_table[] = { 52static const struct device_fixup fixups_table[] = {
53{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset }, 53{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset },
54{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset }, 54{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset },
55{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE, cs5530a_warm_reset }, 55{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE, cs5530a_warm_reset },
@@ -64,7 +64,7 @@ static struct device_fixup fixups_table[] = {
64 */ 64 */
65void mach_reboot_fixups(void) 65void mach_reboot_fixups(void)
66{ 66{
67 struct device_fixup *cur; 67 const struct device_fixup *cur;
68 struct pci_dev *dev; 68 struct pci_dev *dev;
69 int i; 69 int i;
70 70
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 6f80b852a196..36c540d4ac4b 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1,139 +1,889 @@
1#include <linux/kernel.h> 1/*
2 * Copyright (C) 1995 Linus Torvalds
3 *
4 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
5 *
6 * Memory region support
7 * David Parsons <orc@pell.chi.il.us>, July-August 1999
8 *
9 * Added E820 sanitization routine (removes overlapping memory regions);
10 * Brian Moyle <bmoyle@mvista.com>, February 2001
11 *
12 * Moved CPU detection code to cpu/${cpu}.c
13 * Patrick Mochel <mochel@osdl.org>, March 2002
14 *
15 * Provisions for empty E820 memory regions (reported by certain BIOSes).
16 * Alex Achenbach <xela@slit.de>, December 2002.
17 *
18 */
19
20/*
21 * This file handles the architecture-dependent parts of initialization
22 */
23
24#include <linux/sched.h>
25#include <linux/mm.h>
26#include <linux/mmzone.h>
27#include <linux/screen_info.h>
28#include <linux/ioport.h>
29#include <linux/acpi.h>
30#include <linux/apm_bios.h>
31#include <linux/initrd.h>
32#include <linux/bootmem.h>
33#include <linux/seq_file.h>
34#include <linux/console.h>
35#include <linux/mca.h>
36#include <linux/root_dev.h>
37#include <linux/highmem.h>
2#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/efi.h>
3#include <linux/init.h> 40#include <linux/init.h>
4#include <linux/bootmem.h> 41#include <linux/edd.h>
42#include <linux/iscsi_ibft.h>
43#include <linux/nodemask.h>
44#include <linux/kexec.h>
45#include <linux/dmi.h>
46#include <linux/pfn.h>
47#include <linux/pci.h>
48#include <asm/pci-direct.h>
49#include <linux/init_ohci1394_dma.h>
50#include <linux/kvm_para.h>
51
52#include <linux/errno.h>
53#include <linux/kernel.h>
54#include <linux/stddef.h>
55#include <linux/unistd.h>
56#include <linux/ptrace.h>
57#include <linux/slab.h>
58#include <linux/user.h>
59#include <linux/delay.h>
60#include <linux/highmem.h>
61
62#include <linux/kallsyms.h>
63#include <linux/edd.h>
64#include <linux/iscsi_ibft.h>
65#include <linux/kexec.h>
66#include <linux/cpufreq.h>
67#include <linux/dma-mapping.h>
68#include <linux/ctype.h>
69#include <linux/uaccess.h>
70
5#include <linux/percpu.h> 71#include <linux/percpu.h>
72#include <linux/crash_dump.h>
73
74#include <video/edid.h>
75
76#include <asm/mtrr.h>
77#include <asm/apic.h>
78#include <asm/e820.h>
79#include <asm/mpspec.h>
80#include <asm/setup.h>
81#include <asm/arch_hooks.h>
82#include <asm/efi.h>
83#include <asm/sections.h>
84#include <asm/dmi.h>
85#include <asm/io_apic.h>
86#include <asm/ist.h>
87#include <asm/vmi.h>
88#include <setup_arch.h>
89#include <asm/bios_ebda.h>
90#include <asm/cacheflush.h>
91#include <asm/processor.h>
92#include <asm/bugs.h>
93
94#include <asm/system.h>
95#include <asm/vsyscall.h>
6#include <asm/smp.h> 96#include <asm/smp.h>
97#include <asm/desc.h>
98#include <asm/dma.h>
99#include <asm/gart.h>
100#include <asm/mmu_context.h>
101#include <asm/proto.h>
102
103#include <mach_apic.h>
104#include <asm/paravirt.h>
105
7#include <asm/percpu.h> 106#include <asm/percpu.h>
8#include <asm/sections.h> 107#include <asm/sections.h>
9#include <asm/processor.h>
10#include <asm/setup.h>
11#include <asm/topology.h> 108#include <asm/topology.h>
12#include <asm/mpspec.h>
13#include <asm/apicdef.h> 109#include <asm/apicdef.h>
110#ifdef CONFIG_X86_64
111#include <asm/numa_64.h>
112#endif
14 113
15#ifdef CONFIG_X86_LOCAL_APIC 114#ifndef ARCH_SETUP
16unsigned int num_processors; 115#define ARCH_SETUP
17unsigned disabled_cpus __cpuinitdata; 116#endif
18/* Processor that is doing the boot up */ 117
19unsigned int boot_cpu_physical_apicid = -1U; 118#ifndef CONFIG_DEBUG_BOOT_PARAMS
20EXPORT_SYMBOL(boot_cpu_physical_apicid); 119struct boot_params __initdata boot_params;
120#else
121struct boot_params boot_params;
122#endif
123
124/*
125 * Machine setup..
126 */
127static struct resource data_resource = {
128 .name = "Kernel data",
129 .start = 0,
130 .end = 0,
131 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
132};
133
134static struct resource code_resource = {
135 .name = "Kernel code",
136 .start = 0,
137 .end = 0,
138 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
139};
140
141static struct resource bss_resource = {
142 .name = "Kernel bss",
143 .start = 0,
144 .end = 0,
145 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
146};
147
148
149#ifdef CONFIG_X86_32
150/* This value is set up by the early boot code to point to the value
151 immediately after the boot time page tables. It contains a *physical*
152 address, and must not be in the .bss segment! */
153unsigned long init_pg_tables_start __initdata = ~0UL;
154unsigned long init_pg_tables_end __initdata = ~0UL;
155
156static struct resource video_ram_resource = {
157 .name = "Video RAM area",
158 .start = 0xa0000,
159 .end = 0xbffff,
160 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
161};
162
163/* cpu data as detected by the assembly code in head.S */
164struct cpuinfo_x86 new_cpu_data __cpuinitdata = {0, 0, 0, 0, -1, 1, 0, 0, -1};
165/* common cpu data for all cpus */
166struct cpuinfo_x86 boot_cpu_data __read_mostly = {0, 0, 0, 0, -1, 1, 0, 0, -1};
167EXPORT_SYMBOL(boot_cpu_data);
168static void set_mca_bus(int x)
169{
170#ifdef CONFIG_MCA
171 MCA_bus = x;
172#endif
173}
174
175unsigned int def_to_bigsmp;
176
177/* for MCA, but anyone else can use it if they want */
178unsigned int machine_id;
179unsigned int machine_submodel_id;
180unsigned int BIOS_revision;
181
182struct apm_info apm_info;
183EXPORT_SYMBOL(apm_info);
184
185#if defined(CONFIG_X86_SPEEDSTEP_SMI) || \
186 defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
187struct ist_info ist_info;
188EXPORT_SYMBOL(ist_info);
189#else
190struct ist_info ist_info;
191#endif
192
193#else
194struct cpuinfo_x86 boot_cpu_data __read_mostly;
195EXPORT_SYMBOL(boot_cpu_data);
196#endif
21 197
22DEFINE_PER_CPU(u16, x86_cpu_to_apicid) = BAD_APICID;
23EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
24 198
25/* Bitmask of physically existing CPUs */ 199#if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
26physid_mask_t phys_cpu_present_map; 200unsigned long mmu_cr4_features;
201#else
202unsigned long mmu_cr4_features = X86_CR4_PAE;
27#endif 203#endif
28 204
29#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_X86_SMP) 205/* Boot loader ID as an integer, for the benefit of proc_dointvec */
206int bootloader_type;
207
30/* 208/*
31 * Copy data used in early init routines from the initial arrays to the 209 * Early DMI memory
32 * per cpu data areas. These arrays then become expendable and the
33 * *_early_ptr's are zeroed indicating that the static arrays are gone.
34 */ 210 */
35static void __init setup_per_cpu_maps(void) 211int dmi_alloc_index;
212char dmi_alloc_data[DMI_MAX_DATA];
213
214/*
215 * Setup options
216 */
217struct screen_info screen_info;
218EXPORT_SYMBOL(screen_info);
219struct edid_info edid_info;
220EXPORT_SYMBOL_GPL(edid_info);
221
222extern int root_mountflags;
223
224unsigned long saved_video_mode;
225
226#define RAMDISK_IMAGE_START_MASK 0x07FF
227#define RAMDISK_PROMPT_FLAG 0x8000
228#define RAMDISK_LOAD_FLAG 0x4000
229
230static char __initdata command_line[COMMAND_LINE_SIZE];
231
232#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
233struct edd edd;
234#ifdef CONFIG_EDD_MODULE
235EXPORT_SYMBOL(edd);
236#endif
237/**
238 * copy_edd() - Copy the BIOS EDD information
239 * from boot_params into a safe place.
240 *
241 */
242static inline void copy_edd(void)
243{
244 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
245 sizeof(edd.mbr_signature));
246 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
247 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
248 edd.edd_info_nr = boot_params.eddbuf_entries;
249}
250#else
251static inline void copy_edd(void)
252{
253}
254#endif
255
256#ifdef CONFIG_BLK_DEV_INITRD
257
258#ifdef CONFIG_X86_32
259
260#define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)
261static void __init relocate_initrd(void)
36{ 262{
37 int cpu;
38 263
39 for_each_possible_cpu(cpu) { 264 u64 ramdisk_image = boot_params.hdr.ramdisk_image;
40 per_cpu(x86_cpu_to_apicid, cpu) = x86_cpu_to_apicid_init[cpu]; 265 u64 ramdisk_size = boot_params.hdr.ramdisk_size;
41 per_cpu(x86_bios_cpu_apicid, cpu) = 266 u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
42 x86_bios_cpu_apicid_init[cpu]; 267 u64 ramdisk_here;
43#ifdef CONFIG_NUMA 268 unsigned long slop, clen, mapaddr;
44 per_cpu(x86_cpu_to_node_map, cpu) = 269 char *p, *q;
45 x86_cpu_to_node_map_init[cpu]; 270
271 /* We need to move the initrd down into lowmem */
272 ramdisk_here = find_e820_area(0, end_of_lowmem, ramdisk_size,
273 PAGE_SIZE);
274
275 if (ramdisk_here == -1ULL)
276 panic("Cannot find place for new RAMDISK of size %lld\n",
277 ramdisk_size);
278
279 /* Note: this includes all the lowmem currently occupied by
280 the initrd, we rely on that fact to keep the data intact. */
281 reserve_early(ramdisk_here, ramdisk_here + ramdisk_size,
282 "NEW RAMDISK");
283 initrd_start = ramdisk_here + PAGE_OFFSET;
284 initrd_end = initrd_start + ramdisk_size;
285 printk(KERN_INFO "Allocated new RAMDISK: %08llx - %08llx\n",
286 ramdisk_here, ramdisk_here + ramdisk_size);
287
288 q = (char *)initrd_start;
289
290 /* Copy any lowmem portion of the initrd */
291 if (ramdisk_image < end_of_lowmem) {
292 clen = end_of_lowmem - ramdisk_image;
293 p = (char *)__va(ramdisk_image);
294 memcpy(q, p, clen);
295 q += clen;
296 ramdisk_image += clen;
297 ramdisk_size -= clen;
298 }
299
300 /* Copy the highmem portion of the initrd */
301 while (ramdisk_size) {
302 slop = ramdisk_image & ~PAGE_MASK;
303 clen = ramdisk_size;
304 if (clen > MAX_MAP_CHUNK-slop)
305 clen = MAX_MAP_CHUNK-slop;
306 mapaddr = ramdisk_image & PAGE_MASK;
307 p = early_ioremap(mapaddr, clen+slop);
308 memcpy(q, p+slop, clen);
309 early_iounmap(p, clen+slop);
310 q += clen;
311 ramdisk_image += clen;
312 ramdisk_size -= clen;
313 }
314 /* high pages is not converted by early_res_to_bootmem */
315 ramdisk_image = boot_params.hdr.ramdisk_image;
316 ramdisk_size = boot_params.hdr.ramdisk_size;
317 printk(KERN_INFO "Move RAMDISK from %016llx - %016llx to"
318 " %08llx - %08llx\n",
319 ramdisk_image, ramdisk_image + ramdisk_size - 1,
320 ramdisk_here, ramdisk_here + ramdisk_size - 1);
321}
46#endif 322#endif
323
324static void __init reserve_initrd(void)
325{
326 u64 ramdisk_image = boot_params.hdr.ramdisk_image;
327 u64 ramdisk_size = boot_params.hdr.ramdisk_size;
328 u64 ramdisk_end = ramdisk_image + ramdisk_size;
329 u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
330
331 if (!boot_params.hdr.type_of_loader ||
332 !ramdisk_image || !ramdisk_size)
333 return; /* No initrd provided by bootloader */
334
335 initrd_start = 0;
336
337 if (ramdisk_size >= (end_of_lowmem>>1)) {
338 free_early(ramdisk_image, ramdisk_end);
339 printk(KERN_ERR "initrd too large to handle, "
340 "disabling initrd\n");
341 return;
342 }
343
344 printk(KERN_INFO "RAMDISK: %08llx - %08llx\n", ramdisk_image,
345 ramdisk_end);
346
347
348 if (ramdisk_end <= end_of_lowmem) {
349 /* All in lowmem, easy case */
350 /*
351 * don't need to reserve again, already reserved early
352 * in i386_start_kernel
353 */
354 initrd_start = ramdisk_image + PAGE_OFFSET;
355 initrd_end = initrd_start + ramdisk_size;
356 return;
47 } 357 }
48 358
49 /* indicate the early static arrays will soon be gone */ 359#ifdef CONFIG_X86_32
50 x86_cpu_to_apicid_early_ptr = NULL; 360 relocate_initrd();
51 x86_bios_cpu_apicid_early_ptr = NULL; 361#else
52#ifdef CONFIG_NUMA 362 printk(KERN_ERR "initrd extends beyond end of memory "
53 x86_cpu_to_node_map_early_ptr = NULL; 363 "(0x%08llx > 0x%08llx)\ndisabling initrd\n",
364 ramdisk_end, end_of_lowmem);
365 initrd_start = 0;
54#endif 366#endif
367 free_early(ramdisk_image, ramdisk_end);
55} 368}
369#else
370static void __init reserve_initrd(void)
371{
372}
373#endif /* CONFIG_BLK_DEV_INITRD */
374
375static void __init parse_setup_data(void)
376{
377 struct setup_data *data;
378 u64 pa_data;
379
380 if (boot_params.hdr.version < 0x0209)
381 return;
382 pa_data = boot_params.hdr.setup_data;
383 while (pa_data) {
384 data = early_ioremap(pa_data, PAGE_SIZE);
385 switch (data->type) {
386 case SETUP_E820_EXT:
387 parse_e820_ext(data, pa_data);
388 break;
389 default:
390 break;
391 }
392 pa_data = data->next;
393 early_iounmap(data, PAGE_SIZE);
394 }
395}
396
397static void __init e820_reserve_setup_data(void)
398{
399 struct setup_data *data;
400 u64 pa_data;
401 int found = 0;
402
403 if (boot_params.hdr.version < 0x0209)
404 return;
405 pa_data = boot_params.hdr.setup_data;
406 while (pa_data) {
407 data = early_ioremap(pa_data, sizeof(*data));
408 e820_update_range(pa_data, sizeof(*data)+data->len,
409 E820_RAM, E820_RESERVED_KERN);
410 found = 1;
411 pa_data = data->next;
412 early_iounmap(data, sizeof(*data));
413 }
414 if (!found)
415 return;
56 416
57#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP 417 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
58cpumask_t *cpumask_of_cpu_map __read_mostly; 418 memcpy(&e820_saved, &e820, sizeof(struct e820map));
59EXPORT_SYMBOL(cpumask_of_cpu_map); 419 printk(KERN_INFO "extended physical RAM map:\n");
420 e820_print_map("reserve setup_data");
421}
60 422
61/* requires nr_cpu_ids to be initialized */ 423static void __init reserve_early_setup_data(void)
62static void __init setup_cpumask_of_cpu(void)
63{ 424{
64 int i; 425 struct setup_data *data;
426 u64 pa_data;
427 char buf[32];
428
429 if (boot_params.hdr.version < 0x0209)
430 return;
431 pa_data = boot_params.hdr.setup_data;
432 while (pa_data) {
433 data = early_ioremap(pa_data, sizeof(*data));
434 sprintf(buf, "setup data %x", data->type);
435 reserve_early(pa_data, pa_data+sizeof(*data)+data->len, buf);
436 pa_data = data->next;
437 early_iounmap(data, sizeof(*data));
438 }
439}
440
441/*
442 * --------- Crashkernel reservation ------------------------------
443 */
444
445#ifdef CONFIG_KEXEC
446
447/**
448 * Reserve @size bytes of crashkernel memory at any suitable offset.
449 *
450 * @size: Size of the crashkernel memory to reserve.
451 * Returns the base address on success, and -1ULL on failure.
452 */
453unsigned long long find_and_reserve_crashkernel(unsigned long long size)
454{
455 const unsigned long long alignment = 16<<20; /* 16M */
456 unsigned long long start = 0LL;
457
458 while (1) {
459 int ret;
460
461 start = find_e820_area(start, ULONG_MAX, size, alignment);
462 if (start == -1ULL)
463 return start;
464
465 /* try to reserve it */
466 ret = reserve_bootmem_generic(start, size, BOOTMEM_EXCLUSIVE);
467 if (ret >= 0)
468 return start;
469
470 start += alignment;
471 }
472}
65 473
66 /* alloc_bootmem zeroes memory */ 474static inline unsigned long long get_total_mem(void)
67 cpumask_of_cpu_map = alloc_bootmem_low(sizeof(cpumask_t) * nr_cpu_ids); 475{
68 for (i = 0; i < nr_cpu_ids; i++) 476 unsigned long long total;
69 cpu_set(i, cpumask_of_cpu_map[i]); 477
478 total = max_low_pfn - min_low_pfn;
479#ifdef CONFIG_HIGHMEM
480 total += highend_pfn - highstart_pfn;
481#endif
482
483 return total << PAGE_SHIFT;
484}
485
486static void __init reserve_crashkernel(void)
487{
488 unsigned long long total_mem;
489 unsigned long long crash_size, crash_base;
490 int ret;
491
492 total_mem = get_total_mem();
493
494 ret = parse_crashkernel(boot_command_line, total_mem,
495 &crash_size, &crash_base);
496 if (ret != 0 || crash_size <= 0)
497 return;
498
499 /* 0 means: find the address automatically */
500 if (crash_base <= 0) {
501 crash_base = find_and_reserve_crashkernel(crash_size);
502 if (crash_base == -1ULL) {
503 pr_info("crashkernel reservation failed. "
504 "No suitable area found.\n");
505 return;
506 }
507 } else {
508 ret = reserve_bootmem_generic(crash_base, crash_size,
509 BOOTMEM_EXCLUSIVE);
510 if (ret < 0) {
511 pr_info("crashkernel reservation failed - "
512 "memory is in use\n");
513 return;
514 }
515 }
516
517 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
518 "for crashkernel (System RAM: %ldMB)\n",
519 (unsigned long)(crash_size >> 20),
520 (unsigned long)(crash_base >> 20),
521 (unsigned long)(total_mem >> 20));
522
523 crashk_res.start = crash_base;
524 crashk_res.end = crash_base + crash_size - 1;
525 insert_resource(&iomem_resource, &crashk_res);
70} 526}
71#else 527#else
72static inline void setup_cpumask_of_cpu(void) { } 528static void __init reserve_crashkernel(void)
529{
530}
73#endif 531#endif
74 532
75#ifdef CONFIG_X86_32 533static struct resource standard_io_resources[] = {
76/* 534 { .name = "dma1", .start = 0x00, .end = 0x1f,
77 * Great future not-so-futuristic plan: make i386 and x86_64 do it 535 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
78 * the same way 536 { .name = "pic1", .start = 0x20, .end = 0x21,
537 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
538 { .name = "timer0", .start = 0x40, .end = 0x43,
539 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
540 { .name = "timer1", .start = 0x50, .end = 0x53,
541 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
542 { .name = "keyboard", .start = 0x60, .end = 0x60,
543 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
544 { .name = "keyboard", .start = 0x64, .end = 0x64,
545 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
546 { .name = "dma page reg", .start = 0x80, .end = 0x8f,
547 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
548 { .name = "pic2", .start = 0xa0, .end = 0xa1,
549 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
550 { .name = "dma2", .start = 0xc0, .end = 0xdf,
551 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
552 { .name = "fpu", .start = 0xf0, .end = 0xff,
553 .flags = IORESOURCE_BUSY | IORESOURCE_IO }
554};
555
556static void __init reserve_standard_io_resources(void)
557{
558 int i;
559
560 /* request I/O space for devices used on all i[345]86 PCs */
561 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
562 request_resource(&ioport_resource, &standard_io_resources[i]);
563
564}
565
566#ifdef CONFIG_PROC_VMCORE
567/* elfcorehdr= specifies the location of elf core header
568 * stored by the crashed kernel. This option will be passed
569 * by kexec loader to the capture kernel.
79 */ 570 */
80unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; 571static int __init setup_elfcorehdr(char *arg)
81EXPORT_SYMBOL(__per_cpu_offset); 572{
573 char *end;
574 if (!arg)
575 return -EINVAL;
576 elfcorehdr_addr = memparse(arg, &end);
577 return end > arg ? 0 : -EINVAL;
578}
579early_param("elfcorehdr", setup_elfcorehdr);
82#endif 580#endif
83 581
84/* 582/*
85 * Great future plan: 583 * Determine if we were loaded by an EFI loader. If so, then we have also been
86 * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data. 584 * passed the efi memmap, systab, etc., so we should use these data structures
87 * Always point %gs to its beginning 585 * for initialization. Note, the efi init code path is determined by the
586 * global efi_enabled. This allows the same kernel image to be used on existing
587 * systems (with a traditional BIOS) as well as on EFI systems.
88 */ 588 */
89void __init setup_per_cpu_areas(void) 589/*
590 * setup_arch - architecture-specific boot-time initializations
591 *
592 * Note: On x86_64, fixmaps are ready for use even before this is called.
593 */
594
595void __init setup_arch(char **cmdline_p)
90{ 596{
91 int i, highest_cpu = 0; 597#ifdef CONFIG_X86_32
92 unsigned long size; 598 memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
599 visws_early_detect();
600 pre_setup_arch_hook();
601 early_cpu_init();
602#else
603 printk(KERN_INFO "Command line: %s\n", boot_command_line);
604#endif
93 605
94#ifdef CONFIG_HOTPLUG_CPU 606 early_ioremap_init();
95 prefill_possible_map(); 607
608 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
609 screen_info = boot_params.screen_info;
610 edid_info = boot_params.edid_info;
611#ifdef CONFIG_X86_32
612 apm_info.bios = boot_params.apm_bios_info;
613 ist_info = boot_params.ist_info;
614 if (boot_params.sys_desc_table.length != 0) {
615 set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2);
616 machine_id = boot_params.sys_desc_table.table[0];
617 machine_submodel_id = boot_params.sys_desc_table.table[1];
618 BIOS_revision = boot_params.sys_desc_table.table[2];
619 }
620#endif
621 saved_video_mode = boot_params.hdr.vid_mode;
622 bootloader_type = boot_params.hdr.type_of_loader;
623
624#ifdef CONFIG_BLK_DEV_RAM
625 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
626 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
627 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
96#endif 628#endif
629#ifdef CONFIG_EFI
630 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
631#ifdef CONFIG_X86_32
632 "EL32",
633#else
634 "EL64",
635#endif
636 4)) {
637 efi_enabled = 1;
638 efi_reserve_early();
639 }
640#endif
641
642 ARCH_SETUP
97 643
98 /* Copy section for each CPU (we discard the original) */ 644 setup_memory_map();
99 size = PERCPU_ENOUGH_ROOM; 645 parse_setup_data();
100 printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", 646 /* update the e820_saved too */
101 size); 647 e820_reserve_setup_data();
102 648
103 for_each_possible_cpu(i) { 649 copy_edd();
104 char *ptr; 650
105#ifndef CONFIG_NEED_MULTIPLE_NODES 651 if (!boot_params.hdr.root_flags)
106 ptr = alloc_bootmem_pages(size); 652 root_mountflags &= ~MS_RDONLY;
653 init_mm.start_code = (unsigned long) _text;
654 init_mm.end_code = (unsigned long) _etext;
655 init_mm.end_data = (unsigned long) _edata;
656#ifdef CONFIG_X86_32
657 init_mm.brk = init_pg_tables_end + PAGE_OFFSET;
107#else 658#else
108 int node = early_cpu_to_node(i); 659 init_mm.brk = (unsigned long) &_end;
109 if (!node_online(node) || !NODE_DATA(node)) {
110 ptr = alloc_bootmem_pages(size);
111 printk(KERN_INFO
112 "cpu %d has no node or node-local memory\n", i);
113 }
114 else
115 ptr = alloc_bootmem_pages_node(NODE_DATA(node), size);
116#endif 660#endif
117 if (!ptr) 661
118 panic("Cannot allocate cpu data for CPU %d\n", i); 662 code_resource.start = virt_to_phys(_text);
663 code_resource.end = virt_to_phys(_etext)-1;
664 data_resource.start = virt_to_phys(_etext);
665 data_resource.end = virt_to_phys(_edata)-1;
666 bss_resource.start = virt_to_phys(&__bss_start);
667 bss_resource.end = virt_to_phys(&__bss_stop)-1;
668
119#ifdef CONFIG_X86_64 669#ifdef CONFIG_X86_64
120 cpu_pda(i)->data_offset = ptr - __per_cpu_start; 670 early_cpu_init();
671#endif
672 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
673 *cmdline_p = command_line;
674
675 parse_early_param();
676
677 /* after early param, so could get panic from serial */
678 reserve_early_setup_data();
679
680 if (acpi_mps_check()) {
681#ifdef CONFIG_X86_LOCAL_APIC
682 disable_apic = 1;
683#endif
684 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
685 }
686
687 finish_e820_parsing();
688
689#ifdef CONFIG_X86_32
690 probe_roms();
691#endif
692
693 /* after parse_early_param, so could debug it */
694 insert_resource(&iomem_resource, &code_resource);
695 insert_resource(&iomem_resource, &data_resource);
696 insert_resource(&iomem_resource, &bss_resource);
697
698 if (efi_enabled)
699 efi_init();
700
701#ifdef CONFIG_X86_32
702 if (ppro_with_ram_bug()) {
703 e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
704 E820_RESERVED);
705 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
706 printk(KERN_INFO "fixed physical RAM map:\n");
707 e820_print_map("bad_ppro");
708 }
709#else
710 early_gart_iommu_check();
711#endif
712
713 /*
714 * partially used pages are not usable - thus
715 * we are rounding upwards:
716 */
717 max_pfn = e820_end_of_ram_pfn();
718
719 /* preallocate 4k for mptable mpc */
720 early_reserve_e820_mpc_new();
721 /* update e820 for memory not covered by WB MTRRs */
722 mtrr_bp_init();
723 if (mtrr_trim_uncached_memory(max_pfn))
724 max_pfn = e820_end_of_ram_pfn();
725
726#ifdef CONFIG_X86_32
727 /* max_low_pfn get updated here */
728 find_low_pfn_range();
121#else 729#else
122 __per_cpu_offset[i] = ptr - __per_cpu_start; 730 num_physpages = max_pfn;
731
732 check_efer();
733
734 /* How many end-of-memory variables you have, grandma! */
735 /* need this before calling reserve_initrd */
736 if (max_pfn > (1UL<<(32 - PAGE_SHIFT)))
737 max_low_pfn = e820_end_of_low_ram_pfn();
738 else
739 max_low_pfn = max_pfn;
740
741 high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
123#endif 742#endif
124 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
125 743
126 highest_cpu = i; 744 /* max_pfn_mapped is updated here */
745 max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
746 max_pfn_mapped = max_low_pfn_mapped;
747
748#ifdef CONFIG_X86_64
749 if (max_pfn > max_low_pfn) {
750 max_pfn_mapped = init_memory_mapping(1UL<<32,
751 max_pfn<<PAGE_SHIFT);
752 /* can we preseve max_low_pfn ?*/
753 max_low_pfn = max_pfn;
127 } 754 }
755#endif
756
757 /*
758 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
759 */
128 760
129 nr_cpu_ids = highest_cpu + 1; 761#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
130 printk(KERN_DEBUG "NR_CPUS: %d, nr_cpu_ids: %d\n", NR_CPUS, nr_cpu_ids); 762 if (init_ohci1394_dma_early)
763 init_ohci1394_dma_on_all_controllers();
764#endif
131 765
132 /* Setup percpu data maps */ 766 reserve_initrd();
133 setup_per_cpu_maps();
134 767
135 /* Setup cpumask_of_cpu map */ 768#ifdef CONFIG_X86_64
136 setup_cpumask_of_cpu(); 769 vsmp_init();
137} 770#endif
771
772 dmi_scan_machine();
773
774 io_delay_init();
775
776 /*
777 * Parse the ACPI tables for possible boot-time SMP configuration.
778 */
779 acpi_boot_table_init();
780
781#ifdef CONFIG_ACPI_NUMA
782 /*
783 * Parse SRAT to discover nodes.
784 */
785 acpi_numa_init();
786#endif
787
788 initmem_init(0, max_pfn);
789
790#ifdef CONFIG_X86_64
791 dma32_reserve_bootmem();
792#endif
138 793
794#ifdef CONFIG_ACPI_SLEEP
795 /*
796 * Reserve low memory region for sleep support.
797 */
798 acpi_reserve_bootmem();
799#endif
800#ifdef CONFIG_X86_FIND_SMP_CONFIG
801 /*
802 * Find and reserve possible boot-time SMP configuration:
803 */
804 find_smp_config();
139#endif 805#endif
806 reserve_crashkernel();
807
808 reserve_ibft_region();
809
810#ifdef CONFIG_KVM_CLOCK
811 kvmclock_init();
812#endif
813
814#if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
815 /*
816 * Must be after max_low_pfn is determined, and before kernel
817 * pagetables are setup.
818 */
819 vmi_init();
820#endif
821
822 paging_init();
823
824#ifdef CONFIG_X86_64
825 map_vsyscall();
826#endif
827
828#ifdef CONFIG_X86_GENERICARCH
829 generic_apic_probe();
830#endif
831
832 early_quirks();
833
834 /*
835 * Read APIC and some other early information from ACPI tables.
836 */
837 acpi_boot_init();
838
839#if defined(CONFIG_X86_MPPARSE) || defined(CONFIG_X86_VISWS)
840 /*
841 * get boot-time SMP configuration:
842 */
843 if (smp_found_config)
844 get_smp_config();
845#endif
846
847 prefill_possible_map();
848#ifdef CONFIG_X86_64
849 init_cpu_to_node();
850#endif
851
852#ifdef CONFIG_X86_NUMAQ
853 /*
854 * need to check online nodes num, call it
855 * here before time_init/tsc_init
856 */
857 numaq_tsc_disable();
858#endif
859
860 init_apic_mappings();
861 ioapic_init_mappings();
862
863#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) && defined(CONFIG_X86_32)
864 if (def_to_bigsmp)
865 printk(KERN_WARNING "More than 8 CPUs detected and "
866 "CONFIG_X86_PC cannot handle it.\nUse "
867 "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
868#endif
869 kvm_guest_init();
870
871 e820_reserve_resources();
872 e820_mark_nosave_regions(max_low_pfn);
873
874#ifdef CONFIG_X86_32
875 request_resource(&iomem_resource, &video_ram_resource);
876#endif
877 reserve_standard_io_resources();
878
879 e820_setup_gap();
880
881#ifdef CONFIG_VT
882#if defined(CONFIG_VGA_CONSOLE)
883 if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
884 conswitchp = &vga_con;
885#elif defined(CONFIG_DUMMY_CONSOLE)
886 conswitchp = &dummy_con;
887#endif
888#endif
889}
diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c
deleted file mode 100644
index aee0e8200777..000000000000
--- a/arch/x86/kernel/setup64.c
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2 * X86-64 specific CPU setup.
3 * Copyright (C) 1995 Linus Torvalds
4 * Copyright 2001, 2002, 2003 SuSE Labs / Andi Kleen.
5 * See setup.c for older changelog.
6 */
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/string.h>
11#include <linux/bootmem.h>
12#include <linux/bitops.h>
13#include <linux/module.h>
14#include <linux/kgdb.h>
15#include <asm/pda.h>
16#include <asm/pgtable.h>
17#include <asm/processor.h>
18#include <asm/desc.h>
19#include <asm/atomic.h>
20#include <asm/mmu_context.h>
21#include <asm/smp.h>
22#include <asm/i387.h>
23#include <asm/percpu.h>
24#include <asm/proto.h>
25#include <asm/sections.h>
26#include <asm/setup.h>
27#include <asm/genapic.h>
28
29#ifndef CONFIG_DEBUG_BOOT_PARAMS
30struct boot_params __initdata boot_params;
31#else
32struct boot_params boot_params;
33#endif
34
35cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
36
37struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
38EXPORT_SYMBOL(_cpu_pda);
39struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
40
41struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
42
43char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
44
45unsigned long __supported_pte_mask __read_mostly = ~0UL;
46EXPORT_SYMBOL_GPL(__supported_pte_mask);
47
48static int do_not_nx __cpuinitdata = 0;
49
50/* noexec=on|off
51Control non executable mappings for 64bit processes.
52
53on Enable(default)
54off Disable
55*/
56static int __init nonx_setup(char *str)
57{
58 if (!str)
59 return -EINVAL;
60 if (!strncmp(str, "on", 2)) {
61 __supported_pte_mask |= _PAGE_NX;
62 do_not_nx = 0;
63 } else if (!strncmp(str, "off", 3)) {
64 do_not_nx = 1;
65 __supported_pte_mask &= ~_PAGE_NX;
66 }
67 return 0;
68}
69early_param("noexec", nonx_setup);
70
71int force_personality32 = 0;
72
73/* noexec32=on|off
74Control non executable heap for 32bit processes.
75To control the stack too use noexec=off
76
77on PROT_READ does not imply PROT_EXEC for 32bit processes (default)
78off PROT_READ implies PROT_EXEC
79*/
80static int __init nonx32_setup(char *str)
81{
82 if (!strcmp(str, "on"))
83 force_personality32 &= ~READ_IMPLIES_EXEC;
84 else if (!strcmp(str, "off"))
85 force_personality32 |= READ_IMPLIES_EXEC;
86 return 1;
87}
88__setup("noexec32=", nonx32_setup);
89
90void pda_init(int cpu)
91{
92 struct x8664_pda *pda = cpu_pda(cpu);
93
94 /* Setup up data that may be needed in __get_free_pages early */
95 asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0));
96 /* Memory clobbers used to order PDA accessed */
97 mb();
98 wrmsrl(MSR_GS_BASE, pda);
99 mb();
100
101 pda->cpunumber = cpu;
102 pda->irqcount = -1;
103 pda->kernelstack =
104 (unsigned long)stack_thread_info() - PDA_STACKOFFSET + THREAD_SIZE;
105 pda->active_mm = &init_mm;
106 pda->mmu_state = 0;
107
108 if (cpu == 0) {
109 /* others are initialized in smpboot.c */
110 pda->pcurrent = &init_task;
111 pda->irqstackptr = boot_cpu_stack;
112 } else {
113 pda->irqstackptr = (char *)
114 __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER);
115 if (!pda->irqstackptr)
116 panic("cannot allocate irqstack for cpu %d", cpu);
117 }
118
119
120 pda->irqstackptr += IRQSTACKSIZE-64;
121}
122
123char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]
124__attribute__((section(".bss.page_aligned")));
125
126extern asmlinkage void ignore_sysret(void);
127
128/* May not be marked __init: used by software suspend */
129void syscall_init(void)
130{
131 /*
132 * LSTAR and STAR live in a bit strange symbiosis.
133 * They both write to the same internal register. STAR allows to set CS/DS
134 * but only a 32bit target. LSTAR sets the 64bit rip.
135 */
136 wrmsrl(MSR_STAR, ((u64)__USER32_CS)<<48 | ((u64)__KERNEL_CS)<<32);
137 wrmsrl(MSR_LSTAR, system_call);
138 wrmsrl(MSR_CSTAR, ignore_sysret);
139
140#ifdef CONFIG_IA32_EMULATION
141 syscall32_cpu_init ();
142#endif
143
144 /* Flags to clear on syscall */
145 wrmsrl(MSR_SYSCALL_MASK,
146 X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL);
147}
148
149void __cpuinit check_efer(void)
150{
151 unsigned long efer;
152
153 rdmsrl(MSR_EFER, efer);
154 if (!(efer & EFER_NX) || do_not_nx) {
155 __supported_pte_mask &= ~_PAGE_NX;
156 }
157}
158
159unsigned long kernel_eflags;
160
161/*
162 * Copies of the original ist values from the tss are only accessed during
163 * debugging, no special alignment required.
164 */
165DEFINE_PER_CPU(struct orig_ist, orig_ist);
166
167/*
168 * cpu_init() initializes state that is per-CPU. Some data is already
169 * initialized (naturally) in the bootstrap process, such as the GDT
170 * and IDT. We reload them nevertheless, this function acts as a
171 * 'CPU state barrier', nothing should get across.
172 * A lot of state is already set up in PDA init.
173 */
174void __cpuinit cpu_init (void)
175{
176 int cpu = stack_smp_processor_id();
177 struct tss_struct *t = &per_cpu(init_tss, cpu);
178 struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu);
179 unsigned long v;
180 char *estacks = NULL;
181 struct task_struct *me;
182 int i;
183
184 /* CPU 0 is initialised in head64.c */
185 if (cpu != 0) {
186 pda_init(cpu);
187 } else
188 estacks = boot_exception_stacks;
189
190 me = current;
191
192 if (cpu_test_and_set(cpu, cpu_initialized))
193 panic("CPU#%d already initialized!\n", cpu);
194
195 printk("Initializing CPU#%d\n", cpu);
196
197 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
198
199 /*
200 * Initialize the per-CPU GDT with the boot GDT,
201 * and set up the GDT descriptor:
202 */
203 if (cpu)
204 memcpy(get_cpu_gdt_table(cpu), cpu_gdt_table, GDT_SIZE);
205
206 cpu_gdt_descr[cpu].size = GDT_SIZE;
207 load_gdt((const struct desc_ptr *)&cpu_gdt_descr[cpu]);
208 load_idt((const struct desc_ptr *)&idt_descr);
209
210 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
211 syscall_init();
212
213 wrmsrl(MSR_FS_BASE, 0);
214 wrmsrl(MSR_KERNEL_GS_BASE, 0);
215 barrier();
216
217 check_efer();
218
219 /*
220 * set up and load the per-CPU TSS
221 */
222 for (v = 0; v < N_EXCEPTION_STACKS; v++) {
223 static const unsigned int order[N_EXCEPTION_STACKS] = {
224 [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER,
225 [DEBUG_STACK - 1] = DEBUG_STACK_ORDER
226 };
227 if (cpu) {
228 estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
229 if (!estacks)
230 panic("Cannot allocate exception stack %ld %d\n",
231 v, cpu);
232 }
233 estacks += PAGE_SIZE << order[v];
234 orig_ist->ist[v] = t->x86_tss.ist[v] = (unsigned long)estacks;
235 }
236
237 t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
238 /*
239 * <= is required because the CPU will access up to
240 * 8 bits beyond the end of the IO permission bitmap.
241 */
242 for (i = 0; i <= IO_BITMAP_LONGS; i++)
243 t->io_bitmap[i] = ~0UL;
244
245 atomic_inc(&init_mm.mm_count);
246 me->active_mm = &init_mm;
247 if (me->mm)
248 BUG();
249 enter_lazy_tlb(&init_mm, me);
250
251 set_tss_desc(cpu, t);
252 load_TR_desc();
253 load_LDT(&init_mm.context);
254
255#ifdef CONFIG_KGDB
256 /*
257 * If the kgdb is connected no debug regs should be altered. This
258 * is only applicable when KGDB and a KGDB I/O module are built
259 * into the kernel and you are using early debugging with
260 * kgdbwait. KGDB will control the kernel HW breakpoint registers.
261 */
262 if (kgdb_connected && arch_kgdb_ops.correct_hw_break)
263 arch_kgdb_ops.correct_hw_break();
264 else {
265#endif
266 /*
267 * Clear all 6 debug registers:
268 */
269
270 set_debugreg(0UL, 0);
271 set_debugreg(0UL, 1);
272 set_debugreg(0UL, 2);
273 set_debugreg(0UL, 3);
274 set_debugreg(0UL, 6);
275 set_debugreg(0UL, 7);
276#ifdef CONFIG_KGDB
277 /* If the kgdb is connected no debug regs should be altered. */
278 }
279#endif
280
281 fpu_init();
282
283 raw_local_save_flags(kernel_eflags);
284
285 if (is_uv_system())
286 uv_cpu_init();
287}
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
deleted file mode 100644
index 5a2f8e063887..000000000000
--- a/arch/x86/kernel/setup_32.c
+++ /dev/null
@@ -1,964 +0,0 @@
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 *
4 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
5 *
6 * Memory region support
7 * David Parsons <orc@pell.chi.il.us>, July-August 1999
8 *
9 * Added E820 sanitization routine (removes overlapping memory regions);
10 * Brian Moyle <bmoyle@mvista.com>, February 2001
11 *
12 * Moved CPU detection code to cpu/${cpu}.c
13 * Patrick Mochel <mochel@osdl.org>, March 2002
14 *
15 * Provisions for empty E820 memory regions (reported by certain BIOSes).
16 * Alex Achenbach <xela@slit.de>, December 2002.
17 *
18 */
19
20/*
21 * This file handles the architecture-dependent parts of initialization
22 */
23
24#include <linux/sched.h>
25#include <linux/mm.h>
26#include <linux/mmzone.h>
27#include <linux/screen_info.h>
28#include <linux/ioport.h>
29#include <linux/acpi.h>
30#include <linux/apm_bios.h>
31#include <linux/initrd.h>
32#include <linux/bootmem.h>
33#include <linux/seq_file.h>
34#include <linux/console.h>
35#include <linux/mca.h>
36#include <linux/root_dev.h>
37#include <linux/highmem.h>
38#include <linux/module.h>
39#include <linux/efi.h>
40#include <linux/init.h>
41#include <linux/edd.h>
42#include <linux/iscsi_ibft.h>
43#include <linux/nodemask.h>
44#include <linux/kexec.h>
45#include <linux/crash_dump.h>
46#include <linux/dmi.h>
47#include <linux/pfn.h>
48#include <linux/pci.h>
49#include <linux/init_ohci1394_dma.h>
50#include <linux/kvm_para.h>
51
52#include <video/edid.h>
53
54#include <asm/mtrr.h>
55#include <asm/apic.h>
56#include <asm/e820.h>
57#include <asm/mpspec.h>
58#include <asm/mmzone.h>
59#include <asm/setup.h>
60#include <asm/arch_hooks.h>
61#include <asm/sections.h>
62#include <asm/io_apic.h>
63#include <asm/ist.h>
64#include <asm/io.h>
65#include <asm/vmi.h>
66#include <setup_arch.h>
67#include <asm/bios_ebda.h>
68#include <asm/cacheflush.h>
69#include <asm/processor.h>
70
71/* This value is set up by the early boot code to point to the value
72 immediately after the boot time page tables. It contains a *physical*
73 address, and must not be in the .bss segment! */
74unsigned long init_pg_tables_end __initdata = ~0UL;
75
76/*
77 * Machine setup..
78 */
79static struct resource data_resource = {
80 .name = "Kernel data",
81 .start = 0,
82 .end = 0,
83 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
84};
85
86static struct resource code_resource = {
87 .name = "Kernel code",
88 .start = 0,
89 .end = 0,
90 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
91};
92
93static struct resource bss_resource = {
94 .name = "Kernel bss",
95 .start = 0,
96 .end = 0,
97 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
98};
99
100static struct resource video_ram_resource = {
101 .name = "Video RAM area",
102 .start = 0xa0000,
103 .end = 0xbffff,
104 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
105};
106
107static struct resource standard_io_resources[] = { {
108 .name = "dma1",
109 .start = 0x0000,
110 .end = 0x001f,
111 .flags = IORESOURCE_BUSY | IORESOURCE_IO
112}, {
113 .name = "pic1",
114 .start = 0x0020,
115 .end = 0x0021,
116 .flags = IORESOURCE_BUSY | IORESOURCE_IO
117}, {
118 .name = "timer0",
119 .start = 0x0040,
120 .end = 0x0043,
121 .flags = IORESOURCE_BUSY | IORESOURCE_IO
122}, {
123 .name = "timer1",
124 .start = 0x0050,
125 .end = 0x0053,
126 .flags = IORESOURCE_BUSY | IORESOURCE_IO
127}, {
128 .name = "keyboard",
129 .start = 0x0060,
130 .end = 0x0060,
131 .flags = IORESOURCE_BUSY | IORESOURCE_IO
132}, {
133 .name = "keyboard",
134 .start = 0x0064,
135 .end = 0x0064,
136 .flags = IORESOURCE_BUSY | IORESOURCE_IO
137}, {
138 .name = "dma page reg",
139 .start = 0x0080,
140 .end = 0x008f,
141 .flags = IORESOURCE_BUSY | IORESOURCE_IO
142}, {
143 .name = "pic2",
144 .start = 0x00a0,
145 .end = 0x00a1,
146 .flags = IORESOURCE_BUSY | IORESOURCE_IO
147}, {
148 .name = "dma2",
149 .start = 0x00c0,
150 .end = 0x00df,
151 .flags = IORESOURCE_BUSY | IORESOURCE_IO
152}, {
153 .name = "fpu",
154 .start = 0x00f0,
155 .end = 0x00ff,
156 .flags = IORESOURCE_BUSY | IORESOURCE_IO
157} };
158
159/* cpu data as detected by the assembly code in head.S */
160struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
161/* common cpu data for all cpus */
162struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
163EXPORT_SYMBOL(boot_cpu_data);
164
165unsigned int def_to_bigsmp;
166
167#ifndef CONFIG_X86_PAE
168unsigned long mmu_cr4_features;
169#else
170unsigned long mmu_cr4_features = X86_CR4_PAE;
171#endif
172
173/* for MCA, but anyone else can use it if they want */
174unsigned int machine_id;
175unsigned int machine_submodel_id;
176unsigned int BIOS_revision;
177
178/* Boot loader ID as an integer, for the benefit of proc_dointvec */
179int bootloader_type;
180
181/* user-defined highmem size */
182static unsigned int highmem_pages = -1;
183
184/*
185 * Setup options
186 */
187struct screen_info screen_info;
188EXPORT_SYMBOL(screen_info);
189struct apm_info apm_info;
190EXPORT_SYMBOL(apm_info);
191struct edid_info edid_info;
192EXPORT_SYMBOL_GPL(edid_info);
193struct ist_info ist_info;
194#if defined(CONFIG_X86_SPEEDSTEP_SMI) || \
195 defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
196EXPORT_SYMBOL(ist_info);
197#endif
198
199extern void early_cpu_init(void);
200extern int root_mountflags;
201
202unsigned long saved_video_mode;
203
204#define RAMDISK_IMAGE_START_MASK 0x07FF
205#define RAMDISK_PROMPT_FLAG 0x8000
206#define RAMDISK_LOAD_FLAG 0x4000
207
208static char __initdata command_line[COMMAND_LINE_SIZE];
209
210#ifndef CONFIG_DEBUG_BOOT_PARAMS
211struct boot_params __initdata boot_params;
212#else
213struct boot_params boot_params;
214#endif
215
216#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
217struct edd edd;
218#ifdef CONFIG_EDD_MODULE
219EXPORT_SYMBOL(edd);
220#endif
221/**
222 * copy_edd() - Copy the BIOS EDD information
223 * from boot_params into a safe place.
224 *
225 */
226static inline void copy_edd(void)
227{
228 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
229 sizeof(edd.mbr_signature));
230 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
231 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
232 edd.edd_info_nr = boot_params.eddbuf_entries;
233}
234#else
235static inline void copy_edd(void)
236{
237}
238#endif
239
240int __initdata user_defined_memmap;
241
242/*
243 * "mem=nopentium" disables the 4MB page tables.
244 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
245 * to <mem>, overriding the bios size.
246 * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
247 * <start> to <start>+<mem>, overriding the bios size.
248 *
249 * HPA tells me bootloaders need to parse mem=, so no new
250 * option should be mem= [also see Documentation/i386/boot.txt]
251 */
252static int __init parse_mem(char *arg)
253{
254 if (!arg)
255 return -EINVAL;
256
257 if (strcmp(arg, "nopentium") == 0) {
258 setup_clear_cpu_cap(X86_FEATURE_PSE);
259 } else {
260 /* If the user specifies memory size, we
261 * limit the BIOS-provided memory map to
262 * that size. exactmap can be used to specify
263 * the exact map. mem=number can be used to
264 * trim the existing memory map.
265 */
266 unsigned long long mem_size;
267
268 mem_size = memparse(arg, &arg);
269 limit_regions(mem_size);
270 user_defined_memmap = 1;
271 }
272 return 0;
273}
274early_param("mem", parse_mem);
275
276#ifdef CONFIG_PROC_VMCORE
277/* elfcorehdr= specifies the location of elf core header
278 * stored by the crashed kernel.
279 */
280static int __init parse_elfcorehdr(char *arg)
281{
282 if (!arg)
283 return -EINVAL;
284
285 elfcorehdr_addr = memparse(arg, &arg);
286 return 0;
287}
288early_param("elfcorehdr", parse_elfcorehdr);
289#endif /* CONFIG_PROC_VMCORE */
290
291/*
292 * highmem=size forces highmem to be exactly 'size' bytes.
293 * This works even on boxes that have no highmem otherwise.
294 * This also works to reduce highmem size on bigger boxes.
295 */
296static int __init parse_highmem(char *arg)
297{
298 if (!arg)
299 return -EINVAL;
300
301 highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT;
302 return 0;
303}
304early_param("highmem", parse_highmem);
305
306/*
307 * vmalloc=size forces the vmalloc area to be exactly 'size'
308 * bytes. This can be used to increase (or decrease) the
309 * vmalloc area - the default is 128m.
310 */
311static int __init parse_vmalloc(char *arg)
312{
313 if (!arg)
314 return -EINVAL;
315
316 __VMALLOC_RESERVE = memparse(arg, &arg);
317 return 0;
318}
319early_param("vmalloc", parse_vmalloc);
320
321/*
322 * reservetop=size reserves a hole at the top of the kernel address space which
323 * a hypervisor can load into later. Needed for dynamically loaded hypervisors,
324 * so relocating the fixmap can be done before paging initialization.
325 */
326static int __init parse_reservetop(char *arg)
327{
328 unsigned long address;
329
330 if (!arg)
331 return -EINVAL;
332
333 address = memparse(arg, &arg);
334 reserve_top_address(address);
335 return 0;
336}
337early_param("reservetop", parse_reservetop);
338
339/*
340 * Determine low and high memory ranges:
341 */
342unsigned long __init find_max_low_pfn(void)
343{
344 unsigned long max_low_pfn;
345
346 max_low_pfn = max_pfn;
347 if (max_low_pfn > MAXMEM_PFN) {
348 if (highmem_pages == -1)
349 highmem_pages = max_pfn - MAXMEM_PFN;
350 if (highmem_pages + MAXMEM_PFN < max_pfn)
351 max_pfn = MAXMEM_PFN + highmem_pages;
352 if (highmem_pages + MAXMEM_PFN > max_pfn) {
353 printk("only %luMB highmem pages available, ignoring highmem size of %uMB.\n", pages_to_mb(max_pfn - MAXMEM_PFN), pages_to_mb(highmem_pages));
354 highmem_pages = 0;
355 }
356 max_low_pfn = MAXMEM_PFN;
357#ifndef CONFIG_HIGHMEM
358 /* Maximum memory usable is what is directly addressable */
359 printk(KERN_WARNING "Warning only %ldMB will be used.\n",
360 MAXMEM>>20);
361 if (max_pfn > MAX_NONPAE_PFN)
362 printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
363 else
364 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
365 max_pfn = MAXMEM_PFN;
366#else /* !CONFIG_HIGHMEM */
367#ifndef CONFIG_HIGHMEM64G
368 if (max_pfn > MAX_NONPAE_PFN) {
369 max_pfn = MAX_NONPAE_PFN;
370 printk(KERN_WARNING "Warning only 4GB will be used.\n");
371 printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
372 }
373#endif /* !CONFIG_HIGHMEM64G */
374#endif /* !CONFIG_HIGHMEM */
375 } else {
376 if (highmem_pages == -1)
377 highmem_pages = 0;
378#ifdef CONFIG_HIGHMEM
379 if (highmem_pages >= max_pfn) {
380 printk(KERN_ERR "highmem size specified (%uMB) is bigger than pages available (%luMB)!.\n", pages_to_mb(highmem_pages), pages_to_mb(max_pfn));
381 highmem_pages = 0;
382 }
383 if (highmem_pages) {
384 if (max_low_pfn-highmem_pages < 64*1024*1024/PAGE_SIZE){
385 printk(KERN_ERR "highmem size %uMB results in smaller than 64MB lowmem, ignoring it.\n", pages_to_mb(highmem_pages));
386 highmem_pages = 0;
387 }
388 max_low_pfn -= highmem_pages;
389 }
390#else
391 if (highmem_pages)
392 printk(KERN_ERR "ignoring highmem size on non-highmem kernel!\n");
393#endif
394 }
395 return max_low_pfn;
396}
397
398#define BIOS_LOWMEM_KILOBYTES 0x413
399
400/*
401 * The BIOS places the EBDA/XBDA at the top of conventional
402 * memory, and usually decreases the reported amount of
403 * conventional memory (int 0x12) too. This also contains a
404 * workaround for Dell systems that neglect to reserve EBDA.
405 * The same workaround also avoids a problem with the AMD768MPX
406 * chipset: reserve a page before VGA to prevent PCI prefetch
407 * into it (errata #56). Usually the page is reserved anyways,
408 * unless you have no PS/2 mouse plugged in.
409 */
410static void __init reserve_ebda_region(void)
411{
412 unsigned int lowmem, ebda_addr;
413
414 /* To determine the position of the EBDA and the */
415 /* end of conventional memory, we need to look at */
416 /* the BIOS data area. In a paravirtual environment */
417 /* that area is absent. We'll just have to assume */
418 /* that the paravirt case can handle memory setup */
419 /* correctly, without our help. */
420 if (paravirt_enabled())
421 return;
422
423 /* end of low (conventional) memory */
424 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
425 lowmem <<= 10;
426
427 /* start of EBDA area */
428 ebda_addr = get_bios_ebda();
429
430 /* Fixup: bios puts an EBDA in the top 64K segment */
431 /* of conventional memory, but does not adjust lowmem. */
432 if ((lowmem - ebda_addr) <= 0x10000)
433 lowmem = ebda_addr;
434
435 /* Fixup: bios does not report an EBDA at all. */
436 /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
437 if ((ebda_addr == 0) && (lowmem >= 0x9f000))
438 lowmem = 0x9f000;
439
440 /* Paranoia: should never happen, but... */
441 if ((lowmem == 0) || (lowmem >= 0x100000))
442 lowmem = 0x9f000;
443
444 /* reserve all memory between lowmem and the 1MB mark */
445 reserve_bootmem(lowmem, 0x100000 - lowmem, BOOTMEM_DEFAULT);
446}
447
448#ifndef CONFIG_NEED_MULTIPLE_NODES
449static void __init setup_bootmem_allocator(void);
450static unsigned long __init setup_memory(void)
451{
452 /*
453 * partially used pages are not usable - thus
454 * we are rounding upwards:
455 */
456 min_low_pfn = PFN_UP(init_pg_tables_end);
457
458 max_low_pfn = find_max_low_pfn();
459
460#ifdef CONFIG_HIGHMEM
461 highstart_pfn = highend_pfn = max_pfn;
462 if (max_pfn > max_low_pfn) {
463 highstart_pfn = max_low_pfn;
464 }
465 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
466 pages_to_mb(highend_pfn - highstart_pfn));
467 num_physpages = highend_pfn;
468 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
469#else
470 num_physpages = max_low_pfn;
471 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
472#endif
473#ifdef CONFIG_FLATMEM
474 max_mapnr = num_physpages;
475#endif
476 printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
477 pages_to_mb(max_low_pfn));
478
479 setup_bootmem_allocator();
480
481 return max_low_pfn;
482}
483
484static void __init zone_sizes_init(void)
485{
486 unsigned long max_zone_pfns[MAX_NR_ZONES];
487 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
488 max_zone_pfns[ZONE_DMA] =
489 virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
490 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
491#ifdef CONFIG_HIGHMEM
492 max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
493 add_active_range(0, 0, highend_pfn);
494#else
495 add_active_range(0, 0, max_low_pfn);
496#endif
497
498 free_area_init_nodes(max_zone_pfns);
499}
500#else
501extern unsigned long __init setup_memory(void);
502extern void zone_sizes_init(void);
503#endif /* !CONFIG_NEED_MULTIPLE_NODES */
504
505static inline unsigned long long get_total_mem(void)
506{
507 unsigned long long total;
508
509 total = max_low_pfn - min_low_pfn;
510#ifdef CONFIG_HIGHMEM
511 total += highend_pfn - highstart_pfn;
512#endif
513
514 return total << PAGE_SHIFT;
515}
516
517#ifdef CONFIG_KEXEC
518static void __init reserve_crashkernel(void)
519{
520 unsigned long long total_mem;
521 unsigned long long crash_size, crash_base;
522 int ret;
523
524 total_mem = get_total_mem();
525
526 ret = parse_crashkernel(boot_command_line, total_mem,
527 &crash_size, &crash_base);
528 if (ret == 0 && crash_size > 0) {
529 if (crash_base > 0) {
530 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
531 "for crashkernel (System RAM: %ldMB)\n",
532 (unsigned long)(crash_size >> 20),
533 (unsigned long)(crash_base >> 20),
534 (unsigned long)(total_mem >> 20));
535
536 if (reserve_bootmem(crash_base, crash_size,
537 BOOTMEM_EXCLUSIVE) < 0) {
538 printk(KERN_INFO "crashkernel reservation "
539 "failed - memory is in use\n");
540 return;
541 }
542
543 crashk_res.start = crash_base;
544 crashk_res.end = crash_base + crash_size - 1;
545 } else
546 printk(KERN_INFO "crashkernel reservation failed - "
547 "you have to specify a base address\n");
548 }
549}
550#else
551static inline void __init reserve_crashkernel(void)
552{}
553#endif
554
555#ifdef CONFIG_BLK_DEV_INITRD
556
557static bool do_relocate_initrd = false;
558
559static void __init reserve_initrd(void)
560{
561 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
562 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
563 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
564 unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT;
565 unsigned long ramdisk_here;
566
567 initrd_start = 0;
568
569 if (!boot_params.hdr.type_of_loader ||
570 !ramdisk_image || !ramdisk_size)
571 return; /* No initrd provided by bootloader */
572
573 if (ramdisk_end < ramdisk_image) {
574 printk(KERN_ERR "initrd wraps around end of memory, "
575 "disabling initrd\n");
576 return;
577 }
578 if (ramdisk_size >= end_of_lowmem/2) {
579 printk(KERN_ERR "initrd too large to handle, "
580 "disabling initrd\n");
581 return;
582 }
583 if (ramdisk_end <= end_of_lowmem) {
584 /* All in lowmem, easy case */
585 reserve_bootmem(ramdisk_image, ramdisk_size, BOOTMEM_DEFAULT);
586 initrd_start = ramdisk_image + PAGE_OFFSET;
587 initrd_end = initrd_start+ramdisk_size;
588 return;
589 }
590
591 /* We need to move the initrd down into lowmem */
592 ramdisk_here = (end_of_lowmem - ramdisk_size) & PAGE_MASK;
593
594 /* Note: this includes all the lowmem currently occupied by
595 the initrd, we rely on that fact to keep the data intact. */
596 reserve_bootmem(ramdisk_here, ramdisk_size, BOOTMEM_DEFAULT);
597 initrd_start = ramdisk_here + PAGE_OFFSET;
598 initrd_end = initrd_start + ramdisk_size;
599
600 do_relocate_initrd = true;
601}
602
603#define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)
604
605static void __init relocate_initrd(void)
606{
607 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
608 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
609 unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT;
610 unsigned long ramdisk_here;
611 unsigned long slop, clen, mapaddr;
612 char *p, *q;
613
614 if (!do_relocate_initrd)
615 return;
616
617 ramdisk_here = initrd_start - PAGE_OFFSET;
618
619 q = (char *)initrd_start;
620
621 /* Copy any lowmem portion of the initrd */
622 if (ramdisk_image < end_of_lowmem) {
623 clen = end_of_lowmem - ramdisk_image;
624 p = (char *)__va(ramdisk_image);
625 memcpy(q, p, clen);
626 q += clen;
627 ramdisk_image += clen;
628 ramdisk_size -= clen;
629 }
630
631 /* Copy the highmem portion of the initrd */
632 while (ramdisk_size) {
633 slop = ramdisk_image & ~PAGE_MASK;
634 clen = ramdisk_size;
635 if (clen > MAX_MAP_CHUNK-slop)
636 clen = MAX_MAP_CHUNK-slop;
637 mapaddr = ramdisk_image & PAGE_MASK;
638 p = early_ioremap(mapaddr, clen+slop);
639 memcpy(q, p+slop, clen);
640 early_iounmap(p, clen+slop);
641 q += clen;
642 ramdisk_image += clen;
643 ramdisk_size -= clen;
644 }
645}
646
647#endif /* CONFIG_BLK_DEV_INITRD */
648
649void __init setup_bootmem_allocator(void)
650{
651 unsigned long bootmap_size;
652 /*
653 * Initialize the boot-time allocator (with low memory only):
654 */
655 bootmap_size = init_bootmem(min_low_pfn, max_low_pfn);
656
657 register_bootmem_low_pages(max_low_pfn);
658
659 /*
660 * Reserve the bootmem bitmap itself as well. We do this in two
661 * steps (first step was init_bootmem()) because this catches
662 * the (very unlikely) case of us accidentally initializing the
663 * bootmem allocator with an invalid RAM area.
664 */
665 reserve_bootmem(__pa_symbol(_text), (PFN_PHYS(min_low_pfn) +
666 bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text),
667 BOOTMEM_DEFAULT);
668
669 /*
670 * reserve physical page 0 - it's a special BIOS page on many boxes,
671 * enabling clean reboots, SMP operation, laptop functions.
672 */
673 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
674
675 /* reserve EBDA region */
676 reserve_ebda_region();
677
678#ifdef CONFIG_SMP
679 /*
680 * But first pinch a few for the stack/trampoline stuff
681 * FIXME: Don't need the extra page at 4K, but need to fix
682 * trampoline before removing it. (see the GDT stuff)
683 */
684 reserve_bootmem(PAGE_SIZE, PAGE_SIZE, BOOTMEM_DEFAULT);
685#endif
686#ifdef CONFIG_ACPI_SLEEP
687 /*
688 * Reserve low memory region for sleep support.
689 */
690 acpi_reserve_bootmem();
691#endif
692#ifdef CONFIG_X86_FIND_SMP_CONFIG
693 /*
694 * Find and reserve possible boot-time SMP configuration:
695 */
696 find_smp_config();
697#endif
698#ifdef CONFIG_BLK_DEV_INITRD
699 reserve_initrd();
700#endif
701 numa_kva_reserve();
702 reserve_crashkernel();
703
704 reserve_ibft_region();
705}
706
707/*
708 * The node 0 pgdat is initialized before all of these because
709 * it's needed for bootmem. node>0 pgdats have their virtual
710 * space allocated before the pagetables are in place to access
711 * them, so they can't be cleared then.
712 *
713 * This should all compile down to nothing when NUMA is off.
714 */
715static void __init remapped_pgdat_init(void)
716{
717 int nid;
718
719 for_each_online_node(nid) {
720 if (nid != 0)
721 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
722 }
723}
724
725#ifdef CONFIG_MCA
726static void set_mca_bus(int x)
727{
728 MCA_bus = x;
729}
730#else
731static void set_mca_bus(int x) { }
732#endif
733
734/* Overridden in paravirt.c if CONFIG_PARAVIRT */
735char * __init __attribute__((weak)) memory_setup(void)
736{
737 return machine_specific_memory_setup();
738}
739
740#ifdef CONFIG_NUMA
741/*
742 * In the golden day, when everything among i386 and x86_64 will be
743 * integrated, this will not live here
744 */
745void *x86_cpu_to_node_map_early_ptr;
746int x86_cpu_to_node_map_init[NR_CPUS] = {
747 [0 ... NR_CPUS-1] = NUMA_NO_NODE
748};
749DEFINE_PER_CPU(int, x86_cpu_to_node_map) = NUMA_NO_NODE;
750#endif
751
752/*
753 * Determine if we were loaded by an EFI loader. If so, then we have also been
754 * passed the efi memmap, systab, etc., so we should use these data structures
755 * for initialization. Note, the efi init code path is determined by the
756 * global efi_enabled. This allows the same kernel image to be used on existing
757 * systems (with a traditional BIOS) as well as on EFI systems.
758 */
759void __init setup_arch(char **cmdline_p)
760{
761 unsigned long max_low_pfn;
762
763 memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
764 pre_setup_arch_hook();
765 early_cpu_init();
766 early_ioremap_init();
767
768#ifdef CONFIG_EFI
769 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
770 "EL32", 4))
771 efi_enabled = 1;
772#endif
773
774 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
775 screen_info = boot_params.screen_info;
776 edid_info = boot_params.edid_info;
777 apm_info.bios = boot_params.apm_bios_info;
778 ist_info = boot_params.ist_info;
779 saved_video_mode = boot_params.hdr.vid_mode;
780 if( boot_params.sys_desc_table.length != 0 ) {
781 set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2);
782 machine_id = boot_params.sys_desc_table.table[0];
783 machine_submodel_id = boot_params.sys_desc_table.table[1];
784 BIOS_revision = boot_params.sys_desc_table.table[2];
785 }
786 bootloader_type = boot_params.hdr.type_of_loader;
787
788#ifdef CONFIG_BLK_DEV_RAM
789 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
790 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
791 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
792#endif
793 ARCH_SETUP
794
795 printk(KERN_INFO "BIOS-provided physical RAM map:\n");
796 print_memory_map(memory_setup());
797
798 copy_edd();
799
800 if (!boot_params.hdr.root_flags)
801 root_mountflags &= ~MS_RDONLY;
802 init_mm.start_code = (unsigned long) _text;
803 init_mm.end_code = (unsigned long) _etext;
804 init_mm.end_data = (unsigned long) _edata;
805 init_mm.brk = init_pg_tables_end + PAGE_OFFSET;
806
807 code_resource.start = virt_to_phys(_text);
808 code_resource.end = virt_to_phys(_etext)-1;
809 data_resource.start = virt_to_phys(_etext);
810 data_resource.end = virt_to_phys(_edata)-1;
811 bss_resource.start = virt_to_phys(&__bss_start);
812 bss_resource.end = virt_to_phys(&__bss_stop)-1;
813
814 parse_early_param();
815
816 if (user_defined_memmap) {
817 printk(KERN_INFO "user-defined physical RAM map:\n");
818 print_memory_map("user");
819 }
820
821 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
822 *cmdline_p = command_line;
823
824 if (efi_enabled)
825 efi_init();
826
827 /* update e820 for memory not covered by WB MTRRs */
828 propagate_e820_map();
829 mtrr_bp_init();
830 if (mtrr_trim_uncached_memory(max_pfn))
831 propagate_e820_map();
832
833 max_low_pfn = setup_memory();
834
835#ifdef CONFIG_KVM_CLOCK
836 kvmclock_init();
837#endif
838
839#ifdef CONFIG_VMI
840 /*
841 * Must be after max_low_pfn is determined, and before kernel
842 * pagetables are setup.
843 */
844 vmi_init();
845#endif
846 kvm_guest_init();
847
848 /*
849 * NOTE: before this point _nobody_ is allowed to allocate
850 * any memory using the bootmem allocator. Although the
851 * allocator is now initialised only the first 8Mb of the kernel
852 * virtual address space has been mapped. All allocations before
853 * paging_init() has completed must use the alloc_bootmem_low_pages()
854 * variant (which allocates DMA'able memory) and care must be taken
855 * not to exceed the 8Mb limit.
856 */
857
858#ifdef CONFIG_SMP
859 smp_alloc_memory(); /* AP processor realmode stacks in low memory*/
860#endif
861 paging_init();
862
863 /*
864 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
865 */
866
867#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
868 if (init_ohci1394_dma_early)
869 init_ohci1394_dma_on_all_controllers();
870#endif
871
872 remapped_pgdat_init();
873 sparse_init();
874 zone_sizes_init();
875
876 /*
877 * NOTE: at this point the bootmem allocator is fully available.
878 */
879
880#ifdef CONFIG_BLK_DEV_INITRD
881 relocate_initrd();
882#endif
883
884 paravirt_post_allocator_init();
885
886 dmi_scan_machine();
887
888 io_delay_init();
889
890#ifdef CONFIG_X86_SMP
891 /*
892 * setup to use the early static init tables during kernel startup
893 * X86_SMP will exclude sub-arches that don't deal well with it.
894 */
895 x86_cpu_to_apicid_early_ptr = (void *)x86_cpu_to_apicid_init;
896 x86_bios_cpu_apicid_early_ptr = (void *)x86_bios_cpu_apicid_init;
897#ifdef CONFIG_NUMA
898 x86_cpu_to_node_map_early_ptr = (void *)x86_cpu_to_node_map_init;
899#endif
900#endif
901
902#ifdef CONFIG_X86_GENERICARCH
903 generic_apic_probe();
904#endif
905
906#ifdef CONFIG_ACPI
907 /*
908 * Parse the ACPI tables for possible boot-time SMP configuration.
909 */
910 acpi_boot_table_init();
911#endif
912
913 early_quirks();
914
915#ifdef CONFIG_ACPI
916 acpi_boot_init();
917
918#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
919 if (def_to_bigsmp)
920 printk(KERN_WARNING "More than 8 CPUs detected and "
921 "CONFIG_X86_PC cannot handle it.\nUse "
922 "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
923#endif
924#endif
925#ifdef CONFIG_X86_LOCAL_APIC
926 if (smp_found_config)
927 get_smp_config();
928#endif
929
930 e820_register_memory();
931 e820_mark_nosave_regions();
932
933#ifdef CONFIG_VT
934#if defined(CONFIG_VGA_CONSOLE)
935 if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
936 conswitchp = &vga_con;
937#elif defined(CONFIG_DUMMY_CONSOLE)
938 conswitchp = &dummy_con;
939#endif
940#endif
941}
942
943/*
944 * Request address space for all standard resources
945 *
946 * This is called just before pcibios_init(), which is also a
947 * subsys_initcall, but is linked in later (in arch/i386/pci/common.c).
948 */
949static int __init request_standard_resources(void)
950{
951 int i;
952
953 printk(KERN_INFO "Setting up standard PCI resources\n");
954 init_iomem_resources(&code_resource, &data_resource, &bss_resource);
955
956 request_resource(&iomem_resource, &video_ram_resource);
957
958 /* request I/O space for devices used on all i[345]86 PCs */
959 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
960 request_resource(&ioport_resource, &standard_io_resources[i]);
961 return 0;
962}
963
964subsys_initcall(request_standard_resources);
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
deleted file mode 100644
index 6dff1286ad8a..000000000000
--- a/arch/x86/kernel/setup_64.c
+++ /dev/null
@@ -1,1194 +0,0 @@
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 */
4
5/*
6 * This file handles the architecture-dependent parts of initialization
7 */
8
9#include <linux/errno.h>
10#include <linux/sched.h>
11#include <linux/kernel.h>
12#include <linux/mm.h>
13#include <linux/stddef.h>
14#include <linux/unistd.h>
15#include <linux/ptrace.h>
16#include <linux/slab.h>
17#include <linux/user.h>
18#include <linux/screen_info.h>
19#include <linux/ioport.h>
20#include <linux/delay.h>
21#include <linux/init.h>
22#include <linux/initrd.h>
23#include <linux/highmem.h>
24#include <linux/bootmem.h>
25#include <linux/module.h>
26#include <asm/processor.h>
27#include <linux/console.h>
28#include <linux/seq_file.h>
29#include <linux/crash_dump.h>
30#include <linux/root_dev.h>
31#include <linux/pci.h>
32#include <asm/pci-direct.h>
33#include <linux/efi.h>
34#include <linux/acpi.h>
35#include <linux/kallsyms.h>
36#include <linux/edd.h>
37#include <linux/iscsi_ibft.h>
38#include <linux/mmzone.h>
39#include <linux/kexec.h>
40#include <linux/cpufreq.h>
41#include <linux/dmi.h>
42#include <linux/dma-mapping.h>
43#include <linux/ctype.h>
44#include <linux/sort.h>
45#include <linux/uaccess.h>
46#include <linux/init_ohci1394_dma.h>
47#include <linux/kvm_para.h>
48
49#include <asm/mtrr.h>
50#include <asm/uaccess.h>
51#include <asm/system.h>
52#include <asm/vsyscall.h>
53#include <asm/io.h>
54#include <asm/smp.h>
55#include <asm/msr.h>
56#include <asm/desc.h>
57#include <video/edid.h>
58#include <asm/e820.h>
59#include <asm/dma.h>
60#include <asm/gart.h>
61#include <asm/mpspec.h>
62#include <asm/mmu_context.h>
63#include <asm/proto.h>
64#include <asm/setup.h>
65#include <asm/numa.h>
66#include <asm/sections.h>
67#include <asm/dmi.h>
68#include <asm/cacheflush.h>
69#include <asm/mce.h>
70#include <asm/ds.h>
71#include <asm/topology.h>
72#include <asm/trampoline.h>
73#include <asm/pat.h>
74
75#include <mach_apic.h>
76#ifdef CONFIG_PARAVIRT
77#include <asm/paravirt.h>
78#else
79#define ARCH_SETUP
80#endif
81
82/*
83 * Machine setup..
84 */
85
86struct cpuinfo_x86 boot_cpu_data __read_mostly;
87EXPORT_SYMBOL(boot_cpu_data);
88
89__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
90
91unsigned long mmu_cr4_features;
92
93/* Boot loader ID as an integer, for the benefit of proc_dointvec */
94int bootloader_type;
95
96unsigned long saved_video_mode;
97
98int force_mwait __cpuinitdata;
99
100/*
101 * Early DMI memory
102 */
103int dmi_alloc_index;
104char dmi_alloc_data[DMI_MAX_DATA];
105
106/*
107 * Setup options
108 */
109struct screen_info screen_info;
110EXPORT_SYMBOL(screen_info);
111struct sys_desc_table_struct {
112 unsigned short length;
113 unsigned char table[0];
114};
115
116struct edid_info edid_info;
117EXPORT_SYMBOL_GPL(edid_info);
118
119extern int root_mountflags;
120
121char __initdata command_line[COMMAND_LINE_SIZE];
122
123static struct resource standard_io_resources[] = {
124 { .name = "dma1", .start = 0x00, .end = 0x1f,
125 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
126 { .name = "pic1", .start = 0x20, .end = 0x21,
127 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
128 { .name = "timer0", .start = 0x40, .end = 0x43,
129 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
130 { .name = "timer1", .start = 0x50, .end = 0x53,
131 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
132 { .name = "keyboard", .start = 0x60, .end = 0x60,
133 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
134 { .name = "keyboard", .start = 0x64, .end = 0x64,
135 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
136 { .name = "dma page reg", .start = 0x80, .end = 0x8f,
137 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
138 { .name = "pic2", .start = 0xa0, .end = 0xa1,
139 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
140 { .name = "dma2", .start = 0xc0, .end = 0xdf,
141 .flags = IORESOURCE_BUSY | IORESOURCE_IO },
142 { .name = "fpu", .start = 0xf0, .end = 0xff,
143 .flags = IORESOURCE_BUSY | IORESOURCE_IO }
144};
145
146#define IORESOURCE_RAM (IORESOURCE_BUSY | IORESOURCE_MEM)
147
148static struct resource data_resource = {
149 .name = "Kernel data",
150 .start = 0,
151 .end = 0,
152 .flags = IORESOURCE_RAM,
153};
154static struct resource code_resource = {
155 .name = "Kernel code",
156 .start = 0,
157 .end = 0,
158 .flags = IORESOURCE_RAM,
159};
160static struct resource bss_resource = {
161 .name = "Kernel bss",
162 .start = 0,
163 .end = 0,
164 .flags = IORESOURCE_RAM,
165};
166
167static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c);
168
169#ifdef CONFIG_PROC_VMCORE
170/* elfcorehdr= specifies the location of elf core header
171 * stored by the crashed kernel. This option will be passed
172 * by kexec loader to the capture kernel.
173 */
174static int __init setup_elfcorehdr(char *arg)
175{
176 char *end;
177 if (!arg)
178 return -EINVAL;
179 elfcorehdr_addr = memparse(arg, &end);
180 return end > arg ? 0 : -EINVAL;
181}
182early_param("elfcorehdr", setup_elfcorehdr);
183#endif
184
185#ifndef CONFIG_NUMA
186static void __init
187contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
188{
189 unsigned long bootmap_size, bootmap;
190
191 bootmap_size = bootmem_bootmap_pages(end_pfn)<<PAGE_SHIFT;
192 bootmap = find_e820_area(0, end_pfn<<PAGE_SHIFT, bootmap_size,
193 PAGE_SIZE);
194 if (bootmap == -1L)
195 panic("Cannot find bootmem map of size %ld\n", bootmap_size);
196 bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn);
197 e820_register_active_regions(0, start_pfn, end_pfn);
198 free_bootmem_with_active_regions(0, end_pfn);
199 early_res_to_bootmem(0, end_pfn<<PAGE_SHIFT);
200 reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);
201}
202#endif
203
204#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
205struct edd edd;
206#ifdef CONFIG_EDD_MODULE
207EXPORT_SYMBOL(edd);
208#endif
209/**
210 * copy_edd() - Copy the BIOS EDD information
211 * from boot_params into a safe place.
212 *
213 */
214static inline void copy_edd(void)
215{
216 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
217 sizeof(edd.mbr_signature));
218 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
219 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
220 edd.edd_info_nr = boot_params.eddbuf_entries;
221}
222#else
223static inline void copy_edd(void)
224{
225}
226#endif
227
228#ifdef CONFIG_KEXEC
229static void __init reserve_crashkernel(void)
230{
231 unsigned long long total_mem;
232 unsigned long long crash_size, crash_base;
233 int ret;
234
235 total_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT;
236
237 ret = parse_crashkernel(boot_command_line, total_mem,
238 &crash_size, &crash_base);
239 if (ret == 0 && crash_size) {
240 if (crash_base <= 0) {
241 printk(KERN_INFO "crashkernel reservation failed - "
242 "you have to specify a base address\n");
243 return;
244 }
245
246 if (reserve_bootmem(crash_base, crash_size,
247 BOOTMEM_EXCLUSIVE) < 0) {
248 printk(KERN_INFO "crashkernel reservation failed - "
249 "memory is in use\n");
250 return;
251 }
252
253 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
254 "for crashkernel (System RAM: %ldMB)\n",
255 (unsigned long)(crash_size >> 20),
256 (unsigned long)(crash_base >> 20),
257 (unsigned long)(total_mem >> 20));
258 crashk_res.start = crash_base;
259 crashk_res.end = crash_base + crash_size - 1;
260 insert_resource(&iomem_resource, &crashk_res);
261 }
262}
263#else
264static inline void __init reserve_crashkernel(void)
265{}
266#endif
267
268/* Overridden in paravirt.c if CONFIG_PARAVIRT */
269void __attribute__((weak)) __init memory_setup(void)
270{
271 machine_specific_memory_setup();
272}
273
274static void __init parse_setup_data(void)
275{
276 struct setup_data *data;
277 unsigned long pa_data;
278
279 if (boot_params.hdr.version < 0x0209)
280 return;
281 pa_data = boot_params.hdr.setup_data;
282 while (pa_data) {
283 data = early_ioremap(pa_data, PAGE_SIZE);
284 switch (data->type) {
285 default:
286 break;
287 }
288#ifndef CONFIG_DEBUG_BOOT_PARAMS
289 free_early(pa_data, pa_data+sizeof(*data)+data->len);
290#endif
291 pa_data = data->next;
292 early_iounmap(data, PAGE_SIZE);
293 }
294}
295
296#ifdef CONFIG_PCI_MMCONFIG
297extern void __cpuinit fam10h_check_enable_mmcfg(void);
298extern void __init check_enable_amd_mmconf_dmi(void);
299#else
300void __cpuinit fam10h_check_enable_mmcfg(void)
301{
302}
303void __init check_enable_amd_mmconf_dmi(void)
304{
305}
306#endif
307
308/*
309 * setup_arch - architecture-specific boot-time initializations
310 *
311 * Note: On x86_64, fixmaps are ready for use even before this is called.
312 */
313void __init setup_arch(char **cmdline_p)
314{
315 unsigned i;
316
317 printk(KERN_INFO "Command line: %s\n", boot_command_line);
318
319 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
320 screen_info = boot_params.screen_info;
321 edid_info = boot_params.edid_info;
322 saved_video_mode = boot_params.hdr.vid_mode;
323 bootloader_type = boot_params.hdr.type_of_loader;
324
325#ifdef CONFIG_BLK_DEV_RAM
326 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
327 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
328 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
329#endif
330#ifdef CONFIG_EFI
331 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
332 "EL64", 4))
333 efi_enabled = 1;
334#endif
335
336 ARCH_SETUP
337
338 memory_setup();
339 copy_edd();
340
341 if (!boot_params.hdr.root_flags)
342 root_mountflags &= ~MS_RDONLY;
343 init_mm.start_code = (unsigned long) &_text;
344 init_mm.end_code = (unsigned long) &_etext;
345 init_mm.end_data = (unsigned long) &_edata;
346 init_mm.brk = (unsigned long) &_end;
347
348 code_resource.start = virt_to_phys(&_text);
349 code_resource.end = virt_to_phys(&_etext)-1;
350 data_resource.start = virt_to_phys(&_etext);
351 data_resource.end = virt_to_phys(&_edata)-1;
352 bss_resource.start = virt_to_phys(&__bss_start);
353 bss_resource.end = virt_to_phys(&__bss_stop)-1;
354
355 early_identify_cpu(&boot_cpu_data);
356
357 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
358 *cmdline_p = command_line;
359
360 parse_setup_data();
361
362 parse_early_param();
363
364#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
365 if (init_ohci1394_dma_early)
366 init_ohci1394_dma_on_all_controllers();
367#endif
368
369 finish_e820_parsing();
370
371 /* after parse_early_param, so could debug it */
372 insert_resource(&iomem_resource, &code_resource);
373 insert_resource(&iomem_resource, &data_resource);
374 insert_resource(&iomem_resource, &bss_resource);
375
376 early_gart_iommu_check();
377
378 e820_register_active_regions(0, 0, -1UL);
379 /*
380 * partially used pages are not usable - thus
381 * we are rounding upwards:
382 */
383 end_pfn = e820_end_of_ram();
384 /* update e820 for memory not covered by WB MTRRs */
385 mtrr_bp_init();
386 if (mtrr_trim_uncached_memory(end_pfn)) {
387 e820_register_active_regions(0, 0, -1UL);
388 end_pfn = e820_end_of_ram();
389 }
390
391 num_physpages = end_pfn;
392
393 check_efer();
394
395 max_pfn_mapped = init_memory_mapping(0, (max_pfn_mapped << PAGE_SHIFT));
396 if (efi_enabled)
397 efi_init();
398
399 vsmp_init();
400
401 dmi_scan_machine();
402
403 io_delay_init();
404
405#ifdef CONFIG_KVM_CLOCK
406 kvmclock_init();
407#endif
408
409#ifdef CONFIG_SMP
410 /* setup to use the early static init tables during kernel startup */
411 x86_cpu_to_apicid_early_ptr = (void *)x86_cpu_to_apicid_init;
412 x86_bios_cpu_apicid_early_ptr = (void *)x86_bios_cpu_apicid_init;
413#ifdef CONFIG_NUMA
414 x86_cpu_to_node_map_early_ptr = (void *)x86_cpu_to_node_map_init;
415#endif
416#endif
417
418#ifdef CONFIG_ACPI
419 /*
420 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
421 * Call this early for SRAT node setup.
422 */
423 acpi_boot_table_init();
424#endif
425
426 /* How many end-of-memory variables you have, grandma! */
427 max_low_pfn = end_pfn;
428 max_pfn = end_pfn;
429 high_memory = (void *)__va(end_pfn * PAGE_SIZE - 1) + 1;
430
431 /* Remove active ranges so rediscovery with NUMA-awareness happens */
432 remove_all_active_ranges();
433
434#ifdef CONFIG_ACPI_NUMA
435 /*
436 * Parse SRAT to discover nodes.
437 */
438 acpi_numa_init();
439#endif
440
441#ifdef CONFIG_NUMA
442 numa_initmem_init(0, end_pfn);
443#else
444 contig_initmem_init(0, end_pfn);
445#endif
446
447 dma32_reserve_bootmem();
448
449#ifdef CONFIG_ACPI_SLEEP
450 /*
451 * Reserve low memory region for sleep support.
452 */
453 acpi_reserve_bootmem();
454#endif
455
456 if (efi_enabled)
457 efi_reserve_bootmem();
458
459 /*
460 * Find and reserve possible boot-time SMP configuration:
461 */
462 find_smp_config();
463#ifdef CONFIG_BLK_DEV_INITRD
464 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
465 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
466 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
467 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
468 unsigned long end_of_mem = end_pfn << PAGE_SHIFT;
469
470 if (ramdisk_end <= end_of_mem) {
471 /*
472 * don't need to reserve again, already reserved early
473 * in x86_64_start_kernel, and early_res_to_bootmem
474 * convert that to reserved in bootmem
475 */
476 initrd_start = ramdisk_image + PAGE_OFFSET;
477 initrd_end = initrd_start+ramdisk_size;
478 } else {
479 free_bootmem(ramdisk_image, ramdisk_size);
480 printk(KERN_ERR "initrd extends beyond end of memory "
481 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
482 ramdisk_end, end_of_mem);
483 initrd_start = 0;
484 }
485 }
486#endif
487 reserve_crashkernel();
488
489 reserve_ibft_region();
490
491 paging_init();
492 map_vsyscall();
493
494 early_quirks();
495
496#ifdef CONFIG_ACPI
497 /*
498 * Read APIC and some other early information from ACPI tables.
499 */
500 acpi_boot_init();
501#endif
502
503 init_cpu_to_node();
504
505 /*
506 * get boot-time SMP configuration:
507 */
508 if (smp_found_config)
509 get_smp_config();
510 init_apic_mappings();
511 ioapic_init_mappings();
512
513 kvm_guest_init();
514
515 /*
516 * We trust e820 completely. No explicit ROM probing in memory.
517 */
518 e820_reserve_resources();
519 e820_mark_nosave_regions();
520
521 /* request I/O space for devices used on all i[345]86 PCs */
522 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
523 request_resource(&ioport_resource, &standard_io_resources[i]);
524
525 e820_setup_gap();
526
527#ifdef CONFIG_VT
528#if defined(CONFIG_VGA_CONSOLE)
529 if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
530 conswitchp = &vga_con;
531#elif defined(CONFIG_DUMMY_CONSOLE)
532 conswitchp = &dummy_con;
533#endif
534#endif
535
536 /* do this before identify_cpu for boot cpu */
537 check_enable_amd_mmconf_dmi();
538}
539
540static int __cpuinit get_model_name(struct cpuinfo_x86 *c)
541{
542 unsigned int *v;
543
544 if (c->extended_cpuid_level < 0x80000004)
545 return 0;
546
547 v = (unsigned int *) c->x86_model_id;
548 cpuid(0x80000002, &v[0], &v[1], &v[2], &v[3]);
549 cpuid(0x80000003, &v[4], &v[5], &v[6], &v[7]);
550 cpuid(0x80000004, &v[8], &v[9], &v[10], &v[11]);
551 c->x86_model_id[48] = 0;
552 return 1;
553}
554
555
556static void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
557{
558 unsigned int n, dummy, eax, ebx, ecx, edx;
559
560 n = c->extended_cpuid_level;
561
562 if (n >= 0x80000005) {
563 cpuid(0x80000005, &dummy, &ebx, &ecx, &edx);
564 printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), "
565 "D cache %dK (%d bytes/line)\n",
566 edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
567 c->x86_cache_size = (ecx>>24) + (edx>>24);
568 /* On K8 L1 TLB is inclusive, so don't count it */
569 c->x86_tlbsize = 0;
570 }
571
572 if (n >= 0x80000006) {
573 cpuid(0x80000006, &dummy, &ebx, &ecx, &edx);
574 ecx = cpuid_ecx(0x80000006);
575 c->x86_cache_size = ecx >> 16;
576 c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff);
577
578 printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n",
579 c->x86_cache_size, ecx & 0xFF);
580 }
581 if (n >= 0x80000008) {
582 cpuid(0x80000008, &eax, &dummy, &dummy, &dummy);
583 c->x86_virt_bits = (eax >> 8) & 0xff;
584 c->x86_phys_bits = eax & 0xff;
585 }
586}
587
588#ifdef CONFIG_NUMA
589static int __cpuinit nearby_node(int apicid)
590{
591 int i, node;
592
593 for (i = apicid - 1; i >= 0; i--) {
594 node = apicid_to_node[i];
595 if (node != NUMA_NO_NODE && node_online(node))
596 return node;
597 }
598 for (i = apicid + 1; i < MAX_LOCAL_APIC; i++) {
599 node = apicid_to_node[i];
600 if (node != NUMA_NO_NODE && node_online(node))
601 return node;
602 }
603 return first_node(node_online_map); /* Shouldn't happen */
604}
605#endif
606
607/*
608 * On a AMD dual core setup the lower bits of the APIC id distingush the cores.
609 * Assumes number of cores is a power of two.
610 */
611static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
612{
613#ifdef CONFIG_SMP
614 unsigned bits;
615#ifdef CONFIG_NUMA
616 int cpu = smp_processor_id();
617 int node = 0;
618 unsigned apicid = hard_smp_processor_id();
619#endif
620 bits = c->x86_coreid_bits;
621
622 /* Low order bits define the core id (index of core in socket) */
623 c->cpu_core_id = c->initial_apicid & ((1 << bits)-1);
624 /* Convert the initial APIC ID into the socket ID */
625 c->phys_proc_id = c->initial_apicid >> bits;
626
627#ifdef CONFIG_NUMA
628 node = c->phys_proc_id;
629 if (apicid_to_node[apicid] != NUMA_NO_NODE)
630 node = apicid_to_node[apicid];
631 if (!node_online(node)) {
632 /* Two possibilities here:
633 - The CPU is missing memory and no node was created.
634 In that case try picking one from a nearby CPU
635 - The APIC IDs differ from the HyperTransport node IDs
636 which the K8 northbridge parsing fills in.
637 Assume they are all increased by a constant offset,
638 but in the same order as the HT nodeids.
639 If that doesn't result in a usable node fall back to the
640 path for the previous case. */
641
642 int ht_nodeid = c->initial_apicid;
643
644 if (ht_nodeid >= 0 &&
645 apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
646 node = apicid_to_node[ht_nodeid];
647 /* Pick a nearby node */
648 if (!node_online(node))
649 node = nearby_node(apicid);
650 }
651 numa_set_node(cpu, node);
652
653 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
654#endif
655#endif
656}
657
658static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
659{
660#ifdef CONFIG_SMP
661 unsigned bits, ecx;
662
663 /* Multi core CPU? */
664 if (c->extended_cpuid_level < 0x80000008)
665 return;
666
667 ecx = cpuid_ecx(0x80000008);
668
669 c->x86_max_cores = (ecx & 0xff) + 1;
670
671 /* CPU telling us the core id bits shift? */
672 bits = (ecx >> 12) & 0xF;
673
674 /* Otherwise recompute */
675 if (bits == 0) {
676 while ((1 << bits) < c->x86_max_cores)
677 bits++;
678 }
679
680 c->x86_coreid_bits = bits;
681
682#endif
683}
684
685#define ENABLE_C1E_MASK 0x18000000
686#define CPUID_PROCESSOR_SIGNATURE 1
687#define CPUID_XFAM 0x0ff00000
688#define CPUID_XFAM_K8 0x00000000
689#define CPUID_XFAM_10H 0x00100000
690#define CPUID_XFAM_11H 0x00200000
691#define CPUID_XMOD 0x000f0000
692#define CPUID_XMOD_REV_F 0x00040000
693
694/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */
695static __cpuinit int amd_apic_timer_broken(void)
696{
697 u32 lo, hi, eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
698
699 switch (eax & CPUID_XFAM) {
700 case CPUID_XFAM_K8:
701 if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
702 break;
703 case CPUID_XFAM_10H:
704 case CPUID_XFAM_11H:
705 rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
706 if (lo & ENABLE_C1E_MASK)
707 return 1;
708 break;
709 default:
710 /* err on the side of caution */
711 return 1;
712 }
713 return 0;
714}
715
716static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
717{
718 early_init_amd_mc(c);
719
720 /* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */
721 if (c->x86_power & (1<<8))
722 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
723}
724
725static void __cpuinit init_amd(struct cpuinfo_x86 *c)
726{
727 unsigned level;
728
729#ifdef CONFIG_SMP
730 unsigned long value;
731
732 /*
733 * Disable TLB flush filter by setting HWCR.FFDIS on K8
734 * bit 6 of msr C001_0015
735 *
736 * Errata 63 for SH-B3 steppings
737 * Errata 122 for all steppings (F+ have it disabled by default)
738 */
739 if (c->x86 == 15) {
740 rdmsrl(MSR_K8_HWCR, value);
741 value |= 1 << 6;
742 wrmsrl(MSR_K8_HWCR, value);
743 }
744#endif
745
746 /* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
747 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
748 clear_cpu_cap(c, 0*32+31);
749
750 /* On C+ stepping K8 rep microcode works well for copy/memset */
751 level = cpuid_eax(1);
752 if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) ||
753 level >= 0x0f58))
754 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
755 if (c->x86 == 0x10 || c->x86 == 0x11)
756 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
757
758 /* Enable workaround for FXSAVE leak */
759 if (c->x86 >= 6)
760 set_cpu_cap(c, X86_FEATURE_FXSAVE_LEAK);
761
762 level = get_model_name(c);
763 if (!level) {
764 switch (c->x86) {
765 case 15:
766 /* Should distinguish Models here, but this is only
767 a fallback anyways. */
768 strcpy(c->x86_model_id, "Hammer");
769 break;
770 }
771 }
772 display_cacheinfo(c);
773
774 /* Multi core CPU? */
775 if (c->extended_cpuid_level >= 0x80000008)
776 amd_detect_cmp(c);
777
778 if (c->extended_cpuid_level >= 0x80000006 &&
779 (cpuid_edx(0x80000006) & 0xf000))
780 num_cache_leaves = 4;
781 else
782 num_cache_leaves = 3;
783
784 if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x11)
785 set_cpu_cap(c, X86_FEATURE_K8);
786
787 /* MFENCE stops RDTSC speculation */
788 set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC);
789
790 if (c->x86 == 0x10)
791 fam10h_check_enable_mmcfg();
792
793 if (amd_apic_timer_broken())
794 disable_apic_timer = 1;
795
796 if (c == &boot_cpu_data && c->x86 >= 0xf && c->x86 <= 0x11) {
797 unsigned long long tseg;
798
799 /*
800 * Split up direct mapping around the TSEG SMM area.
801 * Don't do it for gbpages because there seems very little
802 * benefit in doing so.
803 */
804 if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg) &&
805 (tseg >> PMD_SHIFT) < (max_pfn_mapped >> (PMD_SHIFT-PAGE_SHIFT)))
806 set_memory_4k((unsigned long)__va(tseg), 1);
807 }
808}
809
810void __cpuinit detect_ht(struct cpuinfo_x86 *c)
811{
812#ifdef CONFIG_SMP
813 u32 eax, ebx, ecx, edx;
814 int index_msb, core_bits;
815
816 cpuid(1, &eax, &ebx, &ecx, &edx);
817
818
819 if (!cpu_has(c, X86_FEATURE_HT))
820 return;
821 if (cpu_has(c, X86_FEATURE_CMP_LEGACY))
822 goto out;
823
824 smp_num_siblings = (ebx & 0xff0000) >> 16;
825
826 if (smp_num_siblings == 1) {
827 printk(KERN_INFO "CPU: Hyper-Threading is disabled\n");
828 } else if (smp_num_siblings > 1) {
829
830 if (smp_num_siblings > NR_CPUS) {
831 printk(KERN_WARNING "CPU: Unsupported number of "
832 "siblings %d", smp_num_siblings);
833 smp_num_siblings = 1;
834 return;
835 }
836
837 index_msb = get_count_order(smp_num_siblings);
838 c->phys_proc_id = phys_pkg_id(index_msb);
839
840 smp_num_siblings = smp_num_siblings / c->x86_max_cores;
841
842 index_msb = get_count_order(smp_num_siblings);
843
844 core_bits = get_count_order(c->x86_max_cores);
845
846 c->cpu_core_id = phys_pkg_id(index_msb) &
847 ((1 << core_bits) - 1);
848 }
849out:
850 if ((c->x86_max_cores * smp_num_siblings) > 1) {
851 printk(KERN_INFO "CPU: Physical Processor ID: %d\n",
852 c->phys_proc_id);
853 printk(KERN_INFO "CPU: Processor Core ID: %d\n",
854 c->cpu_core_id);
855 }
856
857#endif
858}
859
860/*
861 * find out the number of processor cores on the die
862 */
863static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
864{
865 unsigned int eax, t;
866
867 if (c->cpuid_level < 4)
868 return 1;
869
870 cpuid_count(4, 0, &eax, &t, &t, &t);
871
872 if (eax & 0x1f)
873 return ((eax >> 26) + 1);
874 else
875 return 1;
876}
877
878static void __cpuinit srat_detect_node(void)
879{
880#ifdef CONFIG_NUMA
881 unsigned node;
882 int cpu = smp_processor_id();
883 int apicid = hard_smp_processor_id();
884
885 /* Don't do the funky fallback heuristics the AMD version employs
886 for now. */
887 node = apicid_to_node[apicid];
888 if (node == NUMA_NO_NODE || !node_online(node))
889 node = first_node(node_online_map);
890 numa_set_node(cpu, node);
891
892 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
893#endif
894}
895
896static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
897{
898 if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
899 (c->x86 == 0x6 && c->x86_model >= 0x0e))
900 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
901}
902
903static void __cpuinit init_intel(struct cpuinfo_x86 *c)
904{
905 /* Cache sizes */
906 unsigned n;
907
908 init_intel_cacheinfo(c);
909 if (c->cpuid_level > 9) {
910 unsigned eax = cpuid_eax(10);
911 /* Check for version and the number of counters */
912 if ((eax & 0xff) && (((eax>>8) & 0xff) > 1))
913 set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
914 }
915
916 if (cpu_has_ds) {
917 unsigned int l1, l2;
918 rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
919 if (!(l1 & (1<<11)))
920 set_cpu_cap(c, X86_FEATURE_BTS);
921 if (!(l1 & (1<<12)))
922 set_cpu_cap(c, X86_FEATURE_PEBS);
923 }
924
925
926 if (cpu_has_bts)
927 ds_init_intel(c);
928
929 n = c->extended_cpuid_level;
930 if (n >= 0x80000008) {
931 unsigned eax = cpuid_eax(0x80000008);
932 c->x86_virt_bits = (eax >> 8) & 0xff;
933 c->x86_phys_bits = eax & 0xff;
934 /* CPUID workaround for Intel 0F34 CPU */
935 if (c->x86_vendor == X86_VENDOR_INTEL &&
936 c->x86 == 0xF && c->x86_model == 0x3 &&
937 c->x86_mask == 0x4)
938 c->x86_phys_bits = 36;
939 }
940
941 if (c->x86 == 15)
942 c->x86_cache_alignment = c->x86_clflush_size * 2;
943 if (c->x86 == 6)
944 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
945 set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
946 c->x86_max_cores = intel_num_cpu_cores(c);
947
948 srat_detect_node();
949}
950
951static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c)
952{
953 if (c->x86 == 0x6 && c->x86_model >= 0xf)
954 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
955}
956
957static void __cpuinit init_centaur(struct cpuinfo_x86 *c)
958{
959 /* Cache sizes */
960 unsigned n;
961
962 n = c->extended_cpuid_level;
963 if (n >= 0x80000008) {
964 unsigned eax = cpuid_eax(0x80000008);
965 c->x86_virt_bits = (eax >> 8) & 0xff;
966 c->x86_phys_bits = eax & 0xff;
967 }
968
969 if (c->x86 == 0x6 && c->x86_model >= 0xf) {
970 c->x86_cache_alignment = c->x86_clflush_size * 2;
971 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
972 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
973 }
974 set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
975}
976
977static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
978{
979 char *v = c->x86_vendor_id;
980
981 if (!strcmp(v, "AuthenticAMD"))
982 c->x86_vendor = X86_VENDOR_AMD;
983 else if (!strcmp(v, "GenuineIntel"))
984 c->x86_vendor = X86_VENDOR_INTEL;
985 else if (!strcmp(v, "CentaurHauls"))
986 c->x86_vendor = X86_VENDOR_CENTAUR;
987 else
988 c->x86_vendor = X86_VENDOR_UNKNOWN;
989}
990
991/* Do some early cpuid on the boot CPU to get some parameter that are
992 needed before check_bugs. Everything advanced is in identify_cpu
993 below. */
994static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
995{
996 u32 tfms, xlvl;
997
998 c->loops_per_jiffy = loops_per_jiffy;
999 c->x86_cache_size = -1;
1000 c->x86_vendor = X86_VENDOR_UNKNOWN;
1001 c->x86_model = c->x86_mask = 0; /* So far unknown... */
1002 c->x86_vendor_id[0] = '\0'; /* Unset */
1003 c->x86_model_id[0] = '\0'; /* Unset */
1004 c->x86_clflush_size = 64;
1005 c->x86_cache_alignment = c->x86_clflush_size;
1006 c->x86_max_cores = 1;
1007 c->x86_coreid_bits = 0;
1008 c->extended_cpuid_level = 0;
1009 memset(&c->x86_capability, 0, sizeof c->x86_capability);
1010
1011 /* Get vendor name */
1012 cpuid(0x00000000, (unsigned int *)&c->cpuid_level,
1013 (unsigned int *)&c->x86_vendor_id[0],
1014 (unsigned int *)&c->x86_vendor_id[8],
1015 (unsigned int *)&c->x86_vendor_id[4]);
1016
1017 get_cpu_vendor(c);
1018
1019 /* Initialize the standard set of capabilities */
1020 /* Note that the vendor-specific code below might override */
1021
1022 /* Intel-defined flags: level 0x00000001 */
1023 if (c->cpuid_level >= 0x00000001) {
1024 __u32 misc;
1025 cpuid(0x00000001, &tfms, &misc, &c->x86_capability[4],
1026 &c->x86_capability[0]);
1027 c->x86 = (tfms >> 8) & 0xf;
1028 c->x86_model = (tfms >> 4) & 0xf;
1029 c->x86_mask = tfms & 0xf;
1030 if (c->x86 == 0xf)
1031 c->x86 += (tfms >> 20) & 0xff;
1032 if (c->x86 >= 0x6)
1033 c->x86_model += ((tfms >> 16) & 0xF) << 4;
1034 if (test_cpu_cap(c, X86_FEATURE_CLFLSH))
1035 c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
1036 } else {
1037 /* Have CPUID level 0 only - unheard of */
1038 c->x86 = 4;
1039 }
1040
1041 c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xff;
1042#ifdef CONFIG_SMP
1043 c->phys_proc_id = c->initial_apicid;
1044#endif
1045 /* AMD-defined flags: level 0x80000001 */
1046 xlvl = cpuid_eax(0x80000000);
1047 c->extended_cpuid_level = xlvl;
1048 if ((xlvl & 0xffff0000) == 0x80000000) {
1049 if (xlvl >= 0x80000001) {
1050 c->x86_capability[1] = cpuid_edx(0x80000001);
1051 c->x86_capability[6] = cpuid_ecx(0x80000001);
1052 }
1053 if (xlvl >= 0x80000004)
1054 get_model_name(c); /* Default name */
1055 }
1056
1057 /* Transmeta-defined flags: level 0x80860001 */
1058 xlvl = cpuid_eax(0x80860000);
1059 if ((xlvl & 0xffff0000) == 0x80860000) {
1060 /* Don't set x86_cpuid_level here for now to not confuse. */
1061 if (xlvl >= 0x80860001)
1062 c->x86_capability[2] = cpuid_edx(0x80860001);
1063 }
1064
1065 c->extended_cpuid_level = cpuid_eax(0x80000000);
1066 if (c->extended_cpuid_level >= 0x80000007)
1067 c->x86_power = cpuid_edx(0x80000007);
1068
1069 switch (c->x86_vendor) {
1070 case X86_VENDOR_AMD:
1071 early_init_amd(c);
1072 break;
1073 case X86_VENDOR_INTEL:
1074 early_init_intel(c);
1075 break;
1076 case X86_VENDOR_CENTAUR:
1077 early_init_centaur(c);
1078 break;
1079 }
1080
1081 validate_pat_support(c);
1082}
1083
1084/*
1085 * This does the hard work of actually picking apart the CPU stuff...
1086 */
1087void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
1088{
1089 int i;
1090
1091 early_identify_cpu(c);
1092
1093 init_scattered_cpuid_features(c);
1094
1095 c->apicid = phys_pkg_id(0);
1096
1097 /*
1098 * Vendor-specific initialization. In this section we
1099 * canonicalize the feature flags, meaning if there are
1100 * features a certain CPU supports which CPUID doesn't
1101 * tell us, CPUID claiming incorrect flags, or other bugs,
1102 * we handle them here.
1103 *
1104 * At the end of this section, c->x86_capability better
1105 * indicate the features this CPU genuinely supports!
1106 */
1107 switch (c->x86_vendor) {
1108 case X86_VENDOR_AMD:
1109 init_amd(c);
1110 break;
1111
1112 case X86_VENDOR_INTEL:
1113 init_intel(c);
1114 break;
1115
1116 case X86_VENDOR_CENTAUR:
1117 init_centaur(c);
1118 break;
1119
1120 case X86_VENDOR_UNKNOWN:
1121 default:
1122 display_cacheinfo(c);
1123 break;
1124 }
1125
1126 detect_ht(c);
1127
1128 /*
1129 * On SMP, boot_cpu_data holds the common feature set between
1130 * all CPUs; so make sure that we indicate which features are
1131 * common between the CPUs. The first time this routine gets
1132 * executed, c == &boot_cpu_data.
1133 */
1134 if (c != &boot_cpu_data) {
1135 /* AND the already accumulated flags with these */
1136 for (i = 0; i < NCAPINTS; i++)
1137 boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
1138 }
1139
1140 /* Clear all flags overriden by options */
1141 for (i = 0; i < NCAPINTS; i++)
1142 c->x86_capability[i] &= ~cleared_cpu_caps[i];
1143
1144#ifdef CONFIG_X86_MCE
1145 mcheck_init(c);
1146#endif
1147 select_idle_routine(c);
1148
1149#ifdef CONFIG_NUMA
1150 numa_add_cpu(smp_processor_id());
1151#endif
1152
1153}
1154
1155void __cpuinit identify_boot_cpu(void)
1156{
1157 identify_cpu(&boot_cpu_data);
1158}
1159
1160void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c)
1161{
1162 BUG_ON(c == &boot_cpu_data);
1163 identify_cpu(c);
1164 mtrr_ap_init();
1165}
1166
1167static __init int setup_noclflush(char *arg)
1168{
1169 setup_clear_cpu_cap(X86_FEATURE_CLFLSH);
1170 return 1;
1171}
1172__setup("noclflush", setup_noclflush);
1173
1174void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
1175{
1176 if (c->x86_model_id[0])
1177 printk(KERN_CONT "%s", c->x86_model_id);
1178
1179 if (c->x86_mask || c->cpuid_level >= 0)
1180 printk(KERN_CONT " stepping %02x\n", c->x86_mask);
1181 else
1182 printk(KERN_CONT "\n");
1183}
1184
1185static __init int setup_disablecpuid(char *arg)
1186{
1187 int bit;
1188 if (get_option(&arg, &bit) && bit < NCAPINTS*32)
1189 setup_clear_cpu_cap(bit);
1190 else
1191 return 0;
1192 return 1;
1193}
1194__setup("clearcpuid=", setup_disablecpuid);
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
new file mode 100644
index 000000000000..cac68430d31f
--- /dev/null
+++ b/arch/x86/kernel/setup_percpu.c
@@ -0,0 +1,399 @@
1#include <linux/kernel.h>
2#include <linux/module.h>
3#include <linux/init.h>
4#include <linux/bootmem.h>
5#include <linux/percpu.h>
6#include <linux/kexec.h>
7#include <linux/crash_dump.h>
8#include <asm/smp.h>
9#include <asm/percpu.h>
10#include <asm/sections.h>
11#include <asm/processor.h>
12#include <asm/setup.h>
13#include <asm/topology.h>
14#include <asm/mpspec.h>
15#include <asm/apicdef.h>
16#include <asm/highmem.h>
17
18#ifdef CONFIG_X86_LOCAL_APIC
19unsigned int num_processors;
20unsigned disabled_cpus __cpuinitdata;
21/* Processor that is doing the boot up */
22unsigned int boot_cpu_physical_apicid = -1U;
23unsigned int max_physical_apicid;
24EXPORT_SYMBOL(boot_cpu_physical_apicid);
25
26/* Bitmask of physically existing CPUs */
27physid_mask_t phys_cpu_present_map;
28#endif
29
30/* map cpu index to physical APIC ID */
31DEFINE_EARLY_PER_CPU(u16, x86_cpu_to_apicid, BAD_APICID);
32DEFINE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid, BAD_APICID);
33EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_apicid);
34EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
35
36#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
37#define X86_64_NUMA 1
38
39/* map cpu index to node index */
40DEFINE_EARLY_PER_CPU(int, x86_cpu_to_node_map, NUMA_NO_NODE);
41EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map);
42
43/* which logical CPUs are on which nodes */
44cpumask_t *node_to_cpumask_map;
45EXPORT_SYMBOL(node_to_cpumask_map);
46
47/* setup node_to_cpumask_map */
48static void __init setup_node_to_cpumask_map(void);
49
50#else
51static inline void setup_node_to_cpumask_map(void) { }
52#endif
53
54#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_X86_SMP)
55/*
56 * Copy data used in early init routines from the initial arrays to the
57 * per cpu data areas. These arrays then become expendable and the
58 * *_early_ptr's are zeroed indicating that the static arrays are gone.
59 */
60static void __init setup_per_cpu_maps(void)
61{
62 int cpu;
63
64 for_each_possible_cpu(cpu) {
65 per_cpu(x86_cpu_to_apicid, cpu) =
66 early_per_cpu_map(x86_cpu_to_apicid, cpu);
67 per_cpu(x86_bios_cpu_apicid, cpu) =
68 early_per_cpu_map(x86_bios_cpu_apicid, cpu);
69#ifdef X86_64_NUMA
70 per_cpu(x86_cpu_to_node_map, cpu) =
71 early_per_cpu_map(x86_cpu_to_node_map, cpu);
72#endif
73 }
74
75 /* indicate the early static arrays will soon be gone */
76 early_per_cpu_ptr(x86_cpu_to_apicid) = NULL;
77 early_per_cpu_ptr(x86_bios_cpu_apicid) = NULL;
78#ifdef X86_64_NUMA
79 early_per_cpu_ptr(x86_cpu_to_node_map) = NULL;
80#endif
81}
82
83#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
84cpumask_t *cpumask_of_cpu_map __read_mostly;
85EXPORT_SYMBOL(cpumask_of_cpu_map);
86
87/* requires nr_cpu_ids to be initialized */
88static void __init setup_cpumask_of_cpu(void)
89{
90 int i;
91
92 /* alloc_bootmem zeroes memory */
93 cpumask_of_cpu_map = alloc_bootmem_low(sizeof(cpumask_t) * nr_cpu_ids);
94 for (i = 0; i < nr_cpu_ids; i++)
95 cpu_set(i, cpumask_of_cpu_map[i]);
96}
97#else
98static inline void setup_cpumask_of_cpu(void) { }
99#endif
100
101#ifdef CONFIG_X86_32
102/*
103 * Great future not-so-futuristic plan: make i386 and x86_64 do it
104 * the same way
105 */
106unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
107EXPORT_SYMBOL(__per_cpu_offset);
108static inline void setup_cpu_pda_map(void) { }
109
110#elif !defined(CONFIG_SMP)
111static inline void setup_cpu_pda_map(void) { }
112
113#else /* CONFIG_SMP && CONFIG_X86_64 */
114
115/*
116 * Allocate cpu_pda pointer table and array via alloc_bootmem.
117 */
118static void __init setup_cpu_pda_map(void)
119{
120 char *pda;
121 struct x8664_pda **new_cpu_pda;
122 unsigned long size;
123 int cpu;
124
125 size = roundup(sizeof(struct x8664_pda), cache_line_size());
126
127 /* allocate cpu_pda array and pointer table */
128 {
129 unsigned long tsize = nr_cpu_ids * sizeof(void *);
130 unsigned long asize = size * (nr_cpu_ids - 1);
131
132 tsize = roundup(tsize, cache_line_size());
133 new_cpu_pda = alloc_bootmem(tsize + asize);
134 pda = (char *)new_cpu_pda + tsize;
135 }
136
137 /* initialize pointer table to static pda's */
138 for_each_possible_cpu(cpu) {
139 if (cpu == 0) {
140 /* leave boot cpu pda in place */
141 new_cpu_pda[0] = cpu_pda(0);
142 continue;
143 }
144 new_cpu_pda[cpu] = (struct x8664_pda *)pda;
145 new_cpu_pda[cpu]->in_bootmem = 1;
146 pda += size;
147 }
148
149 /* point to new pointer table */
150 _cpu_pda = new_cpu_pda;
151}
152#endif
153
154/*
155 * Great future plan:
156 * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
157 * Always point %gs to its beginning
158 */
159void __init setup_per_cpu_areas(void)
160{
161 ssize_t size = PERCPU_ENOUGH_ROOM;
162 char *ptr;
163 int cpu;
164
165 /* Setup cpu_pda map */
166 setup_cpu_pda_map();
167
168 /* Copy section for each CPU (we discard the original) */
169 size = PERCPU_ENOUGH_ROOM;
170 printk(KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n",
171 size);
172
173 for_each_possible_cpu(cpu) {
174#ifndef CONFIG_NEED_MULTIPLE_NODES
175 ptr = alloc_bootmem_pages(size);
176#else
177 int node = early_cpu_to_node(cpu);
178 if (!node_online(node) || !NODE_DATA(node)) {
179 ptr = alloc_bootmem_pages(size);
180 printk(KERN_INFO
181 "cpu %d has no node %d or node-local memory\n",
182 cpu, node);
183 }
184 else
185 ptr = alloc_bootmem_pages_node(NODE_DATA(node), size);
186#endif
187 per_cpu_offset(cpu) = ptr - __per_cpu_start;
188 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
189
190 }
191
192 printk(KERN_DEBUG "NR_CPUS: %d, nr_cpu_ids: %d, nr_node_ids %d\n",
193 NR_CPUS, nr_cpu_ids, nr_node_ids);
194
195 /* Setup percpu data maps */
196 setup_per_cpu_maps();
197
198 /* Setup node to cpumask map */
199 setup_node_to_cpumask_map();
200
201 /* Setup cpumask_of_cpu map */
202 setup_cpumask_of_cpu();
203}
204
205#endif
206
207#ifdef X86_64_NUMA
208
209/*
210 * Allocate node_to_cpumask_map based on number of available nodes
211 * Requires node_possible_map to be valid.
212 *
213 * Note: node_to_cpumask() is not valid until after this is done.
214 */
215static void __init setup_node_to_cpumask_map(void)
216{
217 unsigned int node, num = 0;
218 cpumask_t *map;
219
220 /* setup nr_node_ids if not done yet */
221 if (nr_node_ids == MAX_NUMNODES) {
222 for_each_node_mask(node, node_possible_map)
223 num = node;
224 nr_node_ids = num + 1;
225 }
226
227 /* allocate the map */
228 map = alloc_bootmem_low(nr_node_ids * sizeof(cpumask_t));
229
230 Dprintk(KERN_DEBUG "Node to cpumask map at %p for %d nodes\n",
231 map, nr_node_ids);
232
233 /* node_to_cpumask() will now work */
234 node_to_cpumask_map = map;
235}
236
237void __cpuinit numa_set_node(int cpu, int node)
238{
239 int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map);
240
241 if (cpu_pda(cpu) && node != NUMA_NO_NODE)
242 cpu_pda(cpu)->nodenumber = node;
243
244 if (cpu_to_node_map)
245 cpu_to_node_map[cpu] = node;
246
247 else if (per_cpu_offset(cpu))
248 per_cpu(x86_cpu_to_node_map, cpu) = node;
249
250 else
251 Dprintk(KERN_INFO "Setting node for non-present cpu %d\n", cpu);
252}
253
254void __cpuinit numa_clear_node(int cpu)
255{
256 numa_set_node(cpu, NUMA_NO_NODE);
257}
258
259#ifndef CONFIG_DEBUG_PER_CPU_MAPS
260
261void __cpuinit numa_add_cpu(int cpu)
262{
263 cpu_set(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
264}
265
266void __cpuinit numa_remove_cpu(int cpu)
267{
268 cpu_clear(cpu, node_to_cpumask_map[cpu_to_node(cpu)]);
269}
270
271#else /* CONFIG_DEBUG_PER_CPU_MAPS */
272
273/*
274 * --------- debug versions of the numa functions ---------
275 */
276static void __cpuinit numa_set_cpumask(int cpu, int enable)
277{
278 int node = cpu_to_node(cpu);
279 cpumask_t *mask;
280 char buf[64];
281
282 if (node_to_cpumask_map == NULL) {
283 printk(KERN_ERR "node_to_cpumask_map NULL\n");
284 dump_stack();
285 return;
286 }
287
288 mask = &node_to_cpumask_map[node];
289 if (enable)
290 cpu_set(cpu, *mask);
291 else
292 cpu_clear(cpu, *mask);
293
294 cpulist_scnprintf(buf, sizeof(buf), *mask);
295 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n",
296 enable? "numa_add_cpu":"numa_remove_cpu", cpu, node, buf);
297 }
298
299void __cpuinit numa_add_cpu(int cpu)
300{
301 numa_set_cpumask(cpu, 1);
302}
303
304void __cpuinit numa_remove_cpu(int cpu)
305{
306 numa_set_cpumask(cpu, 0);
307}
308
309int cpu_to_node(int cpu)
310{
311 if (early_per_cpu_ptr(x86_cpu_to_node_map)) {
312 printk(KERN_WARNING
313 "cpu_to_node(%d): usage too early!\n", cpu);
314 dump_stack();
315 return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu];
316 }
317 return per_cpu(x86_cpu_to_node_map, cpu);
318}
319EXPORT_SYMBOL(cpu_to_node);
320
321/*
322 * Same function as cpu_to_node() but used if called before the
323 * per_cpu areas are setup.
324 */
325int early_cpu_to_node(int cpu)
326{
327 if (early_per_cpu_ptr(x86_cpu_to_node_map))
328 return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu];
329
330 if (!per_cpu_offset(cpu)) {
331 printk(KERN_WARNING
332 "early_cpu_to_node(%d): no per_cpu area!\n", cpu);
333 dump_stack();
334 return NUMA_NO_NODE;
335 }
336 return per_cpu(x86_cpu_to_node_map, cpu);
337}
338
339
340/* empty cpumask */
341static const cpumask_t cpu_mask_none;
342
343/*
344 * Returns a pointer to the bitmask of CPUs on Node 'node'.
345 */
346const cpumask_t *_node_to_cpumask_ptr(int node)
347{
348 if (node_to_cpumask_map == NULL) {
349 printk(KERN_WARNING
350 "_node_to_cpumask_ptr(%d): no node_to_cpumask_map!\n",
351 node);
352 dump_stack();
353 return (const cpumask_t *)&cpu_online_map;
354 }
355 if (node >= nr_node_ids) {
356 printk(KERN_WARNING
357 "_node_to_cpumask_ptr(%d): node > nr_node_ids(%d)\n",
358 node, nr_node_ids);
359 dump_stack();
360 return &cpu_mask_none;
361 }
362 return &node_to_cpumask_map[node];
363}
364EXPORT_SYMBOL(_node_to_cpumask_ptr);
365
366/*
367 * Returns a bitmask of CPUs on Node 'node'.
368 *
369 * Side note: this function creates the returned cpumask on the stack
370 * so with a high NR_CPUS count, excessive stack space is used. The
371 * node_to_cpumask_ptr function should be used whenever possible.
372 */
373cpumask_t node_to_cpumask(int node)
374{
375 if (node_to_cpumask_map == NULL) {
376 printk(KERN_WARNING
377 "node_to_cpumask(%d): no node_to_cpumask_map!\n", node);
378 dump_stack();
379 return cpu_online_map;
380 }
381 if (node >= nr_node_ids) {
382 printk(KERN_WARNING
383 "node_to_cpumask(%d): node > nr_node_ids(%d)\n",
384 node, nr_node_ids);
385 dump_stack();
386 return cpu_mask_none;
387 }
388 return node_to_cpumask_map[node];
389}
390EXPORT_SYMBOL(node_to_cpumask);
391
392/*
393 * --------- end of debug versions of the numa functions ---------
394 */
395
396#endif /* CONFIG_DEBUG_PER_CPU_MAPS */
397
398#endif /* X86_64_NUMA */
399
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 3e1cecedde42..f35c2d8016ac 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -59,7 +59,6 @@
59#include <asm/pgtable.h> 59#include <asm/pgtable.h>
60#include <asm/tlbflush.h> 60#include <asm/tlbflush.h>
61#include <asm/mtrr.h> 61#include <asm/mtrr.h>
62#include <asm/nmi.h>
63#include <asm/vmi.h> 62#include <asm/vmi.h>
64#include <asm/genapic.h> 63#include <asm/genapic.h>
65#include <linux/mc146818rtc.h> 64#include <linux/mc146818rtc.h>
@@ -68,22 +67,6 @@
68#include <mach_wakecpu.h> 67#include <mach_wakecpu.h>
69#include <smpboot_hooks.h> 68#include <smpboot_hooks.h>
70 69
71/*
72 * FIXME: For x86_64, those are defined in other files. But moving them here,
73 * would make the setup areas dependent on smp, which is a loss. When we
74 * integrate apic between arches, we can probably do a better job, but
75 * right now, they'll stay here -- glommer
76 */
77
78/* which logical CPU number maps to which CPU (physical APIC ID) */
79u16 x86_cpu_to_apicid_init[NR_CPUS] __initdata =
80 { [0 ... NR_CPUS-1] = BAD_APICID };
81void *x86_cpu_to_apicid_early_ptr;
82
83u16 x86_bios_cpu_apicid_init[NR_CPUS] __initdata
84 = { [0 ... NR_CPUS-1] = BAD_APICID };
85void *x86_bios_cpu_apicid_early_ptr;
86
87#ifdef CONFIG_X86_32 70#ifdef CONFIG_X86_32
88u8 apicid_2_node[MAX_APICID]; 71u8 apicid_2_node[MAX_APICID];
89static int low_mappings; 72static int low_mappings;
@@ -198,13 +181,12 @@ static void map_cpu_to_logical_apicid(void)
198 map_cpu_to_node(cpu, node); 181 map_cpu_to_node(cpu, node);
199} 182}
200 183
201static void unmap_cpu_to_logical_apicid(int cpu) 184void numa_remove_cpu(int cpu)
202{ 185{
203 cpu_2_logical_apicid[cpu] = BAD_APICID; 186 cpu_2_logical_apicid[cpu] = BAD_APICID;
204 unmap_cpu_to_node(cpu); 187 unmap_cpu_to_node(cpu);
205} 188}
206#else 189#else
207#define unmap_cpu_to_logical_apicid(cpu) do {} while (0)
208#define map_cpu_to_logical_apicid() do {} while (0) 190#define map_cpu_to_logical_apicid() do {} while (0)
209#endif 191#endif
210 192
@@ -346,15 +328,8 @@ static void __cpuinit start_secondary(void *unused)
346 * smp_call_function(). 328 * smp_call_function().
347 */ 329 */
348 lock_ipi_call_lock(); 330 lock_ipi_call_lock();
349#ifdef CONFIG_X86_64 331#ifdef CONFIG_X86_IO_APIC
350 spin_lock(&vector_lock); 332 setup_vector_irq(smp_processor_id());
351
352 /* Setup the per cpu irq handling data structures */
353 __setup_vector_irq(smp_processor_id());
354 /*
355 * Allow the master to continue.
356 */
357 spin_unlock(&vector_lock);
358#endif 333#endif
359 cpu_set(smp_processor_id(), cpu_online_map); 334 cpu_set(smp_processor_id(), cpu_online_map);
360 unlock_ipi_call_lock(); 335 unlock_ipi_call_lock();
@@ -366,31 +341,8 @@ static void __cpuinit start_secondary(void *unused)
366 cpu_idle(); 341 cpu_idle();
367} 342}
368 343
369#ifdef CONFIG_X86_32
370/*
371 * Everything has been set up for the secondary
372 * CPUs - they just need to reload everything
373 * from the task structure
374 * This function must not return.
375 */
376void __devinit initialize_secondary(void)
377{
378 /*
379 * We don't actually need to load the full TSS,
380 * basically just the stack pointer and the ip.
381 */
382
383 asm volatile(
384 "movl %0,%%esp\n\t"
385 "jmp *%1"
386 :
387 :"m" (current->thread.sp), "m" (current->thread.ip));
388}
389#endif
390
391static void __cpuinit smp_apply_quirks(struct cpuinfo_x86 *c) 344static void __cpuinit smp_apply_quirks(struct cpuinfo_x86 *c)
392{ 345{
393#ifdef CONFIG_X86_32
394 /* 346 /*
395 * Mask B, Pentium, but not Pentium MMX 347 * Mask B, Pentium, but not Pentium MMX
396 */ 348 */
@@ -440,7 +392,6 @@ static void __cpuinit smp_apply_quirks(struct cpuinfo_x86 *c)
440 392
441valid_k7: 393valid_k7:
442 ; 394 ;
443#endif
444} 395}
445 396
446static void __cpuinit smp_checks(void) 397static void __cpuinit smp_checks(void)
@@ -555,23 +506,6 @@ cpumask_t cpu_coregroup_map(int cpu)
555 return c->llc_shared_map; 506 return c->llc_shared_map;
556} 507}
557 508
558#ifdef CONFIG_X86_32
559/*
560 * We are called very early to get the low memory for the
561 * SMP bootup trampoline page.
562 */
563void __init smp_alloc_memory(void)
564{
565 trampoline_base = alloc_bootmem_low_pages(PAGE_SIZE);
566 /*
567 * Has to be in very low memory so we can execute
568 * real-mode AP code.
569 */
570 if (__pa(trampoline_base) >= 0x9F000)
571 BUG();
572}
573#endif
574
575static void impress_friends(void) 509static void impress_friends(void)
576{ 510{
577 int cpu; 511 int cpu;
@@ -748,11 +682,7 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
748 * target processor state. 682 * target processor state.
749 */ 683 */
750 startup_ipi_hook(phys_apicid, (unsigned long) start_secondary, 684 startup_ipi_hook(phys_apicid, (unsigned long) start_secondary,
751#ifdef CONFIG_X86_64
752 (unsigned long)init_rsp);
753#else
754 (unsigned long)stack_start.sp); 685 (unsigned long)stack_start.sp);
755#endif
756 686
757 /* 687 /*
758 * Run STARTUP IPI loop. 688 * Run STARTUP IPI loop.
@@ -832,6 +762,45 @@ static void __cpuinit do_fork_idle(struct work_struct *work)
832 complete(&c_idle->done); 762 complete(&c_idle->done);
833} 763}
834 764
765#ifdef CONFIG_X86_64
766/*
767 * Allocate node local memory for the AP pda.
768 *
769 * Must be called after the _cpu_pda pointer table is initialized.
770 */
771static int __cpuinit get_local_pda(int cpu)
772{
773 struct x8664_pda *oldpda, *newpda;
774 unsigned long size = sizeof(struct x8664_pda);
775 int node = cpu_to_node(cpu);
776
777 if (cpu_pda(cpu) && !cpu_pda(cpu)->in_bootmem)
778 return 0;
779
780 oldpda = cpu_pda(cpu);
781 newpda = kmalloc_node(size, GFP_ATOMIC, node);
782 if (!newpda) {
783 printk(KERN_ERR "Could not allocate node local PDA "
784 "for CPU %d on node %d\n", cpu, node);
785
786 if (oldpda)
787 return 0; /* have a usable pda */
788 else
789 return -1;
790 }
791
792 if (oldpda) {
793 memcpy(newpda, oldpda, size);
794 if (!after_bootmem)
795 free_bootmem((unsigned long)oldpda, size);
796 }
797
798 newpda->in_bootmem = 0;
799 cpu_pda(cpu) = newpda;
800 return 0;
801}
802#endif /* CONFIG_X86_64 */
803
835static int __cpuinit do_boot_cpu(int apicid, int cpu) 804static int __cpuinit do_boot_cpu(int apicid, int cpu)
836/* 805/*
837 * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad 806 * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad
@@ -848,28 +817,14 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
848 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), 817 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
849 }; 818 };
850 INIT_WORK(&c_idle.work, do_fork_idle); 819 INIT_WORK(&c_idle.work, do_fork_idle);
851#ifdef CONFIG_X86_64
852 /* allocate memory for gdts of secondary cpus. Hotplug is considered */
853 if (!cpu_gdt_descr[cpu].address &&
854 !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
855 printk(KERN_ERR "Failed to allocate GDT for CPU %d\n", cpu);
856 return -1;
857 }
858 820
821#ifdef CONFIG_X86_64
859 /* Allocate node local memory for AP pdas */ 822 /* Allocate node local memory for AP pdas */
860 if (cpu_pda(cpu) == &boot_cpu_pda[cpu]) { 823 if (cpu > 0) {
861 struct x8664_pda *newpda, *pda; 824 boot_error = get_local_pda(cpu);
862 int node = cpu_to_node(cpu); 825 if (boot_error)
863 pda = cpu_pda(cpu); 826 goto restore_state;
864 newpda = kmalloc_node(sizeof(struct x8664_pda), GFP_ATOMIC, 827 /* if can't get pda memory, can't start cpu */
865 node);
866 if (newpda) {
867 memcpy(newpda, pda, sizeof(struct x8664_pda));
868 cpu_pda(cpu) = newpda;
869 } else
870 printk(KERN_ERR
871 "Could not allocate node local PDA for CPU %d on node %d\n",
872 cpu, node);
873 } 828 }
874#endif 829#endif
875 830
@@ -905,18 +860,15 @@ do_rest:
905#ifdef CONFIG_X86_32 860#ifdef CONFIG_X86_32
906 per_cpu(current_task, cpu) = c_idle.idle; 861 per_cpu(current_task, cpu) = c_idle.idle;
907 init_gdt(cpu); 862 init_gdt(cpu);
908 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
909 c_idle.idle->thread.ip = (unsigned long) start_secondary;
910 /* Stack for startup_32 can be just as for start_secondary onwards */ 863 /* Stack for startup_32 can be just as for start_secondary onwards */
911 stack_start.sp = (void *) c_idle.idle->thread.sp;
912 irq_ctx_init(cpu); 864 irq_ctx_init(cpu);
913#else 865#else
914 cpu_pda(cpu)->pcurrent = c_idle.idle; 866 cpu_pda(cpu)->pcurrent = c_idle.idle;
915 init_rsp = c_idle.idle->thread.sp;
916 load_sp0(&per_cpu(init_tss, cpu), &c_idle.idle->thread);
917 initial_code = (unsigned long)start_secondary;
918 clear_tsk_thread_flag(c_idle.idle, TIF_FORK); 867 clear_tsk_thread_flag(c_idle.idle, TIF_FORK);
919#endif 868#endif
869 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
870 initial_code = (unsigned long)start_secondary;
871 stack_start.sp = (void *) c_idle.idle->thread.sp;
920 872
921 /* start_ip had better be page-aligned! */ 873 /* start_ip had better be page-aligned! */
922 start_ip = setup_trampoline(); 874 start_ip = setup_trampoline();
@@ -987,13 +939,12 @@ do_rest:
987 inquire_remote_apic(apicid); 939 inquire_remote_apic(apicid);
988 } 940 }
989 } 941 }
990
991 if (boot_error) {
992 /* Try to put things back the way they were before ... */
993 unmap_cpu_to_logical_apicid(cpu);
994#ifdef CONFIG_X86_64 942#ifdef CONFIG_X86_64
995 clear_node_cpumask(cpu); /* was set by numa_add_cpu */ 943restore_state:
996#endif 944#endif
945 if (boot_error) {
946 /* Try to put things back the way they were before ... */
947 numa_remove_cpu(cpu); /* was set by numa_add_cpu */
997 cpu_clear(cpu, cpu_callout_map); /* was set by do_boot_cpu() */ 948 cpu_clear(cpu, cpu_callout_map); /* was set by do_boot_cpu() */
998 cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */ 949 cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */
999 cpu_clear(cpu, cpu_present_map); 950 cpu_clear(cpu, cpu_present_map);
@@ -1087,14 +1038,12 @@ static __init void disable_smp(void)
1087{ 1038{
1088 cpu_present_map = cpumask_of_cpu(0); 1039 cpu_present_map = cpumask_of_cpu(0);
1089 cpu_possible_map = cpumask_of_cpu(0); 1040 cpu_possible_map = cpumask_of_cpu(0);
1090#ifdef CONFIG_X86_32
1091 smpboot_clear_io_apic_irqs(); 1041 smpboot_clear_io_apic_irqs();
1092#endif 1042
1093 if (smp_found_config) 1043 if (smp_found_config)
1094 phys_cpu_present_map = 1044 physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map);
1095 physid_mask_of_physid(boot_cpu_physical_apicid);
1096 else 1045 else
1097 phys_cpu_present_map = physid_mask_of_physid(0); 1046 physid_set_mask_of_physid(0, &phys_cpu_present_map);
1098 map_cpu_to_logical_apicid(); 1047 map_cpu_to_logical_apicid();
1099 cpu_set(0, per_cpu(cpu_sibling_map, 0)); 1048 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1100 cpu_set(0, per_cpu(cpu_core_map, 0)); 1049 cpu_set(0, per_cpu(cpu_core_map, 0));
@@ -1157,12 +1106,12 @@ static int __init smp_sanity_check(unsigned max_cpus)
1157 * If SMP should be disabled, then really disable it! 1106 * If SMP should be disabled, then really disable it!
1158 */ 1107 */
1159 if (!max_cpus) { 1108 if (!max_cpus) {
1160 printk(KERN_INFO "SMP mode deactivated," 1109 printk(KERN_INFO "SMP mode deactivated.\n");
1161 "forcing use of dummy APIC emulation.\n");
1162 smpboot_clear_io_apic(); 1110 smpboot_clear_io_apic();
1163#ifdef CONFIG_X86_32 1111
1112 localise_nmi_watchdog();
1113
1164 connect_bsp_APIC(); 1114 connect_bsp_APIC();
1165#endif
1166 setup_local_APIC(); 1115 setup_local_APIC();
1167 end_local_APIC_setup(); 1116 end_local_APIC_setup();
1168 return -1; 1117 return -1;
@@ -1190,7 +1139,6 @@ static void __init smp_cpu_index_default(void)
1190void __init native_smp_prepare_cpus(unsigned int max_cpus) 1139void __init native_smp_prepare_cpus(unsigned int max_cpus)
1191{ 1140{
1192 preempt_disable(); 1141 preempt_disable();
1193 nmi_watchdog_default();
1194 smp_cpu_index_default(); 1142 smp_cpu_index_default();
1195 current_cpu_data = boot_cpu_data; 1143 current_cpu_data = boot_cpu_data;
1196 cpu_callin_map = cpumask_of_cpu(0); 1144 cpu_callin_map = cpumask_of_cpu(0);
@@ -1217,9 +1165,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1217 } 1165 }
1218 preempt_enable(); 1166 preempt_enable();
1219 1167
1220#ifdef CONFIG_X86_32
1221 connect_bsp_APIC(); 1168 connect_bsp_APIC();
1222#endif 1169
1223 /* 1170 /*
1224 * Switch from PIC to APIC mode. 1171 * Switch from PIC to APIC mode.
1225 */ 1172 */
@@ -1257,8 +1204,8 @@ void __init native_smp_prepare_boot_cpu(void)
1257 int me = smp_processor_id(); 1204 int me = smp_processor_id();
1258#ifdef CONFIG_X86_32 1205#ifdef CONFIG_X86_32
1259 init_gdt(me); 1206 init_gdt(me);
1260 switch_to_new_gdt();
1261#endif 1207#endif
1208 switch_to_new_gdt();
1262 /* already set me in cpu_online_map in boot_cpu_init() */ 1209 /* already set me in cpu_online_map in boot_cpu_init() */
1263 cpu_set(me, cpu_callout_map); 1210 cpu_set(me, cpu_callout_map);
1264 per_cpu(cpu_state, me) = CPU_ONLINE; 1211 per_cpu(cpu_state, me) = CPU_ONLINE;
@@ -1278,23 +1225,6 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
1278 1225
1279#ifdef CONFIG_HOTPLUG_CPU 1226#ifdef CONFIG_HOTPLUG_CPU
1280 1227
1281# ifdef CONFIG_X86_32
1282void cpu_exit_clear(void)
1283{
1284 int cpu = raw_smp_processor_id();
1285
1286 idle_task_exit();
1287
1288 cpu_uninit();
1289 irq_ctx_exit(cpu);
1290
1291 cpu_clear(cpu, cpu_callout_map);
1292 cpu_clear(cpu, cpu_callin_map);
1293
1294 unmap_cpu_to_logical_apicid(cpu);
1295}
1296# endif /* CONFIG_X86_32 */
1297
1298static void remove_siblinginfo(int cpu) 1228static void remove_siblinginfo(int cpu)
1299{ 1229{
1300 int sibling; 1230 int sibling;
@@ -1348,12 +1278,20 @@ __init void prefill_possible_map(void)
1348 int i; 1278 int i;
1349 int possible; 1279 int possible;
1350 1280
1281 /* no processor from mptable or madt */
1282 if (!num_processors)
1283 num_processors = 1;
1284
1285#ifdef CONFIG_HOTPLUG_CPU
1351 if (additional_cpus == -1) { 1286 if (additional_cpus == -1) {
1352 if (disabled_cpus > 0) 1287 if (disabled_cpus > 0)
1353 additional_cpus = disabled_cpus; 1288 additional_cpus = disabled_cpus;
1354 else 1289 else
1355 additional_cpus = 0; 1290 additional_cpus = 0;
1356 } 1291 }
1292#else
1293 additional_cpus = 0;
1294#endif
1357 possible = num_processors + additional_cpus; 1295 possible = num_processors + additional_cpus;
1358 if (possible > NR_CPUS) 1296 if (possible > NR_CPUS)
1359 possible = NR_CPUS; 1297 possible = NR_CPUS;
@@ -1363,18 +1301,18 @@ __init void prefill_possible_map(void)
1363 1301
1364 for (i = 0; i < possible; i++) 1302 for (i = 0; i < possible; i++)
1365 cpu_set(i, cpu_possible_map); 1303 cpu_set(i, cpu_possible_map);
1304
1305 nr_cpu_ids = possible;
1366} 1306}
1367 1307
1368static void __ref remove_cpu_from_maps(int cpu) 1308static void __ref remove_cpu_from_maps(int cpu)
1369{ 1309{
1370 cpu_clear(cpu, cpu_online_map); 1310 cpu_clear(cpu, cpu_online_map);
1371#ifdef CONFIG_X86_64
1372 cpu_clear(cpu, cpu_callout_map); 1311 cpu_clear(cpu, cpu_callout_map);
1373 cpu_clear(cpu, cpu_callin_map); 1312 cpu_clear(cpu, cpu_callin_map);
1374 /* was set by cpu_init() */ 1313 /* was set by cpu_init() */
1375 clear_bit(cpu, (unsigned long *)&cpu_initialized); 1314 clear_bit(cpu, (unsigned long *)&cpu_initialized);
1376 clear_node_cpumask(cpu); 1315 numa_remove_cpu(cpu);
1377#endif
1378} 1316}
1379 1317
1380int __cpu_disable(void) 1318int __cpu_disable(void)
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index ae751094eba9..d67ce5f044ba 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -36,7 +36,9 @@ static struct rio_table_hdr *rio_table_hdr __initdata;
36static struct scal_detail *scal_devs[MAX_NUMNODES] __initdata; 36static struct scal_detail *scal_devs[MAX_NUMNODES] __initdata;
37static struct rio_detail *rio_devs[MAX_NUMNODES*4] __initdata; 37static struct rio_detail *rio_devs[MAX_NUMNODES*4] __initdata;
38 38
39#ifndef CONFIG_X86_NUMAQ
39static int mp_bus_id_to_node[MAX_MP_BUSSES] __initdata; 40static int mp_bus_id_to_node[MAX_MP_BUSSES] __initdata;
41#endif
40 42
41static int __init setup_pci_node_map_for_wpeg(int wpeg_num, int last_bus) 43static int __init setup_pci_node_map_for_wpeg(int wpeg_num, int last_bus)
42{ 44{
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index d2ab52cc1d6b..7066cb855a60 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -19,8 +19,8 @@
19#include <linux/utsname.h> 19#include <linux/utsname.h>
20#include <linux/ipc.h> 20#include <linux/ipc.h>
21 21
22#include <asm/uaccess.h> 22#include <linux/uaccess.h>
23#include <asm/unistd.h> 23#include <linux/unistd.h>
24 24
25asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 25asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
26 unsigned long prot, unsigned long flags, 26 unsigned long prot, unsigned long flags,
@@ -103,7 +103,7 @@ asmlinkage int old_select(struct sel_arg_struct __user *arg)
103 * 103 *
104 * This is really horribly ugly. 104 * This is really horribly ugly.
105 */ 105 */
106asmlinkage int sys_ipc (uint call, int first, int second, 106asmlinkage int sys_ipc(uint call, int first, int second,
107 int third, void __user *ptr, long fifth) 107 int third, void __user *ptr, long fifth)
108{ 108{
109 int version, ret; 109 int version, ret;
@@ -113,24 +113,24 @@ asmlinkage int sys_ipc (uint call, int first, int second,
113 113
114 switch (call) { 114 switch (call) {
115 case SEMOP: 115 case SEMOP:
116 return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL); 116 return sys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL);
117 case SEMTIMEDOP: 117 case SEMTIMEDOP:
118 return sys_semtimedop(first, (struct sembuf __user *)ptr, second, 118 return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
119 (const struct timespec __user *)fifth); 119 (const struct timespec __user *)fifth);
120 120
121 case SEMGET: 121 case SEMGET:
122 return sys_semget (first, second, third); 122 return sys_semget(first, second, third);
123 case SEMCTL: { 123 case SEMCTL: {
124 union semun fourth; 124 union semun fourth;
125 if (!ptr) 125 if (!ptr)
126 return -EINVAL; 126 return -EINVAL;
127 if (get_user(fourth.__pad, (void __user * __user *) ptr)) 127 if (get_user(fourth.__pad, (void __user * __user *) ptr))
128 return -EFAULT; 128 return -EFAULT;
129 return sys_semctl (first, second, third, fourth); 129 return sys_semctl(first, second, third, fourth);
130 } 130 }
131 131
132 case MSGSND: 132 case MSGSND:
133 return sys_msgsnd (first, (struct msgbuf __user *) ptr, 133 return sys_msgsnd(first, (struct msgbuf __user *) ptr,
134 second, third); 134 second, third);
135 case MSGRCV: 135 case MSGRCV:
136 switch (version) { 136 switch (version) {
@@ -138,45 +138,45 @@ asmlinkage int sys_ipc (uint call, int first, int second,
138 struct ipc_kludge tmp; 138 struct ipc_kludge tmp;
139 if (!ptr) 139 if (!ptr)
140 return -EINVAL; 140 return -EINVAL;
141 141
142 if (copy_from_user(&tmp, 142 if (copy_from_user(&tmp,
143 (struct ipc_kludge __user *) ptr, 143 (struct ipc_kludge __user *) ptr,
144 sizeof (tmp))) 144 sizeof(tmp)))
145 return -EFAULT; 145 return -EFAULT;
146 return sys_msgrcv (first, tmp.msgp, second, 146 return sys_msgrcv(first, tmp.msgp, second,
147 tmp.msgtyp, third); 147 tmp.msgtyp, third);
148 } 148 }
149 default: 149 default:
150 return sys_msgrcv (first, 150 return sys_msgrcv(first,
151 (struct msgbuf __user *) ptr, 151 (struct msgbuf __user *) ptr,
152 second, fifth, third); 152 second, fifth, third);
153 } 153 }
154 case MSGGET: 154 case MSGGET:
155 return sys_msgget ((key_t) first, second); 155 return sys_msgget((key_t) first, second);
156 case MSGCTL: 156 case MSGCTL:
157 return sys_msgctl (first, second, (struct msqid_ds __user *) ptr); 157 return sys_msgctl(first, second, (struct msqid_ds __user *) ptr);
158 158
159 case SHMAT: 159 case SHMAT:
160 switch (version) { 160 switch (version) {
161 default: { 161 default: {
162 ulong raddr; 162 ulong raddr;
163 ret = do_shmat (first, (char __user *) ptr, second, &raddr); 163 ret = do_shmat(first, (char __user *) ptr, second, &raddr);
164 if (ret) 164 if (ret)
165 return ret; 165 return ret;
166 return put_user (raddr, (ulong __user *) third); 166 return put_user(raddr, (ulong __user *) third);
167 } 167 }
168 case 1: /* iBCS2 emulator entry point */ 168 case 1: /* iBCS2 emulator entry point */
169 if (!segment_eq(get_fs(), get_ds())) 169 if (!segment_eq(get_fs(), get_ds()))
170 return -EINVAL; 170 return -EINVAL;
171 /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */ 171 /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
172 return do_shmat (first, (char __user *) ptr, second, (ulong *) third); 172 return do_shmat(first, (char __user *) ptr, second, (ulong *) third);
173 } 173 }
174 case SHMDT: 174 case SHMDT:
175 return sys_shmdt ((char __user *)ptr); 175 return sys_shmdt((char __user *)ptr);
176 case SHMGET: 176 case SHMGET:
177 return sys_shmget (first, second, third); 177 return sys_shmget(first, second, third);
178 case SHMCTL: 178 case SHMCTL:
179 return sys_shmctl (first, second, 179 return sys_shmctl(first, second,
180 (struct shmid_ds __user *) ptr); 180 (struct shmid_ds __user *) ptr);
181 default: 181 default:
182 return -ENOSYS; 182 return -ENOSYS;
@@ -186,28 +186,28 @@ asmlinkage int sys_ipc (uint call, int first, int second,
186/* 186/*
187 * Old cruft 187 * Old cruft
188 */ 188 */
189asmlinkage int sys_uname(struct old_utsname __user * name) 189asmlinkage int sys_uname(struct old_utsname __user *name)
190{ 190{
191 int err; 191 int err;
192 if (!name) 192 if (!name)
193 return -EFAULT; 193 return -EFAULT;
194 down_read(&uts_sem); 194 down_read(&uts_sem);
195 err = copy_to_user(name, utsname(), sizeof (*name)); 195 err = copy_to_user(name, utsname(), sizeof(*name));
196 up_read(&uts_sem); 196 up_read(&uts_sem);
197 return err?-EFAULT:0; 197 return err? -EFAULT:0;
198} 198}
199 199
200asmlinkage int sys_olduname(struct oldold_utsname __user * name) 200asmlinkage int sys_olduname(struct oldold_utsname __user *name)
201{ 201{
202 int error; 202 int error;
203 203
204 if (!name) 204 if (!name)
205 return -EFAULT; 205 return -EFAULT;
206 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) 206 if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
207 return -EFAULT; 207 return -EFAULT;
208 208
209 down_read(&uts_sem); 209 down_read(&uts_sem);
210 210
211 error = __copy_to_user(&name->sysname, &utsname()->sysname, 211 error = __copy_to_user(&name->sysname, &utsname()->sysname,
212 __OLD_UTS_LEN); 212 __OLD_UTS_LEN);
213 error |= __put_user(0, name->sysname + __OLD_UTS_LEN); 213 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
@@ -223,9 +223,9 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name)
223 error |= __copy_to_user(&name->machine, &utsname()->machine, 223 error |= __copy_to_user(&name->machine, &utsname()->machine,
224 __OLD_UTS_LEN); 224 __OLD_UTS_LEN);
225 error |= __put_user(0, name->machine + __OLD_UTS_LEN); 225 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
226 226
227 up_read(&uts_sem); 227 up_read(&uts_sem);
228 228
229 error = error ? -EFAULT : 0; 229 error = error ? -EFAULT : 0;
230 230
231 return error; 231 return error;
@@ -241,6 +241,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
241 long __res; 241 long __res;
242 asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" 242 asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
243 : "=a" (__res) 243 : "=a" (__res)
244 : "0" (__NR_execve),"ri" (filename),"c" (argv), "d" (envp) : "memory"); 244 : "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
245 return __res; 245 return __res;
246} 246}
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index 2ff21f398934..059ca6ee59b4 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -39,9 +39,6 @@
39 39
40#include "do_timer.h" 40#include "do_timer.h"
41 41
42unsigned int cpu_khz; /* Detected as we calibrate the TSC */
43EXPORT_SYMBOL(cpu_khz);
44
45int timer_ack; 42int timer_ack;
46 43
47unsigned long profile_pc(struct pt_regs *regs) 44unsigned long profile_pc(struct pt_regs *regs)
@@ -84,8 +81,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
84 if (timer_ack) { 81 if (timer_ack) {
85 /* 82 /*
86 * Subtle, when I/O APICs are used we have to ack timer IRQ 83 * Subtle, when I/O APICs are used we have to ack timer IRQ
87 * manually to reset the IRR bit for do_slow_gettimeoffset(). 84 * manually to deassert NMI lines for the watchdog if run
88 * This will also deassert NMI lines for the watchdog if run
89 * on an 82489DX-based system. 85 * on an 82489DX-based system.
90 */ 86 */
91 spin_lock(&i8259A_lock); 87 spin_lock(&i8259A_lock);
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index c737849e2ef7..e3d49c553af2 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -56,7 +56,7 @@ static irqreturn_t timer_event_interrupt(int irq, void *dev_id)
56/* calibrate_cpu is used on systems with fixed rate TSCs to determine 56/* calibrate_cpu is used on systems with fixed rate TSCs to determine
57 * processor frequency */ 57 * processor frequency */
58#define TICK_COUNT 100000000 58#define TICK_COUNT 100000000
59unsigned long __init native_calculate_cpu_khz(void) 59unsigned long __init calibrate_cpu(void)
60{ 60{
61 int tsc_start, tsc_now; 61 int tsc_start, tsc_now;
62 int i, no_ctr_free; 62 int i, no_ctr_free;
@@ -116,23 +116,11 @@ void __init hpet_time_init(void)
116 116
117void __init time_init(void) 117void __init time_init(void)
118{ 118{
119 tsc_calibrate(); 119 tsc_init();
120
121 cpu_khz = tsc_khz;
122 if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) &&
123 (boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
124 cpu_khz = calculate_cpu_khz();
125
126 if (unsynchronized_tsc())
127 mark_tsc_unstable("TSCs unsynchronized");
128
129 if (cpu_has(&boot_cpu_data, X86_FEATURE_RDTSCP)) 120 if (cpu_has(&boot_cpu_data, X86_FEATURE_RDTSCP))
130 vgetcpu_mode = VGETCPU_RDTSCP; 121 vgetcpu_mode = VGETCPU_RDTSCP;
131 else 122 else
132 vgetcpu_mode = VGETCPU_LSL; 123 vgetcpu_mode = VGETCPU_LSL;
133 124
134 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
135 cpu_khz / 1000, cpu_khz % 1000);
136 init_tsc_clocksource();
137 late_time_init = choose_time_init(); 125 late_time_init = choose_time_init();
138} 126}
diff --git a/arch/x86/kernel/tlb_64.c b/arch/x86/kernel/tlb_64.c
index a1f07d793202..5039d0f097a2 100644
--- a/arch/x86/kernel/tlb_64.c
+++ b/arch/x86/kernel/tlb_64.c
@@ -15,6 +15,8 @@
15#include <asm/proto.h> 15#include <asm/proto.h>
16#include <asm/apicdef.h> 16#include <asm/apicdef.h>
17#include <asm/idle.h> 17#include <asm/idle.h>
18#include <asm/uv/uv_hub.h>
19#include <asm/uv/uv_bau.h>
18 20
19#include <mach_ipi.h> 21#include <mach_ipi.h>
20/* 22/*
@@ -162,6 +164,9 @@ void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
162 union smp_flush_state *f; 164 union smp_flush_state *f;
163 cpumask_t cpumask = *cpumaskp; 165 cpumask_t cpumask = *cpumaskp;
164 166
167 if (is_uv_system() && uv_flush_tlb_others(&cpumask, mm, va))
168 return;
169
165 /* Caller has disabled preemption */ 170 /* Caller has disabled preemption */
166 sender = smp_processor_id() % NUM_INVALIDATE_TLB_VECTORS; 171 sender = smp_processor_id() % NUM_INVALIDATE_TLB_VECTORS;
167 f = &per_cpu(flush_state, sender); 172 f = &per_cpu(flush_state, sender);
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
new file mode 100644
index 000000000000..d0fbb7712ab0
--- /dev/null
+++ b/arch/x86/kernel/tlb_uv.c
@@ -0,0 +1,792 @@
1/*
2 * SGI UltraViolet TLB flush routines.
3 *
4 * (c) 2008 Cliff Wickman <cpw@sgi.com>, SGI.
5 *
6 * This code is released under the GNU General Public License version 2 or
7 * later.
8 */
9#include <linux/mc146818rtc.h>
10#include <linux/proc_fs.h>
11#include <linux/kernel.h>
12
13#include <asm/mmu_context.h>
14#include <asm/uv/uv_mmrs.h>
15#include <asm/uv/uv_hub.h>
16#include <asm/uv/uv_bau.h>
17#include <asm/genapic.h>
18#include <asm/idle.h>
19#include <asm/tsc.h>
20
21#include <mach_apic.h>
22
23static struct bau_control **uv_bau_table_bases __read_mostly;
24static int uv_bau_retry_limit __read_mostly;
25
26/* position of pnode (which is nasid>>1): */
27static int uv_nshift __read_mostly;
28
29static unsigned long uv_mmask __read_mostly;
30
31static DEFINE_PER_CPU(struct ptc_stats, ptcstats);
32static DEFINE_PER_CPU(struct bau_control, bau_control);
33
34/*
35 * Free a software acknowledge hardware resource by clearing its Pending
36 * bit. This will return a reply to the sender.
37 * If the message has timed out, a reply has already been sent by the
38 * hardware but the resource has not been released. In that case our
39 * clear of the Timeout bit (as well) will free the resource. No reply will
40 * be sent (the hardware will only do one reply per message).
41 */
42static void uv_reply_to_message(int resource,
43 struct bau_payload_queue_entry *msg,
44 struct bau_msg_status *msp)
45{
46 unsigned long dw;
47
48 dw = (1 << (resource + UV_SW_ACK_NPENDING)) | (1 << resource);
49 msg->replied_to = 1;
50 msg->sw_ack_vector = 0;
51 if (msp)
52 msp->seen_by.bits = 0;
53 uv_write_local_mmr(UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, dw);
54}
55
56/*
57 * Do all the things a cpu should do for a TLB shootdown message.
58 * Other cpu's may come here at the same time for this message.
59 */
60static void uv_bau_process_message(struct bau_payload_queue_entry *msg,
61 int msg_slot, int sw_ack_slot)
62{
63 unsigned long this_cpu_mask;
64 struct bau_msg_status *msp;
65 int cpu;
66
67 msp = __get_cpu_var(bau_control).msg_statuses + msg_slot;
68 cpu = uv_blade_processor_id();
69 msg->number_of_cpus =
70 uv_blade_nr_online_cpus(uv_node_to_blade_id(numa_node_id()));
71 this_cpu_mask = 1UL << cpu;
72 if (msp->seen_by.bits & this_cpu_mask)
73 return;
74 atomic_or_long(&msp->seen_by.bits, this_cpu_mask);
75
76 if (msg->replied_to == 1)
77 return;
78
79 if (msg->address == TLB_FLUSH_ALL) {
80 local_flush_tlb();
81 __get_cpu_var(ptcstats).alltlb++;
82 } else {
83 __flush_tlb_one(msg->address);
84 __get_cpu_var(ptcstats).onetlb++;
85 }
86
87 __get_cpu_var(ptcstats).requestee++;
88
89 atomic_inc_short(&msg->acknowledge_count);
90 if (msg->number_of_cpus == msg->acknowledge_count)
91 uv_reply_to_message(sw_ack_slot, msg, msp);
92}
93
94/*
95 * Examine the payload queue on one distribution node to see
96 * which messages have not been seen, and which cpu(s) have not seen them.
97 *
98 * Returns the number of cpu's that have not responded.
99 */
100static int uv_examine_destination(struct bau_control *bau_tablesp, int sender)
101{
102 struct bau_payload_queue_entry *msg;
103 struct bau_msg_status *msp;
104 int count = 0;
105 int i;
106 int j;
107
108 for (msg = bau_tablesp->va_queue_first, i = 0; i < DEST_Q_SIZE;
109 msg++, i++) {
110 if ((msg->sending_cpu == sender) && (!msg->replied_to)) {
111 msp = bau_tablesp->msg_statuses + i;
112 printk(KERN_DEBUG
113 "blade %d: address:%#lx %d of %d, not cpu(s): ",
114 i, msg->address, msg->acknowledge_count,
115 msg->number_of_cpus);
116 for (j = 0; j < msg->number_of_cpus; j++) {
117 if (!((1L << j) & msp->seen_by.bits)) {
118 count++;
119 printk("%d ", j);
120 }
121 }
122 printk("\n");
123 }
124 }
125 return count;
126}
127
128/*
129 * Examine the payload queue on all the distribution nodes to see
130 * which messages have not been seen, and which cpu(s) have not seen them.
131 *
132 * Returns the number of cpu's that have not responded.
133 */
134static int uv_examine_destinations(struct bau_target_nodemask *distribution)
135{
136 int sender;
137 int i;
138 int count = 0;
139
140 sender = smp_processor_id();
141 for (i = 0; i < sizeof(struct bau_target_nodemask) * BITSPERBYTE; i++) {
142 if (!bau_node_isset(i, distribution))
143 continue;
144 count += uv_examine_destination(uv_bau_table_bases[i], sender);
145 }
146 return count;
147}
148
149/*
150 * wait for completion of a broadcast message
151 *
152 * return COMPLETE, RETRY or GIVEUP
153 */
154static int uv_wait_completion(struct bau_desc *bau_desc,
155 unsigned long mmr_offset, int right_shift)
156{
157 int exams = 0;
158 long destination_timeouts = 0;
159 long source_timeouts = 0;
160 unsigned long descriptor_status;
161
162 while ((descriptor_status = (((unsigned long)
163 uv_read_local_mmr(mmr_offset) >>
164 right_shift) & UV_ACT_STATUS_MASK)) !=
165 DESC_STATUS_IDLE) {
166 if (descriptor_status == DESC_STATUS_SOURCE_TIMEOUT) {
167 source_timeouts++;
168 if (source_timeouts > SOURCE_TIMEOUT_LIMIT)
169 source_timeouts = 0;
170 __get_cpu_var(ptcstats).s_retry++;
171 return FLUSH_RETRY;
172 }
173 /*
174 * spin here looking for progress at the destinations
175 */
176 if (descriptor_status == DESC_STATUS_DESTINATION_TIMEOUT) {
177 destination_timeouts++;
178 if (destination_timeouts > DESTINATION_TIMEOUT_LIMIT) {
179 /*
180 * returns number of cpus not responding
181 */
182 if (uv_examine_destinations
183 (&bau_desc->distribution) == 0) {
184 __get_cpu_var(ptcstats).d_retry++;
185 return FLUSH_RETRY;
186 }
187 exams++;
188 if (exams >= uv_bau_retry_limit) {
189 printk(KERN_DEBUG
190 "uv_flush_tlb_others");
191 printk("giving up on cpu %d\n",
192 smp_processor_id());
193 return FLUSH_GIVEUP;
194 }
195 /*
196 * delays can hang the simulator
197 udelay(1000);
198 */
199 destination_timeouts = 0;
200 }
201 }
202 }
203 return FLUSH_COMPLETE;
204}
205
206/**
207 * uv_flush_send_and_wait
208 *
209 * Send a broadcast and wait for a broadcast message to complete.
210 *
211 * The cpumaskp mask contains the cpus the broadcast was sent to.
212 *
213 * Returns 1 if all remote flushing was done. The mask is zeroed.
214 * Returns 0 if some remote flushing remains to be done. The mask is left
215 * unchanged.
216 */
217int uv_flush_send_and_wait(int cpu, int this_blade, struct bau_desc *bau_desc,
218 cpumask_t *cpumaskp)
219{
220 int completion_status = 0;
221 int right_shift;
222 int tries = 0;
223 int blade;
224 int bit;
225 unsigned long mmr_offset;
226 unsigned long index;
227 cycles_t time1;
228 cycles_t time2;
229
230 if (cpu < UV_CPUS_PER_ACT_STATUS) {
231 mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_0;
232 right_shift = cpu * UV_ACT_STATUS_SIZE;
233 } else {
234 mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_1;
235 right_shift =
236 ((cpu - UV_CPUS_PER_ACT_STATUS) * UV_ACT_STATUS_SIZE);
237 }
238 time1 = get_cycles();
239 do {
240 tries++;
241 index = (1UL << UVH_LB_BAU_SB_ACTIVATION_CONTROL_PUSH_SHFT) |
242 cpu;
243 uv_write_local_mmr(UVH_LB_BAU_SB_ACTIVATION_CONTROL, index);
244 completion_status = uv_wait_completion(bau_desc, mmr_offset,
245 right_shift);
246 } while (completion_status == FLUSH_RETRY);
247 time2 = get_cycles();
248 __get_cpu_var(ptcstats).sflush += (time2 - time1);
249 if (tries > 1)
250 __get_cpu_var(ptcstats).retriesok++;
251
252 if (completion_status == FLUSH_GIVEUP) {
253 /*
254 * Cause the caller to do an IPI-style TLB shootdown on
255 * the cpu's, all of which are still in the mask.
256 */
257 __get_cpu_var(ptcstats).ptc_i++;
258 return 0;
259 }
260
261 /*
262 * Success, so clear the remote cpu's from the mask so we don't
263 * use the IPI method of shootdown on them.
264 */
265 for_each_cpu_mask(bit, *cpumaskp) {
266 blade = uv_cpu_to_blade_id(bit);
267 if (blade == this_blade)
268 continue;
269 cpu_clear(bit, *cpumaskp);
270 }
271 if (!cpus_empty(*cpumaskp))
272 return 0;
273 return 1;
274}
275
276/**
277 * uv_flush_tlb_others - globally purge translation cache of a virtual
278 * address or all TLB's
279 * @cpumaskp: mask of all cpu's in which the address is to be removed
280 * @mm: mm_struct containing virtual address range
281 * @va: virtual address to be removed (or TLB_FLUSH_ALL for all TLB's on cpu)
282 *
283 * This is the entry point for initiating any UV global TLB shootdown.
284 *
285 * Purges the translation caches of all specified processors of the given
286 * virtual address, or purges all TLB's on specified processors.
287 *
288 * The caller has derived the cpumaskp from the mm_struct and has subtracted
289 * the local cpu from the mask. This function is called only if there
290 * are bits set in the mask. (e.g. flush_tlb_page())
291 *
292 * The cpumaskp is converted into a nodemask of the nodes containing
293 * the cpus.
294 *
295 * Returns 1 if all remote flushing was done.
296 * Returns 0 if some remote flushing remains to be done.
297 */
298int uv_flush_tlb_others(cpumask_t *cpumaskp, struct mm_struct *mm,
299 unsigned long va)
300{
301 int i;
302 int bit;
303 int blade;
304 int cpu;
305 int this_blade;
306 int locals = 0;
307 struct bau_desc *bau_desc;
308
309 cpu = uv_blade_processor_id();
310 this_blade = uv_numa_blade_id();
311 bau_desc = __get_cpu_var(bau_control).descriptor_base;
312 bau_desc += UV_ITEMS_PER_DESCRIPTOR * cpu;
313
314 bau_nodes_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE);
315
316 i = 0;
317 for_each_cpu_mask(bit, *cpumaskp) {
318 blade = uv_cpu_to_blade_id(bit);
319 BUG_ON(blade > (UV_DISTRIBUTION_SIZE - 1));
320 if (blade == this_blade) {
321 locals++;
322 continue;
323 }
324 bau_node_set(blade, &bau_desc->distribution);
325 i++;
326 }
327 if (i == 0) {
328 /*
329 * no off_node flushing; return status for local node
330 */
331 if (locals)
332 return 0;
333 else
334 return 1;
335 }
336 __get_cpu_var(ptcstats).requestor++;
337 __get_cpu_var(ptcstats).ntargeted += i;
338
339 bau_desc->payload.address = va;
340 bau_desc->payload.sending_cpu = smp_processor_id();
341
342 return uv_flush_send_and_wait(cpu, this_blade, bau_desc, cpumaskp);
343}
344
345/*
346 * The BAU message interrupt comes here. (registered by set_intr_gate)
347 * See entry_64.S
348 *
349 * We received a broadcast assist message.
350 *
351 * Interrupts may have been disabled; this interrupt could represent
352 * the receipt of several messages.
353 *
354 * All cores/threads on this node get this interrupt.
355 * The last one to see it does the s/w ack.
356 * (the resource will not be freed until noninterruptable cpus see this
357 * interrupt; hardware will timeout the s/w ack and reply ERROR)
358 */
359void uv_bau_message_interrupt(struct pt_regs *regs)
360{
361 struct bau_payload_queue_entry *va_queue_first;
362 struct bau_payload_queue_entry *va_queue_last;
363 struct bau_payload_queue_entry *msg;
364 struct pt_regs *old_regs = set_irq_regs(regs);
365 cycles_t time1;
366 cycles_t time2;
367 int msg_slot;
368 int sw_ack_slot;
369 int fw;
370 int count = 0;
371 unsigned long local_pnode;
372
373 ack_APIC_irq();
374 exit_idle();
375 irq_enter();
376
377 time1 = get_cycles();
378
379 local_pnode = uv_blade_to_pnode(uv_numa_blade_id());
380
381 va_queue_first = __get_cpu_var(bau_control).va_queue_first;
382 va_queue_last = __get_cpu_var(bau_control).va_queue_last;
383
384 msg = __get_cpu_var(bau_control).bau_msg_head;
385 while (msg->sw_ack_vector) {
386 count++;
387 fw = msg->sw_ack_vector;
388 msg_slot = msg - va_queue_first;
389 sw_ack_slot = ffs(fw) - 1;
390
391 uv_bau_process_message(msg, msg_slot, sw_ack_slot);
392
393 msg++;
394 if (msg > va_queue_last)
395 msg = va_queue_first;
396 __get_cpu_var(bau_control).bau_msg_head = msg;
397 }
398 if (!count)
399 __get_cpu_var(ptcstats).nomsg++;
400 else if (count > 1)
401 __get_cpu_var(ptcstats).multmsg++;
402
403 time2 = get_cycles();
404 __get_cpu_var(ptcstats).dflush += (time2 - time1);
405
406 irq_exit();
407 set_irq_regs(old_regs);
408}
409
410static void uv_enable_timeouts(void)
411{
412 int i;
413 int blade;
414 int last_blade;
415 int pnode;
416 int cur_cpu = 0;
417 unsigned long apicid;
418
419 last_blade = -1;
420 for_each_online_node(i) {
421 blade = uv_node_to_blade_id(i);
422 if (blade == last_blade)
423 continue;
424 last_blade = blade;
425 apicid = per_cpu(x86_cpu_to_apicid, cur_cpu);
426 pnode = uv_blade_to_pnode(blade);
427 cur_cpu += uv_blade_nr_possible_cpus(i);
428 }
429}
430
431static void *uv_ptc_seq_start(struct seq_file *file, loff_t *offset)
432{
433 if (*offset < num_possible_cpus())
434 return offset;
435 return NULL;
436}
437
438static void *uv_ptc_seq_next(struct seq_file *file, void *data, loff_t *offset)
439{
440 (*offset)++;
441 if (*offset < num_possible_cpus())
442 return offset;
443 return NULL;
444}
445
446static void uv_ptc_seq_stop(struct seq_file *file, void *data)
447{
448}
449
450/*
451 * Display the statistics thru /proc
452 * data points to the cpu number
453 */
454static int uv_ptc_seq_show(struct seq_file *file, void *data)
455{
456 struct ptc_stats *stat;
457 int cpu;
458
459 cpu = *(loff_t *)data;
460
461 if (!cpu) {
462 seq_printf(file,
463 "# cpu requestor requestee one all sretry dretry ptc_i ");
464 seq_printf(file,
465 "sw_ack sflush dflush sok dnomsg dmult starget\n");
466 }
467 if (cpu < num_possible_cpus() && cpu_online(cpu)) {
468 stat = &per_cpu(ptcstats, cpu);
469 seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld ",
470 cpu, stat->requestor,
471 stat->requestee, stat->onetlb, stat->alltlb,
472 stat->s_retry, stat->d_retry, stat->ptc_i);
473 seq_printf(file, "%lx %ld %ld %ld %ld %ld %ld\n",
474 uv_read_global_mmr64(uv_blade_to_pnode
475 (uv_cpu_to_blade_id(cpu)),
476 UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE),
477 stat->sflush, stat->dflush,
478 stat->retriesok, stat->nomsg,
479 stat->multmsg, stat->ntargeted);
480 }
481
482 return 0;
483}
484
485/*
486 * 0: display meaning of the statistics
487 * >0: retry limit
488 */
489static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user,
490 size_t count, loff_t *data)
491{
492 long newmode;
493 char optstr[64];
494
495 if (count == 0 || count > sizeof(optstr))
496 return -EINVAL;
497 if (copy_from_user(optstr, user, count))
498 return -EFAULT;
499 optstr[count - 1] = '\0';
500 if (strict_strtoul(optstr, 10, &newmode) < 0) {
501 printk(KERN_DEBUG "%s is invalid\n", optstr);
502 return -EINVAL;
503 }
504
505 if (newmode == 0) {
506 printk(KERN_DEBUG "# cpu: cpu number\n");
507 printk(KERN_DEBUG
508 "requestor: times this cpu was the flush requestor\n");
509 printk(KERN_DEBUG
510 "requestee: times this cpu was requested to flush its TLBs\n");
511 printk(KERN_DEBUG
512 "one: times requested to flush a single address\n");
513 printk(KERN_DEBUG
514 "all: times requested to flush all TLB's\n");
515 printk(KERN_DEBUG
516 "sretry: number of retries of source-side timeouts\n");
517 printk(KERN_DEBUG
518 "dretry: number of retries of destination-side timeouts\n");
519 printk(KERN_DEBUG
520 "ptc_i: times UV fell through to IPI-style flushes\n");
521 printk(KERN_DEBUG
522 "sw_ack: image of UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE\n");
523 printk(KERN_DEBUG
524 "sflush_us: cycles spent in uv_flush_tlb_others()\n");
525 printk(KERN_DEBUG
526 "dflush_us: cycles spent in handling flush requests\n");
527 printk(KERN_DEBUG "sok: successes on retry\n");
528 printk(KERN_DEBUG "dnomsg: interrupts with no message\n");
529 printk(KERN_DEBUG
530 "dmult: interrupts with multiple messages\n");
531 printk(KERN_DEBUG "starget: nodes targeted\n");
532 } else {
533 uv_bau_retry_limit = newmode;
534 printk(KERN_DEBUG "timeout retry limit:%d\n",
535 uv_bau_retry_limit);
536 }
537
538 return count;
539}
540
541static const struct seq_operations uv_ptc_seq_ops = {
542 .start = uv_ptc_seq_start,
543 .next = uv_ptc_seq_next,
544 .stop = uv_ptc_seq_stop,
545 .show = uv_ptc_seq_show
546};
547
548static int uv_ptc_proc_open(struct inode *inode, struct file *file)
549{
550 return seq_open(file, &uv_ptc_seq_ops);
551}
552
553static const struct file_operations proc_uv_ptc_operations = {
554 .open = uv_ptc_proc_open,
555 .read = seq_read,
556 .write = uv_ptc_proc_write,
557 .llseek = seq_lseek,
558 .release = seq_release,
559};
560
561static int __init uv_ptc_init(void)
562{
563 struct proc_dir_entry *proc_uv_ptc;
564
565 if (!is_uv_system())
566 return 0;
567
568 if (!proc_mkdir("sgi_uv", NULL))
569 return -EINVAL;
570
571 proc_uv_ptc = create_proc_entry(UV_PTC_BASENAME, 0444, NULL);
572 if (!proc_uv_ptc) {
573 printk(KERN_ERR "unable to create %s proc entry\n",
574 UV_PTC_BASENAME);
575 remove_proc_entry("sgi_uv", NULL);
576 return -EINVAL;
577 }
578 proc_uv_ptc->proc_fops = &proc_uv_ptc_operations;
579 return 0;
580}
581
582/*
583 * begin the initialization of the per-blade control structures
584 */
585static struct bau_control * __init uv_table_bases_init(int blade, int node)
586{
587 int i;
588 int *ip;
589 struct bau_msg_status *msp;
590 struct bau_control *bau_tabp;
591
592 bau_tabp =
593 kmalloc_node(sizeof(struct bau_control), GFP_KERNEL, node);
594 BUG_ON(!bau_tabp);
595
596 bau_tabp->msg_statuses =
597 kmalloc_node(sizeof(struct bau_msg_status) *
598 DEST_Q_SIZE, GFP_KERNEL, node);
599 BUG_ON(!bau_tabp->msg_statuses);
600
601 for (i = 0, msp = bau_tabp->msg_statuses; i < DEST_Q_SIZE; i++, msp++)
602 bau_cpubits_clear(&msp->seen_by, (int)
603 uv_blade_nr_possible_cpus(blade));
604
605 bau_tabp->watching =
606 kmalloc_node(sizeof(int) * DEST_NUM_RESOURCES, GFP_KERNEL, node);
607 BUG_ON(!bau_tabp->watching);
608
609 for (i = 0, ip = bau_tabp->watching; i < DEST_Q_SIZE; i++, ip++)
610 *ip = 0;
611
612 uv_bau_table_bases[blade] = bau_tabp;
613
614 return bau_tabp;
615}
616
617/*
618 * finish the initialization of the per-blade control structures
619 */
620static void __init
621uv_table_bases_finish(int blade, int node, int cur_cpu,
622 struct bau_control *bau_tablesp,
623 struct bau_desc *adp)
624{
625 struct bau_control *bcp;
626 int i;
627
628 for (i = cur_cpu; i < cur_cpu + uv_blade_nr_possible_cpus(blade); i++) {
629 bcp = (struct bau_control *)&per_cpu(bau_control, i);
630
631 bcp->bau_msg_head = bau_tablesp->va_queue_first;
632 bcp->va_queue_first = bau_tablesp->va_queue_first;
633 bcp->va_queue_last = bau_tablesp->va_queue_last;
634 bcp->watching = bau_tablesp->watching;
635 bcp->msg_statuses = bau_tablesp->msg_statuses;
636 bcp->descriptor_base = adp;
637 }
638}
639
640/*
641 * initialize the sending side's sending buffers
642 */
643static struct bau_desc * __init
644uv_activation_descriptor_init(int node, int pnode)
645{
646 int i;
647 unsigned long pa;
648 unsigned long m;
649 unsigned long n;
650 unsigned long mmr_image;
651 struct bau_desc *adp;
652 struct bau_desc *ad2;
653
654 adp = (struct bau_desc *)
655 kmalloc_node(16384, GFP_KERNEL, node);
656 BUG_ON(!adp);
657
658 pa = __pa((unsigned long)adp);
659 n = pa >> uv_nshift;
660 m = pa & uv_mmask;
661
662 mmr_image = uv_read_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE);
663 if (mmr_image) {
664 uv_write_global_mmr64(pnode, (unsigned long)
665 UVH_LB_BAU_SB_DESCRIPTOR_BASE,
666 (n << UV_DESC_BASE_PNODE_SHIFT | m));
667 }
668
669 for (i = 0, ad2 = adp; i < UV_ACTIVATION_DESCRIPTOR_SIZE; i++, ad2++) {
670 memset(ad2, 0, sizeof(struct bau_desc));
671 ad2->header.sw_ack_flag = 1;
672 ad2->header.base_dest_nodeid =
673 uv_blade_to_pnode(uv_cpu_to_blade_id(0));
674 ad2->header.command = UV_NET_ENDPOINT_INTD;
675 ad2->header.int_both = 1;
676 /*
677 * all others need to be set to zero:
678 * fairness chaining multilevel count replied_to
679 */
680 }
681 return adp;
682}
683
684/*
685 * initialize the destination side's receiving buffers
686 */
687static struct bau_payload_queue_entry * __init
688uv_payload_queue_init(int node, int pnode, struct bau_control *bau_tablesp)
689{
690 struct bau_payload_queue_entry *pqp;
691 char *cp;
692
693 pqp = (struct bau_payload_queue_entry *) kmalloc_node(
694 (DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
695 GFP_KERNEL, node);
696 BUG_ON(!pqp);
697
698 cp = (char *)pqp + 31;
699 pqp = (struct bau_payload_queue_entry *)(((unsigned long)cp >> 5) << 5);
700 bau_tablesp->va_queue_first = pqp;
701 uv_write_global_mmr64(pnode,
702 UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST,
703 ((unsigned long)pnode <<
704 UV_PAYLOADQ_PNODE_SHIFT) |
705 uv_physnodeaddr(pqp));
706 uv_write_global_mmr64(pnode, UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL,
707 uv_physnodeaddr(pqp));
708 bau_tablesp->va_queue_last = pqp + (DEST_Q_SIZE - 1);
709 uv_write_global_mmr64(pnode, UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST,
710 (unsigned long)
711 uv_physnodeaddr(bau_tablesp->va_queue_last));
712 memset(pqp, 0, sizeof(struct bau_payload_queue_entry) * DEST_Q_SIZE);
713
714 return pqp;
715}
716
717/*
718 * Initialization of each UV blade's structures
719 */
720static int __init uv_init_blade(int blade, int node, int cur_cpu)
721{
722 int pnode;
723 unsigned long pa;
724 unsigned long apicid;
725 struct bau_desc *adp;
726 struct bau_payload_queue_entry *pqp;
727 struct bau_control *bau_tablesp;
728
729 bau_tablesp = uv_table_bases_init(blade, node);
730 pnode = uv_blade_to_pnode(blade);
731 adp = uv_activation_descriptor_init(node, pnode);
732 pqp = uv_payload_queue_init(node, pnode, bau_tablesp);
733 uv_table_bases_finish(blade, node, cur_cpu, bau_tablesp, adp);
734 /*
735 * the below initialization can't be in firmware because the
736 * messaging IRQ will be determined by the OS
737 */
738 apicid = per_cpu(x86_cpu_to_apicid, cur_cpu);
739 pa = uv_read_global_mmr64(pnode, UVH_BAU_DATA_CONFIG);
740 if ((pa & 0xff) != UV_BAU_MESSAGE) {
741 uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG,
742 ((apicid << 32) | UV_BAU_MESSAGE));
743 }
744 return 0;
745}
746
747/*
748 * Initialization of BAU-related structures
749 */
750static int __init uv_bau_init(void)
751{
752 int blade;
753 int node;
754 int nblades;
755 int last_blade;
756 int cur_cpu = 0;
757
758 if (!is_uv_system())
759 return 0;
760
761 uv_bau_retry_limit = 1;
762 uv_nshift = uv_hub_info->n_val;
763 uv_mmask = (1UL << uv_hub_info->n_val) - 1;
764 nblades = 0;
765 last_blade = -1;
766 for_each_online_node(node) {
767 blade = uv_node_to_blade_id(node);
768 if (blade == last_blade)
769 continue;
770 last_blade = blade;
771 nblades++;
772 }
773 uv_bau_table_bases = (struct bau_control **)
774 kmalloc(nblades * sizeof(struct bau_control *), GFP_KERNEL);
775 BUG_ON(!uv_bau_table_bases);
776
777 last_blade = -1;
778 for_each_online_node(node) {
779 blade = uv_node_to_blade_id(node);
780 if (blade == last_blade)
781 continue;
782 last_blade = blade;
783 uv_init_blade(blade, node, cur_cpu);
784 cur_cpu += uv_blade_nr_possible_cpus(blade);
785 }
786 set_intr_gate(UV_BAU_MESSAGE, uv_bau_message_intr1);
787 uv_enable_timeouts();
788
789 return 0;
790}
791__initcall(uv_bau_init);
792__initcall(uv_ptc_init);
diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
index abbf199adebb..1106fac6024d 100644
--- a/arch/x86/kernel/trampoline.c
+++ b/arch/x86/kernel/trampoline.c
@@ -2,7 +2,7 @@
2 2
3#include <asm/trampoline.h> 3#include <asm/trampoline.h>
4 4
5/* ready for x86_64, no harm for x86, since it will overwrite after alloc */ 5/* ready for x86_64 and x86 */
6unsigned char *trampoline_base = __va(TRAMPOLINE_BASE); 6unsigned char *trampoline_base = __va(TRAMPOLINE_BASE);
7 7
8/* 8/*
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 08d752de4eee..8a768973c4f0 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
3 * 4 *
4 * Pentium III FXSR, SSE support 5 * Pentium III FXSR, SSE support
5 * Gareth Hughes <gareth@valinux.com>, May 2000 6 * Gareth Hughes <gareth@valinux.com>, May 2000
@@ -60,8 +61,6 @@
60 61
61#include "mach_traps.h" 62#include "mach_traps.h"
62 63
63int panic_on_unrecovered_nmi;
64
65DECLARE_BITMAP(used_vectors, NR_VECTORS); 64DECLARE_BITMAP(used_vectors, NR_VECTORS);
66EXPORT_SYMBOL_GPL(used_vectors); 65EXPORT_SYMBOL_GPL(used_vectors);
67 66
@@ -98,19 +97,22 @@ asmlinkage void alignment_check(void);
98asmlinkage void spurious_interrupt_bug(void); 97asmlinkage void spurious_interrupt_bug(void);
99asmlinkage void machine_check(void); 98asmlinkage void machine_check(void);
100 99
100int panic_on_unrecovered_nmi;
101int kstack_depth_to_print = 24; 101int kstack_depth_to_print = 24;
102static unsigned int code_bytes = 64; 102static unsigned int code_bytes = 64;
103static int ignore_nmis;
104static int die_counter;
103 105
104void printk_address(unsigned long address, int reliable) 106void printk_address(unsigned long address, int reliable)
105{ 107{
106#ifdef CONFIG_KALLSYMS 108#ifdef CONFIG_KALLSYMS
107 char namebuf[KSYM_NAME_LEN];
108 unsigned long offset = 0; 109 unsigned long offset = 0;
109 unsigned long symsize; 110 unsigned long symsize;
110 const char *symname; 111 const char *symname;
111 char reliab[4] = "";
112 char *delim = ":";
113 char *modname; 112 char *modname;
113 char *delim = ":";
114 char namebuf[KSYM_NAME_LEN];
115 char reliab[4] = "";
114 116
115 symname = kallsyms_lookup(address, &symsize, &offset, 117 symname = kallsyms_lookup(address, &symsize, &offset,
116 &modname, namebuf); 118 &modname, namebuf);
@@ -130,22 +132,23 @@ void printk_address(unsigned long address, int reliable)
130#endif 132#endif
131} 133}
132 134
133static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size) 135static inline int valid_stack_ptr(struct thread_info *tinfo,
136 void *p, unsigned int size)
134{ 137{
135 return p > (void *)tinfo && 138 void *t = tinfo;
136 p <= (void *)tinfo + THREAD_SIZE - size; 139 return p > t && p <= t + THREAD_SIZE - size;
137} 140}
138 141
139/* The form of the top of the frame on the stack */ 142/* The form of the top of the frame on the stack */
140struct stack_frame { 143struct stack_frame {
141 struct stack_frame *next_frame; 144 struct stack_frame *next_frame;
142 unsigned long return_address; 145 unsigned long return_address;
143}; 146};
144 147
145static inline unsigned long 148static inline unsigned long
146print_context_stack(struct thread_info *tinfo, 149print_context_stack(struct thread_info *tinfo,
147 unsigned long *stack, unsigned long bp, 150 unsigned long *stack, unsigned long bp,
148 const struct stacktrace_ops *ops, void *data) 151 const struct stacktrace_ops *ops, void *data)
149{ 152{
150 struct stack_frame *frame = (struct stack_frame *)bp; 153 struct stack_frame *frame = (struct stack_frame *)bp;
151 154
@@ -167,8 +170,6 @@ print_context_stack(struct thread_info *tinfo,
167 return bp; 170 return bp;
168} 171}
169 172
170#define MSG(msg) ops->warning(data, msg)
171
172void dump_trace(struct task_struct *task, struct pt_regs *regs, 173void dump_trace(struct task_struct *task, struct pt_regs *regs,
173 unsigned long *stack, unsigned long bp, 174 unsigned long *stack, unsigned long bp,
174 const struct stacktrace_ops *ops, void *data) 175 const struct stacktrace_ops *ops, void *data)
@@ -178,7 +179,6 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
178 179
179 if (!stack) { 180 if (!stack) {
180 unsigned long dummy; 181 unsigned long dummy;
181
182 stack = &dummy; 182 stack = &dummy;
183 if (task != current) 183 if (task != current)
184 stack = (unsigned long *)task->thread.sp; 184 stack = (unsigned long *)task->thread.sp;
@@ -196,7 +196,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
196 } 196 }
197#endif 197#endif
198 198
199 while (1) { 199 for (;;) {
200 struct thread_info *context; 200 struct thread_info *context;
201 201
202 context = (struct thread_info *) 202 context = (struct thread_info *)
@@ -248,10 +248,10 @@ static void print_trace_address(void *data, unsigned long addr, int reliable)
248} 248}
249 249
250static const struct stacktrace_ops print_trace_ops = { 250static const struct stacktrace_ops print_trace_ops = {
251 .warning = print_trace_warning, 251 .warning = print_trace_warning,
252 .warning_symbol = print_trace_warning_symbol, 252 .warning_symbol = print_trace_warning_symbol,
253 .stack = print_trace_stack, 253 .stack = print_trace_stack,
254 .address = print_trace_address, 254 .address = print_trace_address,
255}; 255};
256 256
257static void 257static void
@@ -351,15 +351,14 @@ void show_registers(struct pt_regs *regs)
351 printk(KERN_EMERG "Code: "); 351 printk(KERN_EMERG "Code: ");
352 352
353 ip = (u8 *)regs->ip - code_prologue; 353 ip = (u8 *)regs->ip - code_prologue;
354 if (ip < (u8 *)PAGE_OFFSET || 354 if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
355 probe_kernel_address(ip, c)) {
356 /* try starting at EIP */ 355 /* try starting at EIP */
357 ip = (u8 *)regs->ip; 356 ip = (u8 *)regs->ip;
358 code_len = code_len - code_prologue + 1; 357 code_len = code_len - code_prologue + 1;
359 } 358 }
360 for (i = 0; i < code_len; i++, ip++) { 359 for (i = 0; i < code_len; i++, ip++) {
361 if (ip < (u8 *)PAGE_OFFSET || 360 if (ip < (u8 *)PAGE_OFFSET ||
362 probe_kernel_address(ip, c)) { 361 probe_kernel_address(ip, c)) {
363 printk(" Bad EIP value."); 362 printk(" Bad EIP value.");
364 break; 363 break;
365 } 364 }
@@ -384,8 +383,6 @@ int is_valid_bugaddr(unsigned long ip)
384 return ud2 == 0x0b0f; 383 return ud2 == 0x0b0f;
385} 384}
386 385
387static int die_counter;
388
389int __kprobes __die(const char *str, struct pt_regs *regs, long err) 386int __kprobes __die(const char *str, struct pt_regs *regs, long err)
390{ 387{
391 unsigned short ss; 388 unsigned short ss;
@@ -402,26 +399,22 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
402 printk("DEBUG_PAGEALLOC"); 399 printk("DEBUG_PAGEALLOC");
403#endif 400#endif
404 printk("\n"); 401 printk("\n");
405
406 if (notify_die(DIE_OOPS, str, regs, err, 402 if (notify_die(DIE_OOPS, str, regs, err,
407 current->thread.trap_no, SIGSEGV) != NOTIFY_STOP) { 403 current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
408 404 return 1;
409 show_registers(regs);
410 /* Executive summary in case the oops scrolled away */
411 sp = (unsigned long) (&regs->sp);
412 savesegment(ss, ss);
413 if (user_mode(regs)) {
414 sp = regs->sp;
415 ss = regs->ss & 0xffff;
416 }
417 printk(KERN_EMERG "EIP: [<%08lx>] ", regs->ip);
418 print_symbol("%s", regs->ip);
419 printk(" SS:ESP %04x:%08lx\n", ss, sp);
420 405
421 return 0; 406 show_registers(regs);
407 /* Executive summary in case the oops scrolled away */
408 sp = (unsigned long) (&regs->sp);
409 savesegment(ss, ss);
410 if (user_mode(regs)) {
411 sp = regs->sp;
412 ss = regs->ss & 0xffff;
422 } 413 }
423 414 printk(KERN_EMERG "EIP: [<%08lx>] ", regs->ip);
424 return 1; 415 print_symbol("%s", regs->ip);
416 printk(" SS:ESP %04x:%08lx\n", ss, sp);
417 return 0;
425} 418}
426 419
427/* 420/*
@@ -546,7 +539,7 @@ void do_##name(struct pt_regs *regs, long error_code) \
546{ \ 539{ \
547 trace_hardirqs_fixup(); \ 540 trace_hardirqs_fixup(); \
548 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 541 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
549 == NOTIFY_STOP) \ 542 == NOTIFY_STOP) \
550 return; \ 543 return; \
551 do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \ 544 do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \
552} 545}
@@ -562,7 +555,7 @@ void do_##name(struct pt_regs *regs, long error_code) \
562 info.si_code = sicode; \ 555 info.si_code = sicode; \
563 info.si_addr = (void __user *)siaddr; \ 556 info.si_addr = (void __user *)siaddr; \
564 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 557 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
565 == NOTIFY_STOP) \ 558 == NOTIFY_STOP) \
566 return; \ 559 return; \
567 do_trap(trapnr, signr, str, 0, regs, error_code, &info); \ 560 do_trap(trapnr, signr, str, 0, regs, error_code, &info); \
568} 561}
@@ -571,7 +564,7 @@ void do_##name(struct pt_regs *regs, long error_code) \
571void do_##name(struct pt_regs *regs, long error_code) \ 564void do_##name(struct pt_regs *regs, long error_code) \
572{ \ 565{ \
573 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 566 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
574 == NOTIFY_STOP) \ 567 == NOTIFY_STOP) \
575 return; \ 568 return; \
576 do_trap(trapnr, signr, str, 1, regs, error_code, NULL); \ 569 do_trap(trapnr, signr, str, 1, regs, error_code, NULL); \
577} 570}
@@ -586,27 +579,29 @@ void do_##name(struct pt_regs *regs, long error_code) \
586 info.si_addr = (void __user *)siaddr; \ 579 info.si_addr = (void __user *)siaddr; \
587 trace_hardirqs_fixup(); \ 580 trace_hardirqs_fixup(); \
588 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 581 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
589 == NOTIFY_STOP) \ 582 == NOTIFY_STOP) \
590 return; \ 583 return; \
591 do_trap(trapnr, signr, str, 1, regs, error_code, &info); \ 584 do_trap(trapnr, signr, str, 1, regs, error_code, &info); \
592} 585}
593 586
594DO_VM86_ERROR_INFO(0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip) 587DO_VM86_ERROR_INFO(0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip)
595#ifndef CONFIG_KPROBES 588#ifndef CONFIG_KPROBES
596DO_VM86_ERROR(3, SIGTRAP, "int3", int3) 589DO_VM86_ERROR(3, SIGTRAP, "int3", int3)
597#endif 590#endif
598DO_VM86_ERROR(4, SIGSEGV, "overflow", overflow) 591DO_VM86_ERROR(4, SIGSEGV, "overflow", overflow)
599DO_VM86_ERROR(5, SIGSEGV, "bounds", bounds) 592DO_VM86_ERROR(5, SIGSEGV, "bounds", bounds)
600DO_ERROR_INFO(6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip, 0) 593DO_ERROR_INFO(6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip, 0)
601DO_ERROR(9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) 594DO_ERROR(9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
602DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) 595DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
603DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) 596DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
604DO_ERROR(12, SIGBUS, "stack segment", stack_segment) 597DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
605DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0) 598DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0)
606DO_ERROR_INFO(32, SIGILL, "iret exception", iret_error, ILL_BADSTK, 0, 1) 599DO_ERROR_INFO(32, SIGILL, "iret exception", iret_error, ILL_BADSTK, 0, 1)
607 600
608void __kprobes do_general_protection(struct pt_regs *regs, long error_code) 601void __kprobes
602do_general_protection(struct pt_regs *regs, long error_code)
609{ 603{
604 struct task_struct *tsk;
610 struct thread_struct *thread; 605 struct thread_struct *thread;
611 struct tss_struct *tss; 606 struct tss_struct *tss;
612 int cpu; 607 int cpu;
@@ -647,23 +642,24 @@ void __kprobes do_general_protection(struct pt_regs *regs, long error_code)
647 if (regs->flags & X86_VM_MASK) 642 if (regs->flags & X86_VM_MASK)
648 goto gp_in_vm86; 643 goto gp_in_vm86;
649 644
645 tsk = current;
650 if (!user_mode(regs)) 646 if (!user_mode(regs))
651 goto gp_in_kernel; 647 goto gp_in_kernel;
652 648
653 current->thread.error_code = error_code; 649 tsk->thread.error_code = error_code;
654 current->thread.trap_no = 13; 650 tsk->thread.trap_no = 13;
655 651
656 if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) && 652 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
657 printk_ratelimit()) { 653 printk_ratelimit()) {
658 printk(KERN_INFO 654 printk(KERN_INFO
659 "%s[%d] general protection ip:%lx sp:%lx error:%lx", 655 "%s[%d] general protection ip:%lx sp:%lx error:%lx",
660 current->comm, task_pid_nr(current), 656 tsk->comm, task_pid_nr(tsk),
661 regs->ip, regs->sp, error_code); 657 regs->ip, regs->sp, error_code);
662 print_vma_addr(" in ", regs->ip); 658 print_vma_addr(" in ", regs->ip);
663 printk("\n"); 659 printk("\n");
664 } 660 }
665 661
666 force_sig(SIGSEGV, current); 662 force_sig(SIGSEGV, tsk);
667 return; 663 return;
668 664
669gp_in_vm86: 665gp_in_vm86:
@@ -672,14 +668,15 @@ gp_in_vm86:
672 return; 668 return;
673 669
674gp_in_kernel: 670gp_in_kernel:
675 if (!fixup_exception(regs)) { 671 if (fixup_exception(regs))
676 current->thread.error_code = error_code; 672 return;
677 current->thread.trap_no = 13; 673
678 if (notify_die(DIE_GPF, "general protection fault", regs, 674 tsk->thread.error_code = error_code;
675 tsk->thread.trap_no = 13;
676 if (notify_die(DIE_GPF, "general protection fault", regs,
679 error_code, 13, SIGSEGV) == NOTIFY_STOP) 677 error_code, 13, SIGSEGV) == NOTIFY_STOP)
680 return; 678 return;
681 die("general protection fault", regs, error_code); 679 die("general protection fault", regs, error_code);
682 }
683} 680}
684 681
685static notrace __kprobes void 682static notrace __kprobes void
@@ -756,9 +753,9 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
756 753
757static DEFINE_SPINLOCK(nmi_print_lock); 754static DEFINE_SPINLOCK(nmi_print_lock);
758 755
759void notrace __kprobes die_nmi(struct pt_regs *regs, const char *msg) 756void notrace __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic)
760{ 757{
761 if (notify_die(DIE_NMIWATCHDOG, msg, regs, 0, 2, SIGINT) == NOTIFY_STOP) 758 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, 2, SIGINT) == NOTIFY_STOP)
762 return; 759 return;
763 760
764 spin_lock(&nmi_print_lock); 761 spin_lock(&nmi_print_lock);
@@ -767,10 +764,12 @@ void notrace __kprobes die_nmi(struct pt_regs *regs, const char *msg)
767 * to get a message out: 764 * to get a message out:
768 */ 765 */
769 bust_spinlocks(1); 766 bust_spinlocks(1);
770 printk(KERN_EMERG "%s", msg); 767 printk(KERN_EMERG "%s", str);
771 printk(" on CPU%d, ip %08lx, registers:\n", 768 printk(" on CPU%d, ip %08lx, registers:\n",
772 smp_processor_id(), regs->ip); 769 smp_processor_id(), regs->ip);
773 show_registers(regs); 770 show_registers(regs);
771 if (do_panic)
772 panic("Non maskable interrupt");
774 console_silent(); 773 console_silent();
775 spin_unlock(&nmi_print_lock); 774 spin_unlock(&nmi_print_lock);
776 bust_spinlocks(0); 775 bust_spinlocks(0);
@@ -790,14 +789,17 @@ void notrace __kprobes die_nmi(struct pt_regs *regs, const char *msg)
790static notrace __kprobes void default_do_nmi(struct pt_regs *regs) 789static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
791{ 790{
792 unsigned char reason = 0; 791 unsigned char reason = 0;
792 int cpu;
793
794 cpu = smp_processor_id();
793 795
794 /* Only the BSP gets external NMIs from the system: */ 796 /* Only the BSP gets external NMIs from the system. */
795 if (!smp_processor_id()) 797 if (!cpu)
796 reason = get_nmi_reason(); 798 reason = get_nmi_reason();
797 799
798 if (!(reason & 0xc0)) { 800 if (!(reason & 0xc0)) {
799 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT) 801 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT)
800 == NOTIFY_STOP) 802 == NOTIFY_STOP)
801 return; 803 return;
802#ifdef CONFIG_X86_LOCAL_APIC 804#ifdef CONFIG_X86_LOCAL_APIC
803 /* 805 /*
@@ -806,7 +808,7 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
806 */ 808 */
807 if (nmi_watchdog_tick(regs, reason)) 809 if (nmi_watchdog_tick(regs, reason))
808 return; 810 return;
809 if (!do_nmi_callback(regs, smp_processor_id())) 811 if (!do_nmi_callback(regs, cpu))
810 unknown_nmi_error(reason, regs); 812 unknown_nmi_error(reason, regs);
811#else 813#else
812 unknown_nmi_error(reason, regs); 814 unknown_nmi_error(reason, regs);
@@ -816,6 +818,8 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
816 } 818 }
817 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) 819 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP)
818 return; 820 return;
821
822 /* AK: following checks seem to be broken on modern chipsets. FIXME */
819 if (reason & 0x80) 823 if (reason & 0x80)
820 mem_parity_error(reason, regs); 824 mem_parity_error(reason, regs);
821 if (reason & 0x40) 825 if (reason & 0x40)
@@ -827,8 +831,6 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
827 reassert_nmi(); 831 reassert_nmi();
828} 832}
829 833
830static int ignore_nmis;
831
832notrace __kprobes void do_nmi(struct pt_regs *regs, long error_code) 834notrace __kprobes void do_nmi(struct pt_regs *regs, long error_code)
833{ 835{
834 int cpu; 836 int cpu;
@@ -913,7 +915,7 @@ void __kprobes do_debug(struct pt_regs *regs, long error_code)
913 tsk->thread.debugctlmsr = 0; 915 tsk->thread.debugctlmsr = 0;
914 916
915 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, 917 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
916 SIGTRAP) == NOTIFY_STOP) 918 SIGTRAP) == NOTIFY_STOP)
917 return; 919 return;
918 /* It's safe to allow irq's after DR6 has been saved */ 920 /* It's safe to allow irq's after DR6 has been saved */
919 if (regs->flags & X86_EFLAGS_IF) 921 if (regs->flags & X86_EFLAGS_IF)
@@ -974,9 +976,8 @@ clear_TF_reenable:
974void math_error(void __user *ip) 976void math_error(void __user *ip)
975{ 977{
976 struct task_struct *task; 978 struct task_struct *task;
977 unsigned short cwd;
978 unsigned short swd;
979 siginfo_t info; 979 siginfo_t info;
980 unsigned short cwd, swd;
980 981
981 /* 982 /*
982 * Save the info for the exception handler and clear the error. 983 * Save the info for the exception handler and clear the error.
@@ -995,7 +996,7 @@ void math_error(void __user *ip)
995 * C1 reg you need in case of a stack fault, 0x040 is the stack 996 * C1 reg you need in case of a stack fault, 0x040 is the stack
996 * fault bit. We should only be taking one exception at a time, 997 * fault bit. We should only be taking one exception at a time,
997 * so if this combination doesn't produce any single exception, 998 * so if this combination doesn't produce any single exception,
998 * then we have a bad program that isn't syncronizing its FPU usage 999 * then we have a bad program that isn't synchronizing its FPU usage
999 * and it will suffer the consequences since we won't be able to 1000 * and it will suffer the consequences since we won't be able to
1000 * fully reproduce the context of the exception 1001 * fully reproduce the context of the exception
1001 */ 1002 */
@@ -1004,7 +1005,7 @@ void math_error(void __user *ip)
1004 switch (swd & ~cwd & 0x3f) { 1005 switch (swd & ~cwd & 0x3f) {
1005 case 0x000: /* No unmasked exception */ 1006 case 0x000: /* No unmasked exception */
1006 return; 1007 return;
1007 default: /* Multiple exceptions */ 1008 default: /* Multiple exceptions */
1008 break; 1009 break;
1009 case 0x001: /* Invalid Op */ 1010 case 0x001: /* Invalid Op */
1010 /* 1011 /*
@@ -1040,8 +1041,8 @@ void do_coprocessor_error(struct pt_regs *regs, long error_code)
1040static void simd_math_error(void __user *ip) 1041static void simd_math_error(void __user *ip)
1041{ 1042{
1042 struct task_struct *task; 1043 struct task_struct *task;
1043 unsigned short mxcsr;
1044 siginfo_t info; 1044 siginfo_t info;
1045 unsigned short mxcsr;
1045 1046
1046 /* 1047 /*
1047 * Save the info for the exception handler and clear the error. 1048 * Save the info for the exception handler and clear the error.
@@ -1117,7 +1118,7 @@ void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code)
1117 1118
1118unsigned long patch_espfix_desc(unsigned long uesp, unsigned long kesp) 1119unsigned long patch_espfix_desc(unsigned long uesp, unsigned long kesp)
1119{ 1120{
1120 struct desc_struct *gdt = __get_cpu_var(gdt_page).gdt; 1121 struct desc_struct *gdt = get_cpu_gdt_table(smp_processor_id());
1121 unsigned long base = (kesp - uesp) & -THREAD_SIZE; 1122 unsigned long base = (kesp - uesp) & -THREAD_SIZE;
1122 unsigned long new_kesp = kesp - base; 1123 unsigned long new_kesp = kesp - base;
1123 unsigned long lim_pages = (new_kesp | (THREAD_SIZE - 1)) >> PAGE_SHIFT; 1124 unsigned long lim_pages = (new_kesp | (THREAD_SIZE - 1)) >> PAGE_SHIFT;
@@ -1196,19 +1197,16 @@ void __init trap_init(void)
1196 early_iounmap(p, 4); 1197 early_iounmap(p, 4);
1197#endif 1198#endif
1198 1199
1199#ifdef CONFIG_X86_LOCAL_APIC 1200 set_trap_gate(0, &divide_error);
1200 init_apic_mappings(); 1201 set_intr_gate(1, &debug);
1201#endif 1202 set_intr_gate(2, &nmi);
1202 set_trap_gate(0, &divide_error); 1203 set_system_intr_gate(3, &int3); /* int3 can be called from all */
1203 set_intr_gate(1, &debug); 1204 set_system_gate(4, &overflow); /* int4 can be called from all */
1204 set_intr_gate(2, &nmi); 1205 set_trap_gate(5, &bounds);
1205 set_system_intr_gate(3, &int3); /* int3/4 can be called from all */ 1206 set_trap_gate(6, &invalid_op);
1206 set_system_gate(4, &overflow); 1207 set_trap_gate(7, &device_not_available);
1207 set_trap_gate(5, &bounds); 1208 set_task_gate(8, GDT_ENTRY_DOUBLEFAULT_TSS);
1208 set_trap_gate(6, &invalid_op); 1209 set_trap_gate(9, &coprocessor_segment_overrun);
1209 set_trap_gate(7, &device_not_available);
1210 set_task_gate(8, GDT_ENTRY_DOUBLEFAULT_TSS);
1211 set_trap_gate(9, &coprocessor_segment_overrun);
1212 set_trap_gate(10, &invalid_TSS); 1210 set_trap_gate(10, &invalid_TSS);
1213 set_trap_gate(11, &segment_not_present); 1211 set_trap_gate(11, &segment_not_present);
1214 set_trap_gate(12, &stack_segment); 1212 set_trap_gate(12, &stack_segment);
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index adff76ea97c4..2696a6837782 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -10,49 +10,49 @@
10 * 'Traps.c' handles hardware traps and faults after we have saved some 10 * 'Traps.c' handles hardware traps and faults after we have saved some
11 * state in 'entry.S'. 11 * state in 'entry.S'.
12 */ 12 */
13#include <linux/sched.h> 13#include <linux/moduleparam.h>
14#include <linux/interrupt.h>
15#include <linux/kallsyms.h>
16#include <linux/spinlock.h>
17#include <linux/kprobes.h>
18#include <linux/uaccess.h>
19#include <linux/utsname.h>
20#include <linux/kdebug.h>
14#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/ptrace.h>
15#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/unwind.h>
26#include <linux/delay.h>
16#include <linux/errno.h> 27#include <linux/errno.h>
17#include <linux/ptrace.h> 28#include <linux/kexec.h>
29#include <linux/sched.h>
18#include <linux/timer.h> 30#include <linux/timer.h>
19#include <linux/mm.h>
20#include <linux/init.h> 31#include <linux/init.h>
21#include <linux/delay.h>
22#include <linux/spinlock.h>
23#include <linux/interrupt.h>
24#include <linux/kallsyms.h>
25#include <linux/module.h>
26#include <linux/moduleparam.h>
27#include <linux/nmi.h>
28#include <linux/kprobes.h>
29#include <linux/kexec.h>
30#include <linux/unwind.h>
31#include <linux/uaccess.h>
32#include <linux/bug.h> 32#include <linux/bug.h>
33#include <linux/kdebug.h> 33#include <linux/nmi.h>
34#include <linux/utsname.h> 34#include <linux/mm.h>
35
36#include <mach_traps.h>
37 35
38#if defined(CONFIG_EDAC) 36#if defined(CONFIG_EDAC)
39#include <linux/edac.h> 37#include <linux/edac.h>
40#endif 38#endif
41 39
42#include <asm/system.h> 40#include <asm/stacktrace.h>
43#include <asm/io.h> 41#include <asm/processor.h>
44#include <asm/atomic.h>
45#include <asm/debugreg.h> 42#include <asm/debugreg.h>
43#include <asm/atomic.h>
44#include <asm/system.h>
45#include <asm/unwind.h>
46#include <asm/desc.h> 46#include <asm/desc.h>
47#include <asm/i387.h> 47#include <asm/i387.h>
48#include <asm/processor.h> 48#include <asm/nmi.h>
49#include <asm/unwind.h>
50#include <asm/smp.h> 49#include <asm/smp.h>
50#include <asm/io.h>
51#include <asm/pgalloc.h> 51#include <asm/pgalloc.h>
52#include <asm/pda.h>
53#include <asm/proto.h> 52#include <asm/proto.h>
54#include <asm/nmi.h> 53#include <asm/pda.h>
55#include <asm/stacktrace.h> 54
55#include <mach_traps.h>
56 56
57asmlinkage void divide_error(void); 57asmlinkage void divide_error(void);
58asmlinkage void debug(void); 58asmlinkage void debug(void);
@@ -71,12 +71,15 @@ asmlinkage void general_protection(void);
71asmlinkage void page_fault(void); 71asmlinkage void page_fault(void);
72asmlinkage void coprocessor_error(void); 72asmlinkage void coprocessor_error(void);
73asmlinkage void simd_coprocessor_error(void); 73asmlinkage void simd_coprocessor_error(void);
74asmlinkage void reserved(void);
75asmlinkage void alignment_check(void); 74asmlinkage void alignment_check(void);
76asmlinkage void machine_check(void);
77asmlinkage void spurious_interrupt_bug(void); 75asmlinkage void spurious_interrupt_bug(void);
76asmlinkage void machine_check(void);
78 77
78int panic_on_unrecovered_nmi;
79int kstack_depth_to_print = 12;
79static unsigned int code_bytes = 64; 80static unsigned int code_bytes = 64;
81static int ignore_nmis;
82static int die_counter;
80 83
81static inline void conditional_sti(struct pt_regs *regs) 84static inline void conditional_sti(struct pt_regs *regs)
82{ 85{
@@ -100,34 +103,9 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
100 dec_preempt_count(); 103 dec_preempt_count();
101} 104}
102 105
103int kstack_depth_to_print = 12;
104
105void printk_address(unsigned long address, int reliable) 106void printk_address(unsigned long address, int reliable)
106{ 107{
107#ifdef CONFIG_KALLSYMS 108 printk(" [<%016lx>] %s%pS\n", address, reliable ? "": "? ", (void *) address);
108 unsigned long offset = 0, symsize;
109 const char *symname;
110 char *modname;
111 char *delim = ":";
112 char namebuf[KSYM_NAME_LEN];
113 char reliab[4] = "";
114
115 symname = kallsyms_lookup(address, &symsize, &offset,
116 &modname, namebuf);
117 if (!symname) {
118 printk(" [<%016lx>]\n", address);
119 return;
120 }
121 if (!reliable)
122 strcpy(reliab, "? ");
123
124 if (!modname)
125 modname = delim = "";
126 printk(" [<%016lx>] %s%s%s%s%s+0x%lx/0x%lx\n",
127 address, reliab, delim, modname, delim, symname, offset, symsize);
128#else
129 printk(" [<%016lx>]\n", address);
130#endif
131} 109}
132 110
133static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, 111static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
@@ -204,8 +182,6 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
204 return NULL; 182 return NULL;
205} 183}
206 184
207#define MSG(txt) ops->warning(data, txt)
208
209/* 185/*
210 * x86-64 can have up to three kernel stacks: 186 * x86-64 can have up to three kernel stacks:
211 * process stack 187 * process stack
@@ -232,11 +208,11 @@ struct stack_frame {
232 unsigned long return_address; 208 unsigned long return_address;
233}; 209};
234 210
235 211static inline unsigned long
236static inline unsigned long print_context_stack(struct thread_info *tinfo, 212print_context_stack(struct thread_info *tinfo,
237 unsigned long *stack, unsigned long bp, 213 unsigned long *stack, unsigned long bp,
238 const struct stacktrace_ops *ops, void *data, 214 const struct stacktrace_ops *ops, void *data,
239 unsigned long *end) 215 unsigned long *end)
240{ 216{
241 struct stack_frame *frame = (struct stack_frame *)bp; 217 struct stack_frame *frame = (struct stack_frame *)bp;
242 218
@@ -258,7 +234,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo,
258 return bp; 234 return bp;
259} 235}
260 236
261void dump_trace(struct task_struct *tsk, struct pt_regs *regs, 237void dump_trace(struct task_struct *task, struct pt_regs *regs,
262 unsigned long *stack, unsigned long bp, 238 unsigned long *stack, unsigned long bp,
263 const struct stacktrace_ops *ops, void *data) 239 const struct stacktrace_ops *ops, void *data)
264{ 240{
@@ -267,36 +243,34 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
267 unsigned used = 0; 243 unsigned used = 0;
268 struct thread_info *tinfo; 244 struct thread_info *tinfo;
269 245
270 if (!tsk) 246 if (!task)
271 tsk = current; 247 task = current;
272 tinfo = task_thread_info(tsk);
273 248
274 if (!stack) { 249 if (!stack) {
275 unsigned long dummy; 250 unsigned long dummy;
276 stack = &dummy; 251 stack = &dummy;
277 if (tsk && tsk != current) 252 if (task && task != current)
278 stack = (unsigned long *)tsk->thread.sp; 253 stack = (unsigned long *)task->thread.sp;
279 } 254 }
280 255
281#ifdef CONFIG_FRAME_POINTER 256#ifdef CONFIG_FRAME_POINTER
282 if (!bp) { 257 if (!bp) {
283 if (tsk == current) { 258 if (task == current) {
284 /* Grab bp right from our regs */ 259 /* Grab bp right from our regs */
285 asm("movq %%rbp, %0" : "=r" (bp):); 260 asm("movq %%rbp, %0" : "=r" (bp) :);
286 } else { 261 } else {
287 /* bp is the last reg pushed by switch_to */ 262 /* bp is the last reg pushed by switch_to */
288 bp = *(unsigned long *) tsk->thread.sp; 263 bp = *(unsigned long *) task->thread.sp;
289 } 264 }
290 } 265 }
291#endif 266#endif
292 267
293
294
295 /* 268 /*
296 * Print function call entries in all stacks, starting at the 269 * Print function call entries in all stacks, starting at the
297 * current stack address. If the stacks consist of nested 270 * current stack address. If the stacks consist of nested
298 * exceptions 271 * exceptions
299 */ 272 */
273 tinfo = task_thread_info(task);
300 for (;;) { 274 for (;;) {
301 char *id; 275 char *id;
302 unsigned long *estack_end; 276 unsigned long *estack_end;
@@ -381,18 +355,17 @@ static const struct stacktrace_ops print_trace_ops = {
381 .address = print_trace_address, 355 .address = print_trace_address,
382}; 356};
383 357
384void 358void show_trace(struct task_struct *task, struct pt_regs *regs,
385show_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, 359 unsigned long *stack, unsigned long bp)
386 unsigned long bp)
387{ 360{
388 printk("\nCall Trace:\n"); 361 printk("\nCall Trace:\n");
389 dump_trace(tsk, regs, stack, bp, &print_trace_ops, NULL); 362 dump_trace(task, regs, stack, bp, &print_trace_ops, NULL);
390 printk("\n"); 363 printk("\n");
391} 364}
392 365
393static void 366static void
394_show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *sp, 367_show_stack(struct task_struct *task, struct pt_regs *regs,
395 unsigned long bp) 368 unsigned long *sp, unsigned long bp)
396{ 369{
397 unsigned long *stack; 370 unsigned long *stack;
398 int i; 371 int i;
@@ -404,14 +377,14 @@ _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *sp,
404 // back trace for this cpu. 377 // back trace for this cpu.
405 378
406 if (sp == NULL) { 379 if (sp == NULL) {
407 if (tsk) 380 if (task)
408 sp = (unsigned long *)tsk->thread.sp; 381 sp = (unsigned long *)task->thread.sp;
409 else 382 else
410 sp = (unsigned long *)&sp; 383 sp = (unsigned long *)&sp;
411 } 384 }
412 385
413 stack = sp; 386 stack = sp;
414 for(i=0; i < kstack_depth_to_print; i++) { 387 for (i = 0; i < kstack_depth_to_print; i++) {
415 if (stack >= irqstack && stack <= irqstack_end) { 388 if (stack >= irqstack && stack <= irqstack_end) {
416 if (stack == irqstack_end) { 389 if (stack == irqstack_end) {
417 stack = (unsigned long *) (irqstack_end[-1]); 390 stack = (unsigned long *) (irqstack_end[-1]);
@@ -426,12 +399,12 @@ _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *sp,
426 printk(" %016lx", *stack++); 399 printk(" %016lx", *stack++);
427 touch_nmi_watchdog(); 400 touch_nmi_watchdog();
428 } 401 }
429 show_trace(tsk, regs, sp, bp); 402 show_trace(task, regs, sp, bp);
430} 403}
431 404
432void show_stack(struct task_struct *tsk, unsigned long * sp) 405void show_stack(struct task_struct *task, unsigned long *sp)
433{ 406{
434 _show_stack(tsk, NULL, sp, 0); 407 _show_stack(task, NULL, sp, 0);
435} 408}
436 409
437/* 410/*
@@ -439,8 +412,8 @@ void show_stack(struct task_struct *tsk, unsigned long * sp)
439 */ 412 */
440void dump_stack(void) 413void dump_stack(void)
441{ 414{
442 unsigned long dummy;
443 unsigned long bp = 0; 415 unsigned long bp = 0;
416 unsigned long stack;
444 417
445#ifdef CONFIG_FRAME_POINTER 418#ifdef CONFIG_FRAME_POINTER
446 if (!bp) 419 if (!bp)
@@ -452,7 +425,7 @@ void dump_stack(void)
452 init_utsname()->release, 425 init_utsname()->release,
453 (int)strcspn(init_utsname()->version, " "), 426 (int)strcspn(init_utsname()->version, " "),
454 init_utsname()->version); 427 init_utsname()->version);
455 show_trace(NULL, NULL, &dummy, bp); 428 show_trace(NULL, NULL, &stack, bp);
456} 429}
457 430
458EXPORT_SYMBOL(dump_stack); 431EXPORT_SYMBOL(dump_stack);
@@ -463,12 +436,8 @@ void show_registers(struct pt_regs *regs)
463 unsigned long sp; 436 unsigned long sp;
464 const int cpu = smp_processor_id(); 437 const int cpu = smp_processor_id();
465 struct task_struct *cur = cpu_pda(cpu)->pcurrent; 438 struct task_struct *cur = cpu_pda(cpu)->pcurrent;
466 u8 *ip;
467 unsigned int code_prologue = code_bytes * 43 / 64;
468 unsigned int code_len = code_bytes;
469 439
470 sp = regs->sp; 440 sp = regs->sp;
471 ip = (u8 *) regs->ip - code_prologue;
472 printk("CPU %d ", cpu); 441 printk("CPU %d ", cpu);
473 __show_regs(regs); 442 __show_regs(regs);
474 printk("Process %s (pid: %d, threadinfo %p, task %p)\n", 443 printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
@@ -479,15 +448,21 @@ void show_registers(struct pt_regs *regs)
479 * time of the fault.. 448 * time of the fault..
480 */ 449 */
481 if (!user_mode(regs)) { 450 if (!user_mode(regs)) {
451 unsigned int code_prologue = code_bytes * 43 / 64;
452 unsigned int code_len = code_bytes;
482 unsigned char c; 453 unsigned char c;
454 u8 *ip;
455
483 printk("Stack: "); 456 printk("Stack: ");
484 _show_stack(NULL, regs, (unsigned long *)sp, regs->bp); 457 _show_stack(NULL, regs, (unsigned long *)sp, regs->bp);
485 printk("\n"); 458 printk("\n");
486 459
487 printk(KERN_EMERG "Code: "); 460 printk(KERN_EMERG "Code: ");
461
462 ip = (u8 *)regs->ip - code_prologue;
488 if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) { 463 if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
489 /* try starting at RIP */ 464 /* try starting at RIP */
490 ip = (u8 *) regs->ip; 465 ip = (u8 *)regs->ip;
491 code_len = code_len - code_prologue + 1; 466 code_len = code_len - code_prologue + 1;
492 } 467 }
493 for (i = 0; i < code_len; i++, ip++) { 468 for (i = 0; i < code_len; i++, ip++) {
@@ -503,7 +478,7 @@ void show_registers(struct pt_regs *regs)
503 } 478 }
504 } 479 }
505 printk("\n"); 480 printk("\n");
506} 481}
507 482
508int is_valid_bugaddr(unsigned long ip) 483int is_valid_bugaddr(unsigned long ip)
509{ 484{
@@ -561,10 +536,9 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
561 do_exit(signr); 536 do_exit(signr);
562} 537}
563 538
564int __kprobes __die(const char * str, struct pt_regs * regs, long err) 539int __kprobes __die(const char *str, struct pt_regs *regs, long err)
565{ 540{
566 static int die_counter; 541 printk(KERN_EMERG "%s: %04lx [%u] ", str, err & 0xffff, ++die_counter);
567 printk(KERN_EMERG "%s: %04lx [%u] ", str, err & 0xffff,++die_counter);
568#ifdef CONFIG_PREEMPT 542#ifdef CONFIG_PREEMPT
569 printk("PREEMPT "); 543 printk("PREEMPT ");
570#endif 544#endif
@@ -575,8 +549,10 @@ int __kprobes __die(const char * str, struct pt_regs * regs, long err)
575 printk("DEBUG_PAGEALLOC"); 549 printk("DEBUG_PAGEALLOC");
576#endif 550#endif
577 printk("\n"); 551 printk("\n");
578 if (notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV) == NOTIFY_STOP) 552 if (notify_die(DIE_OOPS, str, regs, err,
553 current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
579 return 1; 554 return 1;
555
580 show_registers(regs); 556 show_registers(regs);
581 add_taint(TAINT_DIE); 557 add_taint(TAINT_DIE);
582 /* Executive summary in case the oops scrolled away */ 558 /* Executive summary in case the oops scrolled away */
@@ -588,7 +564,7 @@ int __kprobes __die(const char * str, struct pt_regs * regs, long err)
588 return 0; 564 return 0;
589} 565}
590 566
591void die(const char * str, struct pt_regs * regs, long err) 567void die(const char *str, struct pt_regs *regs, long err)
592{ 568{
593 unsigned long flags = oops_begin(); 569 unsigned long flags = oops_begin();
594 570
@@ -605,8 +581,7 @@ die_nmi(char *str, struct pt_regs *regs, int do_panic)
605{ 581{
606 unsigned long flags; 582 unsigned long flags;
607 583
608 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, 2, SIGINT) == 584 if (notify_die(DIE_NMIWATCHDOG, str, regs, 0, 2, SIGINT) == NOTIFY_STOP)
609 NOTIFY_STOP)
610 return; 585 return;
611 586
612 flags = oops_begin(); 587 flags = oops_begin();
@@ -614,7 +589,9 @@ die_nmi(char *str, struct pt_regs *regs, int do_panic)
614 * We are in trouble anyway, lets at least try 589 * We are in trouble anyway, lets at least try
615 * to get a message out. 590 * to get a message out.
616 */ 591 */
617 printk(str, smp_processor_id()); 592 printk(KERN_EMERG "%s", str);
593 printk(" on CPU%d, ip %08lx, registers:\n",
594 smp_processor_id(), regs->ip);
618 show_registers(regs); 595 show_registers(regs);
619 if (kexec_should_crash(current)) 596 if (kexec_should_crash(current))
620 crash_kexec(regs); 597 crash_kexec(regs);
@@ -626,44 +603,44 @@ die_nmi(char *str, struct pt_regs *regs, int do_panic)
626 do_exit(SIGBUS); 603 do_exit(SIGBUS);
627} 604}
628 605
629static void __kprobes do_trap(int trapnr, int signr, char *str, 606static void __kprobes
630 struct pt_regs * regs, long error_code, 607do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
631 siginfo_t *info) 608 long error_code, siginfo_t *info)
632{ 609{
633 struct task_struct *tsk = current; 610 struct task_struct *tsk = current;
634 611
635 if (user_mode(regs)) { 612 if (!user_mode(regs))
636 /* 613 goto kernel_trap;
637 * We want error_code and trap_no set for userspace
638 * faults and kernelspace faults which result in
639 * die(), but not kernelspace faults which are fixed
640 * up. die() gives the process no chance to handle
641 * the signal and notice the kernel fault information,
642 * so that won't result in polluting the information
643 * about previously queued, but not yet delivered,
644 * faults. See also do_general_protection below.
645 */
646 tsk->thread.error_code = error_code;
647 tsk->thread.trap_no = trapnr;
648
649 if (show_unhandled_signals && unhandled_signal(tsk, signr) &&
650 printk_ratelimit()) {
651 printk(KERN_INFO
652 "%s[%d] trap %s ip:%lx sp:%lx error:%lx",
653 tsk->comm, tsk->pid, str,
654 regs->ip, regs->sp, error_code);
655 print_vma_addr(" in ", regs->ip);
656 printk("\n");
657 }
658 614
659 if (info) 615 /*
660 force_sig_info(signr, info, tsk); 616 * We want error_code and trap_no set for userspace faults and
661 else 617 * kernelspace faults which result in die(), but not
662 force_sig(signr, tsk); 618 * kernelspace faults which are fixed up. die() gives the
663 return; 619 * process no chance to handle the signal and notice the
620 * kernel fault information, so that won't result in polluting
621 * the information about previously queued, but not yet
622 * delivered, faults. See also do_general_protection below.
623 */
624 tsk->thread.error_code = error_code;
625 tsk->thread.trap_no = trapnr;
626
627 if (show_unhandled_signals && unhandled_signal(tsk, signr) &&
628 printk_ratelimit()) {
629 printk(KERN_INFO
630 "%s[%d] trap %s ip:%lx sp:%lx error:%lx",
631 tsk->comm, tsk->pid, str,
632 regs->ip, regs->sp, error_code);
633 print_vma_addr(" in ", regs->ip);
634 printk("\n");
664 } 635 }
665 636
637 if (info)
638 force_sig_info(signr, info, tsk);
639 else
640 force_sig(signr, tsk);
641 return;
666 642
643kernel_trap:
667 if (!fixup_exception(regs)) { 644 if (!fixup_exception(regs)) {
668 tsk->thread.error_code = error_code; 645 tsk->thread.error_code = error_code;
669 tsk->thread.trap_no = trapnr; 646 tsk->thread.trap_no = trapnr;
@@ -673,41 +650,39 @@ static void __kprobes do_trap(int trapnr, int signr, char *str,
673} 650}
674 651
675#define DO_ERROR(trapnr, signr, str, name) \ 652#define DO_ERROR(trapnr, signr, str, name) \
676asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ 653asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
677{ \ 654{ \
678 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 655 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
679 == NOTIFY_STOP) \ 656 == NOTIFY_STOP) \
680 return; \ 657 return; \
681 conditional_sti(regs); \ 658 conditional_sti(regs); \
682 do_trap(trapnr, signr, str, regs, error_code, NULL); \ 659 do_trap(trapnr, signr, str, regs, error_code, NULL); \
683} 660}
684 661
685#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ 662#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
686asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ 663asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
687{ \ 664{ \
688 siginfo_t info; \ 665 siginfo_t info; \
689 info.si_signo = signr; \ 666 info.si_signo = signr; \
690 info.si_errno = 0; \ 667 info.si_errno = 0; \
691 info.si_code = sicode; \ 668 info.si_code = sicode; \
692 info.si_addr = (void __user *)siaddr; \ 669 info.si_addr = (void __user *)siaddr; \
693 trace_hardirqs_fixup(); \ 670 trace_hardirqs_fixup(); \
694 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 671 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
695 == NOTIFY_STOP) \ 672 == NOTIFY_STOP) \
696 return; \ 673 return; \
697 conditional_sti(regs); \ 674 conditional_sti(regs); \
698 do_trap(trapnr, signr, str, regs, error_code, &info); \ 675 do_trap(trapnr, signr, str, regs, error_code, &info); \
699} 676}
700 677
701DO_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip) 678DO_ERROR_INFO(0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip)
702DO_ERROR( 4, SIGSEGV, "overflow", overflow) 679DO_ERROR(4, SIGSEGV, "overflow", overflow)
703DO_ERROR( 5, SIGSEGV, "bounds", bounds) 680DO_ERROR(5, SIGSEGV, "bounds", bounds)
704DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip) 681DO_ERROR_INFO(6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip)
705DO_ERROR( 7, SIGSEGV, "device not available", device_not_available) 682DO_ERROR(9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
706DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
707DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) 683DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
708DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) 684DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
709DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) 685DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
710DO_ERROR(18, SIGSEGV, "reserved", reserved)
711 686
712/* Runs on IST stack */ 687/* Runs on IST stack */
713asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code) 688asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code)
@@ -737,31 +712,34 @@ asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)
737 die(str, regs, error_code); 712 die(str, regs, error_code);
738} 713}
739 714
740asmlinkage void __kprobes do_general_protection(struct pt_regs * regs, 715asmlinkage void __kprobes
741 long error_code) 716do_general_protection(struct pt_regs *regs, long error_code)
742{ 717{
743 struct task_struct *tsk = current; 718 struct task_struct *tsk;
744 719
745 conditional_sti(regs); 720 conditional_sti(regs);
746 721
747 if (user_mode(regs)) { 722 tsk = current;
748 tsk->thread.error_code = error_code; 723 if (!user_mode(regs))
749 tsk->thread.trap_no = 13; 724 goto gp_in_kernel;
750
751 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
752 printk_ratelimit()) {
753 printk(KERN_INFO
754 "%s[%d] general protection ip:%lx sp:%lx error:%lx",
755 tsk->comm, tsk->pid,
756 regs->ip, regs->sp, error_code);
757 print_vma_addr(" in ", regs->ip);
758 printk("\n");
759 }
760 725
761 force_sig(SIGSEGV, tsk); 726 tsk->thread.error_code = error_code;
762 return; 727 tsk->thread.trap_no = 13;
763 } 728
729 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
730 printk_ratelimit()) {
731 printk(KERN_INFO
732 "%s[%d] general protection ip:%lx sp:%lx error:%lx",
733 tsk->comm, tsk->pid,
734 regs->ip, regs->sp, error_code);
735 print_vma_addr(" in ", regs->ip);
736 printk("\n");
737 }
764 738
739 force_sig(SIGSEGV, tsk);
740 return;
741
742gp_in_kernel:
765 if (fixup_exception(regs)) 743 if (fixup_exception(regs))
766 return; 744 return;
767 745
@@ -774,14 +752,14 @@ asmlinkage void __kprobes do_general_protection(struct pt_regs * regs,
774} 752}
775 753
776static notrace __kprobes void 754static notrace __kprobes void
777mem_parity_error(unsigned char reason, struct pt_regs * regs) 755mem_parity_error(unsigned char reason, struct pt_regs *regs)
778{ 756{
779 printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n", 757 printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n",
780 reason); 758 reason);
781 printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n"); 759 printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n");
782 760
783#if defined(CONFIG_EDAC) 761#if defined(CONFIG_EDAC)
784 if(edac_handler_set()) { 762 if (edac_handler_set()) {
785 edac_atomic_assert_error(); 763 edac_atomic_assert_error();
786 return; 764 return;
787 } 765 }
@@ -798,7 +776,7 @@ mem_parity_error(unsigned char reason, struct pt_regs * regs)
798} 776}
799 777
800static notrace __kprobes void 778static notrace __kprobes void
801io_check_error(unsigned char reason, struct pt_regs * regs) 779io_check_error(unsigned char reason, struct pt_regs *regs)
802{ 780{
803 printk("NMI: IOCK error (debug interrupt?)\n"); 781 printk("NMI: IOCK error (debug interrupt?)\n");
804 show_registers(regs); 782 show_registers(regs);
@@ -828,14 +806,14 @@ unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
828 806
829/* Runs on IST stack. This code must keep interrupts off all the time. 807/* Runs on IST stack. This code must keep interrupts off all the time.
830 Nested NMIs are prevented by the CPU. */ 808 Nested NMIs are prevented by the CPU. */
831asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs) 809asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs)
832{ 810{
833 unsigned char reason = 0; 811 unsigned char reason = 0;
834 int cpu; 812 int cpu;
835 813
836 cpu = smp_processor_id(); 814 cpu = smp_processor_id();
837 815
838 /* Only the BSP gets external NMIs from the system. */ 816 /* Only the BSP gets external NMIs from the system. */
839 if (!cpu) 817 if (!cpu)
840 reason = get_nmi_reason(); 818 reason = get_nmi_reason();
841 819
@@ -847,32 +825,57 @@ asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs)
847 * Ok, so this is none of the documented NMI sources, 825 * Ok, so this is none of the documented NMI sources,
848 * so it must be the NMI watchdog. 826 * so it must be the NMI watchdog.
849 */ 827 */
850 if (nmi_watchdog_tick(regs,reason)) 828 if (nmi_watchdog_tick(regs, reason))
851 return; 829 return;
852 if (!do_nmi_callback(regs,cpu)) 830 if (!do_nmi_callback(regs, cpu))
853 unknown_nmi_error(reason, regs); 831 unknown_nmi_error(reason, regs);
854 832
855 return; 833 return;
856 } 834 }
857 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) 835 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP)
858 return; 836 return;
859 837
860 /* AK: following checks seem to be broken on modern chipsets. FIXME */ 838 /* AK: following checks seem to be broken on modern chipsets. FIXME */
861
862 if (reason & 0x80) 839 if (reason & 0x80)
863 mem_parity_error(reason, regs); 840 mem_parity_error(reason, regs);
864 if (reason & 0x40) 841 if (reason & 0x40)
865 io_check_error(reason, regs); 842 io_check_error(reason, regs);
866} 843}
867 844
845asmlinkage notrace __kprobes void
846do_nmi(struct pt_regs *regs, long error_code)
847{
848 nmi_enter();
849
850 add_pda(__nmi_count, 1);
851
852 if (!ignore_nmis)
853 default_do_nmi(regs);
854
855 nmi_exit();
856}
857
858void stop_nmi(void)
859{
860 acpi_nmi_disable();
861 ignore_nmis++;
862}
863
864void restart_nmi(void)
865{
866 ignore_nmis--;
867 acpi_nmi_enable();
868}
869
868/* runs on IST stack. */ 870/* runs on IST stack. */
869asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) 871asmlinkage void __kprobes do_int3(struct pt_regs *regs, long error_code)
870{ 872{
871 trace_hardirqs_fixup(); 873 trace_hardirqs_fixup();
872 874
873 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { 875 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP)
876 == NOTIFY_STOP)
874 return; 877 return;
875 } 878
876 preempt_conditional_sti(regs); 879 preempt_conditional_sti(regs);
877 do_trap(3, SIGTRAP, "int3", regs, error_code, NULL); 880 do_trap(3, SIGTRAP, "int3", regs, error_code, NULL);
878 preempt_conditional_cli(regs); 881 preempt_conditional_cli(regs);
@@ -903,8 +906,8 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
903asmlinkage void __kprobes do_debug(struct pt_regs * regs, 906asmlinkage void __kprobes do_debug(struct pt_regs * regs,
904 unsigned long error_code) 907 unsigned long error_code)
905{ 908{
906 unsigned long condition;
907 struct task_struct *tsk = current; 909 struct task_struct *tsk = current;
910 unsigned long condition;
908 siginfo_t info; 911 siginfo_t info;
909 912
910 trace_hardirqs_fixup(); 913 trace_hardirqs_fixup();
@@ -925,21 +928,19 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
925 928
926 /* Mask out spurious debug traps due to lazy DR7 setting */ 929 /* Mask out spurious debug traps due to lazy DR7 setting */
927 if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) { 930 if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {
928 if (!tsk->thread.debugreg7) { 931 if (!tsk->thread.debugreg7)
929 goto clear_dr7; 932 goto clear_dr7;
930 }
931 } 933 }
932 934
933 tsk->thread.debugreg6 = condition; 935 tsk->thread.debugreg6 = condition;
934 936
935
936 /* 937 /*
937 * Single-stepping through TF: make sure we ignore any events in 938 * Single-stepping through TF: make sure we ignore any events in
938 * kernel space (but re-enable TF when returning to user mode). 939 * kernel space (but re-enable TF when returning to user mode).
939 */ 940 */
940 if (condition & DR_STEP) { 941 if (condition & DR_STEP) {
941 if (!user_mode(regs)) 942 if (!user_mode(regs))
942 goto clear_TF_reenable; 943 goto clear_TF_reenable;
943 } 944 }
944 945
945 /* Ok, finally something we can handle */ 946 /* Ok, finally something we can handle */
@@ -952,7 +953,7 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
952 force_sig_info(SIGTRAP, &info, tsk); 953 force_sig_info(SIGTRAP, &info, tsk);
953 954
954clear_dr7: 955clear_dr7:
955 set_debugreg(0UL, 7); 956 set_debugreg(0, 7);
956 preempt_conditional_cli(regs); 957 preempt_conditional_cli(regs);
957 return; 958 return;
958 959
@@ -960,6 +961,7 @@ clear_TF_reenable:
960 set_tsk_thread_flag(tsk, TIF_SINGLESTEP); 961 set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
961 regs->flags &= ~X86_EFLAGS_TF; 962 regs->flags &= ~X86_EFLAGS_TF;
962 preempt_conditional_cli(regs); 963 preempt_conditional_cli(regs);
964 return;
963} 965}
964 966
965static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) 967static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr)
@@ -982,7 +984,7 @@ static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr)
982asmlinkage void do_coprocessor_error(struct pt_regs *regs) 984asmlinkage void do_coprocessor_error(struct pt_regs *regs)
983{ 985{
984 void __user *ip = (void __user *)(regs->ip); 986 void __user *ip = (void __user *)(regs->ip);
985 struct task_struct * task; 987 struct task_struct *task;
986 siginfo_t info; 988 siginfo_t info;
987 unsigned short cwd, swd; 989 unsigned short cwd, swd;
988 990
@@ -1015,30 +1017,30 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
1015 cwd = get_fpu_cwd(task); 1017 cwd = get_fpu_cwd(task);
1016 swd = get_fpu_swd(task); 1018 swd = get_fpu_swd(task);
1017 switch (swd & ~cwd & 0x3f) { 1019 switch (swd & ~cwd & 0x3f) {
1018 case 0x000: 1020 case 0x000: /* No unmasked exception */
1019 default: 1021 default: /* Multiple exceptions */
1020 break; 1022 break;
1021 case 0x001: /* Invalid Op */ 1023 case 0x001: /* Invalid Op */
1022 /* 1024 /*
1023 * swd & 0x240 == 0x040: Stack Underflow 1025 * swd & 0x240 == 0x040: Stack Underflow
1024 * swd & 0x240 == 0x240: Stack Overflow 1026 * swd & 0x240 == 0x240: Stack Overflow
1025 * User must clear the SF bit (0x40) if set 1027 * User must clear the SF bit (0x40) if set
1026 */ 1028 */
1027 info.si_code = FPE_FLTINV; 1029 info.si_code = FPE_FLTINV;
1028 break; 1030 break;
1029 case 0x002: /* Denormalize */ 1031 case 0x002: /* Denormalize */
1030 case 0x010: /* Underflow */ 1032 case 0x010: /* Underflow */
1031 info.si_code = FPE_FLTUND; 1033 info.si_code = FPE_FLTUND;
1032 break; 1034 break;
1033 case 0x004: /* Zero Divide */ 1035 case 0x004: /* Zero Divide */
1034 info.si_code = FPE_FLTDIV; 1036 info.si_code = FPE_FLTDIV;
1035 break; 1037 break;
1036 case 0x008: /* Overflow */ 1038 case 0x008: /* Overflow */
1037 info.si_code = FPE_FLTOVF; 1039 info.si_code = FPE_FLTOVF;
1038 break; 1040 break;
1039 case 0x020: /* Precision */ 1041 case 0x020: /* Precision */
1040 info.si_code = FPE_FLTRES; 1042 info.si_code = FPE_FLTRES;
1041 break; 1043 break;
1042 } 1044 }
1043 force_sig_info(SIGFPE, &info, task); 1045 force_sig_info(SIGFPE, &info, task);
1044} 1046}
@@ -1051,7 +1053,7 @@ asmlinkage void bad_intr(void)
1051asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) 1053asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
1052{ 1054{
1053 void __user *ip = (void __user *)(regs->ip); 1055 void __user *ip = (void __user *)(regs->ip);
1054 struct task_struct * task; 1056 struct task_struct *task;
1055 siginfo_t info; 1057 siginfo_t info;
1056 unsigned short mxcsr; 1058 unsigned short mxcsr;
1057 1059
@@ -1079,25 +1081,25 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
1079 */ 1081 */
1080 mxcsr = get_fpu_mxcsr(task); 1082 mxcsr = get_fpu_mxcsr(task);
1081 switch (~((mxcsr & 0x1f80) >> 7) & (mxcsr & 0x3f)) { 1083 switch (~((mxcsr & 0x1f80) >> 7) & (mxcsr & 0x3f)) {
1082 case 0x000: 1084 case 0x000:
1083 default: 1085 default:
1084 break; 1086 break;
1085 case 0x001: /* Invalid Op */ 1087 case 0x001: /* Invalid Op */
1086 info.si_code = FPE_FLTINV; 1088 info.si_code = FPE_FLTINV;
1087 break; 1089 break;
1088 case 0x002: /* Denormalize */ 1090 case 0x002: /* Denormalize */
1089 case 0x010: /* Underflow */ 1091 case 0x010: /* Underflow */
1090 info.si_code = FPE_FLTUND; 1092 info.si_code = FPE_FLTUND;
1091 break; 1093 break;
1092 case 0x004: /* Zero Divide */ 1094 case 0x004: /* Zero Divide */
1093 info.si_code = FPE_FLTDIV; 1095 info.si_code = FPE_FLTDIV;
1094 break; 1096 break;
1095 case 0x008: /* Overflow */ 1097 case 0x008: /* Overflow */
1096 info.si_code = FPE_FLTOVF; 1098 info.si_code = FPE_FLTOVF;
1097 break; 1099 break;
1098 case 0x020: /* Precision */ 1100 case 0x020: /* Precision */
1099 info.si_code = FPE_FLTRES; 1101 info.si_code = FPE_FLTRES;
1100 break; 1102 break;
1101 } 1103 }
1102 force_sig_info(SIGFPE, &info, task); 1104 force_sig_info(SIGFPE, &info, task);
1103} 1105}
@@ -1115,7 +1117,7 @@ asmlinkage void __attribute__((weak)) mce_threshold_interrupt(void)
1115} 1117}
1116 1118
1117/* 1119/*
1118 * 'math_state_restore()' saves the current math information in the 1120 * 'math_state_restore()' saves the current math information in the
1119 * old math state array, and gets the new ones from the current task 1121 * old math state array, and gets the new ones from the current task
1120 * 1122 *
1121 * Careful.. There are problems with IBM-designed IRQ13 behaviour. 1123 * Careful.. There are problems with IBM-designed IRQ13 behaviour.
@@ -1140,7 +1142,7 @@ asmlinkage void math_state_restore(void)
1140 local_irq_disable(); 1142 local_irq_disable();
1141 } 1143 }
1142 1144
1143 clts(); /* Allow maths ops (or we recurse) */ 1145 clts(); /* Allow maths ops (or we recurse) */
1144 restore_fpu_checking(&me->thread.xstate->fxsave); 1146 restore_fpu_checking(&me->thread.xstate->fxsave);
1145 task_thread_info(me)->status |= TS_USEDFPU; 1147 task_thread_info(me)->status |= TS_USEDFPU;
1146 me->fpu_counter++; 1148 me->fpu_counter++;
@@ -1149,64 +1151,61 @@ EXPORT_SYMBOL_GPL(math_state_restore);
1149 1151
1150void __init trap_init(void) 1152void __init trap_init(void)
1151{ 1153{
1152 set_intr_gate(0,&divide_error); 1154 set_intr_gate(0, &divide_error);
1153 set_intr_gate_ist(1,&debug,DEBUG_STACK); 1155 set_intr_gate_ist(1, &debug, DEBUG_STACK);
1154 set_intr_gate_ist(2,&nmi,NMI_STACK); 1156 set_intr_gate_ist(2, &nmi, NMI_STACK);
1155 set_system_gate_ist(3,&int3,DEBUG_STACK); /* int3 can be called from all */ 1157 set_system_gate_ist(3, &int3, DEBUG_STACK); /* int3 can be called from all */
1156 set_system_gate(4,&overflow); /* int4 can be called from all */ 1158 set_system_gate(4, &overflow); /* int4 can be called from all */
1157 set_intr_gate(5,&bounds); 1159 set_intr_gate(5, &bounds);
1158 set_intr_gate(6,&invalid_op); 1160 set_intr_gate(6, &invalid_op);
1159 set_intr_gate(7,&device_not_available); 1161 set_intr_gate(7, &device_not_available);
1160 set_intr_gate_ist(8,&double_fault, DOUBLEFAULT_STACK); 1162 set_intr_gate_ist(8, &double_fault, DOUBLEFAULT_STACK);
1161 set_intr_gate(9,&coprocessor_segment_overrun); 1163 set_intr_gate(9, &coprocessor_segment_overrun);
1162 set_intr_gate(10,&invalid_TSS); 1164 set_intr_gate(10, &invalid_TSS);
1163 set_intr_gate(11,&segment_not_present); 1165 set_intr_gate(11, &segment_not_present);
1164 set_intr_gate_ist(12,&stack_segment,STACKFAULT_STACK); 1166 set_intr_gate_ist(12, &stack_segment, STACKFAULT_STACK);
1165 set_intr_gate(13,&general_protection); 1167 set_intr_gate(13, &general_protection);
1166 set_intr_gate(14,&page_fault); 1168 set_intr_gate(14, &page_fault);
1167 set_intr_gate(15,&spurious_interrupt_bug); 1169 set_intr_gate(15, &spurious_interrupt_bug);
1168 set_intr_gate(16,&coprocessor_error); 1170 set_intr_gate(16, &coprocessor_error);
1169 set_intr_gate(17,&alignment_check); 1171 set_intr_gate(17, &alignment_check);
1170#ifdef CONFIG_X86_MCE 1172#ifdef CONFIG_X86_MCE
1171 set_intr_gate_ist(18,&machine_check, MCE_STACK); 1173 set_intr_gate_ist(18, &machine_check, MCE_STACK);
1172#endif 1174#endif
1173 set_intr_gate(19,&simd_coprocessor_error); 1175 set_intr_gate(19, &simd_coprocessor_error);
1174 1176
1175#ifdef CONFIG_IA32_EMULATION 1177#ifdef CONFIG_IA32_EMULATION
1176 set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall); 1178 set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall);
1177#endif 1179#endif
1178
1179 /* 1180 /*
1180 * initialize the per thread extended state: 1181 * initialize the per thread extended state:
1181 */ 1182 */
1182 init_thread_xstate(); 1183 init_thread_xstate();
1183 /* 1184 /*
1184 * Should be a barrier for any external CPU state. 1185 * Should be a barrier for any external CPU state:
1185 */ 1186 */
1186 cpu_init(); 1187 cpu_init();
1187} 1188}
1188 1189
1189
1190static int __init oops_setup(char *s) 1190static int __init oops_setup(char *s)
1191{ 1191{
1192 if (!s) 1192 if (!s)
1193 return -EINVAL; 1193 return -EINVAL;
1194 if (!strcmp(s, "panic")) 1194 if (!strcmp(s, "panic"))
1195 panic_on_oops = 1; 1195 panic_on_oops = 1;
1196 return 0; 1196 return 0;
1197} 1197}
1198early_param("oops", oops_setup); 1198early_param("oops", oops_setup);
1199 1199
1200static int __init kstack_setup(char *s) 1200static int __init kstack_setup(char *s)
1201{ 1201{
1202 if (!s) 1202 if (!s)
1203 return -EINVAL; 1203 return -EINVAL;
1204 kstack_depth_to_print = simple_strtoul(s,NULL,0); 1204 kstack_depth_to_print = simple_strtoul(s, NULL, 0);
1205 return 0; 1205 return 0;
1206} 1206}
1207early_param("kstack", kstack_setup); 1207early_param("kstack", kstack_setup);
1208 1208
1209
1210static int __init code_bytes_setup(char *s) 1209static int __init code_bytes_setup(char *s)
1211{ 1210{
1212 code_bytes = simple_strtoul(s, NULL, 0); 1211 code_bytes = simple_strtoul(s, NULL, 0);
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
new file mode 100644
index 000000000000..3c36f92160c9
--- /dev/null
+++ b/arch/x86/kernel/tsc.c
@@ -0,0 +1,533 @@
1#include <linux/kernel.h>
2#include <linux/sched.h>
3#include <linux/init.h>
4#include <linux/module.h>
5#include <linux/timer.h>
6#include <linux/acpi_pmtmr.h>
7#include <linux/cpufreq.h>
8#include <linux/dmi.h>
9#include <linux/delay.h>
10#include <linux/clocksource.h>
11#include <linux/percpu.h>
12
13#include <asm/hpet.h>
14#include <asm/timer.h>
15#include <asm/vgtod.h>
16#include <asm/time.h>
17#include <asm/delay.h>
18
19unsigned int cpu_khz; /* TSC clocks / usec, not used here */
20EXPORT_SYMBOL(cpu_khz);
21unsigned int tsc_khz;
22EXPORT_SYMBOL(tsc_khz);
23
24/*
25 * TSC can be unstable due to cpufreq or due to unsynced TSCs
26 */
27static int tsc_unstable;
28
29/* native_sched_clock() is called before tsc_init(), so
30 we must start with the TSC soft disabled to prevent
31 erroneous rdtsc usage on !cpu_has_tsc processors */
32static int tsc_disabled = -1;
33
34/*
35 * Scheduler clock - returns current time in nanosec units.
36 */
37u64 native_sched_clock(void)
38{
39 u64 this_offset;
40
41 /*
42 * Fall back to jiffies if there's no TSC available:
43 * ( But note that we still use it if the TSC is marked
44 * unstable. We do this because unlike Time Of Day,
45 * the scheduler clock tolerates small errors and it's
46 * very important for it to be as fast as the platform
47 * can achive it. )
48 */
49 if (unlikely(tsc_disabled)) {
50 /* No locking but a rare wrong value is not a big deal: */
51 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
52 }
53
54 /* read the Time Stamp Counter: */
55 rdtscll(this_offset);
56
57 /* return the value in ns */
58 return cycles_2_ns(this_offset);
59}
60
61/* We need to define a real function for sched_clock, to override the
62 weak default version */
63#ifdef CONFIG_PARAVIRT
64unsigned long long sched_clock(void)
65{
66 return paravirt_sched_clock();
67}
68#else
69unsigned long long
70sched_clock(void) __attribute__((alias("native_sched_clock")));
71#endif
72
73int check_tsc_unstable(void)
74{
75 return tsc_unstable;
76}
77EXPORT_SYMBOL_GPL(check_tsc_unstable);
78
79#ifdef CONFIG_X86_TSC
80int __init notsc_setup(char *str)
81{
82 printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
83 "cannot disable TSC completely.\n");
84 tsc_disabled = 1;
85 return 1;
86}
87#else
88/*
89 * disable flag for tsc. Takes effect by clearing the TSC cpu flag
90 * in cpu/common.c
91 */
92int __init notsc_setup(char *str)
93{
94 setup_clear_cpu_cap(X86_FEATURE_TSC);
95 return 1;
96}
97#endif
98
99__setup("notsc", notsc_setup);
100
101#define MAX_RETRIES 5
102#define SMI_TRESHOLD 50000
103
104/*
105 * Read TSC and the reference counters. Take care of SMI disturbance
106 */
107static u64 __init tsc_read_refs(u64 *pm, u64 *hpet)
108{
109 u64 t1, t2;
110 int i;
111
112 for (i = 0; i < MAX_RETRIES; i++) {
113 t1 = get_cycles();
114 if (hpet)
115 *hpet = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF;
116 else
117 *pm = acpi_pm_read_early();
118 t2 = get_cycles();
119 if ((t2 - t1) < SMI_TRESHOLD)
120 return t2;
121 }
122 return ULLONG_MAX;
123}
124
125/**
126 * native_calibrate_tsc - calibrate the tsc on boot
127 */
128unsigned long native_calibrate_tsc(void)
129{
130 unsigned long flags;
131 u64 tsc1, tsc2, tr1, tr2, delta, pm1, pm2, hpet1, hpet2;
132 int hpet = is_hpet_enabled();
133 unsigned int tsc_khz_val = 0;
134
135 local_irq_save(flags);
136
137 tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL);
138
139 outb((inb(0x61) & ~0x02) | 0x01, 0x61);
140
141 outb(0xb0, 0x43);
142 outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
143 outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42);
144 tr1 = get_cycles();
145 while ((inb(0x61) & 0x20) == 0);
146 tr2 = get_cycles();
147
148 tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL);
149
150 local_irq_restore(flags);
151
152 /*
153 * Preset the result with the raw and inaccurate PIT
154 * calibration value
155 */
156 delta = (tr2 - tr1);
157 do_div(delta, 50);
158 tsc_khz_val = delta;
159
160 /* hpet or pmtimer available ? */
161 if (!hpet && !pm1 && !pm2) {
162 printk(KERN_INFO "TSC calibrated against PIT\n");
163 goto out;
164 }
165
166 /* Check, whether the sampling was disturbed by an SMI */
167 if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) {
168 printk(KERN_WARNING "TSC calibration disturbed by SMI, "
169 "using PIT calibration result\n");
170 goto out;
171 }
172
173 tsc2 = (tsc2 - tsc1) * 1000000LL;
174
175 if (hpet) {
176 printk(KERN_INFO "TSC calibrated against HPET\n");
177 if (hpet2 < hpet1)
178 hpet2 += 0x100000000ULL;
179 hpet2 -= hpet1;
180 tsc1 = ((u64)hpet2 * hpet_readl(HPET_PERIOD));
181 do_div(tsc1, 1000000);
182 } else {
183 printk(KERN_INFO "TSC calibrated against PM_TIMER\n");
184 if (pm2 < pm1)
185 pm2 += (u64)ACPI_PM_OVRRUN;
186 pm2 -= pm1;
187 tsc1 = pm2 * 1000000000LL;
188 do_div(tsc1, PMTMR_TICKS_PER_SEC);
189 }
190
191 do_div(tsc2, tsc1);
192 tsc_khz_val = tsc2;
193
194out:
195 return tsc_khz_val;
196}
197
198
199#ifdef CONFIG_X86_32
200/* Only called from the Powernow K7 cpu freq driver */
201int recalibrate_cpu_khz(void)
202{
203#ifndef CONFIG_SMP
204 unsigned long cpu_khz_old = cpu_khz;
205
206 if (cpu_has_tsc) {
207 tsc_khz = calibrate_tsc();
208 cpu_khz = tsc_khz;
209 cpu_data(0).loops_per_jiffy =
210 cpufreq_scale(cpu_data(0).loops_per_jiffy,
211 cpu_khz_old, cpu_khz);
212 return 0;
213 } else
214 return -ENODEV;
215#else
216 return -ENODEV;
217#endif
218}
219
220EXPORT_SYMBOL(recalibrate_cpu_khz);
221
222#endif /* CONFIG_X86_32 */
223
224/* Accelerators for sched_clock()
225 * convert from cycles(64bits) => nanoseconds (64bits)
226 * basic equation:
227 * ns = cycles / (freq / ns_per_sec)
228 * ns = cycles * (ns_per_sec / freq)
229 * ns = cycles * (10^9 / (cpu_khz * 10^3))
230 * ns = cycles * (10^6 / cpu_khz)
231 *
232 * Then we use scaling math (suggested by george@mvista.com) to get:
233 * ns = cycles * (10^6 * SC / cpu_khz) / SC
234 * ns = cycles * cyc2ns_scale / SC
235 *
236 * And since SC is a constant power of two, we can convert the div
237 * into a shift.
238 *
239 * We can use khz divisor instead of mhz to keep a better precision, since
240 * cyc2ns_scale is limited to 10^6 * 2^10, which fits in 32 bits.
241 * (mathieu.desnoyers@polymtl.ca)
242 *
243 * -johnstul@us.ibm.com "math is hard, lets go shopping!"
244 */
245
246DEFINE_PER_CPU(unsigned long, cyc2ns);
247
248static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
249{
250 unsigned long long tsc_now, ns_now;
251 unsigned long flags, *scale;
252
253 local_irq_save(flags);
254 sched_clock_idle_sleep_event();
255
256 scale = &per_cpu(cyc2ns, cpu);
257
258 rdtscll(tsc_now);
259 ns_now = __cycles_2_ns(tsc_now);
260
261 if (cpu_khz)
262 *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz;
263
264 sched_clock_idle_wakeup_event(0);
265 local_irq_restore(flags);
266}
267
268#ifdef CONFIG_CPU_FREQ
269
270/* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
271 * changes.
272 *
273 * RED-PEN: On SMP we assume all CPUs run with the same frequency. It's
274 * not that important because current Opteron setups do not support
275 * scaling on SMP anyroads.
276 *
277 * Should fix up last_tsc too. Currently gettimeofday in the
278 * first tick after the change will be slightly wrong.
279 */
280
281static unsigned int ref_freq;
282static unsigned long loops_per_jiffy_ref;
283static unsigned long tsc_khz_ref;
284
285static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
286 void *data)
287{
288 struct cpufreq_freqs *freq = data;
289 unsigned long *lpj, dummy;
290
291 if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC))
292 return 0;
293
294 lpj = &dummy;
295 if (!(freq->flags & CPUFREQ_CONST_LOOPS))
296#ifdef CONFIG_SMP
297 lpj = &cpu_data(freq->cpu).loops_per_jiffy;
298#else
299 lpj = &boot_cpu_data.loops_per_jiffy;
300#endif
301
302 if (!ref_freq) {
303 ref_freq = freq->old;
304 loops_per_jiffy_ref = *lpj;
305 tsc_khz_ref = tsc_khz;
306 }
307 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) ||
308 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
309 (val == CPUFREQ_RESUMECHANGE)) {
310 *lpj = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);
311
312 tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new);
313 if (!(freq->flags & CPUFREQ_CONST_LOOPS))
314 mark_tsc_unstable("cpufreq changes");
315 }
316
317 set_cyc2ns_scale(tsc_khz_ref, freq->cpu);
318
319 return 0;
320}
321
322static struct notifier_block time_cpufreq_notifier_block = {
323 .notifier_call = time_cpufreq_notifier
324};
325
326static int __init cpufreq_tsc(void)
327{
328 cpufreq_register_notifier(&time_cpufreq_notifier_block,
329 CPUFREQ_TRANSITION_NOTIFIER);
330 return 0;
331}
332
333core_initcall(cpufreq_tsc);
334
335#endif /* CONFIG_CPU_FREQ */
336
337/* clocksource code */
338
339static struct clocksource clocksource_tsc;
340
341/*
342 * We compare the TSC to the cycle_last value in the clocksource
343 * structure to avoid a nasty time-warp. This can be observed in a
344 * very small window right after one CPU updated cycle_last under
345 * xtime/vsyscall_gtod lock and the other CPU reads a TSC value which
346 * is smaller than the cycle_last reference value due to a TSC which
347 * is slighty behind. This delta is nowhere else observable, but in
348 * that case it results in a forward time jump in the range of hours
349 * due to the unsigned delta calculation of the time keeping core
350 * code, which is necessary to support wrapping clocksources like pm
351 * timer.
352 */
353static cycle_t read_tsc(void)
354{
355 cycle_t ret = (cycle_t)get_cycles();
356
357 return ret >= clocksource_tsc.cycle_last ?
358 ret : clocksource_tsc.cycle_last;
359}
360
361static cycle_t __vsyscall_fn vread_tsc(void)
362{
363 cycle_t ret = (cycle_t)vget_cycles();
364
365 return ret >= __vsyscall_gtod_data.clock.cycle_last ?
366 ret : __vsyscall_gtod_data.clock.cycle_last;
367}
368
369static struct clocksource clocksource_tsc = {
370 .name = "tsc",
371 .rating = 300,
372 .read = read_tsc,
373 .mask = CLOCKSOURCE_MASK(64),
374 .shift = 22,
375 .flags = CLOCK_SOURCE_IS_CONTINUOUS |
376 CLOCK_SOURCE_MUST_VERIFY,
377#ifdef CONFIG_X86_64
378 .vread = vread_tsc,
379#endif
380};
381
382void mark_tsc_unstable(char *reason)
383{
384 if (!tsc_unstable) {
385 tsc_unstable = 1;
386 printk("Marking TSC unstable due to %s\n", reason);
387 /* Change only the rating, when not registered */
388 if (clocksource_tsc.mult)
389 clocksource_change_rating(&clocksource_tsc, 0);
390 else
391 clocksource_tsc.rating = 0;
392 }
393}
394
395EXPORT_SYMBOL_GPL(mark_tsc_unstable);
396
397static int __init dmi_mark_tsc_unstable(const struct dmi_system_id *d)
398{
399 printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
400 d->ident);
401 tsc_unstable = 1;
402 return 0;
403}
404
405/* List of systems that have known TSC problems */
406static struct dmi_system_id __initdata bad_tsc_dmi_table[] = {
407 {
408 .callback = dmi_mark_tsc_unstable,
409 .ident = "IBM Thinkpad 380XD",
410 .matches = {
411 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
412 DMI_MATCH(DMI_BOARD_NAME, "2635FA0"),
413 },
414 },
415 {}
416};
417
418/*
419 * Geode_LX - the OLPC CPU has a possibly a very reliable TSC
420 */
421#ifdef CONFIG_MGEODE_LX
422/* RTSC counts during suspend */
423#define RTSC_SUSP 0x100
424
425static void __init check_geode_tsc_reliable(void)
426{
427 unsigned long res_low, res_high;
428
429 rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
430 if (res_low & RTSC_SUSP)
431 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
432}
433#else
434static inline void check_geode_tsc_reliable(void) { }
435#endif
436
437/*
438 * Make an educated guess if the TSC is trustworthy and synchronized
439 * over all CPUs.
440 */
441__cpuinit int unsynchronized_tsc(void)
442{
443 if (!cpu_has_tsc || tsc_unstable)
444 return 1;
445
446#ifdef CONFIG_SMP
447 if (apic_is_clustered_box())
448 return 1;
449#endif
450
451 if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
452 return 0;
453 /*
454 * Intel systems are normally all synchronized.
455 * Exceptions must mark TSC as unstable:
456 */
457 if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
458 /* assume multi socket systems are not synchronized: */
459 if (num_possible_cpus() > 1)
460 tsc_unstable = 1;
461 }
462
463 return tsc_unstable;
464}
465
466static void __init init_tsc_clocksource(void)
467{
468 clocksource_tsc.mult = clocksource_khz2mult(tsc_khz,
469 clocksource_tsc.shift);
470 /* lower the rating if we already know its unstable: */
471 if (check_tsc_unstable()) {
472 clocksource_tsc.rating = 0;
473 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
474 }
475 clocksource_register(&clocksource_tsc);
476}
477
478void __init tsc_init(void)
479{
480 u64 lpj;
481 int cpu;
482
483 if (!cpu_has_tsc)
484 return;
485
486 tsc_khz = calibrate_tsc();
487 cpu_khz = tsc_khz;
488
489 if (!tsc_khz) {
490 mark_tsc_unstable("could not calculate TSC khz");
491 return;
492 }
493
494#ifdef CONFIG_X86_64
495 if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) &&
496 (boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
497 cpu_khz = calibrate_cpu();
498#endif
499
500 lpj = ((u64)tsc_khz * 1000);
501 do_div(lpj, HZ);
502 lpj_fine = lpj;
503
504 printk("Detected %lu.%03lu MHz processor.\n",
505 (unsigned long)cpu_khz / 1000,
506 (unsigned long)cpu_khz % 1000);
507
508 /*
509 * Secondary CPUs do not run through tsc_init(), so set up
510 * all the scale factors for all CPUs, assuming the same
511 * speed as the bootup CPU. (cpufreq notifiers will fix this
512 * up if their speed diverges)
513 */
514 for_each_possible_cpu(cpu)
515 set_cyc2ns_scale(cpu_khz, cpu);
516
517 if (tsc_disabled > 0)
518 return;
519
520 /* now allow native_sched_clock() to use rdtsc */
521 tsc_disabled = 0;
522
523 use_tsc_delay();
524 /* Check and install the TSC clocksource */
525 dmi_check_system(bad_tsc_dmi_table);
526
527 if (unsynchronized_tsc())
528 mark_tsc_unstable("TSCs unsynchronized");
529
530 check_geode_tsc_reliable();
531 init_tsc_clocksource();
532}
533
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
deleted file mode 100644
index 65b70637ad97..000000000000
--- a/arch/x86/kernel/tsc_32.c
+++ /dev/null
@@ -1,451 +0,0 @@
1#include <linux/sched.h>
2#include <linux/clocksource.h>
3#include <linux/workqueue.h>
4#include <linux/cpufreq.h>
5#include <linux/jiffies.h>
6#include <linux/init.h>
7#include <linux/dmi.h>
8#include <linux/percpu.h>
9
10#include <asm/delay.h>
11#include <asm/tsc.h>
12#include <asm/io.h>
13#include <asm/timer.h>
14
15#include "mach_timer.h"
16
17/* native_sched_clock() is called before tsc_init(), so
18 we must start with the TSC soft disabled to prevent
19 erroneous rdtsc usage on !cpu_has_tsc processors */
20static int tsc_disabled = -1;
21
22/*
23 * On some systems the TSC frequency does not
24 * change with the cpu frequency. So we need
25 * an extra value to store the TSC freq
26 */
27unsigned int tsc_khz;
28EXPORT_SYMBOL_GPL(tsc_khz);
29
30#ifdef CONFIG_X86_TSC
31static int __init tsc_setup(char *str)
32{
33 printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
34 "cannot disable TSC completely.\n");
35 tsc_disabled = 1;
36 return 1;
37}
38#else
39/*
40 * disable flag for tsc. Takes effect by clearing the TSC cpu flag
41 * in cpu/common.c
42 */
43static int __init tsc_setup(char *str)
44{
45 setup_clear_cpu_cap(X86_FEATURE_TSC);
46 return 1;
47}
48#endif
49
50__setup("notsc", tsc_setup);
51
52/*
53 * code to mark and check if the TSC is unstable
54 * due to cpufreq or due to unsynced TSCs
55 */
56static int tsc_unstable;
57
58int check_tsc_unstable(void)
59{
60 return tsc_unstable;
61}
62EXPORT_SYMBOL_GPL(check_tsc_unstable);
63
64/* Accelerators for sched_clock()
65 * convert from cycles(64bits) => nanoseconds (64bits)
66 * basic equation:
67 * ns = cycles / (freq / ns_per_sec)
68 * ns = cycles * (ns_per_sec / freq)
69 * ns = cycles * (10^9 / (cpu_khz * 10^3))
70 * ns = cycles * (10^6 / cpu_khz)
71 *
72 * Then we use scaling math (suggested by george@mvista.com) to get:
73 * ns = cycles * (10^6 * SC / cpu_khz) / SC
74 * ns = cycles * cyc2ns_scale / SC
75 *
76 * And since SC is a constant power of two, we can convert the div
77 * into a shift.
78 *
79 * We can use khz divisor instead of mhz to keep a better precision, since
80 * cyc2ns_scale is limited to 10^6 * 2^10, which fits in 32 bits.
81 * (mathieu.desnoyers@polymtl.ca)
82 *
83 * -johnstul@us.ibm.com "math is hard, lets go shopping!"
84 */
85
86DEFINE_PER_CPU(unsigned long, cyc2ns);
87
88static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
89{
90 unsigned long long tsc_now, ns_now;
91 unsigned long flags, *scale;
92
93 local_irq_save(flags);
94 sched_clock_idle_sleep_event();
95
96 scale = &per_cpu(cyc2ns, cpu);
97
98 rdtscll(tsc_now);
99 ns_now = __cycles_2_ns(tsc_now);
100
101 if (cpu_khz)
102 *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz;
103
104 /*
105 * Start smoothly with the new frequency:
106 */
107 sched_clock_idle_wakeup_event(0);
108 local_irq_restore(flags);
109}
110
111/*
112 * Scheduler clock - returns current time in nanosec units.
113 */
114unsigned long long native_sched_clock(void)
115{
116 unsigned long long this_offset;
117
118 /*
119 * Fall back to jiffies if there's no TSC available:
120 * ( But note that we still use it if the TSC is marked
121 * unstable. We do this because unlike Time Of Day,
122 * the scheduler clock tolerates small errors and it's
123 * very important for it to be as fast as the platform
124 * can achive it. )
125 */
126 if (unlikely(tsc_disabled))
127 /* No locking but a rare wrong value is not a big deal: */
128 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
129
130 /* read the Time Stamp Counter: */
131 rdtscll(this_offset);
132
133 /* return the value in ns */
134 return cycles_2_ns(this_offset);
135}
136
137/* We need to define a real function for sched_clock, to override the
138 weak default version */
139#ifdef CONFIG_PARAVIRT
140unsigned long long sched_clock(void)
141{
142 return paravirt_sched_clock();
143}
144#else
145unsigned long long sched_clock(void)
146 __attribute__((alias("native_sched_clock")));
147#endif
148
149unsigned long native_calculate_cpu_khz(void)
150{
151 unsigned long long start, end;
152 unsigned long count;
153 u64 delta64 = (u64)ULLONG_MAX;
154 int i;
155 unsigned long flags;
156
157 local_irq_save(flags);
158
159 /* run 3 times to ensure the cache is warm and to get an accurate reading */
160 for (i = 0; i < 3; i++) {
161 mach_prepare_counter();
162 rdtscll(start);
163 mach_countup(&count);
164 rdtscll(end);
165
166 /*
167 * Error: ECTCNEVERSET
168 * The CTC wasn't reliable: we got a hit on the very first read,
169 * or the CPU was so fast/slow that the quotient wouldn't fit in
170 * 32 bits..
171 */
172 if (count <= 1)
173 continue;
174
175 /* cpu freq too slow: */
176 if ((end - start) <= CALIBRATE_TIME_MSEC)
177 continue;
178
179 /*
180 * We want the minimum time of all runs in case one of them
181 * is inaccurate due to SMI or other delay
182 */
183 delta64 = min(delta64, (end - start));
184 }
185
186 /* cpu freq too fast (or every run was bad): */
187 if (delta64 > (1ULL<<32))
188 goto err;
189
190 delta64 += CALIBRATE_TIME_MSEC/2; /* round for do_div */
191 do_div(delta64,CALIBRATE_TIME_MSEC);
192
193 local_irq_restore(flags);
194 return (unsigned long)delta64;
195err:
196 local_irq_restore(flags);
197 return 0;
198}
199
200int recalibrate_cpu_khz(void)
201{
202#ifndef CONFIG_SMP
203 unsigned long cpu_khz_old = cpu_khz;
204
205 if (cpu_has_tsc) {
206 cpu_khz = calculate_cpu_khz();
207 tsc_khz = cpu_khz;
208 cpu_data(0).loops_per_jiffy =
209 cpufreq_scale(cpu_data(0).loops_per_jiffy,
210 cpu_khz_old, cpu_khz);
211 return 0;
212 } else
213 return -ENODEV;
214#else
215 return -ENODEV;
216#endif
217}
218
219EXPORT_SYMBOL(recalibrate_cpu_khz);
220
221#ifdef CONFIG_CPU_FREQ
222
223/*
224 * if the CPU frequency is scaled, TSC-based delays will need a different
225 * loops_per_jiffy value to function properly.
226 */
227static unsigned int ref_freq;
228static unsigned long loops_per_jiffy_ref;
229static unsigned long cpu_khz_ref;
230
231static int
232time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data)
233{
234 struct cpufreq_freqs *freq = data;
235
236 if (!ref_freq) {
237 if (!freq->old){
238 ref_freq = freq->new;
239 return 0;
240 }
241 ref_freq = freq->old;
242 loops_per_jiffy_ref = cpu_data(freq->cpu).loops_per_jiffy;
243 cpu_khz_ref = cpu_khz;
244 }
245
246 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) ||
247 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
248 (val == CPUFREQ_RESUMECHANGE)) {
249 if (!(freq->flags & CPUFREQ_CONST_LOOPS))
250 cpu_data(freq->cpu).loops_per_jiffy =
251 cpufreq_scale(loops_per_jiffy_ref,
252 ref_freq, freq->new);
253
254 if (cpu_khz) {
255
256 if (num_online_cpus() == 1)
257 cpu_khz = cpufreq_scale(cpu_khz_ref,
258 ref_freq, freq->new);
259 if (!(freq->flags & CPUFREQ_CONST_LOOPS)) {
260 tsc_khz = cpu_khz;
261 set_cyc2ns_scale(cpu_khz, freq->cpu);
262 /*
263 * TSC based sched_clock turns
264 * to junk w/ cpufreq
265 */
266 mark_tsc_unstable("cpufreq changes");
267 }
268 }
269 }
270
271 return 0;
272}
273
274static struct notifier_block time_cpufreq_notifier_block = {
275 .notifier_call = time_cpufreq_notifier
276};
277
278static int __init cpufreq_tsc(void)
279{
280 return cpufreq_register_notifier(&time_cpufreq_notifier_block,
281 CPUFREQ_TRANSITION_NOTIFIER);
282}
283core_initcall(cpufreq_tsc);
284
285#endif
286
287/* clock source code */
288
289static unsigned long current_tsc_khz;
290static struct clocksource clocksource_tsc;
291
292/*
293 * We compare the TSC to the cycle_last value in the clocksource
294 * structure to avoid a nasty time-warp issue. This can be observed in
295 * a very small window right after one CPU updated cycle_last under
296 * xtime lock and the other CPU reads a TSC value which is smaller
297 * than the cycle_last reference value due to a TSC which is slighty
298 * behind. This delta is nowhere else observable, but in that case it
299 * results in a forward time jump in the range of hours due to the
300 * unsigned delta calculation of the time keeping core code, which is
301 * necessary to support wrapping clocksources like pm timer.
302 */
303static cycle_t read_tsc(void)
304{
305 cycle_t ret;
306
307 rdtscll(ret);
308
309 return ret >= clocksource_tsc.cycle_last ?
310 ret : clocksource_tsc.cycle_last;
311}
312
313static struct clocksource clocksource_tsc = {
314 .name = "tsc",
315 .rating = 300,
316 .read = read_tsc,
317 .mask = CLOCKSOURCE_MASK(64),
318 .mult = 0, /* to be set */
319 .shift = 22,
320 .flags = CLOCK_SOURCE_IS_CONTINUOUS |
321 CLOCK_SOURCE_MUST_VERIFY,
322};
323
324void mark_tsc_unstable(char *reason)
325{
326 if (!tsc_unstable) {
327 tsc_unstable = 1;
328 printk("Marking TSC unstable due to: %s.\n", reason);
329 /* Can be called before registration */
330 if (clocksource_tsc.mult)
331 clocksource_change_rating(&clocksource_tsc, 0);
332 else
333 clocksource_tsc.rating = 0;
334 }
335}
336EXPORT_SYMBOL_GPL(mark_tsc_unstable);
337
338static int __init dmi_mark_tsc_unstable(const struct dmi_system_id *d)
339{
340 printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
341 d->ident);
342 tsc_unstable = 1;
343 return 0;
344}
345
346/* List of systems that have known TSC problems */
347static struct dmi_system_id __initdata bad_tsc_dmi_table[] = {
348 {
349 .callback = dmi_mark_tsc_unstable,
350 .ident = "IBM Thinkpad 380XD",
351 .matches = {
352 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
353 DMI_MATCH(DMI_BOARD_NAME, "2635FA0"),
354 },
355 },
356 {}
357};
358
359/*
360 * Make an educated guess if the TSC is trustworthy and synchronized
361 * over all CPUs.
362 */
363__cpuinit int unsynchronized_tsc(void)
364{
365 if (!cpu_has_tsc || tsc_unstable)
366 return 1;
367
368 /* Anything with constant TSC should be synchronized */
369 if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
370 return 0;
371
372 /*
373 * Intel systems are normally all synchronized.
374 * Exceptions must mark TSC as unstable:
375 */
376 if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
377 /* assume multi socket systems are not synchronized: */
378 if (num_possible_cpus() > 1)
379 tsc_unstable = 1;
380 }
381 return tsc_unstable;
382}
383
384/*
385 * Geode_LX - the OLPC CPU has a possibly a very reliable TSC
386 */
387#ifdef CONFIG_MGEODE_LX
388/* RTSC counts during suspend */
389#define RTSC_SUSP 0x100
390
391static void __init check_geode_tsc_reliable(void)
392{
393 unsigned long res_low, res_high;
394
395 rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
396 if (res_low & RTSC_SUSP)
397 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
398}
399#else
400static inline void check_geode_tsc_reliable(void) { }
401#endif
402
403
404void __init tsc_init(void)
405{
406 int cpu;
407
408 if (!cpu_has_tsc || tsc_disabled > 0)
409 return;
410
411 cpu_khz = calculate_cpu_khz();
412 tsc_khz = cpu_khz;
413
414 if (!cpu_khz) {
415 mark_tsc_unstable("could not calculate TSC khz");
416 return;
417 }
418
419 /* now allow native_sched_clock() to use rdtsc */
420 tsc_disabled = 0;
421
422 printk("Detected %lu.%03lu MHz processor.\n",
423 (unsigned long)cpu_khz / 1000,
424 (unsigned long)cpu_khz % 1000);
425
426 /*
427 * Secondary CPUs do not run through tsc_init(), so set up
428 * all the scale factors for all CPUs, assuming the same
429 * speed as the bootup CPU. (cpufreq notifiers will fix this
430 * up if their speed diverges)
431 */
432 for_each_possible_cpu(cpu)
433 set_cyc2ns_scale(cpu_khz, cpu);
434
435 use_tsc_delay();
436
437 /* Check and install the TSC clocksource */
438 dmi_check_system(bad_tsc_dmi_table);
439
440 unsynchronized_tsc();
441 check_geode_tsc_reliable();
442 current_tsc_khz = tsc_khz;
443 clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz,
444 clocksource_tsc.shift);
445 /* lower the rating if we already know its unstable: */
446 if (check_tsc_unstable()) {
447 clocksource_tsc.rating = 0;
448 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
449 }
450 clocksource_register(&clocksource_tsc);
451}
diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
deleted file mode 100644
index 1784b8077a12..000000000000
--- a/arch/x86/kernel/tsc_64.c
+++ /dev/null
@@ -1,357 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/sched.h>
3#include <linux/interrupt.h>
4#include <linux/init.h>
5#include <linux/clocksource.h>
6#include <linux/time.h>
7#include <linux/acpi.h>
8#include <linux/cpufreq.h>
9#include <linux/acpi_pmtmr.h>
10
11#include <asm/hpet.h>
12#include <asm/timex.h>
13#include <asm/timer.h>
14#include <asm/vgtod.h>
15
16static int notsc __initdata = 0;
17
18unsigned int cpu_khz; /* TSC clocks / usec, not used here */
19EXPORT_SYMBOL(cpu_khz);
20unsigned int tsc_khz;
21EXPORT_SYMBOL(tsc_khz);
22
23/* Accelerators for sched_clock()
24 * convert from cycles(64bits) => nanoseconds (64bits)
25 * basic equation:
26 * ns = cycles / (freq / ns_per_sec)
27 * ns = cycles * (ns_per_sec / freq)
28 * ns = cycles * (10^9 / (cpu_khz * 10^3))
29 * ns = cycles * (10^6 / cpu_khz)
30 *
31 * Then we use scaling math (suggested by george@mvista.com) to get:
32 * ns = cycles * (10^6 * SC / cpu_khz) / SC
33 * ns = cycles * cyc2ns_scale / SC
34 *
35 * And since SC is a constant power of two, we can convert the div
36 * into a shift.
37 *
38 * We can use khz divisor instead of mhz to keep a better precision, since
39 * cyc2ns_scale is limited to 10^6 * 2^10, which fits in 32 bits.
40 * (mathieu.desnoyers@polymtl.ca)
41 *
42 * -johnstul@us.ibm.com "math is hard, lets go shopping!"
43 */
44DEFINE_PER_CPU(unsigned long, cyc2ns);
45
46static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
47{
48 unsigned long long tsc_now, ns_now;
49 unsigned long flags, *scale;
50
51 local_irq_save(flags);
52 sched_clock_idle_sleep_event();
53
54 scale = &per_cpu(cyc2ns, cpu);
55
56 rdtscll(tsc_now);
57 ns_now = __cycles_2_ns(tsc_now);
58
59 if (cpu_khz)
60 *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz;
61
62 sched_clock_idle_wakeup_event(0);
63 local_irq_restore(flags);
64}
65
66unsigned long long native_sched_clock(void)
67{
68 unsigned long a = 0;
69
70 /* Could do CPU core sync here. Opteron can execute rdtsc speculatively,
71 * which means it is not completely exact and may not be monotonous
72 * between CPUs. But the errors should be too small to matter for
73 * scheduling purposes.
74 */
75
76 rdtscll(a);
77 return cycles_2_ns(a);
78}
79
80/* We need to define a real function for sched_clock, to override the
81 weak default version */
82#ifdef CONFIG_PARAVIRT
83unsigned long long sched_clock(void)
84{
85 return paravirt_sched_clock();
86}
87#else
88unsigned long long
89sched_clock(void) __attribute__((alias("native_sched_clock")));
90#endif
91
92
93static int tsc_unstable;
94
95int check_tsc_unstable(void)
96{
97 return tsc_unstable;
98}
99EXPORT_SYMBOL_GPL(check_tsc_unstable);
100
101#ifdef CONFIG_CPU_FREQ
102
103/* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
104 * changes.
105 *
106 * RED-PEN: On SMP we assume all CPUs run with the same frequency. It's
107 * not that important because current Opteron setups do not support
108 * scaling on SMP anyroads.
109 *
110 * Should fix up last_tsc too. Currently gettimeofday in the
111 * first tick after the change will be slightly wrong.
112 */
113
114static unsigned int ref_freq;
115static unsigned long loops_per_jiffy_ref;
116static unsigned long tsc_khz_ref;
117
118static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
119 void *data)
120{
121 struct cpufreq_freqs *freq = data;
122 unsigned long *lpj, dummy;
123
124 if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC))
125 return 0;
126
127 lpj = &dummy;
128 if (!(freq->flags & CPUFREQ_CONST_LOOPS))
129#ifdef CONFIG_SMP
130 lpj = &cpu_data(freq->cpu).loops_per_jiffy;
131#else
132 lpj = &boot_cpu_data.loops_per_jiffy;
133#endif
134
135 if (!ref_freq) {
136 ref_freq = freq->old;
137 loops_per_jiffy_ref = *lpj;
138 tsc_khz_ref = tsc_khz;
139 }
140 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) ||
141 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
142 (val == CPUFREQ_RESUMECHANGE)) {
143 *lpj =
144 cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);
145
146 tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new);
147 if (!(freq->flags & CPUFREQ_CONST_LOOPS))
148 mark_tsc_unstable("cpufreq changes");
149 }
150
151 set_cyc2ns_scale(tsc_khz_ref, freq->cpu);
152
153 return 0;
154}
155
156static struct notifier_block time_cpufreq_notifier_block = {
157 .notifier_call = time_cpufreq_notifier
158};
159
160static int __init cpufreq_tsc(void)
161{
162 cpufreq_register_notifier(&time_cpufreq_notifier_block,
163 CPUFREQ_TRANSITION_NOTIFIER);
164 return 0;
165}
166
167core_initcall(cpufreq_tsc);
168
169#endif
170
171#define MAX_RETRIES 5
172#define SMI_TRESHOLD 50000
173
174/*
175 * Read TSC and the reference counters. Take care of SMI disturbance
176 */
177static unsigned long __init tsc_read_refs(unsigned long *pm,
178 unsigned long *hpet)
179{
180 unsigned long t1, t2;
181 int i;
182
183 for (i = 0; i < MAX_RETRIES; i++) {
184 t1 = get_cycles();
185 if (hpet)
186 *hpet = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF;
187 else
188 *pm = acpi_pm_read_early();
189 t2 = get_cycles();
190 if ((t2 - t1) < SMI_TRESHOLD)
191 return t2;
192 }
193 return ULONG_MAX;
194}
195
196/**
197 * tsc_calibrate - calibrate the tsc on boot
198 */
199void __init tsc_calibrate(void)
200{
201 unsigned long flags, tsc1, tsc2, tr1, tr2, pm1, pm2, hpet1, hpet2;
202 int hpet = is_hpet_enabled(), cpu;
203
204 local_irq_save(flags);
205
206 tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL);
207
208 outb((inb(0x61) & ~0x02) | 0x01, 0x61);
209
210 outb(0xb0, 0x43);
211 outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
212 outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42);
213 tr1 = get_cycles();
214 while ((inb(0x61) & 0x20) == 0);
215 tr2 = get_cycles();
216
217 tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL);
218
219 local_irq_restore(flags);
220
221 /*
222 * Preset the result with the raw and inaccurate PIT
223 * calibration value
224 */
225 tsc_khz = (tr2 - tr1) / 50;
226
227 /* hpet or pmtimer available ? */
228 if (!hpet && !pm1 && !pm2) {
229 printk(KERN_INFO "TSC calibrated against PIT\n");
230 goto out;
231 }
232
233 /* Check, whether the sampling was disturbed by an SMI */
234 if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) {
235 printk(KERN_WARNING "TSC calibration disturbed by SMI, "
236 "using PIT calibration result\n");
237 goto out;
238 }
239
240 tsc2 = (tsc2 - tsc1) * 1000000L;
241
242 if (hpet) {
243 printk(KERN_INFO "TSC calibrated against HPET\n");
244 if (hpet2 < hpet1)
245 hpet2 += 0x100000000;
246 hpet2 -= hpet1;
247 tsc1 = (hpet2 * hpet_readl(HPET_PERIOD)) / 1000000;
248 } else {
249 printk(KERN_INFO "TSC calibrated against PM_TIMER\n");
250 if (pm2 < pm1)
251 pm2 += ACPI_PM_OVRRUN;
252 pm2 -= pm1;
253 tsc1 = (pm2 * 1000000000) / PMTMR_TICKS_PER_SEC;
254 }
255
256 tsc_khz = tsc2 / tsc1;
257
258out:
259 for_each_possible_cpu(cpu)
260 set_cyc2ns_scale(tsc_khz, cpu);
261}
262
263/*
264 * Make an educated guess if the TSC is trustworthy and synchronized
265 * over all CPUs.
266 */
267__cpuinit int unsynchronized_tsc(void)
268{
269 if (tsc_unstable)
270 return 1;
271
272#ifdef CONFIG_SMP
273 if (apic_is_clustered_box())
274 return 1;
275#endif
276
277 if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
278 return 0;
279
280 /* Assume multi socket systems are not synchronized */
281 return num_present_cpus() > 1;
282}
283
284int __init notsc_setup(char *s)
285{
286 notsc = 1;
287 return 1;
288}
289
290__setup("notsc", notsc_setup);
291
292static struct clocksource clocksource_tsc;
293
294/*
295 * We compare the TSC to the cycle_last value in the clocksource
296 * structure to avoid a nasty time-warp. This can be observed in a
297 * very small window right after one CPU updated cycle_last under
298 * xtime/vsyscall_gtod lock and the other CPU reads a TSC value which
299 * is smaller than the cycle_last reference value due to a TSC which
300 * is slighty behind. This delta is nowhere else observable, but in
301 * that case it results in a forward time jump in the range of hours
302 * due to the unsigned delta calculation of the time keeping core
303 * code, which is necessary to support wrapping clocksources like pm
304 * timer.
305 */
306static cycle_t read_tsc(void)
307{
308 cycle_t ret = (cycle_t)get_cycles();
309
310 return ret >= clocksource_tsc.cycle_last ?
311 ret : clocksource_tsc.cycle_last;
312}
313
314static cycle_t __vsyscall_fn vread_tsc(void)
315{
316 cycle_t ret = (cycle_t)vget_cycles();
317
318 return ret >= __vsyscall_gtod_data.clock.cycle_last ?
319 ret : __vsyscall_gtod_data.clock.cycle_last;
320}
321
322static struct clocksource clocksource_tsc = {
323 .name = "tsc",
324 .rating = 300,
325 .read = read_tsc,
326 .mask = CLOCKSOURCE_MASK(64),
327 .shift = 22,
328 .flags = CLOCK_SOURCE_IS_CONTINUOUS |
329 CLOCK_SOURCE_MUST_VERIFY,
330 .vread = vread_tsc,
331};
332
333void mark_tsc_unstable(char *reason)
334{
335 if (!tsc_unstable) {
336 tsc_unstable = 1;
337 printk("Marking TSC unstable due to %s\n", reason);
338 /* Change only the rating, when not registered */
339 if (clocksource_tsc.mult)
340 clocksource_change_rating(&clocksource_tsc, 0);
341 else
342 clocksource_tsc.rating = 0;
343 }
344}
345EXPORT_SYMBOL_GPL(mark_tsc_unstable);
346
347void __init init_tsc_clocksource(void)
348{
349 if (!notsc) {
350 clocksource_tsc.mult = clocksource_khz2mult(tsc_khz,
351 clocksource_tsc.shift);
352 if (check_tsc_unstable())
353 clocksource_tsc.rating = 0;
354
355 clocksource_register(&clocksource_tsc);
356 }
357}
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
new file mode 100644
index 000000000000..e94bdb6add1d
--- /dev/null
+++ b/arch/x86/kernel/visws_quirks.c
@@ -0,0 +1,709 @@
1/*
2 * SGI Visual Workstation support and quirks, unmaintained.
3 *
4 * Split out from setup.c by davej@suse.de
5 *
6 * Copyright (C) 1999 Bent Hagemark, Ingo Molnar
7 *
8 * SGI Visual Workstation interrupt controller
9 *
10 * The Cobalt system ASIC in the Visual Workstation contains a "Cobalt" APIC
11 * which serves as the main interrupt controller in the system. Non-legacy
12 * hardware in the system uses this controller directly. Legacy devices
13 * are connected to the PIIX4 which in turn has its 8259(s) connected to
14 * a of the Cobalt APIC entry.
15 *
16 * 09/02/2000 - Updated for 2.4 by jbarnes@sgi.com
17 *
18 * 25/11/2002 - Updated for 2.5 by Andrey Panin <pazke@orbita1.ru>
19 */
20#include <linux/interrupt.h>
21#include <linux/module.h>
22#include <linux/init.h>
23#include <linux/smp.h>
24
25#include <asm/visws/cobalt.h>
26#include <asm/visws/piix4.h>
27#include <asm/arch_hooks.h>
28#include <asm/fixmap.h>
29#include <asm/reboot.h>
30#include <asm/setup.h>
31#include <asm/e820.h>
32#include <asm/smp.h>
33#include <asm/io.h>
34
35#include <mach_ipi.h>
36
37#include "mach_apic.h"
38
39#include <linux/init.h>
40#include <linux/smp.h>
41
42#include <linux/kernel_stat.h>
43#include <linux/interrupt.h>
44#include <linux/init.h>
45
46#include <asm/io.h>
47#include <asm/apic.h>
48#include <asm/i8259.h>
49#include <asm/irq_vectors.h>
50#include <asm/visws/cobalt.h>
51#include <asm/visws/lithium.h>
52#include <asm/visws/piix4.h>
53
54#include <linux/sched.h>
55#include <linux/kernel.h>
56#include <linux/init.h>
57#include <linux/pci.h>
58#include <linux/pci_ids.h>
59
60extern int no_broadcast;
61
62#include <asm/io.h>
63#include <asm/apic.h>
64#include <asm/arch_hooks.h>
65#include <asm/visws/cobalt.h>
66#include <asm/visws/lithium.h>
67
68char visws_board_type = -1;
69char visws_board_rev = -1;
70
71int is_visws_box(void)
72{
73 return visws_board_type >= 0;
74}
75
76static int __init visws_time_init_quirk(void)
77{
78 printk(KERN_INFO "Starting Cobalt Timer system clock\n");
79
80 /* Set the countdown value */
81 co_cpu_write(CO_CPU_TIMEVAL, CO_TIME_HZ/HZ);
82
83 /* Start the timer */
84 co_cpu_write(CO_CPU_CTRL, co_cpu_read(CO_CPU_CTRL) | CO_CTRL_TIMERUN);
85
86 /* Enable (unmask) the timer interrupt */
87 co_cpu_write(CO_CPU_CTRL, co_cpu_read(CO_CPU_CTRL) & ~CO_CTRL_TIMEMASK);
88
89 /*
90 * Zero return means the generic timer setup code will set up
91 * the standard vector:
92 */
93 return 0;
94}
95
96static int __init visws_pre_intr_init_quirk(void)
97{
98 init_VISWS_APIC_irqs();
99
100 /*
101 * We dont want ISA irqs to be set up by the generic code:
102 */
103 return 1;
104}
105
106/* Quirk for machine specific memory setup. */
107
108#define MB (1024 * 1024)
109
110unsigned long sgivwfb_mem_phys;
111unsigned long sgivwfb_mem_size;
112EXPORT_SYMBOL(sgivwfb_mem_phys);
113EXPORT_SYMBOL(sgivwfb_mem_size);
114
115long long mem_size __initdata = 0;
116
117static char * __init visws_memory_setup_quirk(void)
118{
119 long long gfx_mem_size = 8 * MB;
120
121 mem_size = boot_params.alt_mem_k;
122
123 if (!mem_size) {
124 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
125 mem_size = 128 * MB;
126 }
127
128 /*
129 * this hardcodes the graphics memory to 8 MB
130 * it really should be sized dynamically (or at least
131 * set as a boot param)
132 */
133 if (!sgivwfb_mem_size) {
134 printk(KERN_WARNING "Defaulting to 8 MB framebuffer size\n");
135 sgivwfb_mem_size = 8 * MB;
136 }
137
138 /*
139 * Trim to nearest MB
140 */
141 sgivwfb_mem_size &= ~((1 << 20) - 1);
142 sgivwfb_mem_phys = mem_size - gfx_mem_size;
143
144 e820_add_region(0, LOWMEMSIZE(), E820_RAM);
145 e820_add_region(HIGH_MEMORY, mem_size - sgivwfb_mem_size - HIGH_MEMORY, E820_RAM);
146 e820_add_region(sgivwfb_mem_phys, sgivwfb_mem_size, E820_RESERVED);
147
148 return "PROM";
149}
150
151static void visws_machine_emergency_restart(void)
152{
153 /*
154 * Visual Workstations restart after this
155 * register is poked on the PIIX4
156 */
157 outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
158}
159
160static void visws_machine_power_off(void)
161{
162 unsigned short pm_status;
163/* extern unsigned int pci_bus0; */
164
165 while ((pm_status = inw(PMSTS_PORT)) & 0x100)
166 outw(pm_status, PMSTS_PORT);
167
168 outw(PM_SUSPEND_ENABLE, PMCNTRL_PORT);
169
170 mdelay(10);
171
172#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
173 (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
174
175/* outl(PCI_CONF1_ADDRESS(pci_bus0, SPECIAL_DEV, SPECIAL_REG), 0xCF8); */
176 outl(PIIX_SPECIAL_STOP, 0xCFC);
177}
178
179static int __init visws_get_smp_config_quirk(unsigned int early)
180{
181 /*
182 * Prevent MP-table parsing by the generic code:
183 */
184 return 1;
185}
186
187extern unsigned int __cpuinitdata maxcpus;
188
189/*
190 * The Visual Workstation is Intel MP compliant in the hardware
191 * sense, but it doesn't have a BIOS(-configuration table).
192 * No problem for Linux.
193 */
194
195static void __init MP_processor_info (struct mpc_config_processor *m)
196{
197 int ver, logical_apicid;
198 physid_mask_t apic_cpus;
199
200 if (!(m->mpc_cpuflag & CPU_ENABLED))
201 return;
202
203 logical_apicid = m->mpc_apicid;
204 printk(KERN_INFO "%sCPU #%d %u:%u APIC version %d\n",
205 m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "",
206 m->mpc_apicid,
207 (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
208 (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
209 m->mpc_apicver);
210
211 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR)
212 boot_cpu_physical_apicid = m->mpc_apicid;
213
214 ver = m->mpc_apicver;
215 if ((ver >= 0x14 && m->mpc_apicid >= 0xff) || m->mpc_apicid >= 0xf) {
216 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
217 m->mpc_apicid, MAX_APICS);
218 return;
219 }
220
221 apic_cpus = apicid_to_cpu_present(m->mpc_apicid);
222 physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus);
223 /*
224 * Validate version
225 */
226 if (ver == 0x0) {
227 printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! "
228 "fixing up to 0x10. (tell your hw vendor)\n",
229 m->mpc_apicid);
230 ver = 0x10;
231 }
232 apic_version[m->mpc_apicid] = ver;
233}
234
235int __init visws_find_smp_config_quirk(unsigned int reserve)
236{
237 struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS);
238 unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
239
240 if (ncpus > CO_CPU_MAX) {
241 printk(KERN_WARNING "find_visws_smp: got cpu count of %d at %p\n",
242 ncpus, mp);
243
244 ncpus = CO_CPU_MAX;
245 }
246
247 if (ncpus > maxcpus)
248 ncpus = maxcpus;
249
250#ifdef CONFIG_X86_LOCAL_APIC
251 smp_found_config = 1;
252#endif
253 while (ncpus--)
254 MP_processor_info(mp++);
255
256 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
257
258 return 1;
259}
260
261extern int visws_trap_init_quirk(void);
262
263void __init visws_early_detect(void)
264{
265 int raw;
266
267 visws_board_type = (char)(inb_p(PIIX_GPI_BD_REG) & PIIX_GPI_BD_REG)
268 >> PIIX_GPI_BD_SHIFT;
269
270 if (visws_board_type < 0)
271 return;
272
273 /*
274 * Install special quirks for timer, interrupt and memory setup:
275 */
276 arch_time_init_quirk = visws_time_init_quirk;
277 arch_pre_intr_init_quirk = visws_pre_intr_init_quirk;
278 arch_memory_setup_quirk = visws_memory_setup_quirk;
279
280 /*
281 * Fall back to generic behavior for traps:
282 */
283 arch_intr_init_quirk = NULL;
284 arch_trap_init_quirk = visws_trap_init_quirk;
285
286 /*
287 * Install reboot quirks:
288 */
289 pm_power_off = visws_machine_power_off;
290 machine_ops.emergency_restart = visws_machine_emergency_restart;
291
292 /*
293 * Do not use broadcast IPIs:
294 */
295 no_broadcast = 0;
296
297 /*
298 * Override generic MP-table parsing:
299 */
300 mach_get_smp_config_quirk = visws_get_smp_config_quirk;
301 mach_find_smp_config_quirk = visws_find_smp_config_quirk;
302
303#ifdef CONFIG_X86_IO_APIC
304 /*
305 * Turn off IO-APIC detection and initialization:
306 */
307 skip_ioapic_setup = 1;
308#endif
309
310 /*
311 * Get Board rev.
312 * First, we have to initialize the 307 part to allow us access
313 * to the GPIO registers. Let's map them at 0x0fc0 which is right
314 * after the PIIX4 PM section.
315 */
316 outb_p(SIO_DEV_SEL, SIO_INDEX);
317 outb_p(SIO_GP_DEV, SIO_DATA); /* Talk to GPIO regs. */
318
319 outb_p(SIO_DEV_MSB, SIO_INDEX);
320 outb_p(SIO_GP_MSB, SIO_DATA); /* MSB of GPIO base address */
321
322 outb_p(SIO_DEV_LSB, SIO_INDEX);
323 outb_p(SIO_GP_LSB, SIO_DATA); /* LSB of GPIO base address */
324
325 outb_p(SIO_DEV_ENB, SIO_INDEX);
326 outb_p(1, SIO_DATA); /* Enable GPIO registers. */
327
328 /*
329 * Now, we have to map the power management section to write
330 * a bit which enables access to the GPIO registers.
331 * What lunatic came up with this shit?
332 */
333 outb_p(SIO_DEV_SEL, SIO_INDEX);
334 outb_p(SIO_PM_DEV, SIO_DATA); /* Talk to GPIO regs. */
335
336 outb_p(SIO_DEV_MSB, SIO_INDEX);
337 outb_p(SIO_PM_MSB, SIO_DATA); /* MSB of PM base address */
338
339 outb_p(SIO_DEV_LSB, SIO_INDEX);
340 outb_p(SIO_PM_LSB, SIO_DATA); /* LSB of PM base address */
341
342 outb_p(SIO_DEV_ENB, SIO_INDEX);
343 outb_p(1, SIO_DATA); /* Enable PM registers. */
344
345 /*
346 * Now, write the PM register which enables the GPIO registers.
347 */
348 outb_p(SIO_PM_FER2, SIO_PM_INDEX);
349 outb_p(SIO_PM_GP_EN, SIO_PM_DATA);
350
351 /*
352 * Now, initialize the GPIO registers.
353 * We want them all to be inputs which is the
354 * power on default, so let's leave them alone.
355 * So, let's just read the board rev!
356 */
357 raw = inb_p(SIO_GP_DATA1);
358 raw &= 0x7f; /* 7 bits of valid board revision ID. */
359
360 if (visws_board_type == VISWS_320) {
361 if (raw < 0x6) {
362 visws_board_rev = 4;
363 } else if (raw < 0xc) {
364 visws_board_rev = 5;
365 } else {
366 visws_board_rev = 6;
367 }
368 } else if (visws_board_type == VISWS_540) {
369 visws_board_rev = 2;
370 } else {
371 visws_board_rev = raw;
372 }
373
374 printk(KERN_INFO "Silicon Graphics Visual Workstation %s (rev %d) detected\n",
375 (visws_board_type == VISWS_320 ? "320" :
376 (visws_board_type == VISWS_540 ? "540" :
377 "unknown")), visws_board_rev);
378}
379
380#define A01234 (LI_INTA_0 | LI_INTA_1 | LI_INTA_2 | LI_INTA_3 | LI_INTA_4)
381#define BCD (LI_INTB | LI_INTC | LI_INTD)
382#define ALLDEVS (A01234 | BCD)
383
384static __init void lithium_init(void)
385{
386 set_fixmap(FIX_LI_PCIA, LI_PCI_A_PHYS);
387 set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS);
388
389 if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
390 (li_pcia_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) {
391 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A');
392/* panic("This machine is not SGI Visual Workstation 320/540"); */
393 }
394
395 if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
396 (li_pcib_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) {
397 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B');
398/* panic("This machine is not SGI Visual Workstation 320/540"); */
399 }
400
401 li_pcia_write16(LI_PCI_INTEN, ALLDEVS);
402 li_pcib_write16(LI_PCI_INTEN, ALLDEVS);
403}
404
405static __init void cobalt_init(void)
406{
407 /*
408 * On normal SMP PC this is used only with SMP, but we have to
409 * use it and set it up here to start the Cobalt clock
410 */
411 set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
412 setup_local_APIC();
413 printk(KERN_INFO "Local APIC Version %#x, ID %#x\n",
414 (unsigned int)apic_read(APIC_LVR),
415 (unsigned int)apic_read(APIC_ID));
416
417 set_fixmap(FIX_CO_CPU, CO_CPU_PHYS);
418 set_fixmap(FIX_CO_APIC, CO_APIC_PHYS);
419 printk(KERN_INFO "Cobalt Revision %#lx, APIC ID %#lx\n",
420 co_cpu_read(CO_CPU_REV), co_apic_read(CO_APIC_ID));
421
422 /* Enable Cobalt APIC being careful to NOT change the ID! */
423 co_apic_write(CO_APIC_ID, co_apic_read(CO_APIC_ID) | CO_APIC_ENABLE);
424
425 printk(KERN_INFO "Cobalt APIC enabled: ID reg %#lx\n",
426 co_apic_read(CO_APIC_ID));
427}
428
429int __init visws_trap_init_quirk(void)
430{
431 lithium_init();
432 cobalt_init();
433
434 return 1;
435}
436
437/*
438 * IRQ controller / APIC support:
439 */
440
441static DEFINE_SPINLOCK(cobalt_lock);
442
443/*
444 * Set the given Cobalt APIC Redirection Table entry to point
445 * to the given IDT vector/index.
446 */
447static inline void co_apic_set(int entry, int irq)
448{
449 co_apic_write(CO_APIC_LO(entry), CO_APIC_LEVEL | (irq + FIRST_EXTERNAL_VECTOR));
450 co_apic_write(CO_APIC_HI(entry), 0);
451}
452
453/*
454 * Cobalt (IO)-APIC functions to handle PCI devices.
455 */
456static inline int co_apic_ide0_hack(void)
457{
458 extern char visws_board_type;
459 extern char visws_board_rev;
460
461 if (visws_board_type == VISWS_320 && visws_board_rev == 5)
462 return 5;
463 return CO_APIC_IDE0;
464}
465
466static int is_co_apic(unsigned int irq)
467{
468 if (IS_CO_APIC(irq))
469 return CO_APIC(irq);
470
471 switch (irq) {
472 case 0: return CO_APIC_CPU;
473 case CO_IRQ_IDE0: return co_apic_ide0_hack();
474 case CO_IRQ_IDE1: return CO_APIC_IDE1;
475 default: return -1;
476 }
477}
478
479
480/*
481 * This is the SGI Cobalt (IO-)APIC:
482 */
483
484static void enable_cobalt_irq(unsigned int irq)
485{
486 co_apic_set(is_co_apic(irq), irq);
487}
488
489static void disable_cobalt_irq(unsigned int irq)
490{
491 int entry = is_co_apic(irq);
492
493 co_apic_write(CO_APIC_LO(entry), CO_APIC_MASK);
494 co_apic_read(CO_APIC_LO(entry));
495}
496
497/*
498 * "irq" really just serves to identify the device. Here is where we
499 * map this to the Cobalt APIC entry where it's physically wired.
500 * This is called via request_irq -> setup_irq -> irq_desc->startup()
501 */
502static unsigned int startup_cobalt_irq(unsigned int irq)
503{
504 unsigned long flags;
505
506 spin_lock_irqsave(&cobalt_lock, flags);
507 if ((irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING)))
508 irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING);
509 enable_cobalt_irq(irq);
510 spin_unlock_irqrestore(&cobalt_lock, flags);
511 return 0;
512}
513
514static void ack_cobalt_irq(unsigned int irq)
515{
516 unsigned long flags;
517
518 spin_lock_irqsave(&cobalt_lock, flags);
519 disable_cobalt_irq(irq);
520 apic_write(APIC_EOI, APIC_EIO_ACK);
521 spin_unlock_irqrestore(&cobalt_lock, flags);
522}
523
524static void end_cobalt_irq(unsigned int irq)
525{
526 unsigned long flags;
527
528 spin_lock_irqsave(&cobalt_lock, flags);
529 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
530 enable_cobalt_irq(irq);
531 spin_unlock_irqrestore(&cobalt_lock, flags);
532}
533
534static struct irq_chip cobalt_irq_type = {
535 .typename = "Cobalt-APIC",
536 .startup = startup_cobalt_irq,
537 .shutdown = disable_cobalt_irq,
538 .enable = enable_cobalt_irq,
539 .disable = disable_cobalt_irq,
540 .ack = ack_cobalt_irq,
541 .end = end_cobalt_irq,
542};
543
544
545/*
546 * This is the PIIX4-based 8259 that is wired up indirectly to Cobalt
547 * -- not the manner expected by the code in i8259.c.
548 *
549 * there is a 'master' physical interrupt source that gets sent to
550 * the CPU. But in the chipset there are various 'virtual' interrupts
551 * waiting to be handled. We represent this to Linux through a 'master'
552 * interrupt controller type, and through a special virtual interrupt-
553 * controller. Device drivers only see the virtual interrupt sources.
554 */
555static unsigned int startup_piix4_master_irq(unsigned int irq)
556{
557 init_8259A(0);
558
559 return startup_cobalt_irq(irq);
560}
561
562static void end_piix4_master_irq(unsigned int irq)
563{
564 unsigned long flags;
565
566 spin_lock_irqsave(&cobalt_lock, flags);
567 enable_cobalt_irq(irq);
568 spin_unlock_irqrestore(&cobalt_lock, flags);
569}
570
571static struct irq_chip piix4_master_irq_type = {
572 .typename = "PIIX4-master",
573 .startup = startup_piix4_master_irq,
574 .ack = ack_cobalt_irq,
575 .end = end_piix4_master_irq,
576};
577
578
579static struct irq_chip piix4_virtual_irq_type = {
580 .typename = "PIIX4-virtual",
581 .shutdown = disable_8259A_irq,
582 .enable = enable_8259A_irq,
583 .disable = disable_8259A_irq,
584};
585
586
587/*
588 * PIIX4-8259 master/virtual functions to handle interrupt requests
589 * from legacy devices: floppy, parallel, serial, rtc.
590 *
591 * None of these get Cobalt APIC entries, neither do they have IDT
592 * entries. These interrupts are purely virtual and distributed from
593 * the 'master' interrupt source: CO_IRQ_8259.
594 *
595 * When the 8259 interrupts its handler figures out which of these
596 * devices is interrupting and dispatches to its handler.
597 *
598 * CAREFUL: devices see the 'virtual' interrupt only. Thus disable/
599 * enable_irq gets the right irq. This 'master' irq is never directly
600 * manipulated by any driver.
601 */
602static irqreturn_t piix4_master_intr(int irq, void *dev_id)
603{
604 int realirq;
605 irq_desc_t *desc;
606 unsigned long flags;
607
608 spin_lock_irqsave(&i8259A_lock, flags);
609
610 /* Find out what's interrupting in the PIIX4 master 8259 */
611 outb(0x0c, 0x20); /* OCW3 Poll command */
612 realirq = inb(0x20);
613
614 /*
615 * Bit 7 == 0 means invalid/spurious
616 */
617 if (unlikely(!(realirq & 0x80)))
618 goto out_unlock;
619
620 realirq &= 7;
621
622 if (unlikely(realirq == 2)) {
623 outb(0x0c, 0xa0);
624 realirq = inb(0xa0);
625
626 if (unlikely(!(realirq & 0x80)))
627 goto out_unlock;
628
629 realirq = (realirq & 7) + 8;
630 }
631
632 /* mask and ack interrupt */
633 cached_irq_mask |= 1 << realirq;
634 if (unlikely(realirq > 7)) {
635 inb(0xa1);
636 outb(cached_slave_mask, 0xa1);
637 outb(0x60 + (realirq & 7), 0xa0);
638 outb(0x60 + 2, 0x20);
639 } else {
640 inb(0x21);
641 outb(cached_master_mask, 0x21);
642 outb(0x60 + realirq, 0x20);
643 }
644
645 spin_unlock_irqrestore(&i8259A_lock, flags);
646
647 desc = irq_desc + realirq;
648
649 /*
650 * handle this 'virtual interrupt' as a Cobalt one now.
651 */
652 kstat_cpu(smp_processor_id()).irqs[realirq]++;
653
654 if (likely(desc->action != NULL))
655 handle_IRQ_event(realirq, desc->action);
656
657 if (!(desc->status & IRQ_DISABLED))
658 enable_8259A_irq(realirq);
659
660 return IRQ_HANDLED;
661
662out_unlock:
663 spin_unlock_irqrestore(&i8259A_lock, flags);
664 return IRQ_NONE;
665}
666
667static struct irqaction master_action = {
668 .handler = piix4_master_intr,
669 .name = "PIIX4-8259",
670};
671
672static struct irqaction cascade_action = {
673 .handler = no_action,
674 .name = "cascade",
675};
676
677
678void init_VISWS_APIC_irqs(void)
679{
680 int i;
681
682 for (i = 0; i < CO_IRQ_APIC0 + CO_APIC_LAST + 1; i++) {
683 irq_desc[i].status = IRQ_DISABLED;
684 irq_desc[i].action = 0;
685 irq_desc[i].depth = 1;
686
687 if (i == 0) {
688 irq_desc[i].chip = &cobalt_irq_type;
689 }
690 else if (i == CO_IRQ_IDE0) {
691 irq_desc[i].chip = &cobalt_irq_type;
692 }
693 else if (i == CO_IRQ_IDE1) {
694 irq_desc[i].chip = &cobalt_irq_type;
695 }
696 else if (i == CO_IRQ_8259) {
697 irq_desc[i].chip = &piix4_master_irq_type;
698 }
699 else if (i < CO_IRQ_APIC0) {
700 irq_desc[i].chip = &piix4_virtual_irq_type;
701 }
702 else if (IS_CO_APIC(i)) {
703 irq_desc[i].chip = &cobalt_irq_type;
704 }
705 }
706
707 setup_irq(CO_IRQ_8259, &master_action);
708 setup_irq(2, &cascade_action);
709}
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index 956f38927aa7..b15346092b7b 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -151,7 +151,7 @@ static unsigned vmi_patch(u8 type, u16 clobbers, void *insns,
151 insns, ip); 151 insns, ip);
152 case PARAVIRT_PATCH(pv_cpu_ops.iret): 152 case PARAVIRT_PATCH(pv_cpu_ops.iret):
153 return patch_internal(VMI_CALL_IRET, len, insns, ip); 153 return patch_internal(VMI_CALL_IRET, len, insns, ip);
154 case PARAVIRT_PATCH(pv_cpu_ops.irq_enable_syscall_ret): 154 case PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit):
155 return patch_internal(VMI_CALL_SYSEXIT, len, insns, ip); 155 return patch_internal(VMI_CALL_SYSEXIT, len, insns, ip);
156 default: 156 default:
157 break; 157 break;
@@ -896,7 +896,7 @@ static inline int __init activate_vmi(void)
896 * the backend. They are performance critical anyway, so requiring 896 * the backend. They are performance critical anyway, so requiring
897 * a patch is not a big problem. 897 * a patch is not a big problem.
898 */ 898 */
899 pv_cpu_ops.irq_enable_syscall_ret = (void *)0xfeedbab0; 899 pv_cpu_ops.irq_enable_sysexit = (void *)0xfeedbab0;
900 pv_cpu_ops.iret = (void *)0xbadbab0; 900 pv_cpu_ops.iret = (void *)0xbadbab0;
901 901
902#ifdef CONFIG_SMP 902#ifdef CONFIG_SMP
@@ -932,7 +932,7 @@ static inline int __init activate_vmi(void)
932 pv_apic_ops.setup_secondary_clock = vmi_time_ap_init; 932 pv_apic_ops.setup_secondary_clock = vmi_time_ap_init;
933#endif 933#endif
934 pv_time_ops.sched_clock = vmi_sched_clock; 934 pv_time_ops.sched_clock = vmi_sched_clock;
935 pv_time_ops.get_cpu_khz = vmi_cpu_khz; 935 pv_time_ops.get_tsc_khz = vmi_tsc_khz;
936 936
937 /* We have true wallclock functions; disable CMOS clock sync */ 937 /* We have true wallclock functions; disable CMOS clock sync */
938 no_sync_cmos_clock = 1; 938 no_sync_cmos_clock = 1;
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c
index a2b030780aa9..6953859fe289 100644
--- a/arch/x86/kernel/vmiclock_32.c
+++ b/arch/x86/kernel/vmiclock_32.c
@@ -33,8 +33,7 @@
33#include <asm/apic.h> 33#include <asm/apic.h>
34#include <asm/timer.h> 34#include <asm/timer.h>
35#include <asm/i8253.h> 35#include <asm/i8253.h>
36 36#include <asm/irq_vectors.h>
37#include <irq_vectors.h>
38 37
39#define VMI_ONESHOT (VMI_ALARM_IS_ONESHOT | VMI_CYCLES_REAL | vmi_get_alarm_wiring()) 38#define VMI_ONESHOT (VMI_ALARM_IS_ONESHOT | VMI_CYCLES_REAL | vmi_get_alarm_wiring())
40#define VMI_PERIODIC (VMI_ALARM_IS_PERIODIC | VMI_CYCLES_REAL | vmi_get_alarm_wiring()) 39#define VMI_PERIODIC (VMI_ALARM_IS_PERIODIC | VMI_CYCLES_REAL | vmi_get_alarm_wiring())
@@ -70,8 +69,8 @@ unsigned long long vmi_sched_clock(void)
70 return cycles_2_ns(vmi_timer_ops.get_cycle_counter(VMI_CYCLES_AVAILABLE)); 69 return cycles_2_ns(vmi_timer_ops.get_cycle_counter(VMI_CYCLES_AVAILABLE));
71} 70}
72 71
73/* paravirt_ops.get_cpu_khz = vmi_cpu_khz */ 72/* paravirt_ops.get_tsc_khz = vmi_tsc_khz */
74unsigned long vmi_cpu_khz(void) 73unsigned long vmi_tsc_khz(void)
75{ 74{
76 unsigned long long khz; 75 unsigned long long khz;
77 khz = vmi_timer_ops.get_cycle_frequency(); 76 khz = vmi_timer_ops.get_cycle_frequency();
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index ce5ed083a1e9..cdb2363697d2 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -49,23 +49,14 @@ SECTIONS
49 _etext = .; /* End of text section */ 49 _etext = .; /* End of text section */
50 } :text = 0x9090 50 } :text = 0x9090
51 51
52 NOTES :text :note
53
52 . = ALIGN(16); /* Exception table */ 54 . = ALIGN(16); /* Exception table */
53 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { 55 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
54 __start___ex_table = .; 56 __start___ex_table = .;
55 *(__ex_table) 57 *(__ex_table)
56 __stop___ex_table = .; 58 __stop___ex_table = .;
57 } 59 } :text = 0x9090
58
59 NOTES :text :note
60
61 BUG_TABLE :text
62
63 . = ALIGN(4);
64 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
65 __tracedata_start = .;
66 *(.tracedata)
67 __tracedata_end = .;
68 }
69 60
70 RODATA 61 RODATA
71 62
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index fad3674b06a5..63e5c1a22e88 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -19,7 +19,7 @@ PHDRS {
19 data PT_LOAD FLAGS(7); /* RWE */ 19 data PT_LOAD FLAGS(7); /* RWE */
20 user PT_LOAD FLAGS(7); /* RWE */ 20 user PT_LOAD FLAGS(7); /* RWE */
21 data.init PT_LOAD FLAGS(7); /* RWE */ 21 data.init PT_LOAD FLAGS(7); /* RWE */
22 note PT_NOTE FLAGS(4); /* R__ */ 22 note PT_NOTE FLAGS(0); /* ___ */
23} 23}
24SECTIONS 24SECTIONS
25{ 25{
@@ -40,26 +40,17 @@ SECTIONS
40 _etext = .; /* End of text section */ 40 _etext = .; /* End of text section */
41 } :text = 0x9090 41 } :text = 0x9090
42 42
43 NOTES :text :note
44
43 . = ALIGN(16); /* Exception table */ 45 . = ALIGN(16); /* Exception table */
44 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { 46 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
45 __start___ex_table = .; 47 __start___ex_table = .;
46 *(__ex_table) 48 *(__ex_table)
47 __stop___ex_table = .; 49 __stop___ex_table = .;
48 } 50 } :text = 0x9090
49
50 NOTES :text :note
51
52 BUG_TABLE :text
53 51
54 RODATA 52 RODATA
55 53
56 . = ALIGN(4);
57 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
58 __tracedata_start = .;
59 *(.tracedata)
60 __tracedata_end = .;
61 }
62
63 . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ 54 . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */
64 /* Data */ 55 /* Data */
65 .data : AT(ADDR(.data) - LOAD_OFFSET) { 56 .data : AT(ADDR(.data) - LOAD_OFFSET) {
@@ -177,6 +168,7 @@ SECTIONS
177 *(.con_initcall.init) 168 *(.con_initcall.init)
178 } 169 }
179 __con_initcall_end = .; 170 __con_initcall_end = .;
171 . = ALIGN(16);
180 __x86cpuvendor_start = .; 172 __x86cpuvendor_start = .;
181 .x86cpuvendor.init : AT(ADDR(.x86cpuvendor.init) - LOAD_OFFSET) { 173 .x86cpuvendor.init : AT(ADDR(.x86cpuvendor.init) - LOAD_OFFSET) {
182 *(.x86cpuvendor.init) 174 *(.x86cpuvendor.init)
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index ba8c0b75ab0a..0c029e8959c7 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -15,9 +15,12 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/pci_ids.h> 16#include <linux/pci_ids.h>
17#include <linux/pci_regs.h> 17#include <linux/pci_regs.h>
18
19#include <asm/apic.h>
18#include <asm/pci-direct.h> 20#include <asm/pci-direct.h>
19#include <asm/io.h> 21#include <asm/io.h>
20#include <asm/paravirt.h> 22#include <asm/paravirt.h>
23#include <asm/setup.h>
21 24
22#if defined CONFIG_PCI && defined CONFIG_PARAVIRT 25#if defined CONFIG_PCI && defined CONFIG_PARAVIRT
23/* 26/*
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 61efa2f7d564..e50740d32314 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -42,7 +42,8 @@
42#include <asm/topology.h> 42#include <asm/topology.h>
43#include <asm/vgtod.h> 43#include <asm/vgtod.h>
44 44
45#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) 45#define __vsyscall(nr) \
46 __attribute__ ((unused, __section__(".vsyscall_" #nr))) notrace
46#define __syscall_clobber "r11","cx","memory" 47#define __syscall_clobber "r11","cx","memory"
47 48
48/* 49/*
@@ -249,7 +250,7 @@ static ctl_table kernel_root_table2[] = {
249 doesn't violate that. We'll find out if it does. */ 250 doesn't violate that. We'll find out if it does. */
250static void __cpuinit vsyscall_set_cpu(int cpu) 251static void __cpuinit vsyscall_set_cpu(int cpu)
251{ 252{
252 unsigned long *d; 253 unsigned long d;
253 unsigned long node = 0; 254 unsigned long node = 0;
254#ifdef CONFIG_NUMA 255#ifdef CONFIG_NUMA
255 node = cpu_to_node(cpu); 256 node = cpu_to_node(cpu);
@@ -260,11 +261,11 @@ static void __cpuinit vsyscall_set_cpu(int cpu)
260 /* Store cpu number in limit so that it can be loaded quickly 261 /* Store cpu number in limit so that it can be loaded quickly
261 in user space in vgetcpu. 262 in user space in vgetcpu.
262 12 bits for the CPU and 8 bits for the node. */ 263 12 bits for the CPU and 8 bits for the node. */
263 d = (unsigned long *)(get_cpu_gdt_table(cpu) + GDT_ENTRY_PER_CPU); 264 d = 0x0f40000000000ULL;
264 *d = 0x0f40000000000ULL; 265 d |= cpu;
265 *d |= cpu; 266 d |= (node & 0xf) << 12;
266 *d |= (node & 0xf) << 12; 267 d |= (node >> 4) << 48;
267 *d |= (node >> 4) << 48; 268 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
268} 269}
269 270
270static void __cpuinit cpu_vsyscall_init(void *arg) 271static void __cpuinit cpu_vsyscall_init(void *arg)
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index f6c05d0410fb..b545f371b5f5 100644
--- a/arch/x86/kernel/x8664_ksyms_64.c
+++ b/arch/x86/kernel/x8664_ksyms_64.c
@@ -2,13 +2,20 @@
2 All C exports should go in the respective C files. */ 2 All C exports should go in the respective C files. */
3 3
4#include <linux/module.h> 4#include <linux/module.h>
5#include <net/checksum.h>
6#include <linux/smp.h> 5#include <linux/smp.h>
7 6
7#include <net/checksum.h>
8
8#include <asm/processor.h> 9#include <asm/processor.h>
9#include <asm/uaccess.h>
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11#include <asm/uaccess.h>
11#include <asm/desc.h> 12#include <asm/desc.h>
13#include <asm/ftrace.h>
14
15#ifdef CONFIG_FTRACE
16/* mcount is defined in assembly */
17EXPORT_SYMBOL(mcount);
18#endif
12 19
13EXPORT_SYMBOL(kernel_thread); 20EXPORT_SYMBOL(kernel_thread);
14 21
@@ -53,8 +60,3 @@ EXPORT_SYMBOL(init_level4_pgt);
53EXPORT_SYMBOL(load_gs_index); 60EXPORT_SYMBOL(load_gs_index);
54 61
55EXPORT_SYMBOL(_proxy_pda); 62EXPORT_SYMBOL(_proxy_pda);
56
57#ifdef CONFIG_PARAVIRT
58/* Virtualized guests may want to use it */
59EXPORT_SYMBOL_GPL(cpu_gdt_descr);
60#endif
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig
index 964dfa36d367..c70e12b1a637 100644
--- a/arch/x86/lguest/Kconfig
+++ b/arch/x86/lguest/Kconfig
@@ -3,7 +3,7 @@ config LGUEST_GUEST
3 select PARAVIRT 3 select PARAVIRT
4 depends on X86_32 4 depends on X86_32
5 depends on !X86_PAE 5 depends on !X86_PAE
6 depends on !(X86_VISWS || X86_VOYAGER) 6 depends on !X86_VOYAGER
7 select VIRTIO 7 select VIRTIO
8 select VIRTIO_RING 8 select VIRTIO_RING
9 select VIRTIO_CONSOLE 9 select VIRTIO_CONSOLE
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 5c7e2fd52075..50dad44fb542 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -607,7 +607,7 @@ static unsigned long lguest_get_wallclock(void)
607 * what speed it runs at, or 0 if it's unusable as a reliable clock source. 607 * what speed it runs at, or 0 if it's unusable as a reliable clock source.
608 * This matches what we want here: if we return 0 from this function, the x86 608 * This matches what we want here: if we return 0 from this function, the x86
609 * TSC clock will give up and not register itself. */ 609 * TSC clock will give up and not register itself. */
610static unsigned long lguest_cpu_khz(void) 610static unsigned long lguest_tsc_khz(void)
611{ 611{
612 return lguest_data.tsc_khz; 612 return lguest_data.tsc_khz;
613} 613}
@@ -835,7 +835,7 @@ static __init char *lguest_memory_setup(void)
835 835
836 /* The Linux bootloader header contains an "e820" memory map: the 836 /* The Linux bootloader header contains an "e820" memory map: the
837 * Launcher populated the first entry with our memory limit. */ 837 * Launcher populated the first entry with our memory limit. */
838 add_memory_region(boot_params.e820_map[0].addr, 838 e820_add_region(boot_params.e820_map[0].addr,
839 boot_params.e820_map[0].size, 839 boot_params.e820_map[0].size,
840 boot_params.e820_map[0].type); 840 boot_params.e820_map[0].type);
841 841
@@ -998,7 +998,7 @@ __init void lguest_init(void)
998 /* time operations */ 998 /* time operations */
999 pv_time_ops.get_wallclock = lguest_get_wallclock; 999 pv_time_ops.get_wallclock = lguest_get_wallclock;
1000 pv_time_ops.time_init = lguest_time_init; 1000 pv_time_ops.time_init = lguest_time_init;
1001 pv_time_ops.get_cpu_khz = lguest_cpu_khz; 1001 pv_time_ops.get_tsc_khz = lguest_tsc_khz;
1002 1002
1003 /* Now is a good time to look at the implementations of these functions 1003 /* Now is a good time to look at the implementations of these functions
1004 * before returning to the rest of lguest_init(). */ 1004 * before returning to the rest of lguest_init(). */
@@ -1012,6 +1012,7 @@ __init void lguest_init(void)
1012 * clobbered. The Launcher places our initial pagetables somewhere at 1012 * clobbered. The Launcher places our initial pagetables somewhere at
1013 * the top of our physical memory, so we don't need extra space: set 1013 * the top of our physical memory, so we don't need extra space: set
1014 * init_pg_tables_end to the end of the kernel. */ 1014 * init_pg_tables_end to the end of the kernel. */
1015 init_pg_tables_start = __pa(pg0);
1015 init_pg_tables_end = __pa(pg0); 1016 init_pg_tables_end = __pa(pg0);
1016 1017
1017 /* Load the %fs segment register (the per-cpu segment register) with 1018 /* Load the %fs segment register (the per-cpu segment register) with
@@ -1065,9 +1066,9 @@ __init void lguest_init(void)
1065 pm_power_off = lguest_power_off; 1066 pm_power_off = lguest_power_off;
1066 machine_ops.restart = lguest_restart; 1067 machine_ops.restart = lguest_restart;
1067 1068
1068 /* Now we're set up, call start_kernel() in init/main.c and we proceed 1069 /* Now we're set up, call i386_start_kernel() in head32.c and we proceed
1069 * to boot as normal. It never returns. */ 1070 * to boot as normal. It never returns. */
1070 start_kernel(); 1071 i386_start_kernel();
1071} 1072}
1072/* 1073/*
1073 * This marks the end of stage II of our journey, The Guest. 1074 * This marks the end of stage II of our journey, The Guest.
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 76f60f52a885..aa3fa4119424 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -4,8 +4,9 @@
4 4
5obj-$(CONFIG_SMP) := msr-on-cpu.o 5obj-$(CONFIG_SMP) := msr-on-cpu.o
6 6
7lib-y := delay_$(BITS).o 7lib-y := delay.o
8lib-y += usercopy_$(BITS).o getuser_$(BITS).o putuser_$(BITS).o 8lib-y += thunk_$(BITS).o
9lib-y += usercopy_$(BITS).o getuser.o putuser.o
9lib-y += memcpy_$(BITS).o 10lib-y += memcpy_$(BITS).o
10 11
11ifeq ($(CONFIG_X86_32),y) 12ifeq ($(CONFIG_X86_32),y)
diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S
index ee1c3f635157..dfdf428975c0 100644
--- a/arch/x86/lib/copy_user_64.S
+++ b/arch/x86/lib/copy_user_64.S
@@ -1,8 +1,10 @@
1/* Copyright 2002 Andi Kleen, SuSE Labs. 1/*
2 * Copyright 2008 Vitaly Mayatskikh <vmayatsk@redhat.com>
3 * Copyright 2002 Andi Kleen, SuSE Labs.
2 * Subject to the GNU Public License v2. 4 * Subject to the GNU Public License v2.
3 * 5 *
4 * Functions to copy from and to user space. 6 * Functions to copy from and to user space.
5 */ 7 */
6 8
7#include <linux/linkage.h> 9#include <linux/linkage.h>
8#include <asm/dwarf2.h> 10#include <asm/dwarf2.h>
@@ -20,60 +22,88 @@
20 .long \orig-1f /* by default jump to orig */ 22 .long \orig-1f /* by default jump to orig */
211: 231:
22 .section .altinstr_replacement,"ax" 24 .section .altinstr_replacement,"ax"
232: .byte 0xe9 /* near jump with 32bit immediate */ 252: .byte 0xe9 /* near jump with 32bit immediate */
24 .long \alt-1b /* offset */ /* or alternatively to alt */ 26 .long \alt-1b /* offset */ /* or alternatively to alt */
25 .previous 27 .previous
26 .section .altinstructions,"a" 28 .section .altinstructions,"a"
27 .align 8 29 .align 8
28 .quad 0b 30 .quad 0b
29 .quad 2b 31 .quad 2b
30 .byte \feature /* when feature is set */ 32 .byte \feature /* when feature is set */
31 .byte 5 33 .byte 5
32 .byte 5 34 .byte 5
33 .previous 35 .previous
34 .endm 36 .endm
35 37
36/* Standard copy_to_user with segment limit checking */ 38 .macro ALIGN_DESTINATION
39#ifdef FIX_ALIGNMENT
40 /* check for bad alignment of destination */
41 movl %edi,%ecx
42 andl $7,%ecx
43 jz 102f /* already aligned */
44 subl $8,%ecx
45 negl %ecx
46 subl %ecx,%edx
47100: movb (%rsi),%al
48101: movb %al,(%rdi)
49 incq %rsi
50 incq %rdi
51 decl %ecx
52 jnz 100b
53102:
54 .section .fixup,"ax"
55103: addl %r8d,%edx /* ecx is zerorest also */
56 jmp copy_user_handle_tail
57 .previous
58
59 .section __ex_table,"a"
60 .align 8
61 .quad 100b,103b
62 .quad 101b,103b
63 .previous
64#endif
65 .endm
66
67/* Standard copy_to_user with segment limit checking */
37ENTRY(copy_to_user) 68ENTRY(copy_to_user)
38 CFI_STARTPROC 69 CFI_STARTPROC
39 GET_THREAD_INFO(%rax) 70 GET_THREAD_INFO(%rax)
40 movq %rdi,%rcx 71 movq %rdi,%rcx
41 addq %rdx,%rcx 72 addq %rdx,%rcx
42 jc bad_to_user 73 jc bad_to_user
43 cmpq threadinfo_addr_limit(%rax),%rcx 74 cmpq TI_addr_limit(%rax),%rcx
44 jae bad_to_user 75 jae bad_to_user
45 xorl %eax,%eax /* clear zero flag */
46 ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string 76 ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string
47 CFI_ENDPROC 77 CFI_ENDPROC
48 78
49ENTRY(copy_user_generic) 79/* Standard copy_from_user with segment limit checking */
80ENTRY(copy_from_user)
50 CFI_STARTPROC 81 CFI_STARTPROC
51 movl $1,%ecx /* set zero flag */ 82 GET_THREAD_INFO(%rax)
83 movq %rsi,%rcx
84 addq %rdx,%rcx
85 jc bad_from_user
86 cmpq TI_addr_limit(%rax),%rcx
87 jae bad_from_user
52 ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string 88 ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string
53 CFI_ENDPROC 89 CFI_ENDPROC
90ENDPROC(copy_from_user)
54 91
55ENTRY(__copy_from_user_inatomic) 92ENTRY(copy_user_generic)
56 CFI_STARTPROC 93 CFI_STARTPROC
57 xorl %ecx,%ecx /* clear zero flag */
58 ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string 94 ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string
59 CFI_ENDPROC 95 CFI_ENDPROC
96ENDPROC(copy_user_generic)
60 97
61/* Standard copy_from_user with segment limit checking */ 98ENTRY(__copy_from_user_inatomic)
62ENTRY(copy_from_user)
63 CFI_STARTPROC 99 CFI_STARTPROC
64 GET_THREAD_INFO(%rax)
65 movq %rsi,%rcx
66 addq %rdx,%rcx
67 jc bad_from_user
68 cmpq threadinfo_addr_limit(%rax),%rcx
69 jae bad_from_user
70 movl $1,%ecx /* set zero flag */
71 ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string 100 ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string
72 CFI_ENDPROC 101 CFI_ENDPROC
73ENDPROC(copy_from_user) 102ENDPROC(__copy_from_user_inatomic)
74 103
75 .section .fixup,"ax" 104 .section .fixup,"ax"
76 /* must zero dest */ 105 /* must zero dest */
106ENTRY(bad_from_user)
77bad_from_user: 107bad_from_user:
78 CFI_STARTPROC 108 CFI_STARTPROC
79 movl %edx,%ecx 109 movl %edx,%ecx
@@ -81,271 +111,158 @@ bad_from_user:
81 rep 111 rep
82 stosb 112 stosb
83bad_to_user: 113bad_to_user:
84 movl %edx,%eax 114 movl %edx,%eax
85 ret 115 ret
86 CFI_ENDPROC 116 CFI_ENDPROC
87END(bad_from_user) 117ENDPROC(bad_from_user)
88 .previous 118 .previous
89 119
90
91/* 120/*
92 * copy_user_generic_unrolled - memory copy with exception handling. 121 * copy_user_generic_unrolled - memory copy with exception handling.
93 * This version is for CPUs like P4 that don't have efficient micro code for rep movsq 122 * This version is for CPUs like P4 that don't have efficient micro
94 * 123 * code for rep movsq
95 * Input: 124 *
125 * Input:
96 * rdi destination 126 * rdi destination
97 * rsi source 127 * rsi source
98 * rdx count 128 * rdx count
99 * ecx zero flag -- if true zero destination on error
100 * 129 *
101 * Output: 130 * Output:
102 * eax uncopied bytes or 0 if successful. 131 * eax uncopied bytes or 0 if successfull.
103 */ 132 */
104ENTRY(copy_user_generic_unrolled) 133ENTRY(copy_user_generic_unrolled)
105 CFI_STARTPROC 134 CFI_STARTPROC
106 pushq %rbx 135 cmpl $8,%edx
107 CFI_ADJUST_CFA_OFFSET 8 136 jb 20f /* less then 8 bytes, go to byte copy loop */
108 CFI_REL_OFFSET rbx, 0 137 ALIGN_DESTINATION
109 pushq %rcx 138 movl %edx,%ecx
110 CFI_ADJUST_CFA_OFFSET 8 139 andl $63,%edx
111 CFI_REL_OFFSET rcx, 0 140 shrl $6,%ecx
112 xorl %eax,%eax /*zero for the exception handler */ 141 jz 17f
113 1421: movq (%rsi),%r8
114#ifdef FIX_ALIGNMENT 1432: movq 1*8(%rsi),%r9
115 /* check for bad alignment of destination */ 1443: movq 2*8(%rsi),%r10
116 movl %edi,%ecx 1454: movq 3*8(%rsi),%r11
117 andl $7,%ecx 1465: movq %r8,(%rdi)
118 jnz .Lbad_alignment 1476: movq %r9,1*8(%rdi)
119.Lafter_bad_alignment: 1487: movq %r10,2*8(%rdi)
120#endif 1498: movq %r11,3*8(%rdi)
121 1509: movq 4*8(%rsi),%r8
122 movq %rdx,%rcx 15110: movq 5*8(%rsi),%r9
123 15211: movq 6*8(%rsi),%r10
124 movl $64,%ebx 15312: movq 7*8(%rsi),%r11
125 shrq $6,%rdx 15413: movq %r8,4*8(%rdi)
126 decq %rdx 15514: movq %r9,5*8(%rdi)
127 js .Lhandle_tail 15615: movq %r10,6*8(%rdi)
128 15716: movq %r11,7*8(%rdi)
129 .p2align 4
130.Lloop:
131.Ls1: movq (%rsi),%r11
132.Ls2: movq 1*8(%rsi),%r8
133.Ls3: movq 2*8(%rsi),%r9
134.Ls4: movq 3*8(%rsi),%r10
135.Ld1: movq %r11,(%rdi)
136.Ld2: movq %r8,1*8(%rdi)
137.Ld3: movq %r9,2*8(%rdi)
138.Ld4: movq %r10,3*8(%rdi)
139
140.Ls5: movq 4*8(%rsi),%r11
141.Ls6: movq 5*8(%rsi),%r8
142.Ls7: movq 6*8(%rsi),%r9
143.Ls8: movq 7*8(%rsi),%r10
144.Ld5: movq %r11,4*8(%rdi)
145.Ld6: movq %r8,5*8(%rdi)
146.Ld7: movq %r9,6*8(%rdi)
147.Ld8: movq %r10,7*8(%rdi)
148
149 decq %rdx
150
151 leaq 64(%rsi),%rsi 158 leaq 64(%rsi),%rsi
152 leaq 64(%rdi),%rdi 159 leaq 64(%rdi),%rdi
153
154 jns .Lloop
155
156 .p2align 4
157.Lhandle_tail:
158 movl %ecx,%edx
159 andl $63,%ecx
160 shrl $3,%ecx
161 jz .Lhandle_7
162 movl $8,%ebx
163 .p2align 4
164.Lloop_8:
165.Ls9: movq (%rsi),%r8
166.Ld9: movq %r8,(%rdi)
167 decl %ecx 160 decl %ecx
168 leaq 8(%rdi),%rdi 161 jnz 1b
16217: movl %edx,%ecx
163 andl $7,%edx
164 shrl $3,%ecx
165 jz 20f
16618: movq (%rsi),%r8
16719: movq %r8,(%rdi)
169 leaq 8(%rsi),%rsi 168 leaq 8(%rsi),%rsi
170 jnz .Lloop_8 169 leaq 8(%rdi),%rdi
171 170 decl %ecx
172.Lhandle_7: 171 jnz 18b
17220: andl %edx,%edx
173 jz 23f
173 movl %edx,%ecx 174 movl %edx,%ecx
174 andl $7,%ecx 17521: movb (%rsi),%al
175 jz .Lende 17622: movb %al,(%rdi)
176 .p2align 4
177.Lloop_1:
178.Ls10: movb (%rsi),%bl
179.Ld10: movb %bl,(%rdi)
180 incq %rdi
181 incq %rsi 177 incq %rsi
178 incq %rdi
182 decl %ecx 179 decl %ecx
183 jnz .Lloop_1 180 jnz 21b
184 18123: xor %eax,%eax
185 CFI_REMEMBER_STATE
186.Lende:
187 popq %rcx
188 CFI_ADJUST_CFA_OFFSET -8
189 CFI_RESTORE rcx
190 popq %rbx
191 CFI_ADJUST_CFA_OFFSET -8
192 CFI_RESTORE rbx
193 ret 182 ret
194 CFI_RESTORE_STATE
195 183
196#ifdef FIX_ALIGNMENT 184 .section .fixup,"ax"
197 /* align destination */ 18530: shll $6,%ecx
198 .p2align 4 186 addl %ecx,%edx
199.Lbad_alignment: 187 jmp 60f
200 movl $8,%r9d 18840: lea (%rdx,%rcx,8),%rdx
201 subl %ecx,%r9d 189 jmp 60f
202 movl %r9d,%ecx 19050: movl %ecx,%edx
203 cmpq %r9,%rdx 19160: jmp copy_user_handle_tail /* ecx is zerorest also */
204 jz .Lhandle_7 192 .previous
205 js .Lhandle_7
206.Lalign_1:
207.Ls11: movb (%rsi),%bl
208.Ld11: movb %bl,(%rdi)
209 incq %rsi
210 incq %rdi
211 decl %ecx
212 jnz .Lalign_1
213 subq %r9,%rdx
214 jmp .Lafter_bad_alignment
215#endif
216 193
217 /* table sorted by exception address */
218 .section __ex_table,"a" 194 .section __ex_table,"a"
219 .align 8 195 .align 8
220 .quad .Ls1,.Ls1e /* Ls1-Ls4 have copied zero bytes */ 196 .quad 1b,30b
221 .quad .Ls2,.Ls1e 197 .quad 2b,30b
222 .quad .Ls3,.Ls1e 198 .quad 3b,30b
223 .quad .Ls4,.Ls1e 199 .quad 4b,30b
224 .quad .Ld1,.Ls1e /* Ld1-Ld4 have copied 0-24 bytes */ 200 .quad 5b,30b
225 .quad .Ld2,.Ls2e 201 .quad 6b,30b
226 .quad .Ld3,.Ls3e 202 .quad 7b,30b
227 .quad .Ld4,.Ls4e 203 .quad 8b,30b
228 .quad .Ls5,.Ls5e /* Ls5-Ls8 have copied 32 bytes */ 204 .quad 9b,30b
229 .quad .Ls6,.Ls5e 205 .quad 10b,30b
230 .quad .Ls7,.Ls5e 206 .quad 11b,30b
231 .quad .Ls8,.Ls5e 207 .quad 12b,30b
232 .quad .Ld5,.Ls5e /* Ld5-Ld8 have copied 32-56 bytes */ 208 .quad 13b,30b
233 .quad .Ld6,.Ls6e 209 .quad 14b,30b
234 .quad .Ld7,.Ls7e 210 .quad 15b,30b
235 .quad .Ld8,.Ls8e 211 .quad 16b,30b
236 .quad .Ls9,.Le_quad 212 .quad 18b,40b
237 .quad .Ld9,.Le_quad 213 .quad 19b,40b
238 .quad .Ls10,.Le_byte 214 .quad 21b,50b
239 .quad .Ld10,.Le_byte 215 .quad 22b,50b
240#ifdef FIX_ALIGNMENT
241 .quad .Ls11,.Lzero_rest
242 .quad .Ld11,.Lzero_rest
243#endif
244 .quad .Le5,.Le_zero
245 .previous 216 .previous
246
247 /* eax: zero, ebx: 64 */
248.Ls1e: addl $8,%eax /* eax is bytes left uncopied within the loop (Ls1e: 64 .. Ls8e: 8) */
249.Ls2e: addl $8,%eax
250.Ls3e: addl $8,%eax
251.Ls4e: addl $8,%eax
252.Ls5e: addl $8,%eax
253.Ls6e: addl $8,%eax
254.Ls7e: addl $8,%eax
255.Ls8e: addl $8,%eax
256 addq %rbx,%rdi /* +64 */
257 subq %rax,%rdi /* correct destination with computed offset */
258
259 shlq $6,%rdx /* loop counter * 64 (stride length) */
260 addq %rax,%rdx /* add offset to loopcnt */
261 andl $63,%ecx /* remaining bytes */
262 addq %rcx,%rdx /* add them */
263 jmp .Lzero_rest
264
265 /* exception on quad word loop in tail handling */
266 /* ecx: loopcnt/8, %edx: length, rdi: correct */
267.Le_quad:
268 shll $3,%ecx
269 andl $7,%edx
270 addl %ecx,%edx
271 /* edx: bytes to zero, rdi: dest, eax:zero */
272.Lzero_rest:
273 cmpl $0,(%rsp)
274 jz .Le_zero
275 movq %rdx,%rcx
276.Le_byte:
277 xorl %eax,%eax
278.Le5: rep
279 stosb
280 /* when there is another exception while zeroing the rest just return */
281.Le_zero:
282 movq %rdx,%rax
283 jmp .Lende
284 CFI_ENDPROC 217 CFI_ENDPROC
285ENDPROC(copy_user_generic) 218ENDPROC(copy_user_generic_unrolled)
286 219
287 220/* Some CPUs run faster using the string copy instructions.
288 /* Some CPUs run faster using the string copy instructions. 221 * This is also a lot simpler. Use them when possible.
289 This is also a lot simpler. Use them when possible. 222 *
290 Patch in jmps to this code instead of copying it fully 223 * Only 4GB of copy is supported. This shouldn't be a problem
291 to avoid unwanted aliasing in the exception tables. */ 224 * because the kernel normally only writes from/to page sized chunks
292 225 * even if user space passed a longer buffer.
293 /* rdi destination 226 * And more would be dangerous because both Intel and AMD have
294 * rsi source 227 * errata with rep movsq > 4GB. If someone feels the need to fix
295 * rdx count 228 * this please consider this.
296 * ecx zero flag 229 *
297 * 230 * Input:
298 * Output: 231 * rdi destination
299 * eax uncopied bytes or 0 if successfull. 232 * rsi source
300 * 233 * rdx count
301 * Only 4GB of copy is supported. This shouldn't be a problem 234 *
302 * because the kernel normally only writes from/to page sized chunks 235 * Output:
303 * even if user space passed a longer buffer. 236 * eax uncopied bytes or 0 if successful.
304 * And more would be dangerous because both Intel and AMD have 237 */
305 * errata with rep movsq > 4GB. If someone feels the need to fix
306 * this please consider this.
307 */
308ENTRY(copy_user_generic_string) 238ENTRY(copy_user_generic_string)
309 CFI_STARTPROC 239 CFI_STARTPROC
310 movl %ecx,%r8d /* save zero flag */ 240 andl %edx,%edx
241 jz 4f
242 cmpl $8,%edx
243 jb 2f /* less than 8 bytes, go to byte copy loop */
244 ALIGN_DESTINATION
311 movl %edx,%ecx 245 movl %edx,%ecx
312 shrl $3,%ecx 246 shrl $3,%ecx
313 andl $7,%edx 247 andl $7,%edx
314 jz 10f 2481: rep
3151: rep
316 movsq
317 movl %edx,%ecx
3182: rep
319 movsb
3209: movl %ecx,%eax
321 ret
322
323 /* multiple of 8 byte */
32410: rep
325 movsq 249 movsq
326 xor %eax,%eax 2502: movl %edx,%ecx
2513: rep
252 movsb
2534: xorl %eax,%eax
327 ret 254 ret
328 255
329 /* exception handling */ 256 .section .fixup,"ax"
3303: lea (%rdx,%rcx,8),%rax /* exception on quad loop */ 25711: lea (%rdx,%rcx,8),%rcx
331 jmp 6f 25812: movl %ecx,%edx /* ecx is zerorest also */
3325: movl %ecx,%eax /* exception on byte loop */ 259 jmp copy_user_handle_tail
333 /* eax: left over bytes */ 260 .previous
3346: testl %r8d,%r8d /* zero flag set? */
335 jz 7f
336 movl %eax,%ecx /* initialize x86 loop counter */
337 push %rax
338 xorl %eax,%eax
3398: rep
340 stosb /* zero the rest */
34111: pop %rax
3427: ret
343 CFI_ENDPROC
344END(copy_user_generic_c)
345 261
346 .section __ex_table,"a" 262 .section __ex_table,"a"
347 .quad 1b,3b 263 .align 8
348 .quad 2b,5b 264 .quad 1b,11b
349 .quad 8b,11b 265 .quad 3b,12b
350 .quad 10b,3b
351 .previous 266 .previous
267 CFI_ENDPROC
268ENDPROC(copy_user_generic_string)
diff --git a/arch/x86/lib/copy_user_nocache_64.S b/arch/x86/lib/copy_user_nocache_64.S
index 9d3d1ab83763..40e0e309d27e 100644
--- a/arch/x86/lib/copy_user_nocache_64.S
+++ b/arch/x86/lib/copy_user_nocache_64.S
@@ -1,4 +1,6 @@
1/* Copyright 2002 Andi Kleen, SuSE Labs. 1/*
2 * Copyright 2008 Vitaly Mayatskikh <vmayatsk@redhat.com>
3 * Copyright 2002 Andi Kleen, SuSE Labs.
2 * Subject to the GNU Public License v2. 4 * Subject to the GNU Public License v2.
3 * 5 *
4 * Functions to copy from and to user space. 6 * Functions to copy from and to user space.
@@ -12,204 +14,125 @@
12#include <asm/current.h> 14#include <asm/current.h>
13#include <asm/asm-offsets.h> 15#include <asm/asm-offsets.h>
14#include <asm/thread_info.h> 16#include <asm/thread_info.h>
15#include <asm/cpufeature.h>
16
17/*
18 * copy_user_nocache - Uncached memory copy with exception handling
19 * This will force destination/source out of cache for more performance.
20 *
21 * Input:
22 * rdi destination
23 * rsi source
24 * rdx count
25 * rcx zero flag when 1 zero on exception
26 *
27 * Output:
28 * eax uncopied bytes or 0 if successful.
29 */
30ENTRY(__copy_user_nocache)
31 CFI_STARTPROC
32 pushq %rbx
33 CFI_ADJUST_CFA_OFFSET 8
34 CFI_REL_OFFSET rbx, 0
35 pushq %rcx /* save zero flag */
36 CFI_ADJUST_CFA_OFFSET 8
37 CFI_REL_OFFSET rcx, 0
38
39 xorl %eax,%eax /* zero for the exception handler */
40 17
18 .macro ALIGN_DESTINATION
41#ifdef FIX_ALIGNMENT 19#ifdef FIX_ALIGNMENT
42 /* check for bad alignment of destination */ 20 /* check for bad alignment of destination */
43 movl %edi,%ecx 21 movl %edi,%ecx
44 andl $7,%ecx 22 andl $7,%ecx
45 jnz .Lbad_alignment 23 jz 102f /* already aligned */
46.Lafter_bad_alignment: 24 subl $8,%ecx
47#endif 25 negl %ecx
48 26 subl %ecx,%edx
49 movq %rdx,%rcx 27100: movb (%rsi),%al
50 28101: movb %al,(%rdi)
51 movl $64,%ebx 29 incq %rsi
52 shrq $6,%rdx 30 incq %rdi
53 decq %rdx 31 decl %ecx
54 js .Lhandle_tail 32 jnz 100b
55 33102:
56 .p2align 4 34 .section .fixup,"ax"
57.Lloop: 35103: addl %r8d,%edx /* ecx is zerorest also */
58.Ls1: movq (%rsi),%r11 36 jmp copy_user_handle_tail
59.Ls2: movq 1*8(%rsi),%r8 37 .previous
60.Ls3: movq 2*8(%rsi),%r9
61.Ls4: movq 3*8(%rsi),%r10
62.Ld1: movnti %r11,(%rdi)
63.Ld2: movnti %r8,1*8(%rdi)
64.Ld3: movnti %r9,2*8(%rdi)
65.Ld4: movnti %r10,3*8(%rdi)
66
67.Ls5: movq 4*8(%rsi),%r11
68.Ls6: movq 5*8(%rsi),%r8
69.Ls7: movq 6*8(%rsi),%r9
70.Ls8: movq 7*8(%rsi),%r10
71.Ld5: movnti %r11,4*8(%rdi)
72.Ld6: movnti %r8,5*8(%rdi)
73.Ld7: movnti %r9,6*8(%rdi)
74.Ld8: movnti %r10,7*8(%rdi)
75 38
76 dec %rdx 39 .section __ex_table,"a"
40 .align 8
41 .quad 100b,103b
42 .quad 101b,103b
43 .previous
44#endif
45 .endm
77 46
47/*
48 * copy_user_nocache - Uncached memory copy with exception handling
49 * This will force destination/source out of cache for more performance.
50 */
51ENTRY(__copy_user_nocache)
52 CFI_STARTPROC
53 cmpl $8,%edx
54 jb 20f /* less then 8 bytes, go to byte copy loop */
55 ALIGN_DESTINATION
56 movl %edx,%ecx
57 andl $63,%edx
58 shrl $6,%ecx
59 jz 17f
601: movq (%rsi),%r8
612: movq 1*8(%rsi),%r9
623: movq 2*8(%rsi),%r10
634: movq 3*8(%rsi),%r11
645: movnti %r8,(%rdi)
656: movnti %r9,1*8(%rdi)
667: movnti %r10,2*8(%rdi)
678: movnti %r11,3*8(%rdi)
689: movq 4*8(%rsi),%r8
6910: movq 5*8(%rsi),%r9
7011: movq 6*8(%rsi),%r10
7112: movq 7*8(%rsi),%r11
7213: movnti %r8,4*8(%rdi)
7314: movnti %r9,5*8(%rdi)
7415: movnti %r10,6*8(%rdi)
7516: movnti %r11,7*8(%rdi)
78 leaq 64(%rsi),%rsi 76 leaq 64(%rsi),%rsi
79 leaq 64(%rdi),%rdi 77 leaq 64(%rdi),%rdi
80
81 jns .Lloop
82
83 .p2align 4
84.Lhandle_tail:
85 movl %ecx,%edx
86 andl $63,%ecx
87 shrl $3,%ecx
88 jz .Lhandle_7
89 movl $8,%ebx
90 .p2align 4
91.Lloop_8:
92.Ls9: movq (%rsi),%r8
93.Ld9: movnti %r8,(%rdi)
94 decl %ecx 78 decl %ecx
95 leaq 8(%rdi),%rdi 79 jnz 1b
8017: movl %edx,%ecx
81 andl $7,%edx
82 shrl $3,%ecx
83 jz 20f
8418: movq (%rsi),%r8
8519: movnti %r8,(%rdi)
96 leaq 8(%rsi),%rsi 86 leaq 8(%rsi),%rsi
97 jnz .Lloop_8 87 leaq 8(%rdi),%rdi
98 88 decl %ecx
99.Lhandle_7: 89 jnz 18b
9020: andl %edx,%edx
91 jz 23f
100 movl %edx,%ecx 92 movl %edx,%ecx
101 andl $7,%ecx 9321: movb (%rsi),%al
102 jz .Lende 9422: movb %al,(%rdi)
103 .p2align 4
104.Lloop_1:
105.Ls10: movb (%rsi),%bl
106.Ld10: movb %bl,(%rdi)
107 incq %rdi
108 incq %rsi 95 incq %rsi
96 incq %rdi
109 decl %ecx 97 decl %ecx
110 jnz .Lloop_1 98 jnz 21b
111 9923: xorl %eax,%eax
112 CFI_REMEMBER_STATE
113.Lende:
114 popq %rcx
115 CFI_ADJUST_CFA_OFFSET -8
116 CFI_RESTORE %rcx
117 popq %rbx
118 CFI_ADJUST_CFA_OFFSET -8
119 CFI_RESTORE rbx
120 sfence 100 sfence
121 ret 101 ret
122 CFI_RESTORE_STATE
123 102
124#ifdef FIX_ALIGNMENT 103 .section .fixup,"ax"
125 /* align destination */ 10430: shll $6,%ecx
126 .p2align 4 105 addl %ecx,%edx
127.Lbad_alignment: 106 jmp 60f
128 movl $8,%r9d 10740: lea (%rdx,%rcx,8),%rdx
129 subl %ecx,%r9d 108 jmp 60f
130 movl %r9d,%ecx 10950: movl %ecx,%edx
131 cmpq %r9,%rdx 11060: sfence
132 jz .Lhandle_7 111 movl %r8d,%ecx
133 js .Lhandle_7 112 jmp copy_user_handle_tail
134.Lalign_1: 113 .previous
135.Ls11: movb (%rsi),%bl
136.Ld11: movb %bl,(%rdi)
137 incq %rsi
138 incq %rdi
139 decl %ecx
140 jnz .Lalign_1
141 subq %r9,%rdx
142 jmp .Lafter_bad_alignment
143#endif
144 114
145 /* table sorted by exception address */
146 .section __ex_table,"a" 115 .section __ex_table,"a"
147 .align 8 116 .quad 1b,30b
148 .quad .Ls1,.Ls1e /* .Ls[1-4] - 0 bytes copied */ 117 .quad 2b,30b
149 .quad .Ls2,.Ls1e 118 .quad 3b,30b
150 .quad .Ls3,.Ls1e 119 .quad 4b,30b
151 .quad .Ls4,.Ls1e 120 .quad 5b,30b
152 .quad .Ld1,.Ls1e /* .Ld[1-4] - 0..24 bytes coped */ 121 .quad 6b,30b
153 .quad .Ld2,.Ls2e 122 .quad 7b,30b
154 .quad .Ld3,.Ls3e 123 .quad 8b,30b
155 .quad .Ld4,.Ls4e 124 .quad 9b,30b
156 .quad .Ls5,.Ls5e /* .Ls[5-8] - 32 bytes copied */ 125 .quad 10b,30b
157 .quad .Ls6,.Ls5e 126 .quad 11b,30b
158 .quad .Ls7,.Ls5e 127 .quad 12b,30b
159 .quad .Ls8,.Ls5e 128 .quad 13b,30b
160 .quad .Ld5,.Ls5e /* .Ld[5-8] - 32..56 bytes copied */ 129 .quad 14b,30b
161 .quad .Ld6,.Ls6e 130 .quad 15b,30b
162 .quad .Ld7,.Ls7e 131 .quad 16b,30b
163 .quad .Ld8,.Ls8e 132 .quad 18b,40b
164 .quad .Ls9,.Le_quad 133 .quad 19b,40b
165 .quad .Ld9,.Le_quad 134 .quad 21b,50b
166 .quad .Ls10,.Le_byte 135 .quad 22b,50b
167 .quad .Ld10,.Le_byte
168#ifdef FIX_ALIGNMENT
169 .quad .Ls11,.Lzero_rest
170 .quad .Ld11,.Lzero_rest
171#endif
172 .quad .Le5,.Le_zero
173 .previous 136 .previous
174
175 /* eax: zero, ebx: 64 */
176.Ls1e: addl $8,%eax /* eax: bytes left uncopied: Ls1e: 64 .. Ls8e: 8 */
177.Ls2e: addl $8,%eax
178.Ls3e: addl $8,%eax
179.Ls4e: addl $8,%eax
180.Ls5e: addl $8,%eax
181.Ls6e: addl $8,%eax
182.Ls7e: addl $8,%eax
183.Ls8e: addl $8,%eax
184 addq %rbx,%rdi /* +64 */
185 subq %rax,%rdi /* correct destination with computed offset */
186
187 shlq $6,%rdx /* loop counter * 64 (stride length) */
188 addq %rax,%rdx /* add offset to loopcnt */
189 andl $63,%ecx /* remaining bytes */
190 addq %rcx,%rdx /* add them */
191 jmp .Lzero_rest
192
193 /* exception on quad word loop in tail handling */
194 /* ecx: loopcnt/8, %edx: length, rdi: correct */
195.Le_quad:
196 shll $3,%ecx
197 andl $7,%edx
198 addl %ecx,%edx
199 /* edx: bytes to zero, rdi: dest, eax:zero */
200.Lzero_rest:
201 cmpl $0,(%rsp) /* zero flag set? */
202 jz .Le_zero
203 movq %rdx,%rcx
204.Le_byte:
205 xorl %eax,%eax
206.Le5: rep
207 stosb
208 /* when there is another exception while zeroing the rest just return */
209.Le_zero:
210 movq %rdx,%rax
211 jmp .Lende
212 CFI_ENDPROC 137 CFI_ENDPROC
213ENDPROC(__copy_user_nocache) 138ENDPROC(__copy_user_nocache)
214
215
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay.c
index d710f2d167bb..f4568605d7d5 100644
--- a/arch/x86/lib/delay_32.c
+++ b/arch/x86/lib/delay.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 1993 Linus Torvalds 4 * Copyright (C) 1993 Linus Torvalds
5 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> 5 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
6 * Copyright (C) 2008 Jiri Hladky <hladky _dot_ jiri _at_ gmail _dot_ com>
6 * 7 *
7 * The __delay function must _NOT_ be inlined as its execution time 8 * The __delay function must _NOT_ be inlined as its execution time
8 * depends wildly on alignment on many x86 processors. The additional 9 * depends wildly on alignment on many x86 processors. The additional
@@ -28,16 +29,22 @@
28/* simple loop based delay: */ 29/* simple loop based delay: */
29static void delay_loop(unsigned long loops) 30static void delay_loop(unsigned long loops)
30{ 31{
31 int d0; 32 asm volatile(
32 33 " test %0,%0 \n"
33 __asm__ __volatile__( 34 " jz 3f \n"
34 "\tjmp 1f\n" 35 " jmp 1f \n"
35 ".align 16\n" 36
36 "1:\tjmp 2f\n" 37 ".align 16 \n"
37 ".align 16\n" 38 "1: jmp 2f \n"
38 "2:\tdecl %0\n\tjns 2b" 39
39 :"=&a" (d0) 40 ".align 16 \n"
40 :"0" (loops)); 41 "2: dec %0 \n"
42 " jnz 2b \n"
43 "3: dec %0 \n"
44
45 : /* we don't need output */
46 :"a" (loops)
47 );
41} 48}
42 49
43/* TSC based delay: */ 50/* TSC based delay: */
@@ -91,7 +98,7 @@ void use_tsc_delay(void)
91int __devinit read_current_timer(unsigned long *timer_val) 98int __devinit read_current_timer(unsigned long *timer_val)
92{ 99{
93 if (delay_fn == delay_tsc) { 100 if (delay_fn == delay_tsc) {
94 rdtscl(*timer_val); 101 rdtscll(*timer_val);
95 return 0; 102 return 0;
96 } 103 }
97 return -1; 104 return -1;
@@ -101,31 +108,30 @@ void __delay(unsigned long loops)
101{ 108{
102 delay_fn(loops); 109 delay_fn(loops);
103} 110}
111EXPORT_SYMBOL(__delay);
104 112
105inline void __const_udelay(unsigned long xloops) 113inline void __const_udelay(unsigned long xloops)
106{ 114{
107 int d0; 115 int d0;
108 116
109 xloops *= 4; 117 xloops *= 4;
110 __asm__("mull %0" 118 asm("mull %%edx"
111 :"=d" (xloops), "=&a" (d0) 119 :"=d" (xloops), "=&a" (d0)
112 :"1" (xloops), "0" 120 :"1" (xloops), "0"
113 (cpu_data(raw_smp_processor_id()).loops_per_jiffy * (HZ/4))); 121 (cpu_data(raw_smp_processor_id()).loops_per_jiffy * (HZ/4)));
114 122
115 __delay(++xloops); 123 __delay(++xloops);
116} 124}
125EXPORT_SYMBOL(__const_udelay);
117 126
118void __udelay(unsigned long usecs) 127void __udelay(unsigned long usecs)
119{ 128{
120 __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */ 129 __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
121} 130}
131EXPORT_SYMBOL(__udelay);
122 132
123void __ndelay(unsigned long nsecs) 133void __ndelay(unsigned long nsecs)
124{ 134{
125 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ 135 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
126} 136}
127
128EXPORT_SYMBOL(__delay);
129EXPORT_SYMBOL(__const_udelay);
130EXPORT_SYMBOL(__udelay);
131EXPORT_SYMBOL(__ndelay); 137EXPORT_SYMBOL(__ndelay);
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c
deleted file mode 100644
index 4c441be92641..000000000000
--- a/arch/x86/lib/delay_64.c
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * Precise Delay Loops for x86-64
3 *
4 * Copyright (C) 1993 Linus Torvalds
5 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
6 *
7 * The __delay function must _NOT_ be inlined as its execution time
8 * depends wildly on alignment on many x86 processors.
9 */
10
11#include <linux/module.h>
12#include <linux/sched.h>
13#include <linux/timex.h>
14#include <linux/preempt.h>
15#include <linux/delay.h>
16#include <linux/init.h>
17
18#include <asm/delay.h>
19#include <asm/msr.h>
20
21#ifdef CONFIG_SMP
22#include <asm/smp.h>
23#endif
24
25int __devinit read_current_timer(unsigned long *timer_value)
26{
27 rdtscll(*timer_value);
28 return 0;
29}
30
31void __delay(unsigned long loops)
32{
33 unsigned bclock, now;
34 int cpu;
35
36 preempt_disable();
37 cpu = smp_processor_id();
38 rdtscl(bclock);
39 for (;;) {
40 rdtscl(now);
41 if ((now - bclock) >= loops)
42 break;
43
44 /* Allow RT tasks to run */
45 preempt_enable();
46 rep_nop();
47 preempt_disable();
48
49 /*
50 * It is possible that we moved to another CPU, and
51 * since TSC's are per-cpu we need to calculate
52 * that. The delay must guarantee that we wait "at
53 * least" the amount of time. Being moved to another
54 * CPU could make the wait longer but we just need to
55 * make sure we waited long enough. Rebalance the
56 * counter for this CPU.
57 */
58 if (unlikely(cpu != smp_processor_id())) {
59 loops -= (now - bclock);
60 cpu = smp_processor_id();
61 rdtscl(bclock);
62 }
63 }
64 preempt_enable();
65}
66EXPORT_SYMBOL(__delay);
67
68inline void __const_udelay(unsigned long xloops)
69{
70 __delay(((xloops * HZ *
71 cpu_data(raw_smp_processor_id()).loops_per_jiffy) >> 32) + 1);
72}
73EXPORT_SYMBOL(__const_udelay);
74
75void __udelay(unsigned long usecs)
76{
77 __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
78}
79EXPORT_SYMBOL(__udelay);
80
81void __ndelay(unsigned long nsecs)
82{
83 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
84}
85EXPORT_SYMBOL(__ndelay);
diff --git a/arch/x86/lib/getuser_64.S b/arch/x86/lib/getuser.S
index 5448876261f8..ad374003742f 100644
--- a/arch/x86/lib/getuser_64.S
+++ b/arch/x86/lib/getuser.S
@@ -3,6 +3,7 @@
3 * 3 *
4 * (C) Copyright 1998 Linus Torvalds 4 * (C) Copyright 1998 Linus Torvalds
5 * (C) Copyright 2005 Andi Kleen 5 * (C) Copyright 2005 Andi Kleen
6 * (C) Copyright 2008 Glauber Costa
6 * 7 *
7 * These functions have a non-standard call interface 8 * These functions have a non-standard call interface
8 * to make them more efficient, especially as they 9 * to make them more efficient, especially as they
@@ -13,14 +14,13 @@
13/* 14/*
14 * __get_user_X 15 * __get_user_X
15 * 16 *
16 * Inputs: %rcx contains the address. 17 * Inputs: %[r|e]ax contains the address.
17 * The register is modified, but all changes are undone 18 * The register is modified, but all changes are undone
18 * before returning because the C code doesn't know about it. 19 * before returning because the C code doesn't know about it.
19 * 20 *
20 * Outputs: %rax is error code (0 or -EFAULT) 21 * Outputs: %[r|e]ax is error code (0 or -EFAULT)
21 * %rdx contains zero-extended value 22 * %[r|e]dx contains zero-extended value
22 * 23 *
23 * %r8 is destroyed.
24 * 24 *
25 * These functions should not modify any other registers, 25 * These functions should not modify any other registers,
26 * as they get called from within inline assembly. 26 * as they get called from within inline assembly.
@@ -32,78 +32,73 @@
32#include <asm/errno.h> 32#include <asm/errno.h>
33#include <asm/asm-offsets.h> 33#include <asm/asm-offsets.h>
34#include <asm/thread_info.h> 34#include <asm/thread_info.h>
35#include <asm/asm.h>
35 36
36 .text 37 .text
37ENTRY(__get_user_1) 38ENTRY(__get_user_1)
38 CFI_STARTPROC 39 CFI_STARTPROC
39 GET_THREAD_INFO(%r8) 40 GET_THREAD_INFO(%_ASM_DX)
40 cmpq threadinfo_addr_limit(%r8),%rcx 41 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
41 jae bad_get_user 42 jae bad_get_user
421: movzb (%rcx),%edx 431: movzb (%_ASM_AX),%edx
43 xorl %eax,%eax 44 xor %eax,%eax
44 ret 45 ret
45 CFI_ENDPROC 46 CFI_ENDPROC
46ENDPROC(__get_user_1) 47ENDPROC(__get_user_1)
47 48
48ENTRY(__get_user_2) 49ENTRY(__get_user_2)
49 CFI_STARTPROC 50 CFI_STARTPROC
50 GET_THREAD_INFO(%r8) 51 add $1,%_ASM_AX
51 addq $1,%rcx 52 jc bad_get_user
52 jc 20f 53 GET_THREAD_INFO(%_ASM_DX)
53 cmpq threadinfo_addr_limit(%r8),%rcx 54 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
54 jae 20f 55 jae bad_get_user
55 decq %rcx 562: movzwl -1(%_ASM_AX),%edx
562: movzwl (%rcx),%edx 57 xor %eax,%eax
57 xorl %eax,%eax
58 ret 58 ret
5920: decq %rcx
60 jmp bad_get_user
61 CFI_ENDPROC 59 CFI_ENDPROC
62ENDPROC(__get_user_2) 60ENDPROC(__get_user_2)
63 61
64ENTRY(__get_user_4) 62ENTRY(__get_user_4)
65 CFI_STARTPROC 63 CFI_STARTPROC
66 GET_THREAD_INFO(%r8) 64 add $3,%_ASM_AX
67 addq $3,%rcx 65 jc bad_get_user
68 jc 30f 66 GET_THREAD_INFO(%_ASM_DX)
69 cmpq threadinfo_addr_limit(%r8),%rcx 67 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
70 jae 30f 68 jae bad_get_user
71 subq $3,%rcx 693: mov -3(%_ASM_AX),%edx
723: movl (%rcx),%edx 70 xor %eax,%eax
73 xorl %eax,%eax
74 ret 71 ret
7530: subq $3,%rcx
76 jmp bad_get_user
77 CFI_ENDPROC 72 CFI_ENDPROC
78ENDPROC(__get_user_4) 73ENDPROC(__get_user_4)
79 74
75#ifdef CONFIG_X86_64
80ENTRY(__get_user_8) 76ENTRY(__get_user_8)
81 CFI_STARTPROC 77 CFI_STARTPROC
82 GET_THREAD_INFO(%r8) 78 add $7,%_ASM_AX
83 addq $7,%rcx 79 jc bad_get_user
84 jc 40f 80 GET_THREAD_INFO(%_ASM_DX)
85 cmpq threadinfo_addr_limit(%r8),%rcx 81 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
86 jae 40f 82 jae bad_get_user
87 subq $7,%rcx 834: movq -7(%_ASM_AX),%_ASM_DX
884: movq (%rcx),%rdx 84 xor %eax,%eax
89 xorl %eax,%eax
90 ret 85 ret
9140: subq $7,%rcx
92 jmp bad_get_user
93 CFI_ENDPROC 86 CFI_ENDPROC
94ENDPROC(__get_user_8) 87ENDPROC(__get_user_8)
88#endif
95 89
96bad_get_user: 90bad_get_user:
97 CFI_STARTPROC 91 CFI_STARTPROC
98 xorl %edx,%edx 92 xor %edx,%edx
99 movq $(-EFAULT),%rax 93 mov $(-EFAULT),%_ASM_AX
100 ret 94 ret
101 CFI_ENDPROC 95 CFI_ENDPROC
102END(bad_get_user) 96END(bad_get_user)
103 97
104.section __ex_table,"a" 98.section __ex_table,"a"
105 .quad 1b,bad_get_user 99 _ASM_PTR 1b,bad_get_user
106 .quad 2b,bad_get_user 100 _ASM_PTR 2b,bad_get_user
107 .quad 3b,bad_get_user 101 _ASM_PTR 3b,bad_get_user
108 .quad 4b,bad_get_user 102#ifdef CONFIG_X86_64
109.previous 103 _ASM_PTR 4b,bad_get_user
104#endif
diff --git a/arch/x86/lib/getuser_32.S b/arch/x86/lib/getuser_32.S
deleted file mode 100644
index 6d84b53f12a2..000000000000
--- a/arch/x86/lib/getuser_32.S
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * __get_user functions.
3 *
4 * (C) Copyright 1998 Linus Torvalds
5 *
6 * These functions have a non-standard call interface
7 * to make them more efficient, especially as they
8 * return an error value in addition to the "real"
9 * return value.
10 */
11#include <linux/linkage.h>
12#include <asm/dwarf2.h>
13#include <asm/thread_info.h>
14
15
16/*
17 * __get_user_X
18 *
19 * Inputs: %eax contains the address
20 *
21 * Outputs: %eax is error code (0 or -EFAULT)
22 * %edx contains zero-extended value
23 *
24 * These functions should not modify any other registers,
25 * as they get called from within inline assembly.
26 */
27
28.text
29ENTRY(__get_user_1)
30 CFI_STARTPROC
31 GET_THREAD_INFO(%edx)
32 cmpl TI_addr_limit(%edx),%eax
33 jae bad_get_user
341: movzbl (%eax),%edx
35 xorl %eax,%eax
36 ret
37 CFI_ENDPROC
38ENDPROC(__get_user_1)
39
40ENTRY(__get_user_2)
41 CFI_STARTPROC
42 addl $1,%eax
43 jc bad_get_user
44 GET_THREAD_INFO(%edx)
45 cmpl TI_addr_limit(%edx),%eax
46 jae bad_get_user
472: movzwl -1(%eax),%edx
48 xorl %eax,%eax
49 ret
50 CFI_ENDPROC
51ENDPROC(__get_user_2)
52
53ENTRY(__get_user_4)
54 CFI_STARTPROC
55 addl $3,%eax
56 jc bad_get_user
57 GET_THREAD_INFO(%edx)
58 cmpl TI_addr_limit(%edx),%eax
59 jae bad_get_user
603: movl -3(%eax),%edx
61 xorl %eax,%eax
62 ret
63 CFI_ENDPROC
64ENDPROC(__get_user_4)
65
66bad_get_user:
67 CFI_STARTPROC
68 xorl %edx,%edx
69 movl $-14,%eax
70 ret
71 CFI_ENDPROC
72END(bad_get_user)
73
74.section __ex_table,"a"
75 .long 1b,bad_get_user
76 .long 2b,bad_get_user
77 .long 3b,bad_get_user
78.previous
diff --git a/arch/x86/lib/putuser_32.S b/arch/x86/lib/putuser.S
index f58fba109d18..36b0d15ae6e9 100644
--- a/arch/x86/lib/putuser_32.S
+++ b/arch/x86/lib/putuser.S
@@ -2,6 +2,8 @@
2 * __put_user functions. 2 * __put_user functions.
3 * 3 *
4 * (C) Copyright 2005 Linus Torvalds 4 * (C) Copyright 2005 Linus Torvalds
5 * (C) Copyright 2005 Andi Kleen
6 * (C) Copyright 2008 Glauber Costa
5 * 7 *
6 * These functions have a non-standard call interface 8 * These functions have a non-standard call interface
7 * to make them more efficient, especially as they 9 * to make them more efficient, especially as they
@@ -11,6 +13,8 @@
11#include <linux/linkage.h> 13#include <linux/linkage.h>
12#include <asm/dwarf2.h> 14#include <asm/dwarf2.h>
13#include <asm/thread_info.h> 15#include <asm/thread_info.h>
16#include <asm/errno.h>
17#include <asm/asm.h>
14 18
15 19
16/* 20/*
@@ -26,73 +30,68 @@
26 */ 30 */
27 31
28#define ENTER CFI_STARTPROC ; \ 32#define ENTER CFI_STARTPROC ; \
29 pushl %ebx ; \ 33 GET_THREAD_INFO(%_ASM_BX)
30 CFI_ADJUST_CFA_OFFSET 4 ; \ 34#define EXIT ret ; \
31 CFI_REL_OFFSET ebx, 0 ; \
32 GET_THREAD_INFO(%ebx)
33#define EXIT popl %ebx ; \
34 CFI_ADJUST_CFA_OFFSET -4 ; \
35 CFI_RESTORE ebx ; \
36 ret ; \
37 CFI_ENDPROC 35 CFI_ENDPROC
38 36
39.text 37.text
40ENTRY(__put_user_1) 38ENTRY(__put_user_1)
41 ENTER 39 ENTER
42 cmpl TI_addr_limit(%ebx),%ecx 40 cmp TI_addr_limit(%_ASM_BX),%_ASM_CX
43 jae bad_put_user 41 jae bad_put_user
441: movb %al,(%ecx) 421: movb %al,(%_ASM_CX)
45 xorl %eax,%eax 43 xor %eax,%eax
46 EXIT 44 EXIT
47ENDPROC(__put_user_1) 45ENDPROC(__put_user_1)
48 46
49ENTRY(__put_user_2) 47ENTRY(__put_user_2)
50 ENTER 48 ENTER
51 movl TI_addr_limit(%ebx),%ebx 49 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
52 subl $1,%ebx 50 sub $1,%_ASM_BX
53 cmpl %ebx,%ecx 51 cmp %_ASM_BX,%_ASM_CX
54 jae bad_put_user 52 jae bad_put_user
552: movw %ax,(%ecx) 532: movw %ax,(%_ASM_CX)
56 xorl %eax,%eax 54 xor %eax,%eax
57 EXIT 55 EXIT
58ENDPROC(__put_user_2) 56ENDPROC(__put_user_2)
59 57
60ENTRY(__put_user_4) 58ENTRY(__put_user_4)
61 ENTER 59 ENTER
62 movl TI_addr_limit(%ebx),%ebx 60 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
63 subl $3,%ebx 61 sub $3,%_ASM_BX
64 cmpl %ebx,%ecx 62 cmp %_ASM_BX,%_ASM_CX
65 jae bad_put_user 63 jae bad_put_user
663: movl %eax,(%ecx) 643: movl %eax,(%_ASM_CX)
67 xorl %eax,%eax 65 xor %eax,%eax
68 EXIT 66 EXIT
69ENDPROC(__put_user_4) 67ENDPROC(__put_user_4)
70 68
71ENTRY(__put_user_8) 69ENTRY(__put_user_8)
72 ENTER 70 ENTER
73 movl TI_addr_limit(%ebx),%ebx 71 mov TI_addr_limit(%_ASM_BX),%_ASM_BX
74 subl $7,%ebx 72 sub $7,%_ASM_BX
75 cmpl %ebx,%ecx 73 cmp %_ASM_BX,%_ASM_CX
76 jae bad_put_user 74 jae bad_put_user
774: movl %eax,(%ecx) 754: mov %_ASM_AX,(%_ASM_CX)
785: movl %edx,4(%ecx) 76#ifdef CONFIG_X86_32
79 xorl %eax,%eax 775: movl %edx,4(%_ASM_CX)
78#endif
79 xor %eax,%eax
80 EXIT 80 EXIT
81ENDPROC(__put_user_8) 81ENDPROC(__put_user_8)
82 82
83bad_put_user: 83bad_put_user:
84 CFI_STARTPROC simple 84 CFI_STARTPROC
85 CFI_DEF_CFA esp, 2*4 85 movl $-EFAULT,%eax
86 CFI_OFFSET eip, -1*4
87 CFI_OFFSET ebx, -2*4
88 movl $-14,%eax
89 EXIT 86 EXIT
90END(bad_put_user) 87END(bad_put_user)
91 88
92.section __ex_table,"a" 89.section __ex_table,"a"
93 .long 1b,bad_put_user 90 _ASM_PTR 1b,bad_put_user
94 .long 2b,bad_put_user 91 _ASM_PTR 2b,bad_put_user
95 .long 3b,bad_put_user 92 _ASM_PTR 3b,bad_put_user
96 .long 4b,bad_put_user 93 _ASM_PTR 4b,bad_put_user
97 .long 5b,bad_put_user 94#ifdef CONFIG_X86_32
95 _ASM_PTR 5b,bad_put_user
96#endif
98.previous 97.previous
diff --git a/arch/x86/lib/putuser_64.S b/arch/x86/lib/putuser_64.S
deleted file mode 100644
index 4989f5a8fa9b..000000000000
--- a/arch/x86/lib/putuser_64.S
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * __put_user functions.
3 *
4 * (C) Copyright 1998 Linus Torvalds
5 * (C) Copyright 2005 Andi Kleen
6 *
7 * These functions have a non-standard call interface
8 * to make them more efficient, especially as they
9 * return an error value in addition to the "real"
10 * return value.
11 */
12
13/*
14 * __put_user_X
15 *
16 * Inputs: %rcx contains the address
17 * %rdx contains new value
18 *
19 * Outputs: %rax is error code (0 or -EFAULT)
20 *
21 * %r8 is destroyed.
22 *
23 * These functions should not modify any other registers,
24 * as they get called from within inline assembly.
25 */
26
27#include <linux/linkage.h>
28#include <asm/dwarf2.h>
29#include <asm/page.h>
30#include <asm/errno.h>
31#include <asm/asm-offsets.h>
32#include <asm/thread_info.h>
33
34 .text
35ENTRY(__put_user_1)
36 CFI_STARTPROC
37 GET_THREAD_INFO(%r8)
38 cmpq threadinfo_addr_limit(%r8),%rcx
39 jae bad_put_user
401: movb %dl,(%rcx)
41 xorl %eax,%eax
42 ret
43 CFI_ENDPROC
44ENDPROC(__put_user_1)
45
46ENTRY(__put_user_2)
47 CFI_STARTPROC
48 GET_THREAD_INFO(%r8)
49 addq $1,%rcx
50 jc 20f
51 cmpq threadinfo_addr_limit(%r8),%rcx
52 jae 20f
53 decq %rcx
542: movw %dx,(%rcx)
55 xorl %eax,%eax
56 ret
5720: decq %rcx
58 jmp bad_put_user
59 CFI_ENDPROC
60ENDPROC(__put_user_2)
61
62ENTRY(__put_user_4)
63 CFI_STARTPROC
64 GET_THREAD_INFO(%r8)
65 addq $3,%rcx
66 jc 30f
67 cmpq threadinfo_addr_limit(%r8),%rcx
68 jae 30f
69 subq $3,%rcx
703: movl %edx,(%rcx)
71 xorl %eax,%eax
72 ret
7330: subq $3,%rcx
74 jmp bad_put_user
75 CFI_ENDPROC
76ENDPROC(__put_user_4)
77
78ENTRY(__put_user_8)
79 CFI_STARTPROC
80 GET_THREAD_INFO(%r8)
81 addq $7,%rcx
82 jc 40f
83 cmpq threadinfo_addr_limit(%r8),%rcx
84 jae 40f
85 subq $7,%rcx
864: movq %rdx,(%rcx)
87 xorl %eax,%eax
88 ret
8940: subq $7,%rcx
90 jmp bad_put_user
91 CFI_ENDPROC
92ENDPROC(__put_user_8)
93
94bad_put_user:
95 CFI_STARTPROC
96 movq $(-EFAULT),%rax
97 ret
98 CFI_ENDPROC
99END(bad_put_user)
100
101.section __ex_table,"a"
102 .quad 1b,bad_put_user
103 .quad 2b,bad_put_user
104 .quad 3b,bad_put_user
105 .quad 4b,bad_put_user
106.previous
diff --git a/arch/x86/lib/thunk_32.S b/arch/x86/lib/thunk_32.S
new file mode 100644
index 000000000000..650b11e00ecc
--- /dev/null
+++ b/arch/x86/lib/thunk_32.S
@@ -0,0 +1,47 @@
1/*
2 * Trampoline to trace irqs off. (otherwise CALLER_ADDR1 might crash)
3 * Copyright 2008 by Steven Rostedt, Red Hat, Inc
4 * (inspired by Andi Kleen's thunk_64.S)
5 * Subject to the GNU public license, v.2. No warranty of any kind.
6 */
7
8 #include <linux/linkage.h>
9
10#define ARCH_TRACE_IRQS_ON \
11 pushl %eax; \
12 pushl %ecx; \
13 pushl %edx; \
14 call trace_hardirqs_on; \
15 popl %edx; \
16 popl %ecx; \
17 popl %eax;
18
19#define ARCH_TRACE_IRQS_OFF \
20 pushl %eax; \
21 pushl %ecx; \
22 pushl %edx; \
23 call trace_hardirqs_off; \
24 popl %edx; \
25 popl %ecx; \
26 popl %eax;
27
28#ifdef CONFIG_TRACE_IRQFLAGS
29 /* put return address in eax (arg1) */
30 .macro thunk_ra name,func
31 .globl \name
32\name:
33 pushl %eax
34 pushl %ecx
35 pushl %edx
36 /* Place EIP in the arg1 */
37 movl 3*4(%esp), %eax
38 call \func
39 popl %edx
40 popl %ecx
41 popl %eax
42 ret
43 .endm
44
45 thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller
46 thunk_ra trace_hardirqs_off_thunk,trace_hardirqs_off_caller
47#endif
diff --git a/arch/x86/lib/thunk_64.S b/arch/x86/lib/thunk_64.S
index e009251d4e9f..bf9a7d5a5428 100644
--- a/arch/x86/lib/thunk_64.S
+++ b/arch/x86/lib/thunk_64.S
@@ -2,6 +2,7 @@
2 * Save registers before calling assembly functions. This avoids 2 * Save registers before calling assembly functions. This avoids
3 * disturbance of register allocation in some inline assembly constructs. 3 * disturbance of register allocation in some inline assembly constructs.
4 * Copyright 2001,2002 by Andi Kleen, SuSE Labs. 4 * Copyright 2001,2002 by Andi Kleen, SuSE Labs.
5 * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc.
5 * Subject to the GNU public license, v.2. No warranty of any kind. 6 * Subject to the GNU public license, v.2. No warranty of any kind.
6 */ 7 */
7 8
@@ -42,8 +43,22 @@
42#endif 43#endif
43 44
44#ifdef CONFIG_TRACE_IRQFLAGS 45#ifdef CONFIG_TRACE_IRQFLAGS
45 thunk trace_hardirqs_on_thunk,trace_hardirqs_on 46 /* put return address in rdi (arg1) */
46 thunk trace_hardirqs_off_thunk,trace_hardirqs_off 47 .macro thunk_ra name,func
48 .globl \name
49\name:
50 CFI_STARTPROC
51 SAVE_ARGS
52 /* SAVE_ARGS pushs 9 elements */
53 /* the next element would be the rip */
54 movq 9*8(%rsp), %rdi
55 call \func
56 jmp restore
57 CFI_ENDPROC
58 .endm
59
60 thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller
61 thunk_ra trace_hardirqs_off_thunk,trace_hardirqs_off_caller
47#endif 62#endif
48 63
49#ifdef CONFIG_DEBUG_LOCK_ALLOC 64#ifdef CONFIG_DEBUG_LOCK_ALLOC
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index 0c89d1bb0287..f4df6e7c718b 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -158,3 +158,26 @@ unsigned long copy_in_user(void __user *to, const void __user *from, unsigned le
158} 158}
159EXPORT_SYMBOL(copy_in_user); 159EXPORT_SYMBOL(copy_in_user);
160 160
161/*
162 * Try to copy last bytes and clear the rest if needed.
163 * Since protection fault in copy_from/to_user is not a normal situation,
164 * it is not necessary to optimize tail handling.
165 */
166unsigned long
167copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest)
168{
169 char c;
170 unsigned zero_len;
171
172 for (; len; --len) {
173 if (__get_user_nocheck(c, from++, sizeof(char)))
174 break;
175 if (__put_user_nocheck(c, to++, sizeof(char)))
176 break;
177 }
178
179 for (c = 0, zero_len = len; zerorest && zero_len; --zero_len)
180 if (__put_user_nocheck(c, to++, sizeof(char)))
181 break;
182 return len;
183}
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c
index 0c28a071824c..48278fa7d3de 100644
--- a/arch/x86/mach-default/setup.c
+++ b/arch/x86/mach-default/setup.c
@@ -10,6 +10,14 @@
10#include <asm/e820.h> 10#include <asm/e820.h>
11#include <asm/setup.h> 11#include <asm/setup.h>
12 12
13/*
14 * Any quirks to be performed to initialize timers/irqs/etc?
15 */
16int (*arch_time_init_quirk)(void);
17int (*arch_pre_intr_init_quirk)(void);
18int (*arch_intr_init_quirk)(void);
19int (*arch_trap_init_quirk)(void);
20
13#ifdef CONFIG_HOTPLUG_CPU 21#ifdef CONFIG_HOTPLUG_CPU
14#define DEFAULT_SEND_IPI (1) 22#define DEFAULT_SEND_IPI (1)
15#else 23#else
@@ -29,6 +37,10 @@ int no_broadcast=DEFAULT_SEND_IPI;
29 **/ 37 **/
30void __init pre_intr_init_hook(void) 38void __init pre_intr_init_hook(void)
31{ 39{
40 if (arch_pre_intr_init_quirk) {
41 if (arch_pre_intr_init_quirk())
42 return;
43 }
32 init_ISA_irqs(); 44 init_ISA_irqs();
33} 45}
34 46
@@ -52,6 +64,10 @@ static struct irqaction irq2 = {
52 **/ 64 **/
53void __init intr_init_hook(void) 65void __init intr_init_hook(void)
54{ 66{
67 if (arch_intr_init_quirk) {
68 if (arch_intr_init_quirk())
69 return;
70 }
55#ifdef CONFIG_X86_LOCAL_APIC 71#ifdef CONFIG_X86_LOCAL_APIC
56 apic_intr_init(); 72 apic_intr_init();
57#endif 73#endif
@@ -65,7 +81,7 @@ void __init intr_init_hook(void)
65 * 81 *
66 * Description: 82 * Description:
67 * generally used to activate any machine specific identification 83 * generally used to activate any machine specific identification
68 * routines that may be needed before setup_arch() runs. On VISWS 84 * routines that may be needed before setup_arch() runs. On Voyager
69 * this is used to get the board revision and type. 85 * this is used to get the board revision and type.
70 **/ 86 **/
71void __init pre_setup_arch_hook(void) 87void __init pre_setup_arch_hook(void)
@@ -81,6 +97,10 @@ void __init pre_setup_arch_hook(void)
81 **/ 97 **/
82void __init trap_init_hook(void) 98void __init trap_init_hook(void)
83{ 99{
100 if (arch_trap_init_quirk) {
101 if (arch_trap_init_quirk())
102 return;
103 }
84} 104}
85 105
86static struct irqaction irq0 = { 106static struct irqaction irq0 = {
@@ -99,6 +119,16 @@ static struct irqaction irq0 = {
99 **/ 119 **/
100void __init time_init_hook(void) 120void __init time_init_hook(void)
101{ 121{
122 if (arch_time_init_quirk) {
123 /*
124 * A nonzero return code does not mean failure, it means
125 * that the architecture quirk does not want any
126 * generic (timer) setup to be performed after this:
127 */
128 if (arch_time_init_quirk())
129 return;
130 }
131
102 irq0.mask = cpumask_of_cpu(0); 132 irq0.mask = cpumask_of_cpu(0);
103 setup_irq(0, &irq0); 133 setup_irq(0, &irq0);
104} 134}
@@ -142,45 +172,3 @@ static int __init print_ipi_mode(void)
142 172
143late_initcall(print_ipi_mode); 173late_initcall(print_ipi_mode);
144 174
145/**
146 * machine_specific_memory_setup - Hook for machine specific memory setup.
147 *
148 * Description:
149 * This is included late in kernel/setup.c so that it can make
150 * use of all of the static functions.
151 **/
152
153char * __init machine_specific_memory_setup(void)
154{
155 char *who;
156
157
158 who = "BIOS-e820";
159
160 /*
161 * Try to copy the BIOS-supplied E820-map.
162 *
163 * Otherwise fake a memory map; one section from 0k->640k,
164 * the next section from 1mb->appropriate_mem_k
165 */
166 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
167 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
168 < 0) {
169 unsigned long mem_size;
170
171 /* compare results from other methods and take the greater */
172 if (boot_params.alt_mem_k
173 < boot_params.screen_info.ext_mem_k) {
174 mem_size = boot_params.screen_info.ext_mem_k;
175 who = "BIOS-88";
176 } else {
177 mem_size = boot_params.alt_mem_k;
178 who = "BIOS-e801";
179 }
180
181 e820.nr_map = 0;
182 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
183 add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
184 }
185 return who;
186}
diff --git a/arch/x86/mach-es7000/Makefile b/arch/x86/mach-es7000/Makefile
index 69dd4da218dc..3ef8b43b62fc 100644
--- a/arch/x86/mach-es7000/Makefile
+++ b/arch/x86/mach-es7000/Makefile
@@ -3,4 +3,3 @@
3# 3#
4 4
5obj-$(CONFIG_X86_ES7000) := es7000plat.o 5obj-$(CONFIG_X86_ES7000) := es7000plat.o
6obj-$(CONFIG_X86_GENERICARCH) := es7000plat.o
diff --git a/arch/x86/mach-es7000/es7000plat.c b/arch/x86/mach-es7000/es7000plat.c
index f5d6f7d8b86e..4354ce804889 100644
--- a/arch/x86/mach-es7000/es7000plat.c
+++ b/arch/x86/mach-es7000/es7000plat.c
@@ -52,6 +52,8 @@ static struct mip_reg *host_reg;
52static int mip_port; 52static int mip_port;
53static unsigned long mip_addr, host_addr; 53static unsigned long mip_addr, host_addr;
54 54
55int es7000_plat;
56
55/* 57/*
56 * GSI override for ES7000 platforms. 58 * GSI override for ES7000 platforms.
57 */ 59 */
@@ -175,53 +177,6 @@ find_unisys_acpi_oem_table(unsigned long *oem_addr)
175} 177}
176#endif 178#endif
177 179
178/*
179 * This file also gets compiled if CONFIG_X86_GENERICARCH is set. Generic
180 * arch already has got following function definitions (asm-generic/es7000.c)
181 * hence no need to define these for that case.
182 */
183#ifndef CONFIG_X86_GENERICARCH
184void es7000_sw_apic(void);
185void __init enable_apic_mode(void)
186{
187 es7000_sw_apic();
188 return;
189}
190
191__init int mps_oem_check(struct mp_config_table *mpc, char *oem,
192 char *productid)
193{
194 if (mpc->mpc_oemptr) {
195 struct mp_config_oemtable *oem_table =
196 (struct mp_config_oemtable *)mpc->mpc_oemptr;
197 if (!strncmp(oem, "UNISYS", 6))
198 return parse_unisys_oem((char *)oem_table);
199 }
200 return 0;
201}
202#ifdef CONFIG_ACPI
203/* Hook from generic ACPI tables.c */
204int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
205{
206 unsigned long oem_addr;
207 if (!find_unisys_acpi_oem_table(&oem_addr)) {
208 if (es7000_check_dsdt())
209 return parse_unisys_oem((char *)oem_addr);
210 else {
211 setup_unisys();
212 return 1;
213 }
214 }
215 return 0;
216}
217#else
218int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
219{
220 return 0;
221}
222#endif
223#endif /* COFIG_X86_GENERICARCH */
224
225static void 180static void
226es7000_spin(int n) 181es7000_spin(int n)
227{ 182{
diff --git a/arch/x86/mach-generic/Makefile b/arch/x86/mach-generic/Makefile
index 19d6d407737b..0dbd7803a1d5 100644
--- a/arch/x86/mach-generic/Makefile
+++ b/arch/x86/mach-generic/Makefile
@@ -2,7 +2,11 @@
2# Makefile for the generic architecture 2# Makefile for the generic architecture
3# 3#
4 4
5EXTRA_CFLAGS := -Iarch/x86/kernel 5EXTRA_CFLAGS := -Iarch/x86/kernel
6 6
7obj-y := probe.o summit.o bigsmp.o es7000.o default.o 7obj-y := probe.o default.o
8obj-y += ../../x86/mach-es7000/ 8obj-$(CONFIG_X86_NUMAQ) += numaq.o
9obj-$(CONFIG_X86_SUMMIT) += summit.o
10obj-$(CONFIG_X86_BIGSMP) += bigsmp.o
11obj-$(CONFIG_X86_ES7000) += es7000.o
12obj-$(CONFIG_X86_ES7000) += ../../x86/mach-es7000/
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c
index 95fc463056d0..59d771714559 100644
--- a/arch/x86/mach-generic/bigsmp.c
+++ b/arch/x86/mach-generic/bigsmp.c
@@ -23,10 +23,8 @@ static int dmi_bigsmp; /* can be set by dmi scanners */
23 23
24static int hp_ht_bigsmp(const struct dmi_system_id *d) 24static int hp_ht_bigsmp(const struct dmi_system_id *d)
25{ 25{
26#ifdef CONFIG_X86_GENERICARCH
27 printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); 26 printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident);
28 dmi_bigsmp = 1; 27 dmi_bigsmp = 1;
29#endif
30 return 0; 28 return 0;
31} 29}
32 30
@@ -48,7 +46,7 @@ static const struct dmi_system_id bigsmp_dmi_table[] = {
48static int probe_bigsmp(void) 46static int probe_bigsmp(void)
49{ 47{
50 if (def_to_bigsmp) 48 if (def_to_bigsmp)
51 dmi_bigsmp = 1; 49 dmi_bigsmp = 1;
52 else 50 else
53 dmi_check_system(bigsmp_dmi_table); 51 dmi_check_system(bigsmp_dmi_table);
54 return dmi_bigsmp; 52 return dmi_bigsmp;
diff --git a/arch/x86/mach-generic/numaq.c b/arch/x86/mach-generic/numaq.c
new file mode 100644
index 000000000000..8091e68764c4
--- /dev/null
+++ b/arch/x86/mach-generic/numaq.c
@@ -0,0 +1,41 @@
1/*
2 * APIC driver for the IBM NUMAQ chipset.
3 */
4#define APIC_DEFINITION 1
5#include <linux/threads.h>
6#include <linux/cpumask.h>
7#include <linux/smp.h>
8#include <asm/mpspec.h>
9#include <asm/genapic.h>
10#include <asm/fixmap.h>
11#include <asm/apicdef.h>
12#include <linux/kernel.h>
13#include <linux/string.h>
14#include <linux/init.h>
15#include <asm/mach-numaq/mach_apic.h>
16#include <asm/mach-numaq/mach_apicdef.h>
17#include <asm/mach-numaq/mach_ipi.h>
18#include <asm/mach-numaq/mach_mpparse.h>
19#include <asm/mach-numaq/mach_wakecpu.h>
20#include <asm/numaq.h>
21
22static int mps_oem_check(struct mp_config_table *mpc, char *oem,
23 char *productid)
24{
25 numaq_mps_oem_check(mpc, oem, productid);
26 return found_numaq;
27}
28
29static int probe_numaq(void)
30{
31 /* already know from get_memcfg_numaq() */
32 return found_numaq;
33}
34
35/* Hook from generic ACPI tables.c */
36static int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
37{
38 return 0;
39}
40
41struct genapic apic_numaq = APIC_INIT("NUMAQ", probe_numaq);
diff --git a/arch/x86/mach-generic/probe.c b/arch/x86/mach-generic/probe.c
index c5ae751b994a..5a7e4619e1c4 100644
--- a/arch/x86/mach-generic/probe.c
+++ b/arch/x86/mach-generic/probe.c
@@ -16,6 +16,7 @@
16#include <asm/apicdef.h> 16#include <asm/apicdef.h>
17#include <asm/genapic.h> 17#include <asm/genapic.h>
18 18
19extern struct genapic apic_numaq;
19extern struct genapic apic_summit; 20extern struct genapic apic_summit;
20extern struct genapic apic_bigsmp; 21extern struct genapic apic_bigsmp;
21extern struct genapic apic_es7000; 22extern struct genapic apic_es7000;
@@ -24,9 +25,18 @@ extern struct genapic apic_default;
24struct genapic *genapic = &apic_default; 25struct genapic *genapic = &apic_default;
25 26
26static struct genapic *apic_probe[] __initdata = { 27static struct genapic *apic_probe[] __initdata = {
28#ifdef CONFIG_X86_NUMAQ
29 &apic_numaq,
30#endif
31#ifdef CONFIG_X86_SUMMIT
27 &apic_summit, 32 &apic_summit,
33#endif
34#ifdef CONFIG_X86_BIGSMP
28 &apic_bigsmp, 35 &apic_bigsmp,
36#endif
37#ifdef CONFIG_X86_ES7000
29 &apic_es7000, 38 &apic_es7000,
39#endif
30 &apic_default, /* must be last */ 40 &apic_default, /* must be last */
31 NULL, 41 NULL,
32}; 42};
@@ -54,6 +64,7 @@ early_param("apic", parse_apic);
54 64
55void __init generic_bigsmp_probe(void) 65void __init generic_bigsmp_probe(void)
56{ 66{
67#ifdef CONFIG_X86_BIGSMP
57 /* 68 /*
58 * This routine is used to switch to bigsmp mode when 69 * This routine is used to switch to bigsmp mode when
59 * - There is no apic= option specified by the user 70 * - There is no apic= option specified by the user
@@ -67,6 +78,7 @@ void __init generic_bigsmp_probe(void)
67 printk(KERN_INFO "Overriding APIC driver with %s\n", 78 printk(KERN_INFO "Overriding APIC driver with %s\n",
68 genapic->name); 79 genapic->name);
69 } 80 }
81#endif
70} 82}
71 83
72void __init generic_apic_probe(void) 84void __init generic_apic_probe(void)
@@ -88,7 +100,8 @@ void __init generic_apic_probe(void)
88 100
89/* These functions can switch the APIC even after the initial ->probe() */ 101/* These functions can switch the APIC even after the initial ->probe() */
90 102
91int __init mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid) 103int __init mps_oem_check(struct mp_config_table *mpc, char *oem,
104 char *productid)
92{ 105{
93 int i; 106 int i;
94 for (i = 0; apic_probe[i]; ++i) { 107 for (i = 0; apic_probe[i]; ++i) {
diff --git a/arch/x86/mach-visws/Makefile b/arch/x86/mach-visws/Makefile
deleted file mode 100644
index 835fd96ad768..000000000000
--- a/arch/x86/mach-visws/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5obj-y := setup.o traps.o reboot.o
6
7obj-$(CONFIG_X86_VISWS_APIC) += visws_apic.o
8obj-$(CONFIG_X86_LOCAL_APIC) += mpparse.o
diff --git a/arch/x86/mach-visws/mpparse.c b/arch/x86/mach-visws/mpparse.c
deleted file mode 100644
index 57484e91ab90..000000000000
--- a/arch/x86/mach-visws/mpparse.c
+++ /dev/null
@@ -1,88 +0,0 @@
1
2#include <linux/init.h>
3#include <linux/smp.h>
4
5#include <asm/smp.h>
6#include <asm/io.h>
7
8#include "cobalt.h"
9#include "mach_apic.h"
10
11/* Have we found an MP table */
12int smp_found_config;
13
14int pic_mode;
15
16extern unsigned int __cpuinitdata maxcpus;
17
18/*
19 * The Visual Workstation is Intel MP compliant in the hardware
20 * sense, but it doesn't have a BIOS(-configuration table).
21 * No problem for Linux.
22 */
23
24static void __init MP_processor_info (struct mpc_config_processor *m)
25{
26 int ver, logical_apicid;
27 physid_mask_t apic_cpus;
28
29 if (!(m->mpc_cpuflag & CPU_ENABLED))
30 return;
31
32 logical_apicid = m->mpc_apicid;
33 printk(KERN_INFO "%sCPU #%d %u:%u APIC version %d\n",
34 m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "",
35 m->mpc_apicid,
36 (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
37 (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
38 m->mpc_apicver);
39
40 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR)
41 boot_cpu_physical_apicid = m->mpc_apicid;
42
43 ver = m->mpc_apicver;
44 if ((ver >= 0x14 && m->mpc_apicid >= 0xff) || m->mpc_apicid >= 0xf) {
45 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
46 m->mpc_apicid, MAX_APICS);
47 return;
48 }
49
50 apic_cpus = apicid_to_cpu_present(m->mpc_apicid);
51 physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus);
52 /*
53 * Validate version
54 */
55 if (ver == 0x0) {
56 printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! "
57 "fixing up to 0x10. (tell your hw vendor)\n",
58 m->mpc_apicid);
59 ver = 0x10;
60 }
61 apic_version[m->mpc_apicid] = ver;
62}
63
64void __init find_smp_config(void)
65{
66 struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS);
67 unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
68
69 if (ncpus > CO_CPU_MAX) {
70 printk(KERN_WARNING "find_visws_smp: got cpu count of %d at %p\n",
71 ncpus, mp);
72
73 ncpus = CO_CPU_MAX;
74 }
75
76 if (ncpus > maxcpus)
77 ncpus = maxcpus;
78
79 smp_found_config = 1;
80 while (ncpus--)
81 MP_processor_info(mp++);
82
83 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
84}
85
86void __init get_smp_config (void)
87{
88}
diff --git a/arch/x86/mach-visws/reboot.c b/arch/x86/mach-visws/reboot.c
deleted file mode 100644
index 99332abfad42..000000000000
--- a/arch/x86/mach-visws/reboot.c
+++ /dev/null
@@ -1,55 +0,0 @@
1#include <linux/module.h>
2#include <linux/smp.h>
3#include <linux/delay.h>
4
5#include <asm/io.h>
6#include "piix4.h"
7
8void (*pm_power_off)(void);
9EXPORT_SYMBOL(pm_power_off);
10
11void machine_shutdown(void)
12{
13#ifdef CONFIG_SMP
14 smp_send_stop();
15#endif
16}
17
18void machine_emergency_restart(void)
19{
20 /*
21 * Visual Workstations restart after this
22 * register is poked on the PIIX4
23 */
24 outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
25}
26
27void machine_restart(char * __unused)
28{
29 machine_shutdown();
30 machine_emergency_restart();
31}
32
33void machine_power_off(void)
34{
35 unsigned short pm_status;
36 extern unsigned int pci_bus0;
37
38 while ((pm_status = inw(PMSTS_PORT)) & 0x100)
39 outw(pm_status, PMSTS_PORT);
40
41 outw(PM_SUSPEND_ENABLE, PMCNTRL_PORT);
42
43 mdelay(10);
44
45#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
46 (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
47
48 outl(PCI_CONF1_ADDRESS(pci_bus0, SPECIAL_DEV, SPECIAL_REG), 0xCF8);
49 outl(PIIX_SPECIAL_STOP, 0xCFC);
50}
51
52void machine_halt(void)
53{
54}
55
diff --git a/arch/x86/mach-visws/setup.c b/arch/x86/mach-visws/setup.c
deleted file mode 100644
index de4c9dbd086f..000000000000
--- a/arch/x86/mach-visws/setup.c
+++ /dev/null
@@ -1,183 +0,0 @@
1/*
2 * Unmaintained SGI Visual Workstation support.
3 * Split out from setup.c by davej@suse.de
4 */
5
6#include <linux/smp.h>
7#include <linux/init.h>
8#include <linux/interrupt.h>
9#include <linux/module.h>
10
11#include <asm/fixmap.h>
12#include <asm/arch_hooks.h>
13#include <asm/io.h>
14#include <asm/e820.h>
15#include <asm/setup.h>
16#include "cobalt.h"
17#include "piix4.h"
18
19int no_broadcast;
20
21char visws_board_type = -1;
22char visws_board_rev = -1;
23
24void __init visws_get_board_type_and_rev(void)
25{
26 int raw;
27
28 visws_board_type = (char)(inb_p(PIIX_GPI_BD_REG) & PIIX_GPI_BD_REG)
29 >> PIIX_GPI_BD_SHIFT;
30 /*
31 * Get Board rev.
32 * First, we have to initialize the 307 part to allow us access
33 * to the GPIO registers. Let's map them at 0x0fc0 which is right
34 * after the PIIX4 PM section.
35 */
36 outb_p(SIO_DEV_SEL, SIO_INDEX);
37 outb_p(SIO_GP_DEV, SIO_DATA); /* Talk to GPIO regs. */
38
39 outb_p(SIO_DEV_MSB, SIO_INDEX);
40 outb_p(SIO_GP_MSB, SIO_DATA); /* MSB of GPIO base address */
41
42 outb_p(SIO_DEV_LSB, SIO_INDEX);
43 outb_p(SIO_GP_LSB, SIO_DATA); /* LSB of GPIO base address */
44
45 outb_p(SIO_DEV_ENB, SIO_INDEX);
46 outb_p(1, SIO_DATA); /* Enable GPIO registers. */
47
48 /*
49 * Now, we have to map the power management section to write
50 * a bit which enables access to the GPIO registers.
51 * What lunatic came up with this shit?
52 */
53 outb_p(SIO_DEV_SEL, SIO_INDEX);
54 outb_p(SIO_PM_DEV, SIO_DATA); /* Talk to GPIO regs. */
55
56 outb_p(SIO_DEV_MSB, SIO_INDEX);
57 outb_p(SIO_PM_MSB, SIO_DATA); /* MSB of PM base address */
58
59 outb_p(SIO_DEV_LSB, SIO_INDEX);
60 outb_p(SIO_PM_LSB, SIO_DATA); /* LSB of PM base address */
61
62 outb_p(SIO_DEV_ENB, SIO_INDEX);
63 outb_p(1, SIO_DATA); /* Enable PM registers. */
64
65 /*
66 * Now, write the PM register which enables the GPIO registers.
67 */
68 outb_p(SIO_PM_FER2, SIO_PM_INDEX);
69 outb_p(SIO_PM_GP_EN, SIO_PM_DATA);
70
71 /*
72 * Now, initialize the GPIO registers.
73 * We want them all to be inputs which is the
74 * power on default, so let's leave them alone.
75 * So, let's just read the board rev!
76 */
77 raw = inb_p(SIO_GP_DATA1);
78 raw &= 0x7f; /* 7 bits of valid board revision ID. */
79
80 if (visws_board_type == VISWS_320) {
81 if (raw < 0x6) {
82 visws_board_rev = 4;
83 } else if (raw < 0xc) {
84 visws_board_rev = 5;
85 } else {
86 visws_board_rev = 6;
87 }
88 } else if (visws_board_type == VISWS_540) {
89 visws_board_rev = 2;
90 } else {
91 visws_board_rev = raw;
92 }
93
94 printk(KERN_INFO "Silicon Graphics Visual Workstation %s (rev %d) detected\n",
95 (visws_board_type == VISWS_320 ? "320" :
96 (visws_board_type == VISWS_540 ? "540" :
97 "unknown")), visws_board_rev);
98}
99
100void __init pre_intr_init_hook(void)
101{
102 init_VISWS_APIC_irqs();
103}
104
105void __init intr_init_hook(void)
106{
107#ifdef CONFIG_X86_LOCAL_APIC
108 apic_intr_init();
109#endif
110}
111
112void __init pre_setup_arch_hook()
113{
114 visws_get_board_type_and_rev();
115}
116
117static struct irqaction irq0 = {
118 .handler = timer_interrupt,
119 .flags = IRQF_DISABLED | IRQF_IRQPOLL,
120 .name = "timer",
121};
122
123void __init time_init_hook(void)
124{
125 printk(KERN_INFO "Starting Cobalt Timer system clock\n");
126
127 /* Set the countdown value */
128 co_cpu_write(CO_CPU_TIMEVAL, CO_TIME_HZ/HZ);
129
130 /* Start the timer */
131 co_cpu_write(CO_CPU_CTRL, co_cpu_read(CO_CPU_CTRL) | CO_CTRL_TIMERUN);
132
133 /* Enable (unmask) the timer interrupt */
134 co_cpu_write(CO_CPU_CTRL, co_cpu_read(CO_CPU_CTRL) & ~CO_CTRL_TIMEMASK);
135
136 /* Wire cpu IDT entry to s/w handler (and Cobalt APIC to IDT) */
137 setup_irq(0, &irq0);
138}
139
140/* Hook for machine specific memory setup. */
141
142#define MB (1024 * 1024)
143
144unsigned long sgivwfb_mem_phys;
145unsigned long sgivwfb_mem_size;
146EXPORT_SYMBOL(sgivwfb_mem_phys);
147EXPORT_SYMBOL(sgivwfb_mem_size);
148
149long long mem_size __initdata = 0;
150
151char * __init machine_specific_memory_setup(void)
152{
153 long long gfx_mem_size = 8 * MB;
154
155 mem_size = boot_params.alt_mem_k;
156
157 if (!mem_size) {
158 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
159 mem_size = 128 * MB;
160 }
161
162 /*
163 * this hardcodes the graphics memory to 8 MB
164 * it really should be sized dynamically (or at least
165 * set as a boot param)
166 */
167 if (!sgivwfb_mem_size) {
168 printk(KERN_WARNING "Defaulting to 8 MB framebuffer size\n");
169 sgivwfb_mem_size = 8 * MB;
170 }
171
172 /*
173 * Trim to nearest MB
174 */
175 sgivwfb_mem_size &= ~((1 << 20) - 1);
176 sgivwfb_mem_phys = mem_size - gfx_mem_size;
177
178 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
179 add_memory_region(HIGH_MEMORY, mem_size - sgivwfb_mem_size - HIGH_MEMORY, E820_RAM);
180 add_memory_region(sgivwfb_mem_phys, sgivwfb_mem_size, E820_RESERVED);
181
182 return "PROM";
183}
diff --git a/arch/x86/mach-visws/traps.c b/arch/x86/mach-visws/traps.c
deleted file mode 100644
index bfac6ba10f8a..000000000000
--- a/arch/x86/mach-visws/traps.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/* VISWS traps */
2
3#include <linux/sched.h>
4#include <linux/kernel.h>
5#include <linux/init.h>
6#include <linux/pci.h>
7#include <linux/pci_ids.h>
8
9#include <asm/io.h>
10#include <asm/arch_hooks.h>
11#include <asm/apic.h>
12#include "cobalt.h"
13#include "lithium.h"
14
15
16#define A01234 (LI_INTA_0 | LI_INTA_1 | LI_INTA_2 | LI_INTA_3 | LI_INTA_4)
17#define BCD (LI_INTB | LI_INTC | LI_INTD)
18#define ALLDEVS (A01234 | BCD)
19
20static __init void lithium_init(void)
21{
22 set_fixmap(FIX_LI_PCIA, LI_PCI_A_PHYS);
23 set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS);
24
25 if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
26 (li_pcia_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) {
27 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A');
28 panic("This machine is not SGI Visual Workstation 320/540");
29 }
30
31 if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
32 (li_pcib_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) {
33 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B');
34 panic("This machine is not SGI Visual Workstation 320/540");
35 }
36
37 li_pcia_write16(LI_PCI_INTEN, ALLDEVS);
38 li_pcib_write16(LI_PCI_INTEN, ALLDEVS);
39}
40
41static __init void cobalt_init(void)
42{
43 /*
44 * On normal SMP PC this is used only with SMP, but we have to
45 * use it and set it up here to start the Cobalt clock
46 */
47 set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
48 setup_local_APIC();
49 printk(KERN_INFO "Local APIC Version %#x, ID %#x\n",
50 (unsigned int)apic_read(APIC_LVR),
51 (unsigned int)apic_read(APIC_ID));
52
53 set_fixmap(FIX_CO_CPU, CO_CPU_PHYS);
54 set_fixmap(FIX_CO_APIC, CO_APIC_PHYS);
55 printk(KERN_INFO "Cobalt Revision %#lx, APIC ID %#lx\n",
56 co_cpu_read(CO_CPU_REV), co_apic_read(CO_APIC_ID));
57
58 /* Enable Cobalt APIC being careful to NOT change the ID! */
59 co_apic_write(CO_APIC_ID, co_apic_read(CO_APIC_ID) | CO_APIC_ENABLE);
60
61 printk(KERN_INFO "Cobalt APIC enabled: ID reg %#lx\n",
62 co_apic_read(CO_APIC_ID));
63}
64
65void __init trap_init_hook(void)
66{
67 lithium_init();
68 cobalt_init();
69}
diff --git a/arch/x86/mach-visws/visws_apic.c b/arch/x86/mach-visws/visws_apic.c
deleted file mode 100644
index cef9cb1d15ac..000000000000
--- a/arch/x86/mach-visws/visws_apic.c
+++ /dev/null
@@ -1,297 +0,0 @@
1/*
2 * Copyright (C) 1999 Bent Hagemark, Ingo Molnar
3 *
4 * SGI Visual Workstation interrupt controller
5 *
6 * The Cobalt system ASIC in the Visual Workstation contains a "Cobalt" APIC
7 * which serves as the main interrupt controller in the system. Non-legacy
8 * hardware in the system uses this controller directly. Legacy devices
9 * are connected to the PIIX4 which in turn has its 8259(s) connected to
10 * a of the Cobalt APIC entry.
11 *
12 * 09/02/2000 - Updated for 2.4 by jbarnes@sgi.com
13 *
14 * 25/11/2002 - Updated for 2.5 by Andrey Panin <pazke@orbita1.ru>
15 */
16
17#include <linux/kernel_stat.h>
18#include <linux/interrupt.h>
19#include <linux/init.h>
20
21#include <asm/io.h>
22#include <asm/apic.h>
23#include <asm/i8259.h>
24
25#include "cobalt.h"
26#include "irq_vectors.h"
27
28
29static DEFINE_SPINLOCK(cobalt_lock);
30
31/*
32 * Set the given Cobalt APIC Redirection Table entry to point
33 * to the given IDT vector/index.
34 */
35static inline void co_apic_set(int entry, int irq)
36{
37 co_apic_write(CO_APIC_LO(entry), CO_APIC_LEVEL | (irq + FIRST_EXTERNAL_VECTOR));
38 co_apic_write(CO_APIC_HI(entry), 0);
39}
40
41/*
42 * Cobalt (IO)-APIC functions to handle PCI devices.
43 */
44static inline int co_apic_ide0_hack(void)
45{
46 extern char visws_board_type;
47 extern char visws_board_rev;
48
49 if (visws_board_type == VISWS_320 && visws_board_rev == 5)
50 return 5;
51 return CO_APIC_IDE0;
52}
53
54static int is_co_apic(unsigned int irq)
55{
56 if (IS_CO_APIC(irq))
57 return CO_APIC(irq);
58
59 switch (irq) {
60 case 0: return CO_APIC_CPU;
61 case CO_IRQ_IDE0: return co_apic_ide0_hack();
62 case CO_IRQ_IDE1: return CO_APIC_IDE1;
63 default: return -1;
64 }
65}
66
67
68/*
69 * This is the SGI Cobalt (IO-)APIC:
70 */
71
72static void enable_cobalt_irq(unsigned int irq)
73{
74 co_apic_set(is_co_apic(irq), irq);
75}
76
77static void disable_cobalt_irq(unsigned int irq)
78{
79 int entry = is_co_apic(irq);
80
81 co_apic_write(CO_APIC_LO(entry), CO_APIC_MASK);
82 co_apic_read(CO_APIC_LO(entry));
83}
84
85/*
86 * "irq" really just serves to identify the device. Here is where we
87 * map this to the Cobalt APIC entry where it's physically wired.
88 * This is called via request_irq -> setup_irq -> irq_desc->startup()
89 */
90static unsigned int startup_cobalt_irq(unsigned int irq)
91{
92 unsigned long flags;
93
94 spin_lock_irqsave(&cobalt_lock, flags);
95 if ((irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING)))
96 irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING);
97 enable_cobalt_irq(irq);
98 spin_unlock_irqrestore(&cobalt_lock, flags);
99 return 0;
100}
101
102static void ack_cobalt_irq(unsigned int irq)
103{
104 unsigned long flags;
105
106 spin_lock_irqsave(&cobalt_lock, flags);
107 disable_cobalt_irq(irq);
108 apic_write(APIC_EOI, APIC_EIO_ACK);
109 spin_unlock_irqrestore(&cobalt_lock, flags);
110}
111
112static void end_cobalt_irq(unsigned int irq)
113{
114 unsigned long flags;
115
116 spin_lock_irqsave(&cobalt_lock, flags);
117 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
118 enable_cobalt_irq(irq);
119 spin_unlock_irqrestore(&cobalt_lock, flags);
120}
121
122static struct irq_chip cobalt_irq_type = {
123 .typename = "Cobalt-APIC",
124 .startup = startup_cobalt_irq,
125 .shutdown = disable_cobalt_irq,
126 .enable = enable_cobalt_irq,
127 .disable = disable_cobalt_irq,
128 .ack = ack_cobalt_irq,
129 .end = end_cobalt_irq,
130};
131
132
133/*
134 * This is the PIIX4-based 8259 that is wired up indirectly to Cobalt
135 * -- not the manner expected by the code in i8259.c.
136 *
137 * there is a 'master' physical interrupt source that gets sent to
138 * the CPU. But in the chipset there are various 'virtual' interrupts
139 * waiting to be handled. We represent this to Linux through a 'master'
140 * interrupt controller type, and through a special virtual interrupt-
141 * controller. Device drivers only see the virtual interrupt sources.
142 */
143static unsigned int startup_piix4_master_irq(unsigned int irq)
144{
145 init_8259A(0);
146
147 return startup_cobalt_irq(irq);
148}
149
150static void end_piix4_master_irq(unsigned int irq)
151{
152 unsigned long flags;
153
154 spin_lock_irqsave(&cobalt_lock, flags);
155 enable_cobalt_irq(irq);
156 spin_unlock_irqrestore(&cobalt_lock, flags);
157}
158
159static struct irq_chip piix4_master_irq_type = {
160 .typename = "PIIX4-master",
161 .startup = startup_piix4_master_irq,
162 .ack = ack_cobalt_irq,
163 .end = end_piix4_master_irq,
164};
165
166
167static struct irq_chip piix4_virtual_irq_type = {
168 .typename = "PIIX4-virtual",
169 .shutdown = disable_8259A_irq,
170 .enable = enable_8259A_irq,
171 .disable = disable_8259A_irq,
172};
173
174
175/*
176 * PIIX4-8259 master/virtual functions to handle interrupt requests
177 * from legacy devices: floppy, parallel, serial, rtc.
178 *
179 * None of these get Cobalt APIC entries, neither do they have IDT
180 * entries. These interrupts are purely virtual and distributed from
181 * the 'master' interrupt source: CO_IRQ_8259.
182 *
183 * When the 8259 interrupts its handler figures out which of these
184 * devices is interrupting and dispatches to its handler.
185 *
186 * CAREFUL: devices see the 'virtual' interrupt only. Thus disable/
187 * enable_irq gets the right irq. This 'master' irq is never directly
188 * manipulated by any driver.
189 */
190static irqreturn_t piix4_master_intr(int irq, void *dev_id)
191{
192 int realirq;
193 irq_desc_t *desc;
194 unsigned long flags;
195
196 spin_lock_irqsave(&i8259A_lock, flags);
197
198 /* Find out what's interrupting in the PIIX4 master 8259 */
199 outb(0x0c, 0x20); /* OCW3 Poll command */
200 realirq = inb(0x20);
201
202 /*
203 * Bit 7 == 0 means invalid/spurious
204 */
205 if (unlikely(!(realirq & 0x80)))
206 goto out_unlock;
207
208 realirq &= 7;
209
210 if (unlikely(realirq == 2)) {
211 outb(0x0c, 0xa0);
212 realirq = inb(0xa0);
213
214 if (unlikely(!(realirq & 0x80)))
215 goto out_unlock;
216
217 realirq = (realirq & 7) + 8;
218 }
219
220 /* mask and ack interrupt */
221 cached_irq_mask |= 1 << realirq;
222 if (unlikely(realirq > 7)) {
223 inb(0xa1);
224 outb(cached_slave_mask, 0xa1);
225 outb(0x60 + (realirq & 7), 0xa0);
226 outb(0x60 + 2, 0x20);
227 } else {
228 inb(0x21);
229 outb(cached_master_mask, 0x21);
230 outb(0x60 + realirq, 0x20);
231 }
232
233 spin_unlock_irqrestore(&i8259A_lock, flags);
234
235 desc = irq_desc + realirq;
236
237 /*
238 * handle this 'virtual interrupt' as a Cobalt one now.
239 */
240 kstat_cpu(smp_processor_id()).irqs[realirq]++;
241
242 if (likely(desc->action != NULL))
243 handle_IRQ_event(realirq, desc->action);
244
245 if (!(desc->status & IRQ_DISABLED))
246 enable_8259A_irq(realirq);
247
248 return IRQ_HANDLED;
249
250out_unlock:
251 spin_unlock_irqrestore(&i8259A_lock, flags);
252 return IRQ_NONE;
253}
254
255static struct irqaction master_action = {
256 .handler = piix4_master_intr,
257 .name = "PIIX4-8259",
258};
259
260static struct irqaction cascade_action = {
261 .handler = no_action,
262 .name = "cascade",
263};
264
265
266void init_VISWS_APIC_irqs(void)
267{
268 int i;
269
270 for (i = 0; i < CO_IRQ_APIC0 + CO_APIC_LAST + 1; i++) {
271 irq_desc[i].status = IRQ_DISABLED;
272 irq_desc[i].action = 0;
273 irq_desc[i].depth = 1;
274
275 if (i == 0) {
276 irq_desc[i].chip = &cobalt_irq_type;
277 }
278 else if (i == CO_IRQ_IDE0) {
279 irq_desc[i].chip = &cobalt_irq_type;
280 }
281 else if (i == CO_IRQ_IDE1) {
282 irq_desc[i].chip = &cobalt_irq_type;
283 }
284 else if (i == CO_IRQ_8259) {
285 irq_desc[i].chip = &piix4_master_irq_type;
286 }
287 else if (i < CO_IRQ_APIC0) {
288 irq_desc[i].chip = &piix4_virtual_irq_type;
289 }
290 else if (IS_CO_APIC(i)) {
291 irq_desc[i].chip = &cobalt_irq_type;
292 }
293 }
294
295 setup_irq(CO_IRQ_8259, &master_action);
296 setup_irq(2, &cascade_action);
297}
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c
index 5ae5466b9eb9..6bbdd633864c 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -62,6 +62,7 @@ void __init time_init_hook(void)
62char *__init machine_specific_memory_setup(void) 62char *__init machine_specific_memory_setup(void)
63{ 63{
64 char *who; 64 char *who;
65 int new_nr;
65 66
66 who = "NOT VOYAGER"; 67 who = "NOT VOYAGER";
67 68
@@ -73,7 +74,7 @@ char *__init machine_specific_memory_setup(void)
73 74
74 e820.nr_map = 0; 75 e820.nr_map = 0;
75 for (i = 0; voyager_memory_detect(i, &addr, &length); i++) { 76 for (i = 0; voyager_memory_detect(i, &addr, &length); i++) {
76 add_memory_region(addr, length, E820_RAM); 77 e820_add_region(addr, length, E820_RAM);
77 } 78 }
78 return who; 79 return who;
79 } else if (voyager_level == 4) { 80 } else if (voyager_level == 4) {
@@ -91,43 +92,17 @@ char *__init machine_specific_memory_setup(void)
91 tom = (boot_params.screen_info.ext_mem_k) << 10; 92 tom = (boot_params.screen_info.ext_mem_k) << 10;
92 } 93 }
93 who = "Voyager-TOM"; 94 who = "Voyager-TOM";
94 add_memory_region(0, 0x9f000, E820_RAM); 95 e820_add_region(0, 0x9f000, E820_RAM);
95 /* map from 1M to top of memory */ 96 /* map from 1M to top of memory */
96 add_memory_region(1 * 1024 * 1024, tom - 1 * 1024 * 1024, 97 e820_add_region(1 * 1024 * 1024, tom - 1 * 1024 * 1024,
97 E820_RAM); 98 E820_RAM);
98 /* FIXME: Should check the ASICs to see if I need to 99 /* FIXME: Should check the ASICs to see if I need to
99 * take out the 8M window. Just do it at the moment 100 * take out the 8M window. Just do it at the moment
100 * */ 101 * */
101 add_memory_region(8 * 1024 * 1024, 8 * 1024 * 1024, 102 e820_add_region(8 * 1024 * 1024, 8 * 1024 * 1024,
102 E820_RESERVED); 103 E820_RESERVED);
103 return who; 104 return who;
104 } 105 }
105 106
106 who = "BIOS-e820"; 107 return default_machine_specific_memory_setup();
107
108 /*
109 * Try to copy the BIOS-supplied E820-map.
110 *
111 * Otherwise fake a memory map; one section from 0k->640k,
112 * the next section from 1mb->appropriate_mem_k
113 */
114 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
115 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
116 < 0) {
117 unsigned long mem_size;
118
119 /* compare results from other methods and take the greater */
120 if (boot_params.alt_mem_k < boot_params.screen_info.ext_mem_k) {
121 mem_size = boot_params.screen_info.ext_mem_k;
122 who = "BIOS-88";
123 } else {
124 mem_size = boot_params.alt_mem_k;
125 who = "BIOS-e801";
126 }
127
128 e820.nr_map = 0;
129 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
130 add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
131 }
132 return who;
133} 108}
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 8acbf0cdf1a5..8dedd01e909f 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -59,11 +59,6 @@ __u32 voyager_quad_processors = 0;
59 * activity count. Finally exported by i386_ksyms.c */ 59 * activity count. Finally exported by i386_ksyms.c */
60static int voyager_extended_cpus = 1; 60static int voyager_extended_cpus = 1;
61 61
62/* Have we found an SMP box - used by time.c to do the profiling
63 interrupt for timeslicing; do not set to 1 until the per CPU timer
64 interrupt is active */
65int smp_found_config = 0;
66
67/* Used for the invalidate map that's also checked in the spinlock */ 62/* Used for the invalidate map that's also checked in the spinlock */
68static volatile unsigned long smp_invalidate_needed; 63static volatile unsigned long smp_invalidate_needed;
69 64
@@ -1137,15 +1132,6 @@ void flush_tlb_all(void)
1137 on_each_cpu(do_flush_tlb_all, 0, 1, 1); 1132 on_each_cpu(do_flush_tlb_all, 0, 1, 1);
1138} 1133}
1139 1134
1140/* used to set up the trampoline for other CPUs when the memory manager
1141 * is sorted out */
1142void __init smp_alloc_memory(void)
1143{
1144 trampoline_base = alloc_bootmem_low_pages(PAGE_SIZE);
1145 if (__pa(trampoline_base) >= 0x93000)
1146 BUG();
1147}
1148
1149/* send a reschedule CPI to one CPU by physical CPU number*/ 1135/* send a reschedule CPI to one CPU by physical CPU number*/
1150static void voyager_smp_send_reschedule(int cpu) 1136static void voyager_smp_send_reschedule(int cpu)
1151{ 1137{
diff --git a/arch/x86/math-emu/reg_constant.c b/arch/x86/math-emu/reg_constant.c
index 04869e64b18e..00548354912f 100644
--- a/arch/x86/math-emu/reg_constant.c
+++ b/arch/x86/math-emu/reg_constant.c
@@ -16,8 +16,8 @@
16#include "reg_constant.h" 16#include "reg_constant.h"
17#include "control_w.h" 17#include "control_w.h"
18 18
19#define MAKE_REG(s,e,l,h) { l, h, \ 19#define MAKE_REG(s, e, l, h) { l, h, \
20 ((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) } 20 ((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) }
21 21
22FPU_REG const CONST_1 = MAKE_REG(POS, 0, 0x00000000, 0x80000000); 22FPU_REG const CONST_1 = MAKE_REG(POS, 0, 0x00000000, 0x80000000);
23#if 0 23#if 0
@@ -40,7 +40,7 @@ FPU_REG const CONST_PI2extra = MAKE_REG(NEG, -66,
40FPU_REG const CONST_Z = MAKE_REG(POS, EXP_UNDER, 0x0, 0x0); 40FPU_REG const CONST_Z = MAKE_REG(POS, EXP_UNDER, 0x0, 0x0);
41 41
42/* Only the sign and significand (and tag) are used in internal NaNs */ 42/* Only the sign and significand (and tag) are used in internal NaNs */
43/* The 80486 never generates one of these 43/* The 80486 never generates one of these
44FPU_REG const CONST_SNAN = MAKE_REG(POS, EXP_OVER, 0x00000001, 0x80000000); 44FPU_REG const CONST_SNAN = MAKE_REG(POS, EXP_OVER, 0x00000001, 0x80000000);
45 */ 45 */
46/* This is the real indefinite QNaN */ 46/* This is the real indefinite QNaN */
@@ -49,7 +49,7 @@ FPU_REG const CONST_QNaN = MAKE_REG(NEG, EXP_OVER, 0x00000000, 0xC0000000);
49/* Only the sign (and tag) is used in internal infinities */ 49/* Only the sign (and tag) is used in internal infinities */
50FPU_REG const CONST_INF = MAKE_REG(POS, EXP_OVER, 0x00000000, 0x80000000); 50FPU_REG const CONST_INF = MAKE_REG(POS, EXP_OVER, 0x00000000, 0x80000000);
51 51
52static void fld_const(FPU_REG const *c, int adj, u_char tag) 52static void fld_const(FPU_REG const * c, int adj, u_char tag)
53{ 53{
54 FPU_REG *st_new_ptr; 54 FPU_REG *st_new_ptr;
55 55
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index b7b3e4c7cfc9..9873716e9f76 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -8,10 +8,16 @@ obj-$(CONFIG_X86_PTDUMP) += dump_pagetables.o
8 8
9obj-$(CONFIG_HIGHMEM) += highmem_32.o 9obj-$(CONFIG_HIGHMEM) += highmem_32.o
10 10
11obj-$(CONFIG_MMIOTRACE_HOOKS) += kmmio.o
12obj-$(CONFIG_MMIOTRACE) += mmiotrace.o
13mmiotrace-y := pf_in.o mmio-mod.o
14obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o
15
11ifeq ($(CONFIG_X86_32),y) 16ifeq ($(CONFIG_X86_32),y)
12obj-$(CONFIG_NUMA) += discontig_32.o 17obj-$(CONFIG_NUMA) += discontig_32.o
13else 18else
14obj-$(CONFIG_NUMA) += numa_64.o 19obj-$(CONFIG_NUMA) += numa_64.o
15obj-$(CONFIG_K8_NUMA) += k8topology_64.o 20obj-$(CONFIG_K8_NUMA) += k8topology_64.o
16obj-$(CONFIG_ACPI_NUMA) += srat_64.o
17endif 21endif
22obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o
23
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 914ccf983687..5dfef9fa061a 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -38,6 +38,7 @@
38#include <asm/setup.h> 38#include <asm/setup.h>
39#include <asm/mmzone.h> 39#include <asm/mmzone.h>
40#include <asm/bios_ebda.h> 40#include <asm/bios_ebda.h>
41#include <asm/proto.h>
41 42
42struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; 43struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
43EXPORT_SYMBOL(node_data); 44EXPORT_SYMBOL(node_data);
@@ -59,14 +60,14 @@ unsigned long node_end_pfn[MAX_NUMNODES] __read_mostly;
59/* 60/*
60 * 4) physnode_map - the mapping between a pfn and owning node 61 * 4) physnode_map - the mapping between a pfn and owning node
61 * physnode_map keeps track of the physical memory layout of a generic 62 * physnode_map keeps track of the physical memory layout of a generic
62 * numa node on a 256Mb break (each element of the array will 63 * numa node on a 64Mb break (each element of the array will
63 * represent 256Mb of memory and will be marked by the node id. so, 64 * represent 64Mb of memory and will be marked by the node id. so,
64 * if the first gig is on node 0, and the second gig is on node 1 65 * if the first gig is on node 0, and the second gig is on node 1
65 * physnode_map will contain: 66 * physnode_map will contain:
66 * 67 *
67 * physnode_map[0-3] = 0; 68 * physnode_map[0-15] = 0;
68 * physnode_map[4-7] = 1; 69 * physnode_map[16-31] = 1;
69 * physnode_map[8- ] = -1; 70 * physnode_map[32- ] = -1;
70 */ 71 */
71s8 physnode_map[MAX_ELEMENTS] __read_mostly = { [0 ... (MAX_ELEMENTS - 1)] = -1}; 72s8 physnode_map[MAX_ELEMENTS] __read_mostly = { [0 ... (MAX_ELEMENTS - 1)] = -1};
72EXPORT_SYMBOL(physnode_map); 73EXPORT_SYMBOL(physnode_map);
@@ -75,15 +76,15 @@ void memory_present(int nid, unsigned long start, unsigned long end)
75{ 76{
76 unsigned long pfn; 77 unsigned long pfn;
77 78
78 printk(KERN_INFO "Node: %d, start_pfn: %ld, end_pfn: %ld\n", 79 printk(KERN_INFO "Node: %d, start_pfn: %lx, end_pfn: %lx\n",
79 nid, start, end); 80 nid, start, end);
80 printk(KERN_DEBUG " Setting physnode_map array to node %d for pfns:\n", nid); 81 printk(KERN_DEBUG " Setting physnode_map array to node %d for pfns:\n", nid);
81 printk(KERN_DEBUG " "); 82 printk(KERN_DEBUG " ");
82 for (pfn = start; pfn < end; pfn += PAGES_PER_ELEMENT) { 83 for (pfn = start; pfn < end; pfn += PAGES_PER_ELEMENT) {
83 physnode_map[pfn / PAGES_PER_ELEMENT] = nid; 84 physnode_map[pfn / PAGES_PER_ELEMENT] = nid;
84 printk("%ld ", pfn); 85 printk(KERN_CONT "%lx ", pfn);
85 } 86 }
86 printk("\n"); 87 printk(KERN_CONT "\n");
87} 88}
88 89
89unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn, 90unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn,
@@ -99,7 +100,6 @@ unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn,
99#endif 100#endif
100 101
101extern unsigned long find_max_low_pfn(void); 102extern unsigned long find_max_low_pfn(void);
102extern void add_one_highpage_init(struct page *, int, int);
103extern unsigned long highend_pfn, highstart_pfn; 103extern unsigned long highend_pfn, highstart_pfn;
104 104
105#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE) 105#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE)
@@ -117,13 +117,13 @@ static unsigned long kva_pages;
117 */ 117 */
118int __init get_memcfg_numa_flat(void) 118int __init get_memcfg_numa_flat(void)
119{ 119{
120 printk("NUMA - single node, flat memory mode\n"); 120 printk(KERN_DEBUG "NUMA - single node, flat memory mode\n");
121 121
122 /* Run the memory configuration and find the top of memory. */
123 propagate_e820_map();
124 node_start_pfn[0] = 0; 122 node_start_pfn[0] = 0;
125 node_end_pfn[0] = max_pfn; 123 node_end_pfn[0] = max_pfn;
124 e820_register_active_regions(0, 0, max_pfn);
126 memory_present(0, 0, max_pfn); 125 memory_present(0, 0, max_pfn);
126 node_remap_size[0] = node_memmap_size_bytes(0, 0, max_pfn);
127 127
128 /* Indicate there is one node available. */ 128 /* Indicate there is one node available. */
129 nodes_clear(node_online_map); 129 nodes_clear(node_online_map);
@@ -156,24 +156,32 @@ static void __init propagate_e820_map_node(int nid)
156 */ 156 */
157static void __init allocate_pgdat(int nid) 157static void __init allocate_pgdat(int nid)
158{ 158{
159 if (nid && node_has_online_mem(nid)) 159 char buf[16];
160
161 if (node_has_online_mem(nid) && node_remap_start_vaddr[nid])
160 NODE_DATA(nid) = (pg_data_t *)node_remap_start_vaddr[nid]; 162 NODE_DATA(nid) = (pg_data_t *)node_remap_start_vaddr[nid];
161 else { 163 else {
162 NODE_DATA(nid) = (pg_data_t *)(pfn_to_kaddr(min_low_pfn)); 164 unsigned long pgdat_phys;
163 min_low_pfn += PFN_UP(sizeof(pg_data_t)); 165 pgdat_phys = find_e820_area(min_low_pfn<<PAGE_SHIFT,
166 max_pfn_mapped<<PAGE_SHIFT,
167 sizeof(pg_data_t),
168 PAGE_SIZE);
169 NODE_DATA(nid) = (pg_data_t *)(pfn_to_kaddr(pgdat_phys>>PAGE_SHIFT));
170 memset(buf, 0, sizeof(buf));
171 sprintf(buf, "NODE_DATA %d", nid);
172 reserve_early(pgdat_phys, pgdat_phys + sizeof(pg_data_t), buf);
164 } 173 }
174 printk(KERN_DEBUG "allocate_pgdat: node %d NODE_DATA %08lx\n",
175 nid, (unsigned long)NODE_DATA(nid));
165} 176}
166 177
167#ifdef CONFIG_DISCONTIGMEM
168/* 178/*
169 * In the discontig memory model, a portion of the kernel virtual area (KVA) 179 * In the DISCONTIGMEM and SPARSEMEM memory model, a portion of the kernel
170 * is reserved and portions of nodes are mapped using it. This is to allow 180 * virtual address space (KVA) is reserved and portions of nodes are mapped
171 * node-local memory to be allocated for structures that would normally require 181 * using it. This is to allow node-local memory to be allocated for
172 * ZONE_NORMAL. The memory is allocated with alloc_remap() and callers 182 * structures that would normally require ZONE_NORMAL. The memory is
173 * should be prepared to allocate from the bootmem allocator instead. This KVA 183 * allocated with alloc_remap() and callers should be prepared to allocate
174 * mechanism is incompatible with SPARSEMEM as it makes assumptions about the 184 * from the bootmem allocator instead.
175 * layout of memory that are broken if alloc_remap() succeeds for some of the
176 * map and fails for others
177 */ 185 */
178static unsigned long node_remap_start_pfn[MAX_NUMNODES]; 186static unsigned long node_remap_start_pfn[MAX_NUMNODES];
179static void *node_remap_end_vaddr[MAX_NUMNODES]; 187static void *node_remap_end_vaddr[MAX_NUMNODES];
@@ -195,15 +203,19 @@ void *alloc_remap(int nid, unsigned long size)
195 return allocation; 203 return allocation;
196} 204}
197 205
198void __init remap_numa_kva(void) 206static void __init remap_numa_kva(void)
199{ 207{
200 void *vaddr; 208 void *vaddr;
201 unsigned long pfn; 209 unsigned long pfn;
202 int node; 210 int node;
203 211
204 for_each_online_node(node) { 212 for_each_online_node(node) {
213 printk(KERN_DEBUG "remap_numa_kva: node %d\n", node);
205 for (pfn=0; pfn < node_remap_size[node]; pfn += PTRS_PER_PTE) { 214 for (pfn=0; pfn < node_remap_size[node]; pfn += PTRS_PER_PTE) {
206 vaddr = node_remap_start_vaddr[node]+(pfn<<PAGE_SHIFT); 215 vaddr = node_remap_start_vaddr[node]+(pfn<<PAGE_SHIFT);
216 printk(KERN_DEBUG "remap_numa_kva: %08lx to pfn %08lx\n",
217 (unsigned long)vaddr,
218 node_remap_start_pfn[node] + pfn);
207 set_pmd_pfn((ulong) vaddr, 219 set_pmd_pfn((ulong) vaddr,
208 node_remap_start_pfn[node] + pfn, 220 node_remap_start_pfn[node] + pfn,
209 PAGE_KERNEL_LARGE); 221 PAGE_KERNEL_LARGE);
@@ -215,17 +227,21 @@ static unsigned long calculate_numa_remap_pages(void)
215{ 227{
216 int nid; 228 int nid;
217 unsigned long size, reserve_pages = 0; 229 unsigned long size, reserve_pages = 0;
218 unsigned long pfn;
219 230
220 for_each_online_node(nid) { 231 for_each_online_node(nid) {
221 unsigned old_end_pfn = node_end_pfn[nid]; 232 u64 node_kva_target;
233 u64 node_kva_final;
222 234
223 /* 235 /*
224 * The acpi/srat node info can show hot-add memroy zones 236 * The acpi/srat node info can show hot-add memroy zones
225 * where memory could be added but not currently present. 237 * where memory could be added but not currently present.
226 */ 238 */
239 printk(KERN_DEBUG "node %d pfn: [%lx - %lx]\n",
240 nid, node_start_pfn[nid], node_end_pfn[nid]);
227 if (node_start_pfn[nid] > max_pfn) 241 if (node_start_pfn[nid] > max_pfn)
228 continue; 242 continue;
243 if (!node_end_pfn[nid])
244 continue;
229 if (node_end_pfn[nid] > max_pfn) 245 if (node_end_pfn[nid] > max_pfn)
230 node_end_pfn[nid] = max_pfn; 246 node_end_pfn[nid] = max_pfn;
231 247
@@ -237,41 +253,48 @@ static unsigned long calculate_numa_remap_pages(void)
237 /* now the roundup is correct, convert to PAGE_SIZE pages */ 253 /* now the roundup is correct, convert to PAGE_SIZE pages */
238 size = size * PTRS_PER_PTE; 254 size = size * PTRS_PER_PTE;
239 255
240 /* 256 node_kva_target = round_down(node_end_pfn[nid] - size,
241 * Validate the region we are allocating only contains valid 257 PTRS_PER_PTE);
242 * pages. 258 node_kva_target <<= PAGE_SHIFT;
243 */ 259 do {
244 for (pfn = node_end_pfn[nid] - size; 260 node_kva_final = find_e820_area(node_kva_target,
245 pfn < node_end_pfn[nid]; pfn++) 261 ((u64)node_end_pfn[nid])<<PAGE_SHIFT,
246 if (!page_is_ram(pfn)) 262 ((u64)size)<<PAGE_SHIFT,
247 break; 263 LARGE_PAGE_BYTES);
248 264 node_kva_target -= LARGE_PAGE_BYTES;
249 if (pfn != node_end_pfn[nid]) 265 } while (node_kva_final == -1ULL &&
250 size = 0; 266 (node_kva_target>>PAGE_SHIFT) > (node_start_pfn[nid]));
267
268 if (node_kva_final == -1ULL)
269 panic("Can not get kva ram\n");
251 270
252 printk("Reserving %ld pages of KVA for lmem_map of node %d\n",
253 size, nid);
254 node_remap_size[nid] = size; 271 node_remap_size[nid] = size;
255 node_remap_offset[nid] = reserve_pages; 272 node_remap_offset[nid] = reserve_pages;
256 reserve_pages += size; 273 reserve_pages += size;
257 printk("Shrinking node %d from %ld pages to %ld pages\n", 274 printk(KERN_DEBUG "Reserving %ld pages of KVA for lmem_map of"
258 nid, node_end_pfn[nid], node_end_pfn[nid] - size); 275 " node %d at %llx\n",
259 276 size, nid, node_kva_final>>PAGE_SHIFT);
260 if (node_end_pfn[nid] & (PTRS_PER_PTE-1)) { 277
261 /* 278 /*
262 * Align node_end_pfn[] and node_remap_start_pfn[] to 279 * prevent kva address below max_low_pfn want it on system
263 * pmd boundary. remap_numa_kva will barf otherwise. 280 * with less memory later.
264 */ 281 * layout will be: KVA address , KVA RAM
265 printk("Shrinking node %d further by %ld pages for proper alignment\n", 282 *
266 nid, node_end_pfn[nid] & (PTRS_PER_PTE-1)); 283 * we are supposed to only record the one less then max_low_pfn
267 size += node_end_pfn[nid] & (PTRS_PER_PTE-1); 284 * but we could have some hole in high memory, and it will only
268 } 285 * check page_is_ram(pfn) && !page_is_reserved_early(pfn) to decide
286 * to use it as free.
287 * So reserve_early here, hope we don't run out of that array
288 */
289 reserve_early(node_kva_final,
290 node_kva_final+(((u64)size)<<PAGE_SHIFT),
291 "KVA RAM");
269 292
270 node_end_pfn[nid] -= size; 293 node_remap_start_pfn[nid] = node_kva_final>>PAGE_SHIFT;
271 node_remap_start_pfn[nid] = node_end_pfn[nid]; 294 remove_active_range(nid, node_remap_start_pfn[nid],
272 shrink_active_range(nid, old_end_pfn, node_end_pfn[nid]); 295 node_remap_start_pfn[nid] + size);
273 } 296 }
274 printk("Reserving total of %ld pages for numa KVA remap\n", 297 printk(KERN_INFO "Reserving total of %lx pages for numa KVA remap\n",
275 reserve_pages); 298 reserve_pages);
276 return reserve_pages; 299 return reserve_pages;
277} 300}
@@ -285,37 +308,16 @@ static void init_remap_allocator(int nid)
285 node_remap_alloc_vaddr[nid] = node_remap_start_vaddr[nid] + 308 node_remap_alloc_vaddr[nid] = node_remap_start_vaddr[nid] +
286 ALIGN(sizeof(pg_data_t), PAGE_SIZE); 309 ALIGN(sizeof(pg_data_t), PAGE_SIZE);
287 310
288 printk ("node %d will remap to vaddr %08lx - %08lx\n", nid, 311 printk(KERN_DEBUG "node %d will remap to vaddr %08lx - %08lx\n", nid,
289 (ulong) node_remap_start_vaddr[nid], 312 (ulong) node_remap_start_vaddr[nid],
290 (ulong) pfn_to_kaddr(highstart_pfn 313 (ulong) node_remap_end_vaddr[nid]);
291 + node_remap_offset[nid] + node_remap_size[nid]));
292}
293#else
294void *alloc_remap(int nid, unsigned long size)
295{
296 return NULL;
297}
298
299static unsigned long calculate_numa_remap_pages(void)
300{
301 return 0;
302}
303
304static void init_remap_allocator(int nid)
305{
306}
307
308void __init remap_numa_kva(void)
309{
310} 314}
311#endif /* CONFIG_DISCONTIGMEM */
312 315
313extern void setup_bootmem_allocator(void); 316void __init initmem_init(unsigned long start_pfn,
314unsigned long __init setup_memory(void) 317 unsigned long end_pfn)
315{ 318{
316 int nid; 319 int nid;
317 unsigned long system_start_pfn, system_max_low_pfn; 320 long kva_target_pfn;
318 unsigned long wasted_pages;
319 321
320 /* 322 /*
321 * When mapping a NUMA machine we allocate the node_mem_map arrays 323 * When mapping a NUMA machine we allocate the node_mem_map arrays
@@ -324,109 +326,77 @@ unsigned long __init setup_memory(void)
324 * this space and use it to adjust the boundary between ZONE_NORMAL 326 * this space and use it to adjust the boundary between ZONE_NORMAL
325 * and ZONE_HIGHMEM. 327 * and ZONE_HIGHMEM.
326 */ 328 */
327 get_memcfg_numa();
328 329
329 kva_pages = calculate_numa_remap_pages(); 330 get_memcfg_numa();
330 331
331 /* partially used pages are not usable - thus round upwards */ 332 kva_pages = round_up(calculate_numa_remap_pages(), PTRS_PER_PTE);
332 system_start_pfn = min_low_pfn = PFN_UP(init_pg_tables_end);
333 333
334 kva_start_pfn = find_max_low_pfn() - kva_pages; 334 kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE);
335 do {
336 kva_start_pfn = find_e820_area(kva_target_pfn<<PAGE_SHIFT,
337 max_low_pfn<<PAGE_SHIFT,
338 kva_pages<<PAGE_SHIFT,
339 PTRS_PER_PTE<<PAGE_SHIFT) >> PAGE_SHIFT;
340 kva_target_pfn -= PTRS_PER_PTE;
341 } while (kva_start_pfn == -1UL && kva_target_pfn > min_low_pfn);
335 342
336#ifdef CONFIG_BLK_DEV_INITRD 343 if (kva_start_pfn == -1UL)
337 /* Numa kva area is below the initrd */ 344 panic("Can not get kva space\n");
338 if (initrd_start)
339 kva_start_pfn = PFN_DOWN(initrd_start - PAGE_OFFSET)
340 - kva_pages;
341#endif
342 345
343 /* 346 printk(KERN_INFO "kva_start_pfn ~ %lx max_low_pfn ~ %lx\n",
344 * We waste pages past at the end of the KVA for no good reason other
345 * than how it is located. This is bad.
346 */
347 wasted_pages = kva_start_pfn & (PTRS_PER_PTE-1);
348 kva_start_pfn -= wasted_pages;
349 kva_pages += wasted_pages;
350
351 system_max_low_pfn = max_low_pfn = find_max_low_pfn();
352 printk("kva_start_pfn ~ %ld find_max_low_pfn() ~ %ld\n",
353 kva_start_pfn, max_low_pfn); 347 kva_start_pfn, max_low_pfn);
354 printk("max_pfn = %ld\n", max_pfn); 348 printk(KERN_INFO "max_pfn = %lx\n", max_pfn);
349
350 /* avoid clash with initrd */
351 reserve_early(kva_start_pfn<<PAGE_SHIFT,
352 (kva_start_pfn + kva_pages)<<PAGE_SHIFT,
353 "KVA PG");
355#ifdef CONFIG_HIGHMEM 354#ifdef CONFIG_HIGHMEM
356 highstart_pfn = highend_pfn = max_pfn; 355 highstart_pfn = highend_pfn = max_pfn;
357 if (max_pfn > system_max_low_pfn) 356 if (max_pfn > max_low_pfn)
358 highstart_pfn = system_max_low_pfn; 357 highstart_pfn = max_low_pfn;
359 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 358 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
360 pages_to_mb(highend_pfn - highstart_pfn)); 359 pages_to_mb(highend_pfn - highstart_pfn));
361 num_physpages = highend_pfn; 360 num_physpages = highend_pfn;
362 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 361 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
363#else 362#else
364 num_physpages = system_max_low_pfn; 363 num_physpages = max_low_pfn;
365 high_memory = (void *) __va(system_max_low_pfn * PAGE_SIZE - 1) + 1; 364 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
366#endif 365#endif
367 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", 366 printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
368 pages_to_mb(system_max_low_pfn)); 367 pages_to_mb(max_low_pfn));
369 printk("min_low_pfn = %ld, max_low_pfn = %ld, highstart_pfn = %ld\n", 368 printk(KERN_DEBUG "max_low_pfn = %lx, highstart_pfn = %lx\n",
370 min_low_pfn, max_low_pfn, highstart_pfn); 369 max_low_pfn, highstart_pfn);
371 370
372 printk("Low memory ends at vaddr %08lx\n", 371 printk(KERN_DEBUG "Low memory ends at vaddr %08lx\n",
373 (ulong) pfn_to_kaddr(max_low_pfn)); 372 (ulong) pfn_to_kaddr(max_low_pfn));
374 for_each_online_node(nid) { 373 for_each_online_node(nid) {
375 init_remap_allocator(nid); 374 init_remap_allocator(nid);
376 375
377 allocate_pgdat(nid); 376 allocate_pgdat(nid);
378 } 377 }
379 printk("High memory starts at vaddr %08lx\n", 378 remap_numa_kva();
379
380 printk(KERN_DEBUG "High memory starts at vaddr %08lx\n",
380 (ulong) pfn_to_kaddr(highstart_pfn)); 381 (ulong) pfn_to_kaddr(highstart_pfn));
381 for_each_online_node(nid) 382 for_each_online_node(nid)
382 propagate_e820_map_node(nid); 383 propagate_e820_map_node(nid);
383 384
384 memset(NODE_DATA(0), 0, sizeof(struct pglist_data)); 385 for_each_online_node(nid)
386 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
387
385 NODE_DATA(0)->bdata = &node0_bdata; 388 NODE_DATA(0)->bdata = &node0_bdata;
386 setup_bootmem_allocator(); 389 setup_bootmem_allocator();
387 return max_low_pfn;
388}
389
390void __init numa_kva_reserve(void)
391{
392 if (kva_pages)
393 reserve_bootmem(PFN_PHYS(kva_start_pfn), PFN_PHYS(kva_pages),
394 BOOTMEM_DEFAULT);
395} 390}
396 391
397void __init zone_sizes_init(void) 392void __init set_highmem_pages_init(void)
398{
399 int nid;
400 unsigned long max_zone_pfns[MAX_NR_ZONES];
401 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
402 max_zone_pfns[ZONE_DMA] =
403 virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
404 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
405#ifdef CONFIG_HIGHMEM
406 max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
407#endif
408
409 /* If SRAT has not registered memory, register it now */
410 if (find_max_pfn_with_active_regions() == 0) {
411 for_each_online_node(nid) {
412 if (node_has_online_mem(nid))
413 add_active_range(nid, node_start_pfn[nid],
414 node_end_pfn[nid]);
415 }
416 }
417
418 free_area_init_nodes(max_zone_pfns);
419 return;
420}
421
422void __init set_highmem_pages_init(int bad_ppro)
423{ 393{
424#ifdef CONFIG_HIGHMEM 394#ifdef CONFIG_HIGHMEM
425 struct zone *zone; 395 struct zone *zone;
426 struct page *page; 396 int nid;
427 397
428 for_each_zone(zone) { 398 for_each_zone(zone) {
429 unsigned long node_pfn, zone_start_pfn, zone_end_pfn; 399 unsigned long zone_start_pfn, zone_end_pfn;
430 400
431 if (!is_highmem(zone)) 401 if (!is_highmem(zone))
432 continue; 402 continue;
@@ -434,16 +404,12 @@ void __init set_highmem_pages_init(int bad_ppro)
434 zone_start_pfn = zone->zone_start_pfn; 404 zone_start_pfn = zone->zone_start_pfn;
435 zone_end_pfn = zone_start_pfn + zone->spanned_pages; 405 zone_end_pfn = zone_start_pfn + zone->spanned_pages;
436 406
437 printk("Initializing %s for node %d (%08lx:%08lx)\n", 407 nid = zone_to_nid(zone);
438 zone->name, zone_to_nid(zone), 408 printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
439 zone_start_pfn, zone_end_pfn); 409 zone->name, nid, zone_start_pfn, zone_end_pfn);
440 410
441 for (node_pfn = zone_start_pfn; node_pfn < zone_end_pfn; node_pfn++) { 411 add_highpages_with_active_regions(nid, zone_start_pfn,
442 if (!pfn_valid(node_pfn)) 412 zone_end_pfn);
443 continue;
444 page = pfn_to_page(node_pfn);
445 add_one_highpage_init(page, node_pfn, bad_ppro);
446 }
447 } 413 }
448 totalram_pages += totalhigh_pages; 414 totalram_pages += totalhigh_pages;
449#endif 415#endif
@@ -476,3 +442,4 @@ int memory_add_physaddr_to_nid(u64 addr)
476 442
477EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 443EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
478#endif 444#endif
445
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 2c24bea92c66..0bb0caed8971 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -42,7 +42,7 @@ static struct addr_marker address_markers[] = {
42 { 0, "User Space" }, 42 { 0, "User Space" },
43#ifdef CONFIG_X86_64 43#ifdef CONFIG_X86_64
44 { 0x8000000000000000UL, "Kernel Space" }, 44 { 0x8000000000000000UL, "Kernel Space" },
45 { 0xffff810000000000UL, "Low Kernel Mapping" }, 45 { PAGE_OFFSET, "Low Kernel Mapping" },
46 { VMALLOC_START, "vmalloc() Area" }, 46 { VMALLOC_START, "vmalloc() Area" },
47 { VMEMMAP_START, "Vmemmap" }, 47 { VMEMMAP_START, "Vmemmap" },
48 { __START_KERNEL_map, "High Kernel Mapping" }, 48 { __START_KERNEL_map, "High Kernel Mapping" },
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 8bcb6f40ccb6..455f3fe67b42 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -10,6 +10,7 @@
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ptrace.h> 12#include <linux/ptrace.h>
13#include <linux/mmiotrace.h>
13#include <linux/mman.h> 14#include <linux/mman.h>
14#include <linux/mm.h> 15#include <linux/mm.h>
15#include <linux/smp.h> 16#include <linux/smp.h>
@@ -49,17 +50,23 @@
49#define PF_RSVD (1<<3) 50#define PF_RSVD (1<<3)
50#define PF_INSTR (1<<4) 51#define PF_INSTR (1<<4)
51 52
53static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr)
54{
55#ifdef CONFIG_MMIOTRACE_HOOKS
56 if (unlikely(is_kmmio_active()))
57 if (kmmio_handler(regs, addr) == 1)
58 return -1;
59#endif
60 return 0;
61}
62
52static inline int notify_page_fault(struct pt_regs *regs) 63static inline int notify_page_fault(struct pt_regs *regs)
53{ 64{
54#ifdef CONFIG_KPROBES 65#ifdef CONFIG_KPROBES
55 int ret = 0; 66 int ret = 0;
56 67
57 /* kprobe_running() needs smp_processor_id() */ 68 /* kprobe_running() needs smp_processor_id() */
58#ifdef CONFIG_X86_32
59 if (!user_mode_vm(regs)) { 69 if (!user_mode_vm(regs)) {
60#else
61 if (!user_mode(regs)) {
62#endif
63 preempt_disable(); 70 preempt_disable();
64 if (kprobe_running() && kprobe_fault_handler(regs, 14)) 71 if (kprobe_running() && kprobe_fault_handler(regs, 14))
65 ret = 1; 72 ret = 1;
@@ -396,11 +403,7 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code,
396 printk(KERN_CONT "NULL pointer dereference"); 403 printk(KERN_CONT "NULL pointer dereference");
397 else 404 else
398 printk(KERN_CONT "paging request"); 405 printk(KERN_CONT "paging request");
399#ifdef CONFIG_X86_32 406 printk(KERN_CONT " at %p\n", (void *) address);
400 printk(KERN_CONT " at %08lx\n", address);
401#else
402 printk(KERN_CONT " at %016lx\n", address);
403#endif
404 printk(KERN_ALERT "IP:"); 407 printk(KERN_ALERT "IP:");
405 printk_address(regs->ip, 1); 408 printk_address(regs->ip, 1);
406 dump_pagetable(address); 409 dump_pagetable(address);
@@ -606,6 +609,8 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
606 609
607 if (notify_page_fault(regs)) 610 if (notify_page_fault(regs))
608 return; 611 return;
612 if (unlikely(kmmio_fault(regs, address)))
613 return;
609 614
610 /* 615 /*
611 * We fault-in kernel-space virtual memory on-demand. The 616 * We fault-in kernel-space virtual memory on-demand. The
@@ -800,14 +805,10 @@ bad_area_nosemaphore:
800 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && 805 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
801 printk_ratelimit()) { 806 printk_ratelimit()) {
802 printk( 807 printk(
803#ifdef CONFIG_X86_32 808 "%s%s[%d]: segfault at %lx ip %p sp %p error %lx",
804 "%s%s[%d]: segfault at %lx ip %08lx sp %08lx error %lx",
805#else
806 "%s%s[%d]: segfault at %lx ip %lx sp %lx error %lx",
807#endif
808 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, 809 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
809 tsk->comm, task_pid_nr(tsk), address, regs->ip, 810 tsk->comm, task_pid_nr(tsk), address,
810 regs->sp, error_code); 811 (void *) regs->ip, (void *) regs->sp, error_code);
811 print_vma_addr(" in ", regs->ip); 812 print_vma_addr(" in ", regs->ip);
812 printk("\n"); 813 printk("\n");
813 } 814 }
@@ -915,14 +916,7 @@ LIST_HEAD(pgd_list);
915void vmalloc_sync_all(void) 916void vmalloc_sync_all(void)
916{ 917{
917#ifdef CONFIG_X86_32 918#ifdef CONFIG_X86_32
918 /* 919 unsigned long start = VMALLOC_START & PGDIR_MASK;
919 * Note that races in the updates of insync and start aren't
920 * problematic: insync can only get set bits added, and updates to
921 * start are only improving performance (without affecting correctness
922 * if undone).
923 */
924 static DECLARE_BITMAP(insync, PTRS_PER_PGD);
925 static unsigned long start = TASK_SIZE;
926 unsigned long address; 920 unsigned long address;
927 921
928 if (SHARED_KERNEL_PMD) 922 if (SHARED_KERNEL_PMD)
@@ -930,56 +924,38 @@ void vmalloc_sync_all(void)
930 924
931 BUILD_BUG_ON(TASK_SIZE & ~PGDIR_MASK); 925 BUILD_BUG_ON(TASK_SIZE & ~PGDIR_MASK);
932 for (address = start; address >= TASK_SIZE; address += PGDIR_SIZE) { 926 for (address = start; address >= TASK_SIZE; address += PGDIR_SIZE) {
933 if (!test_bit(pgd_index(address), insync)) { 927 unsigned long flags;
934 unsigned long flags; 928 struct page *page;
935 struct page *page; 929
936 930 spin_lock_irqsave(&pgd_lock, flags);
937 spin_lock_irqsave(&pgd_lock, flags); 931 list_for_each_entry(page, &pgd_list, lru) {
938 list_for_each_entry(page, &pgd_list, lru) { 932 if (!vmalloc_sync_one(page_address(page),
939 if (!vmalloc_sync_one(page_address(page), 933 address))
940 address)) 934 break;
941 break;
942 }
943 spin_unlock_irqrestore(&pgd_lock, flags);
944 if (!page)
945 set_bit(pgd_index(address), insync);
946 } 935 }
947 if (address == start && test_bit(pgd_index(address), insync)) 936 spin_unlock_irqrestore(&pgd_lock, flags);
948 start = address + PGDIR_SIZE;
949 } 937 }
950#else /* CONFIG_X86_64 */ 938#else /* CONFIG_X86_64 */
951 /* 939 unsigned long start = VMALLOC_START & PGDIR_MASK;
952 * Note that races in the updates of insync and start aren't
953 * problematic: insync can only get set bits added, and updates to
954 * start are only improving performance (without affecting correctness
955 * if undone).
956 */
957 static DECLARE_BITMAP(insync, PTRS_PER_PGD);
958 static unsigned long start = VMALLOC_START & PGDIR_MASK;
959 unsigned long address; 940 unsigned long address;
960 941
961 for (address = start; address <= VMALLOC_END; address += PGDIR_SIZE) { 942 for (address = start; address <= VMALLOC_END; address += PGDIR_SIZE) {
962 if (!test_bit(pgd_index(address), insync)) { 943 const pgd_t *pgd_ref = pgd_offset_k(address);
963 const pgd_t *pgd_ref = pgd_offset_k(address); 944 unsigned long flags;
964 unsigned long flags; 945 struct page *page;
965 struct page *page; 946
966 947 if (pgd_none(*pgd_ref))
967 if (pgd_none(*pgd_ref)) 948 continue;
968 continue; 949 spin_lock_irqsave(&pgd_lock, flags);
969 spin_lock_irqsave(&pgd_lock, flags); 950 list_for_each_entry(page, &pgd_list, lru) {
970 list_for_each_entry(page, &pgd_list, lru) { 951 pgd_t *pgd;
971 pgd_t *pgd; 952 pgd = (pgd_t *)page_address(page) + pgd_index(address);
972 pgd = (pgd_t *)page_address(page) + pgd_index(address); 953 if (pgd_none(*pgd))
973 if (pgd_none(*pgd)) 954 set_pgd(pgd, *pgd_ref);
974 set_pgd(pgd, *pgd_ref); 955 else
975 else 956 BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref));
976 BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref));
977 }
978 spin_unlock_irqrestore(&pgd_lock, flags);
979 set_bit(pgd_index(address), insync);
980 } 957 }
981 if (address == start) 958 spin_unlock_irqrestore(&pgd_lock, flags);
982 start = address + PGDIR_SIZE;
983 } 959 }
984#endif 960#endif
985} 961}
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index ec30d10154b6..9689a5138e64 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -50,6 +50,7 @@
50 50
51unsigned int __VMALLOC_RESERVE = 128 << 20; 51unsigned int __VMALLOC_RESERVE = 128 << 20;
52 52
53unsigned long max_low_pfn_mapped;
53unsigned long max_pfn_mapped; 54unsigned long max_pfn_mapped;
54 55
55DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 56DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -57,6 +58,27 @@ unsigned long highstart_pfn, highend_pfn;
57 58
58static noinline int do_test_wp_bit(void); 59static noinline int do_test_wp_bit(void);
59 60
61
62static unsigned long __initdata table_start;
63static unsigned long __meminitdata table_end;
64static unsigned long __meminitdata table_top;
65
66static int __initdata after_init_bootmem;
67
68static __init void *alloc_low_page(unsigned long *phys)
69{
70 unsigned long pfn = table_end++;
71 void *adr;
72
73 if (pfn >= table_top)
74 panic("alloc_low_page: ran out of memory");
75
76 adr = __va(pfn * PAGE_SIZE);
77 memset(adr, 0, PAGE_SIZE);
78 *phys = pfn * PAGE_SIZE;
79 return adr;
80}
81
60/* 82/*
61 * Creates a middle page table and puts a pointer to it in the 83 * Creates a middle page table and puts a pointer to it in the
62 * given global directory entry. This only returns the gd entry 84 * given global directory entry. This only returns the gd entry
@@ -68,9 +90,12 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
68 pmd_t *pmd_table; 90 pmd_t *pmd_table;
69 91
70#ifdef CONFIG_X86_PAE 92#ifdef CONFIG_X86_PAE
93 unsigned long phys;
71 if (!(pgd_val(*pgd) & _PAGE_PRESENT)) { 94 if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
72 pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); 95 if (after_init_bootmem)
73 96 pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
97 else
98 pmd_table = (pmd_t *)alloc_low_page(&phys);
74 paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT); 99 paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT);
75 set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); 100 set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
76 pud = pud_offset(pgd, 0); 101 pud = pud_offset(pgd, 0);
@@ -92,12 +117,16 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)
92 if (!(pmd_val(*pmd) & _PAGE_PRESENT)) { 117 if (!(pmd_val(*pmd) & _PAGE_PRESENT)) {
93 pte_t *page_table = NULL; 118 pte_t *page_table = NULL;
94 119
120 if (after_init_bootmem) {
95#ifdef CONFIG_DEBUG_PAGEALLOC 121#ifdef CONFIG_DEBUG_PAGEALLOC
96 page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); 122 page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE);
97#endif 123#endif
98 if (!page_table) { 124 if (!page_table)
99 page_table = 125 page_table =
100 (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); 126 (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
127 } else {
128 unsigned long phys;
129 page_table = (pte_t *)alloc_low_page(&phys);
101 } 130 }
102 131
103 paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT); 132 paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT);
@@ -155,38 +184,44 @@ static inline int is_kernel_text(unsigned long addr)
155 * of max_low_pfn pages, by creating page tables starting from address 184 * of max_low_pfn pages, by creating page tables starting from address
156 * PAGE_OFFSET: 185 * PAGE_OFFSET:
157 */ 186 */
158static void __init kernel_physical_mapping_init(pgd_t *pgd_base) 187static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
188 unsigned long start_pfn,
189 unsigned long end_pfn,
190 int use_pse)
159{ 191{
160 int pgd_idx, pmd_idx, pte_ofs; 192 int pgd_idx, pmd_idx, pte_ofs;
161 unsigned long pfn; 193 unsigned long pfn;
162 pgd_t *pgd; 194 pgd_t *pgd;
163 pmd_t *pmd; 195 pmd_t *pmd;
164 pte_t *pte; 196 pte_t *pte;
197 unsigned pages_2m = 0, pages_4k = 0;
165 198
166 pgd_idx = pgd_index(PAGE_OFFSET); 199 if (!cpu_has_pse)
167 pgd = pgd_base + pgd_idx; 200 use_pse = 0;
168 pfn = 0;
169 201
202 pfn = start_pfn;
203 pgd_idx = pgd_index((pfn<<PAGE_SHIFT) + PAGE_OFFSET);
204 pgd = pgd_base + pgd_idx;
170 for (; pgd_idx < PTRS_PER_PGD; pgd++, pgd_idx++) { 205 for (; pgd_idx < PTRS_PER_PGD; pgd++, pgd_idx++) {
171 pmd = one_md_table_init(pgd); 206 pmd = one_md_table_init(pgd);
172 if (pfn >= max_low_pfn)
173 continue;
174 207
175 for (pmd_idx = 0; 208 if (pfn >= end_pfn)
176 pmd_idx < PTRS_PER_PMD && pfn < max_low_pfn; 209 continue;
210#ifdef CONFIG_X86_PAE
211 pmd_idx = pmd_index((pfn<<PAGE_SHIFT) + PAGE_OFFSET);
212 pmd += pmd_idx;
213#else
214 pmd_idx = 0;
215#endif
216 for (; pmd_idx < PTRS_PER_PMD && pfn < end_pfn;
177 pmd++, pmd_idx++) { 217 pmd++, pmd_idx++) {
178 unsigned int addr = pfn * PAGE_SIZE + PAGE_OFFSET; 218 unsigned int addr = pfn * PAGE_SIZE + PAGE_OFFSET;
179 219
180 /* 220 /*
181 * Map with big pages if possible, otherwise 221 * Map with big pages if possible, otherwise
182 * create normal page tables: 222 * create normal page tables:
183 *
184 * Don't use a large page for the first 2/4MB of memory
185 * because there are often fixed size MTRRs in there
186 * and overlapping MTRRs into large pages can cause
187 * slowdowns.
188 */ 223 */
189 if (cpu_has_pse && !(pgd_idx == 0 && pmd_idx == 0)) { 224 if (use_pse) {
190 unsigned int addr2; 225 unsigned int addr2;
191 pgprot_t prot = PAGE_KERNEL_LARGE; 226 pgprot_t prot = PAGE_KERNEL_LARGE;
192 227
@@ -197,34 +232,30 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
197 is_kernel_text(addr2)) 232 is_kernel_text(addr2))
198 prot = PAGE_KERNEL_LARGE_EXEC; 233 prot = PAGE_KERNEL_LARGE_EXEC;
199 234
235 pages_2m++;
200 set_pmd(pmd, pfn_pmd(pfn, prot)); 236 set_pmd(pmd, pfn_pmd(pfn, prot));
201 237
202 pfn += PTRS_PER_PTE; 238 pfn += PTRS_PER_PTE;
203 max_pfn_mapped = pfn;
204 continue; 239 continue;
205 } 240 }
206 pte = one_page_table_init(pmd); 241 pte = one_page_table_init(pmd);
207 242
208 for (pte_ofs = 0; 243 pte_ofs = pte_index((pfn<<PAGE_SHIFT) + PAGE_OFFSET);
209 pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; 244 pte += pte_ofs;
245 for (; pte_ofs < PTRS_PER_PTE && pfn < end_pfn;
210 pte++, pfn++, pte_ofs++, addr += PAGE_SIZE) { 246 pte++, pfn++, pte_ofs++, addr += PAGE_SIZE) {
211 pgprot_t prot = PAGE_KERNEL; 247 pgprot_t prot = PAGE_KERNEL;
212 248
213 if (is_kernel_text(addr)) 249 if (is_kernel_text(addr))
214 prot = PAGE_KERNEL_EXEC; 250 prot = PAGE_KERNEL_EXEC;
215 251
252 pages_4k++;
216 set_pte(pte, pfn_pte(pfn, prot)); 253 set_pte(pte, pfn_pte(pfn, prot));
217 } 254 }
218 max_pfn_mapped = pfn;
219 } 255 }
220 } 256 }
221} 257 update_page_count(PG_LEVEL_2M, pages_2m);
222 258 update_page_count(PG_LEVEL_4K, pages_4k);
223static inline int page_kills_ppro(unsigned long pagenr)
224{
225 if (pagenr >= 0x70000 && pagenr <= 0x7003F)
226 return 1;
227 return 0;
228} 259}
229 260
230/* 261/*
@@ -287,29 +318,62 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base)
287 pkmap_page_table = pte; 318 pkmap_page_table = pte;
288} 319}
289 320
290void __init add_one_highpage_init(struct page *page, int pfn, int bad_ppro) 321static void __init add_one_highpage_init(struct page *page, int pfn)
291{ 322{
292 if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) { 323 ClearPageReserved(page);
293 ClearPageReserved(page); 324 init_page_count(page);
294 init_page_count(page); 325 __free_page(page);
295 __free_page(page); 326 totalhigh_pages++;
296 totalhigh_pages++;
297 } else
298 SetPageReserved(page);
299} 327}
300 328
301#ifndef CONFIG_NUMA 329struct add_highpages_data {
302static void __init set_highmem_pages_init(int bad_ppro) 330 unsigned long start_pfn;
331 unsigned long end_pfn;
332};
333
334static int __init add_highpages_work_fn(unsigned long start_pfn,
335 unsigned long end_pfn, void *datax)
303{ 336{
304 int pfn; 337 int node_pfn;
338 struct page *page;
339 unsigned long final_start_pfn, final_end_pfn;
340 struct add_highpages_data *data;
305 341
306 for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) { 342 data = (struct add_highpages_data *)datax;
307 /* 343
308 * Holes under sparsemem might not have no mem_map[]: 344 final_start_pfn = max(start_pfn, data->start_pfn);
309 */ 345 final_end_pfn = min(end_pfn, data->end_pfn);
310 if (pfn_valid(pfn)) 346 if (final_start_pfn >= final_end_pfn)
311 add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); 347 return 0;
348
349 for (node_pfn = final_start_pfn; node_pfn < final_end_pfn;
350 node_pfn++) {
351 if (!pfn_valid(node_pfn))
352 continue;
353 page = pfn_to_page(node_pfn);
354 add_one_highpage_init(page, node_pfn);
312 } 355 }
356
357 return 0;
358
359}
360
361void __init add_highpages_with_active_regions(int nid, unsigned long start_pfn,
362 unsigned long end_pfn)
363{
364 struct add_highpages_data data;
365
366 data.start_pfn = start_pfn;
367 data.end_pfn = end_pfn;
368
369 work_with_active_regions(nid, add_highpages_work_fn, &data);
370}
371
372#ifndef CONFIG_NUMA
373static void __init set_highmem_pages_init(void)
374{
375 add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
376
313 totalram_pages += totalhigh_pages; 377 totalram_pages += totalhigh_pages;
314} 378}
315#endif /* !CONFIG_NUMA */ 379#endif /* !CONFIG_NUMA */
@@ -317,14 +381,9 @@ static void __init set_highmem_pages_init(int bad_ppro)
317#else 381#else
318# define kmap_init() do { } while (0) 382# define kmap_init() do { } while (0)
319# define permanent_kmaps_init(pgd_base) do { } while (0) 383# define permanent_kmaps_init(pgd_base) do { } while (0)
320# define set_highmem_pages_init(bad_ppro) do { } while (0) 384# define set_highmem_pages_init() do { } while (0)
321#endif /* CONFIG_HIGHMEM */ 385#endif /* CONFIG_HIGHMEM */
322 386
323pteval_t __PAGE_KERNEL = _PAGE_KERNEL;
324EXPORT_SYMBOL(__PAGE_KERNEL);
325
326pteval_t __PAGE_KERNEL_EXEC = _PAGE_KERNEL_EXEC;
327
328void __init native_pagetable_setup_start(pgd_t *base) 387void __init native_pagetable_setup_start(pgd_t *base)
329{ 388{
330 unsigned long pfn, va; 389 unsigned long pfn, va;
@@ -380,27 +439,10 @@ void __init native_pagetable_setup_done(pgd_t *base)
380 * be partially populated, and so it avoids stomping on any existing 439 * be partially populated, and so it avoids stomping on any existing
381 * mappings. 440 * mappings.
382 */ 441 */
383static void __init pagetable_init(void) 442static void __init early_ioremap_page_table_range_init(pgd_t *pgd_base)
384{ 443{
385 pgd_t *pgd_base = swapper_pg_dir;
386 unsigned long vaddr, end; 444 unsigned long vaddr, end;
387 445
388 paravirt_pagetable_setup_start(pgd_base);
389
390 /* Enable PSE if available */
391 if (cpu_has_pse)
392 set_in_cr4(X86_CR4_PSE);
393
394 /* Enable PGE if available */
395 if (cpu_has_pge) {
396 set_in_cr4(X86_CR4_PGE);
397 __PAGE_KERNEL |= _PAGE_GLOBAL;
398 __PAGE_KERNEL_EXEC |= _PAGE_GLOBAL;
399 }
400
401 kernel_physical_mapping_init(pgd_base);
402 remap_numa_kva();
403
404 /* 446 /*
405 * Fixed mappings, only the page table structure has to be 447 * Fixed mappings, only the page table structure has to be
406 * created - mappings will be set by set_fixmap(): 448 * created - mappings will be set by set_fixmap():
@@ -410,6 +452,13 @@ static void __init pagetable_init(void)
410 end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK; 452 end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK;
411 page_table_range_init(vaddr, end, pgd_base); 453 page_table_range_init(vaddr, end, pgd_base);
412 early_ioremap_reset(); 454 early_ioremap_reset();
455}
456
457static void __init pagetable_init(void)
458{
459 pgd_t *pgd_base = swapper_pg_dir;
460
461 paravirt_pagetable_setup_start(pgd_base);
413 462
414 permanent_kmaps_init(pgd_base); 463 permanent_kmaps_init(pgd_base);
415 464
@@ -456,7 +505,7 @@ void zap_low_mappings(void)
456 505
457int nx_enabled; 506int nx_enabled;
458 507
459pteval_t __supported_pte_mask __read_mostly = ~_PAGE_NX; 508pteval_t __supported_pte_mask __read_mostly = ~(_PAGE_NX | _PAGE_GLOBAL);
460EXPORT_SYMBOL_GPL(__supported_pte_mask); 509EXPORT_SYMBOL_GPL(__supported_pte_mask);
461 510
462#ifdef CONFIG_X86_PAE 511#ifdef CONFIG_X86_PAE
@@ -509,27 +558,318 @@ static void __init set_nx(void)
509} 558}
510#endif 559#endif
511 560
561/* user-defined highmem size */
562static unsigned int highmem_pages = -1;
563
512/* 564/*
513 * paging_init() sets up the page tables - note that the first 8MB are 565 * highmem=size forces highmem to be exactly 'size' bytes.
514 * already mapped by head.S. 566 * This works even on boxes that have no highmem otherwise.
515 * 567 * This also works to reduce highmem size on bigger boxes.
516 * This routines also unmaps the page at virtual kernel address 0, so
517 * that we can trap those pesky NULL-reference errors in the kernel.
518 */ 568 */
519void __init paging_init(void) 569static int __init parse_highmem(char *arg)
570{
571 if (!arg)
572 return -EINVAL;
573
574 highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT;
575 return 0;
576}
577early_param("highmem", parse_highmem);
578
579/*
580 * Determine low and high memory ranges:
581 */
582void __init find_low_pfn_range(void)
583{
584 /* it could update max_pfn */
585
586 /* max_low_pfn is 0, we already have early_res support */
587
588 max_low_pfn = max_pfn;
589 if (max_low_pfn > MAXMEM_PFN) {
590 if (highmem_pages == -1)
591 highmem_pages = max_pfn - MAXMEM_PFN;
592 if (highmem_pages + MAXMEM_PFN < max_pfn)
593 max_pfn = MAXMEM_PFN + highmem_pages;
594 if (highmem_pages + MAXMEM_PFN > max_pfn) {
595 printk(KERN_WARNING "only %luMB highmem pages "
596 "available, ignoring highmem size of %uMB.\n",
597 pages_to_mb(max_pfn - MAXMEM_PFN),
598 pages_to_mb(highmem_pages));
599 highmem_pages = 0;
600 }
601 max_low_pfn = MAXMEM_PFN;
602#ifndef CONFIG_HIGHMEM
603 /* Maximum memory usable is what is directly addressable */
604 printk(KERN_WARNING "Warning only %ldMB will be used.\n",
605 MAXMEM>>20);
606 if (max_pfn > MAX_NONPAE_PFN)
607 printk(KERN_WARNING
608 "Use a HIGHMEM64G enabled kernel.\n");
609 else
610 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
611 max_pfn = MAXMEM_PFN;
612#else /* !CONFIG_HIGHMEM */
613#ifndef CONFIG_HIGHMEM64G
614 if (max_pfn > MAX_NONPAE_PFN) {
615 max_pfn = MAX_NONPAE_PFN;
616 printk(KERN_WARNING "Warning only 4GB will be used."
617 "Use a HIGHMEM64G enabled kernel.\n");
618 }
619#endif /* !CONFIG_HIGHMEM64G */
620#endif /* !CONFIG_HIGHMEM */
621 } else {
622 if (highmem_pages == -1)
623 highmem_pages = 0;
624#ifdef CONFIG_HIGHMEM
625 if (highmem_pages >= max_pfn) {
626 printk(KERN_ERR "highmem size specified (%uMB) is "
627 "bigger than pages available (%luMB)!.\n",
628 pages_to_mb(highmem_pages),
629 pages_to_mb(max_pfn));
630 highmem_pages = 0;
631 }
632 if (highmem_pages) {
633 if (max_low_pfn - highmem_pages <
634 64*1024*1024/PAGE_SIZE){
635 printk(KERN_ERR "highmem size %uMB results in "
636 "smaller than 64MB lowmem, ignoring it.\n"
637 , pages_to_mb(highmem_pages));
638 highmem_pages = 0;
639 }
640 max_low_pfn -= highmem_pages;
641 }
642#else
643 if (highmem_pages)
644 printk(KERN_ERR "ignoring highmem size on non-highmem"
645 " kernel!\n");
646#endif
647 }
648}
649
650#ifndef CONFIG_NEED_MULTIPLE_NODES
651void __init initmem_init(unsigned long start_pfn,
652 unsigned long end_pfn)
520{ 653{
654#ifdef CONFIG_HIGHMEM
655 highstart_pfn = highend_pfn = max_pfn;
656 if (max_pfn > max_low_pfn)
657 highstart_pfn = max_low_pfn;
658 memory_present(0, 0, highend_pfn);
659 e820_register_active_regions(0, 0, highend_pfn);
660 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
661 pages_to_mb(highend_pfn - highstart_pfn));
662 num_physpages = highend_pfn;
663 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
664#else
665 memory_present(0, 0, max_low_pfn);
666 e820_register_active_regions(0, 0, max_low_pfn);
667 num_physpages = max_low_pfn;
668 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
669#endif
670#ifdef CONFIG_FLATMEM
671 max_mapnr = num_physpages;
672#endif
673 printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
674 pages_to_mb(max_low_pfn));
675
676 setup_bootmem_allocator();
677}
678#endif /* !CONFIG_NEED_MULTIPLE_NODES */
679
680static void __init zone_sizes_init(void)
681{
682 unsigned long max_zone_pfns[MAX_NR_ZONES];
683 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
684 max_zone_pfns[ZONE_DMA] =
685 virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
686 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
687#ifdef CONFIG_HIGHMEM
688 max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
689#endif
690
691 free_area_init_nodes(max_zone_pfns);
692}
693
694void __init setup_bootmem_allocator(void)
695{
696 int i;
697 unsigned long bootmap_size, bootmap;
698 /*
699 * Initialize the boot-time allocator (with low memory only):
700 */
701 bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT;
702 bootmap = find_e820_area(min_low_pfn<<PAGE_SHIFT,
703 max_pfn_mapped<<PAGE_SHIFT, bootmap_size,
704 PAGE_SIZE);
705 if (bootmap == -1L)
706 panic("Cannot find bootmem map of size %ld\n", bootmap_size);
707 reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP");
708
709 /* don't touch min_low_pfn */
710 bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap >> PAGE_SHIFT,
711 min_low_pfn, max_low_pfn);
712 printk(KERN_INFO " mapped low ram: 0 - %08lx\n",
713 max_pfn_mapped<<PAGE_SHIFT);
714 printk(KERN_INFO " low ram: %08lx - %08lx\n",
715 min_low_pfn<<PAGE_SHIFT, max_low_pfn<<PAGE_SHIFT);
716 printk(KERN_INFO " bootmap %08lx - %08lx\n",
717 bootmap, bootmap + bootmap_size);
718 for_each_online_node(i)
719 free_bootmem_with_active_regions(i, max_low_pfn);
720 early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
721
722 after_init_bootmem = 1;
723}
724
725static void __init find_early_table_space(unsigned long end)
726{
727 unsigned long puds, pmds, ptes, tables, start;
728
729 puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
730 tables = PAGE_ALIGN(puds * sizeof(pud_t));
731
732 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
733 tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
734
735 if (cpu_has_pse) {
736 unsigned long extra;
737
738 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
739 extra += PMD_SIZE;
740 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
741 } else
742 ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
743
744 tables += PAGE_ALIGN(ptes * sizeof(pte_t));
745
746 /* for fixmap */
747 tables += PAGE_SIZE * 2;
748
749 /*
750 * RED-PEN putting page tables only on node 0 could
751 * cause a hotspot and fill up ZONE_DMA. The page tables
752 * need roughly 0.5KB per GB.
753 */
754 start = 0x7000;
755 table_start = find_e820_area(start, max_pfn_mapped<<PAGE_SHIFT,
756 tables, PAGE_SIZE);
757 if (table_start == -1UL)
758 panic("Cannot find space for the kernel page tables");
759
760 table_start >>= PAGE_SHIFT;
761 table_end = table_start;
762 table_top = table_start + (tables>>PAGE_SHIFT);
763
764 printk(KERN_DEBUG "kernel direct mapping tables up to %lx @ %lx-%lx\n",
765 end, table_start << PAGE_SHIFT,
766 (table_start << PAGE_SHIFT) + tables);
767}
768
769unsigned long __init_refok init_memory_mapping(unsigned long start,
770 unsigned long end)
771{
772 pgd_t *pgd_base = swapper_pg_dir;
773 unsigned long start_pfn, end_pfn;
774 unsigned long big_page_start;
775
776 /*
777 * Find space for the kernel direct mapping tables.
778 */
779 if (!after_init_bootmem)
780 find_early_table_space(end);
781
521#ifdef CONFIG_X86_PAE 782#ifdef CONFIG_X86_PAE
522 set_nx(); 783 set_nx();
523 if (nx_enabled) 784 if (nx_enabled)
524 printk(KERN_INFO "NX (Execute Disable) protection: active\n"); 785 printk(KERN_INFO "NX (Execute Disable) protection: active\n");
525#endif 786#endif
526 pagetable_init(); 787
788 /* Enable PSE if available */
789 if (cpu_has_pse)
790 set_in_cr4(X86_CR4_PSE);
791
792 /* Enable PGE if available */
793 if (cpu_has_pge) {
794 set_in_cr4(X86_CR4_PGE);
795 __supported_pte_mask |= _PAGE_GLOBAL;
796 }
797
798 /*
799 * Don't use a large page for the first 2/4MB of memory
800 * because there are often fixed size MTRRs in there
801 * and overlapping MTRRs into large pages can cause
802 * slowdowns.
803 */
804 big_page_start = PMD_SIZE;
805
806 if (start < big_page_start) {
807 start_pfn = start >> PAGE_SHIFT;
808 end_pfn = min(big_page_start>>PAGE_SHIFT, end>>PAGE_SHIFT);
809 } else {
810 /* head is not big page alignment ? */
811 start_pfn = start >> PAGE_SHIFT;
812 end_pfn = ((start + (PMD_SIZE - 1))>>PMD_SHIFT)
813 << (PMD_SHIFT - PAGE_SHIFT);
814 }
815 if (start_pfn < end_pfn)
816 kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn, 0);
817
818 /* big page range */
819 start_pfn = ((start + (PMD_SIZE - 1))>>PMD_SHIFT)
820 << (PMD_SHIFT - PAGE_SHIFT);
821 if (start_pfn < (big_page_start >> PAGE_SHIFT))
822 start_pfn = big_page_start >> PAGE_SHIFT;
823 end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
824 if (start_pfn < end_pfn)
825 kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn,
826 cpu_has_pse);
827
828 /* tail is not big page alignment ? */
829 start_pfn = end_pfn;
830 if (start_pfn > (big_page_start>>PAGE_SHIFT)) {
831 end_pfn = end >> PAGE_SHIFT;
832 if (start_pfn < end_pfn)
833 kernel_physical_mapping_init(pgd_base, start_pfn,
834 end_pfn, 0);
835 }
836
837 early_ioremap_page_table_range_init(pgd_base);
527 838
528 load_cr3(swapper_pg_dir); 839 load_cr3(swapper_pg_dir);
529 840
530 __flush_tlb_all(); 841 __flush_tlb_all();
531 842
843 if (!after_init_bootmem)
844 reserve_early(table_start << PAGE_SHIFT,
845 table_end << PAGE_SHIFT, "PGTABLE");
846
847 return end >> PAGE_SHIFT;
848}
849
850
851/*
852 * paging_init() sets up the page tables - note that the first 8MB are
853 * already mapped by head.S.
854 *
855 * This routines also unmaps the page at virtual kernel address 0, so
856 * that we can trap those pesky NULL-reference errors in the kernel.
857 */
858void __init paging_init(void)
859{
860 pagetable_init();
861
862 __flush_tlb_all();
863
532 kmap_init(); 864 kmap_init();
865
866 /*
867 * NOTE: at this point the bootmem allocator is fully available.
868 */
869 sparse_init();
870 zone_sizes_init();
871
872 paravirt_post_allocator_init();
533} 873}
534 874
535/* 875/*
@@ -564,24 +904,11 @@ static struct kcore_list kcore_mem, kcore_vmalloc;
564void __init mem_init(void) 904void __init mem_init(void)
565{ 905{
566 int codesize, reservedpages, datasize, initsize; 906 int codesize, reservedpages, datasize, initsize;
567 int tmp, bad_ppro; 907 int tmp;
568 908
569#ifdef CONFIG_FLATMEM 909#ifdef CONFIG_FLATMEM
570 BUG_ON(!mem_map); 910 BUG_ON(!mem_map);
571#endif 911#endif
572 bad_ppro = ppro_with_ram_bug();
573
574#ifdef CONFIG_HIGHMEM
575 /* check that fixmap and pkmap do not overlap */
576 if (PKMAP_BASE + LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) {
577 printk(KERN_ERR
578 "fixmap and kmap areas overlap - this will crash\n");
579 printk(KERN_ERR "pkstart: %lxh pkend: %lxh fixstart %lxh\n",
580 PKMAP_BASE, PKMAP_BASE + LAST_PKMAP*PAGE_SIZE,
581 FIXADDR_START);
582 BUG();
583 }
584#endif
585 /* this will put all low memory onto the freelists */ 912 /* this will put all low memory onto the freelists */
586 totalram_pages += free_all_bootmem(); 913 totalram_pages += free_all_bootmem();
587 914
@@ -593,7 +920,7 @@ void __init mem_init(void)
593 if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp))) 920 if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
594 reservedpages++; 921 reservedpages++;
595 922
596 set_highmem_pages_init(bad_ppro); 923 set_highmem_pages_init();
597 924
598 codesize = (unsigned long) &_etext - (unsigned long) &_text; 925 codesize = (unsigned long) &_etext - (unsigned long) &_text;
599 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 926 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
@@ -614,7 +941,6 @@ void __init mem_init(void)
614 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) 941 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))
615 ); 942 );
616 943
617#if 1 /* double-sanity-check paranoia */
618 printk(KERN_INFO "virtual kernel memory layout:\n" 944 printk(KERN_INFO "virtual kernel memory layout:\n"
619 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" 945 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
620#ifdef CONFIG_HIGHMEM 946#ifdef CONFIG_HIGHMEM
@@ -655,7 +981,6 @@ void __init mem_init(void)
655#endif 981#endif
656 BUG_ON(VMALLOC_START > VMALLOC_END); 982 BUG_ON(VMALLOC_START > VMALLOC_END);
657 BUG_ON((unsigned long)high_memory > VMALLOC_START); 983 BUG_ON((unsigned long)high_memory > VMALLOC_START);
658#endif /* double-sanity-check paranoia */
659 984
660 if (boot_cpu_data.wp_works_ok < 0) 985 if (boot_cpu_data.wp_works_ok < 0)
661 test_wp_bit(); 986 test_wp_bit();
@@ -710,6 +1035,8 @@ void mark_rodata_ro(void)
710 unsigned long start = PFN_ALIGN(_text); 1035 unsigned long start = PFN_ALIGN(_text);
711 unsigned long size = PFN_ALIGN(_etext) - start; 1036 unsigned long size = PFN_ALIGN(_etext) - start;
712 1037
1038#ifndef CONFIG_DYNAMIC_FTRACE
1039 /* Dynamic tracing modifies the kernel text section */
713 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT); 1040 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
714 printk(KERN_INFO "Write protecting the kernel text: %luk\n", 1041 printk(KERN_INFO "Write protecting the kernel text: %luk\n",
715 size >> 10); 1042 size >> 10);
@@ -722,6 +1049,8 @@ void mark_rodata_ro(void)
722 printk(KERN_INFO "Testing CPA: write protecting again\n"); 1049 printk(KERN_INFO "Testing CPA: write protecting again\n");
723 set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT); 1050 set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT);
724#endif 1051#endif
1052#endif /* CONFIG_DYNAMIC_FTRACE */
1053
725 start += size; 1054 start += size;
726 size = (unsigned long)__end_rodata - start; 1055 size = (unsigned long)__end_rodata - start;
727 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT); 1056 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
@@ -784,3 +1113,9 @@ void free_initrd_mem(unsigned long start, unsigned long end)
784 free_init_pages("initrd memory", start, end); 1113 free_init_pages("initrd memory", start, end);
785} 1114}
786#endif 1115#endif
1116
1117int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
1118 int flags)
1119{
1120 return reserve_bootmem(phys, len, flags);
1121}
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 819dad973b13..27de2435e008 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -18,6 +18,7 @@
18#include <linux/swap.h> 18#include <linux/swap.h>
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/initrd.h>
21#include <linux/pagemap.h> 22#include <linux/pagemap.h>
22#include <linux/bootmem.h> 23#include <linux/bootmem.h>
23#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
@@ -47,6 +48,14 @@
47#include <asm/numa.h> 48#include <asm/numa.h>
48#include <asm/cacheflush.h> 49#include <asm/cacheflush.h>
49 50
51/*
52 * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
53 * The direct mapping extends to max_pfn_mapped, so that we can directly access
54 * apertures, ACPI and other tables without having to play with fixmaps.
55 */
56unsigned long max_low_pfn_mapped;
57unsigned long max_pfn_mapped;
58
50static unsigned long dma_reserve __initdata; 59static unsigned long dma_reserve __initdata;
51 60
52DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 61DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -135,26 +144,17 @@ static __init void *spp_getpage(void)
135 return ptr; 144 return ptr;
136} 145}
137 146
138static __init void 147void
139set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot) 148set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte)
140{ 149{
141 pgd_t *pgd;
142 pud_t *pud; 150 pud_t *pud;
143 pmd_t *pmd; 151 pmd_t *pmd;
144 pte_t *pte, new_pte; 152 pte_t *pte;
145
146 pr_debug("set_pte_phys %lx to %lx\n", vaddr, phys);
147 153
148 pgd = pgd_offset_k(vaddr); 154 pud = pud_page + pud_index(vaddr);
149 if (pgd_none(*pgd)) {
150 printk(KERN_ERR
151 "PGD FIXMAP MISSING, it should be setup in head.S!\n");
152 return;
153 }
154 pud = pud_offset(pgd, vaddr);
155 if (pud_none(*pud)) { 155 if (pud_none(*pud)) {
156 pmd = (pmd_t *) spp_getpage(); 156 pmd = (pmd_t *) spp_getpage();
157 set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER)); 157 pud_populate(&init_mm, pud, pmd);
158 if (pmd != pmd_offset(pud, 0)) { 158 if (pmd != pmd_offset(pud, 0)) {
159 printk(KERN_ERR "PAGETABLE BUG #01! %p <-> %p\n", 159 printk(KERN_ERR "PAGETABLE BUG #01! %p <-> %p\n",
160 pmd, pmd_offset(pud, 0)); 160 pmd, pmd_offset(pud, 0));
@@ -164,13 +164,12 @@ set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
164 pmd = pmd_offset(pud, vaddr); 164 pmd = pmd_offset(pud, vaddr);
165 if (pmd_none(*pmd)) { 165 if (pmd_none(*pmd)) {
166 pte = (pte_t *) spp_getpage(); 166 pte = (pte_t *) spp_getpage();
167 set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER)); 167 pmd_populate_kernel(&init_mm, pmd, pte);
168 if (pte != pte_offset_kernel(pmd, 0)) { 168 if (pte != pte_offset_kernel(pmd, 0)) {
169 printk(KERN_ERR "PAGETABLE BUG #02!\n"); 169 printk(KERN_ERR "PAGETABLE BUG #02!\n");
170 return; 170 return;
171 } 171 }
172 } 172 }
173 new_pte = pfn_pte(phys >> PAGE_SHIFT, prot);
174 173
175 pte = pte_offset_kernel(pmd, vaddr); 174 pte = pte_offset_kernel(pmd, vaddr);
176 if (!pte_none(*pte) && pte_val(new_pte) && 175 if (!pte_none(*pte) && pte_val(new_pte) &&
@@ -185,6 +184,64 @@ set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
185 __flush_tlb_one(vaddr); 184 __flush_tlb_one(vaddr);
186} 185}
187 186
187void
188set_pte_vaddr(unsigned long vaddr, pte_t pteval)
189{
190 pgd_t *pgd;
191 pud_t *pud_page;
192
193 pr_debug("set_pte_vaddr %lx to %lx\n", vaddr, native_pte_val(pteval));
194
195 pgd = pgd_offset_k(vaddr);
196 if (pgd_none(*pgd)) {
197 printk(KERN_ERR
198 "PGD FIXMAP MISSING, it should be setup in head.S!\n");
199 return;
200 }
201 pud_page = (pud_t*)pgd_page_vaddr(*pgd);
202 set_pte_vaddr_pud(pud_page, vaddr, pteval);
203}
204
205/*
206 * Create large page table mappings for a range of physical addresses.
207 */
208static void __init __init_extra_mapping(unsigned long phys, unsigned long size,
209 pgprot_t prot)
210{
211 pgd_t *pgd;
212 pud_t *pud;
213 pmd_t *pmd;
214
215 BUG_ON((phys & ~PMD_MASK) || (size & ~PMD_MASK));
216 for (; size; phys += PMD_SIZE, size -= PMD_SIZE) {
217 pgd = pgd_offset_k((unsigned long)__va(phys));
218 if (pgd_none(*pgd)) {
219 pud = (pud_t *) spp_getpage();
220 set_pgd(pgd, __pgd(__pa(pud) | _KERNPG_TABLE |
221 _PAGE_USER));
222 }
223 pud = pud_offset(pgd, (unsigned long)__va(phys));
224 if (pud_none(*pud)) {
225 pmd = (pmd_t *) spp_getpage();
226 set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE |
227 _PAGE_USER));
228 }
229 pmd = pmd_offset(pud, phys);
230 BUG_ON(!pmd_none(*pmd));
231 set_pmd(pmd, __pmd(phys | pgprot_val(prot)));
232 }
233}
234
235void __init init_extra_mapping_wb(unsigned long phys, unsigned long size)
236{
237 __init_extra_mapping(phys, size, PAGE_KERNEL_LARGE);
238}
239
240void __init init_extra_mapping_uc(unsigned long phys, unsigned long size)
241{
242 __init_extra_mapping(phys, size, PAGE_KERNEL_LARGE_NOCACHE);
243}
244
188/* 245/*
189 * The head.S code sets up the kernel high mapping: 246 * The head.S code sets up the kernel high mapping:
190 * 247 *
@@ -213,20 +270,9 @@ void __init cleanup_highmap(void)
213 } 270 }
214} 271}
215 272
216/* NOTE: this is meant to be run only at boot */
217void __init __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
218{
219 unsigned long address = __fix_to_virt(idx);
220
221 if (idx >= __end_of_fixed_addresses) {
222 printk(KERN_ERR "Invalid __set_fixmap\n");
223 return;
224 }
225 set_pte_phys(address, phys, prot);
226}
227
228static unsigned long __initdata table_start; 273static unsigned long __initdata table_start;
229static unsigned long __meminitdata table_end; 274static unsigned long __meminitdata table_end;
275static unsigned long __meminitdata table_top;
230 276
231static __meminit void *alloc_low_page(unsigned long *phys) 277static __meminit void *alloc_low_page(unsigned long *phys)
232{ 278{
@@ -240,7 +286,7 @@ static __meminit void *alloc_low_page(unsigned long *phys)
240 return adr; 286 return adr;
241 } 287 }
242 288
243 if (pfn >= end_pfn) 289 if (pfn >= table_top)
244 panic("alloc_low_page: ran out of memory"); 290 panic("alloc_low_page: ran out of memory");
245 291
246 adr = early_ioremap(pfn * PAGE_SIZE, PAGE_SIZE); 292 adr = early_ioremap(pfn * PAGE_SIZE, PAGE_SIZE);
@@ -257,65 +303,61 @@ static __meminit void unmap_low_page(void *adr)
257 early_iounmap(adr, PAGE_SIZE); 303 early_iounmap(adr, PAGE_SIZE);
258} 304}
259 305
260/* Must run before zap_low_mappings */ 306static unsigned long __meminit
261__meminit void *early_ioremap(unsigned long addr, unsigned long size) 307phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end)
262{ 308{
263 pmd_t *pmd, *last_pmd; 309 unsigned pages = 0;
264 unsigned long vaddr; 310 unsigned long last_map_addr = end;
265 int i, pmds; 311 int i;
312
313 pte_t *pte = pte_page + pte_index(addr);
266 314
267 pmds = ((addr & ~PMD_MASK) + size + ~PMD_MASK) / PMD_SIZE; 315 for(i = pte_index(addr); i < PTRS_PER_PTE; i++, addr += PAGE_SIZE, pte++) {
268 vaddr = __START_KERNEL_map;
269 pmd = level2_kernel_pgt;
270 last_pmd = level2_kernel_pgt + PTRS_PER_PMD - 1;
271 316
272 for (; pmd <= last_pmd; pmd++, vaddr += PMD_SIZE) { 317 if (addr >= end) {
273 for (i = 0; i < pmds; i++) { 318 if (!after_bootmem) {
274 if (pmd_present(pmd[i])) 319 for(; i < PTRS_PER_PTE; i++, pte++)
275 goto continue_outer_loop; 320 set_pte(pte, __pte(0));
321 }
322 break;
276 } 323 }
277 vaddr += addr & ~PMD_MASK;
278 addr &= PMD_MASK;
279 324
280 for (i = 0; i < pmds; i++, addr += PMD_SIZE) 325 if (pte_val(*pte))
281 set_pmd(pmd+i, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC)); 326 continue;
282 __flush_tlb_all();
283 327
284 return (void *)vaddr; 328 if (0)
285continue_outer_loop: 329 printk(" pte=%p addr=%lx pte=%016lx\n",
286 ; 330 pte, addr, pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL).pte);
331 set_pte(pte, pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL));
332 last_map_addr = (addr & PAGE_MASK) + PAGE_SIZE;
333 pages++;
287 } 334 }
288 printk(KERN_ERR "early_ioremap(0x%lx, %lu) failed\n", addr, size); 335 update_page_count(PG_LEVEL_4K, pages);
289 336
290 return NULL; 337 return last_map_addr;
291} 338}
292 339
293/* 340static unsigned long __meminit
294 * To avoid virtual aliases later: 341phys_pte_update(pmd_t *pmd, unsigned long address, unsigned long end)
295 */
296__meminit void early_iounmap(void *addr, unsigned long size)
297{ 342{
298 unsigned long vaddr; 343 pte_t *pte = (pte_t *)pmd_page_vaddr(*pmd);
299 pmd_t *pmd;
300 int i, pmds;
301
302 vaddr = (unsigned long)addr;
303 pmds = ((vaddr & ~PMD_MASK) + size + ~PMD_MASK) / PMD_SIZE;
304 pmd = level2_kernel_pgt + pmd_index(vaddr);
305
306 for (i = 0; i < pmds; i++)
307 pmd_clear(pmd + i);
308 344
309 __flush_tlb_all(); 345 return phys_pte_init(pte, address, end);
310} 346}
311 347
312static unsigned long __meminit 348static unsigned long __meminit
313phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end) 349phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
350 unsigned long page_size_mask)
314{ 351{
352 unsigned long pages = 0;
353 unsigned long last_map_addr = end;
354
315 int i = pmd_index(address); 355 int i = pmd_index(address);
316 356
317 for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) { 357 for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) {
358 unsigned long pte_phys;
318 pmd_t *pmd = pmd_page + pmd_index(address); 359 pmd_t *pmd = pmd_page + pmd_index(address);
360 pte_t *pte;
319 361
320 if (address >= end) { 362 if (address >= end) {
321 if (!after_bootmem) { 363 if (!after_bootmem) {
@@ -325,31 +367,50 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
325 break; 367 break;
326 } 368 }
327 369
328 if (pmd_val(*pmd)) 370 if (pmd_val(*pmd)) {
371 if (!pmd_large(*pmd))
372 last_map_addr = phys_pte_update(pmd, address,
373 end);
374 continue;
375 }
376
377 if (page_size_mask & (1<<PG_LEVEL_2M)) {
378 pages++;
379 set_pte((pte_t *)pmd,
380 pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
381 last_map_addr = (address & PMD_MASK) + PMD_SIZE;
329 continue; 382 continue;
383 }
384
385 pte = alloc_low_page(&pte_phys);
386 last_map_addr = phys_pte_init(pte, address, end);
387 unmap_low_page(pte);
330 388
331 set_pte((pte_t *)pmd, 389 pmd_populate_kernel(&init_mm, pmd, __va(pte_phys));
332 pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
333 } 390 }
334 return address; 391 update_page_count(PG_LEVEL_2M, pages);
392 return last_map_addr;
335} 393}
336 394
337static unsigned long __meminit 395static unsigned long __meminit
338phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end) 396phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end,
397 unsigned long page_size_mask)
339{ 398{
340 pmd_t *pmd = pmd_offset(pud, 0); 399 pmd_t *pmd = pmd_offset(pud, 0);
341 unsigned long last_map_addr; 400 unsigned long last_map_addr;
342 401
343 spin_lock(&init_mm.page_table_lock); 402 spin_lock(&init_mm.page_table_lock);
344 last_map_addr = phys_pmd_init(pmd, address, end); 403 last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask);
345 spin_unlock(&init_mm.page_table_lock); 404 spin_unlock(&init_mm.page_table_lock);
346 __flush_tlb_all(); 405 __flush_tlb_all();
347 return last_map_addr; 406 return last_map_addr;
348} 407}
349 408
350static unsigned long __meminit 409static unsigned long __meminit
351phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end) 410phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
411 unsigned long page_size_mask)
352{ 412{
413 unsigned long pages = 0;
353 unsigned long last_map_addr = end; 414 unsigned long last_map_addr = end;
354 int i = pud_index(addr); 415 int i = pud_index(addr);
355 416
@@ -369,11 +430,13 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
369 430
370 if (pud_val(*pud)) { 431 if (pud_val(*pud)) {
371 if (!pud_large(*pud)) 432 if (!pud_large(*pud))
372 last_map_addr = phys_pmd_update(pud, addr, end); 433 last_map_addr = phys_pmd_update(pud, addr, end,
434 page_size_mask);
373 continue; 435 continue;
374 } 436 }
375 437
376 if (direct_gbpages) { 438 if (page_size_mask & (1<<PG_LEVEL_1G)) {
439 pages++;
377 set_pte((pte_t *)pud, 440 set_pte((pte_t *)pud,
378 pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); 441 pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
379 last_map_addr = (addr & PUD_MASK) + PUD_SIZE; 442 last_map_addr = (addr & PUD_MASK) + PUD_SIZE;
@@ -383,27 +446,50 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
383 pmd = alloc_low_page(&pmd_phys); 446 pmd = alloc_low_page(&pmd_phys);
384 447
385 spin_lock(&init_mm.page_table_lock); 448 spin_lock(&init_mm.page_table_lock);
386 set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE)); 449 last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask);
387 last_map_addr = phys_pmd_init(pmd, addr, end); 450 unmap_low_page(pmd);
451 pud_populate(&init_mm, pud, __va(pmd_phys));
388 spin_unlock(&init_mm.page_table_lock); 452 spin_unlock(&init_mm.page_table_lock);
389 453
390 unmap_low_page(pmd);
391 } 454 }
392 __flush_tlb_all(); 455 __flush_tlb_all();
456 update_page_count(PG_LEVEL_1G, pages);
393 457
394 return last_map_addr >> PAGE_SHIFT; 458 return last_map_addr;
459}
460
461static unsigned long __meminit
462phys_pud_update(pgd_t *pgd, unsigned long addr, unsigned long end,
463 unsigned long page_size_mask)
464{
465 pud_t *pud;
466
467 pud = (pud_t *)pgd_page_vaddr(*pgd);
468
469 return phys_pud_init(pud, addr, end, page_size_mask);
395} 470}
396 471
397static void __init find_early_table_space(unsigned long end) 472static void __init find_early_table_space(unsigned long end)
398{ 473{
399 unsigned long puds, pmds, tables, start; 474 unsigned long puds, pmds, ptes, tables, start;
400 475
401 puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; 476 puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
402 tables = round_up(puds * sizeof(pud_t), PAGE_SIZE); 477 tables = round_up(puds * sizeof(pud_t), PAGE_SIZE);
403 if (!direct_gbpages) { 478 if (direct_gbpages) {
479 unsigned long extra;
480 extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT);
481 pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT;
482 } else
404 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; 483 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
405 tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE); 484 tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE);
406 } 485
486 if (cpu_has_pse) {
487 unsigned long extra;
488 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
489 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
490 } else
491 ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
492 tables += round_up(ptes * sizeof(pte_t), PAGE_SIZE);
407 493
408 /* 494 /*
409 * RED-PEN putting page tables only on node 0 could 495 * RED-PEN putting page tables only on node 0 could
@@ -417,10 +503,10 @@ static void __init find_early_table_space(unsigned long end)
417 503
418 table_start >>= PAGE_SHIFT; 504 table_start >>= PAGE_SHIFT;
419 table_end = table_start; 505 table_end = table_start;
506 table_top = table_start + (tables >> PAGE_SHIFT);
420 507
421 early_printk("kernel direct mapping tables up to %lx @ %lx-%lx\n", 508 printk(KERN_DEBUG "kernel direct mapping tables up to %lx @ %lx-%lx\n",
422 end, table_start << PAGE_SHIFT, 509 end, table_start << PAGE_SHIFT, table_top << PAGE_SHIFT);
423 (table_start << PAGE_SHIFT) + tables);
424} 510}
425 511
426static void __init init_gbpages(void) 512static void __init init_gbpages(void)
@@ -431,7 +517,7 @@ static void __init init_gbpages(void)
431 direct_gbpages = 0; 517 direct_gbpages = 0;
432} 518}
433 519
434#ifdef CONFIG_MEMTEST_BOOTPARAM 520#ifdef CONFIG_MEMTEST
435 521
436static void __init memtest(unsigned long start_phys, unsigned long size, 522static void __init memtest(unsigned long start_phys, unsigned long size,
437 unsigned pattern) 523 unsigned pattern)
@@ -493,7 +579,8 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
493 579
494} 580}
495 581
496static int memtest_pattern __initdata = CONFIG_MEMTEST_BOOTPARAM_VALUE; 582/* default is disabled */
583static int memtest_pattern __initdata;
497 584
498static int __init parse_memtest(char *arg) 585static int __init parse_memtest(char *arg)
499{ 586{
@@ -542,15 +629,85 @@ static void __init early_memtest(unsigned long start, unsigned long end)
542} 629}
543#endif 630#endif
544 631
632static unsigned long __init kernel_physical_mapping_init(unsigned long start,
633 unsigned long end,
634 unsigned long page_size_mask)
635{
636
637 unsigned long next, last_map_addr = end;
638
639 start = (unsigned long)__va(start);
640 end = (unsigned long)__va(end);
641
642 for (; start < end; start = next) {
643 pgd_t *pgd = pgd_offset_k(start);
644 unsigned long pud_phys;
645 pud_t *pud;
646
647 next = start + PGDIR_SIZE;
648 if (next > end)
649 next = end;
650
651 if (pgd_val(*pgd)) {
652 last_map_addr = phys_pud_update(pgd, __pa(start),
653 __pa(end), page_size_mask);
654 continue;
655 }
656
657 if (after_bootmem)
658 pud = pud_offset(pgd, start & PGDIR_MASK);
659 else
660 pud = alloc_low_page(&pud_phys);
661
662 last_map_addr = phys_pud_init(pud, __pa(start), __pa(next),
663 page_size_mask);
664 unmap_low_page(pud);
665 pgd_populate(&init_mm, pgd_offset_k(start),
666 __va(pud_phys));
667 }
668
669 return last_map_addr;
670}
671
672struct map_range {
673 unsigned long start;
674 unsigned long end;
675 unsigned page_size_mask;
676};
677
678#define NR_RANGE_MR 5
679
680static int save_mr(struct map_range *mr, int nr_range,
681 unsigned long start_pfn, unsigned long end_pfn,
682 unsigned long page_size_mask)
683{
684
685 if (start_pfn < end_pfn) {
686 if (nr_range >= NR_RANGE_MR)
687 panic("run out of range for init_memory_mapping\n");
688 mr[nr_range].start = start_pfn<<PAGE_SHIFT;
689 mr[nr_range].end = end_pfn<<PAGE_SHIFT;
690 mr[nr_range].page_size_mask = page_size_mask;
691 nr_range++;
692 }
693
694 return nr_range;
695}
696
545/* 697/*
546 * Setup the direct mapping of the physical memory at PAGE_OFFSET. 698 * Setup the direct mapping of the physical memory at PAGE_OFFSET.
547 * This runs before bootmem is initialized and gets pages directly from 699 * This runs before bootmem is initialized and gets pages directly from
548 * the physical memory. To access them they are temporarily mapped. 700 * the physical memory. To access them they are temporarily mapped.
549 */ 701 */
550unsigned long __init_refok init_memory_mapping(unsigned long start, unsigned long end) 702unsigned long __init_refok init_memory_mapping(unsigned long start,
703 unsigned long end)
551{ 704{
552 unsigned long next, last_map_addr = end; 705 unsigned long last_map_addr = 0;
553 unsigned long start_phys = start, end_phys = end; 706 unsigned long page_size_mask = 0;
707 unsigned long start_pfn, end_pfn;
708
709 struct map_range mr[NR_RANGE_MR];
710 int nr_range, i;
554 711
555 printk(KERN_INFO "init_memory_mapping\n"); 712 printk(KERN_INFO "init_memory_mapping\n");
556 713
@@ -561,48 +718,115 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, unsigned lon
561 * memory mapped. Unfortunately this is done currently before the 718 * memory mapped. Unfortunately this is done currently before the
562 * nodes are discovered. 719 * nodes are discovered.
563 */ 720 */
564 if (!after_bootmem) { 721 if (!after_bootmem)
565 init_gbpages(); 722 init_gbpages();
566 find_early_table_space(end);
567 }
568 723
569 start = (unsigned long)__va(start); 724 if (direct_gbpages)
570 end = (unsigned long)__va(end); 725 page_size_mask |= 1 << PG_LEVEL_1G;
726 if (cpu_has_pse)
727 page_size_mask |= 1 << PG_LEVEL_2M;
728
729 memset(mr, 0, sizeof(mr));
730 nr_range = 0;
731
732 /* head if not big page alignment ?*/
733 start_pfn = start >> PAGE_SHIFT;
734 end_pfn = ((start + (PMD_SIZE - 1)) >> PMD_SHIFT)
735 << (PMD_SHIFT - PAGE_SHIFT);
736 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
737
738 /* big page (2M) range*/
739 start_pfn = ((start + (PMD_SIZE - 1))>>PMD_SHIFT)
740 << (PMD_SHIFT - PAGE_SHIFT);
741 end_pfn = ((start + (PUD_SIZE - 1))>>PUD_SHIFT)
742 << (PUD_SHIFT - PAGE_SHIFT);
743 if (end_pfn > ((end>>PUD_SHIFT)<<(PUD_SHIFT - PAGE_SHIFT)))
744 end_pfn = ((end>>PUD_SHIFT)<<(PUD_SHIFT - PAGE_SHIFT));
745 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
746 page_size_mask & (1<<PG_LEVEL_2M));
747
748 /* big page (1G) range */
749 start_pfn = end_pfn;
750 end_pfn = (end>>PUD_SHIFT) << (PUD_SHIFT - PAGE_SHIFT);
751 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
752 page_size_mask &
753 ((1<<PG_LEVEL_2M)|(1<<PG_LEVEL_1G)));
754
755 /* tail is not big page (1G) alignment */
756 start_pfn = end_pfn;
757 end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
758 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
759 page_size_mask & (1<<PG_LEVEL_2M));
760
761 /* tail is not big page (2M) alignment */
762 start_pfn = end_pfn;
763 end_pfn = end>>PAGE_SHIFT;
764 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
765
766 /* try to merge same page size and continuous */
767 for (i = 0; nr_range > 1 && i < nr_range - 1; i++) {
768 unsigned long old_start;
769 if (mr[i].end != mr[i+1].start ||
770 mr[i].page_size_mask != mr[i+1].page_size_mask)
771 continue;
772 /* move it */
773 old_start = mr[i].start;
774 memmove(&mr[i], &mr[i+1],
775 (nr_range - 1 - i) * sizeof (struct map_range));
776 mr[i].start = old_start;
777 nr_range--;
778 }
571 779
572 for (; start < end; start = next) { 780 for (i = 0; i < nr_range; i++)
573 pgd_t *pgd = pgd_offset_k(start); 781 printk(KERN_DEBUG " %010lx - %010lx page %s\n",
574 unsigned long pud_phys; 782 mr[i].start, mr[i].end,
575 pud_t *pud; 783 (mr[i].page_size_mask & (1<<PG_LEVEL_1G))?"1G":(
784 (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
576 785
577 if (after_bootmem) 786 if (!after_bootmem)
578 pud = pud_offset(pgd, start & PGDIR_MASK); 787 find_early_table_space(end);
579 else
580 pud = alloc_low_page(&pud_phys);
581 788
582 next = start + PGDIR_SIZE; 789 for (i = 0; i < nr_range; i++)
583 if (next > end) 790 last_map_addr = kernel_physical_mapping_init(
584 next = end; 791 mr[i].start, mr[i].end,
585 last_map_addr = phys_pud_init(pud, __pa(start), __pa(next)); 792 mr[i].page_size_mask);
586 if (!after_bootmem)
587 set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys));
588 unmap_low_page(pud);
589 }
590 793
591 if (!after_bootmem) 794 if (!after_bootmem)
592 mmu_cr4_features = read_cr4(); 795 mmu_cr4_features = read_cr4();
593 __flush_tlb_all(); 796 __flush_tlb_all();
594 797
595 if (!after_bootmem) 798 if (!after_bootmem && table_end > table_start)
596 reserve_early(table_start << PAGE_SHIFT, 799 reserve_early(table_start << PAGE_SHIFT,
597 table_end << PAGE_SHIFT, "PGTABLE"); 800 table_end << PAGE_SHIFT, "PGTABLE");
598 801
802 printk(KERN_INFO "last_map_addr: %lx end: %lx\n",
803 last_map_addr, end);
804
599 if (!after_bootmem) 805 if (!after_bootmem)
600 early_memtest(start_phys, end_phys); 806 early_memtest(start, end);
601 807
602 return last_map_addr; 808 return last_map_addr >> PAGE_SHIFT;
603} 809}
604 810
605#ifndef CONFIG_NUMA 811#ifndef CONFIG_NUMA
812void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn)
813{
814 unsigned long bootmap_size, bootmap;
815
816 bootmap_size = bootmem_bootmap_pages(end_pfn)<<PAGE_SHIFT;
817 bootmap = find_e820_area(0, end_pfn<<PAGE_SHIFT, bootmap_size,
818 PAGE_SIZE);
819 if (bootmap == -1L)
820 panic("Cannot find bootmem map of size %ld\n", bootmap_size);
821 /* don't touch min_low_pfn */
822 bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap >> PAGE_SHIFT,
823 0, end_pfn);
824 e820_register_active_regions(0, start_pfn, end_pfn);
825 free_bootmem_with_active_regions(0, end_pfn);
826 early_res_to_bootmem(0, end_pfn<<PAGE_SHIFT);
827 reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);
828}
829
606void __init paging_init(void) 830void __init paging_init(void)
607{ 831{
608 unsigned long max_zone_pfns[MAX_NR_ZONES]; 832 unsigned long max_zone_pfns[MAX_NR_ZONES];
@@ -610,9 +834,9 @@ void __init paging_init(void)
610 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 834 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
611 max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; 835 max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
612 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; 836 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
613 max_zone_pfns[ZONE_NORMAL] = end_pfn; 837 max_zone_pfns[ZONE_NORMAL] = max_pfn;
614 838
615 memory_present(0, 0, end_pfn); 839 memory_present(0, 0, max_pfn);
616 sparse_init(); 840 sparse_init();
617 free_area_init_nodes(max_zone_pfns); 841 free_area_init_nodes(max_zone_pfns);
618} 842}
@@ -694,8 +918,8 @@ void __init mem_init(void)
694#else 918#else
695 totalram_pages = free_all_bootmem(); 919 totalram_pages = free_all_bootmem();
696#endif 920#endif
697 reservedpages = end_pfn - totalram_pages - 921 reservedpages = max_pfn - totalram_pages -
698 absent_pages_in_range(0, end_pfn); 922 absent_pages_in_range(0, max_pfn);
699 after_bootmem = 1; 923 after_bootmem = 1;
700 924
701 codesize = (unsigned long) &_etext - (unsigned long) &_text; 925 codesize = (unsigned long) &_etext - (unsigned long) &_text;
@@ -714,7 +938,7 @@ void __init mem_init(void)
714 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 938 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
715 "%ldk reserved, %ldk data, %ldk init)\n", 939 "%ldk reserved, %ldk data, %ldk init)\n",
716 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 940 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
717 end_pfn << (PAGE_SHIFT-10), 941 max_pfn << (PAGE_SHIFT-10),
718 codesize >> 10, 942 codesize >> 10,
719 reservedpages << (PAGE_SHIFT-10), 943 reservedpages << (PAGE_SHIFT-10),
720 datasize >> 10, 944 datasize >> 10,
@@ -767,6 +991,13 @@ EXPORT_SYMBOL_GPL(rodata_test_data);
767void mark_rodata_ro(void) 991void mark_rodata_ro(void)
768{ 992{
769 unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata); 993 unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata);
994 unsigned long rodata_start =
995 ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK;
996
997#ifdef CONFIG_DYNAMIC_FTRACE
998 /* Dynamic tracing modifies the kernel text section */
999 start = rodata_start;
1000#endif
770 1001
771 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", 1002 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
772 (end - start) >> 10); 1003 (end - start) >> 10);
@@ -776,8 +1007,7 @@ void mark_rodata_ro(void)
776 * The rodata section (but not the kernel text!) should also be 1007 * The rodata section (but not the kernel text!) should also be
777 * not-executable. 1008 * not-executable.
778 */ 1009 */
779 start = ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK; 1010 set_memory_nx(rodata_start, (end - rodata_start) >> PAGE_SHIFT);
780 set_memory_nx(start, (end - start) >> PAGE_SHIFT);
781 1011
782 rodata_test(); 1012 rodata_test();
783 1013
@@ -799,24 +1029,26 @@ void free_initrd_mem(unsigned long start, unsigned long end)
799} 1029}
800#endif 1030#endif
801 1031
802void __init reserve_bootmem_generic(unsigned long phys, unsigned len) 1032int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
1033 int flags)
803{ 1034{
804#ifdef CONFIG_NUMA 1035#ifdef CONFIG_NUMA
805 int nid, next_nid; 1036 int nid, next_nid;
1037 int ret;
806#endif 1038#endif
807 unsigned long pfn = phys >> PAGE_SHIFT; 1039 unsigned long pfn = phys >> PAGE_SHIFT;
808 1040
809 if (pfn >= end_pfn) { 1041 if (pfn >= max_pfn) {
810 /* 1042 /*
811 * This can happen with kdump kernels when accessing 1043 * This can happen with kdump kernels when accessing
812 * firmware tables: 1044 * firmware tables:
813 */ 1045 */
814 if (pfn < max_pfn_mapped) 1046 if (pfn < max_pfn_mapped)
815 return; 1047 return -EFAULT;
816 1048
817 printk(KERN_ERR "reserve_bootmem: illegal reserve %lx %u\n", 1049 printk(KERN_ERR "reserve_bootmem: illegal reserve %lx %lu\n",
818 phys, len); 1050 phys, len);
819 return; 1051 return -EFAULT;
820 } 1052 }
821 1053
822 /* Should check here against the e820 map to avoid double free */ 1054 /* Should check here against the e820 map to avoid double free */
@@ -824,9 +1056,13 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
824 nid = phys_to_nid(phys); 1056 nid = phys_to_nid(phys);
825 next_nid = phys_to_nid(phys + len - 1); 1057 next_nid = phys_to_nid(phys + len - 1);
826 if (nid == next_nid) 1058 if (nid == next_nid)
827 reserve_bootmem_node(NODE_DATA(nid), phys, len, BOOTMEM_DEFAULT); 1059 ret = reserve_bootmem_node(NODE_DATA(nid), phys, len, flags);
828 else 1060 else
829 reserve_bootmem(phys, len, BOOTMEM_DEFAULT); 1061 ret = reserve_bootmem(phys, len, flags);
1062
1063 if (ret != 0)
1064 return ret;
1065
830#else 1066#else
831 reserve_bootmem(phys, len, BOOTMEM_DEFAULT); 1067 reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
832#endif 1068#endif
@@ -835,6 +1071,8 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
835 dma_reserve += len / PAGE_SIZE; 1071 dma_reserve += len / PAGE_SIZE;
836 set_dma_reserve(dma_reserve); 1072 set_dma_reserve(dma_reserve);
837 } 1073 }
1074
1075 return 0;
838} 1076}
839 1077
840int kern_addr_valid(unsigned long addr) 1078int kern_addr_valid(unsigned long addr)
@@ -939,7 +1177,7 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node)
939 pmd_t *pmd; 1177 pmd_t *pmd;
940 1178
941 for (; addr < end; addr = next) { 1179 for (; addr < end; addr = next) {
942 next = pmd_addr_end(addr, end); 1180 void *p = NULL;
943 1181
944 pgd = vmemmap_pgd_populate(addr, node); 1182 pgd = vmemmap_pgd_populate(addr, node);
945 if (!pgd) 1183 if (!pgd)
@@ -949,33 +1187,51 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node)
949 if (!pud) 1187 if (!pud)
950 return -ENOMEM; 1188 return -ENOMEM;
951 1189
952 pmd = pmd_offset(pud, addr); 1190 if (!cpu_has_pse) {
953 if (pmd_none(*pmd)) { 1191 next = (addr + PAGE_SIZE) & PAGE_MASK;
954 pte_t entry; 1192 pmd = vmemmap_pmd_populate(pud, addr, node);
955 void *p; 1193
1194 if (!pmd)
1195 return -ENOMEM;
1196
1197 p = vmemmap_pte_populate(pmd, addr, node);
956 1198
957 p = vmemmap_alloc_block(PMD_SIZE, node);
958 if (!p) 1199 if (!p)
959 return -ENOMEM; 1200 return -ENOMEM;
960 1201
961 entry = pfn_pte(__pa(p) >> PAGE_SHIFT, 1202 addr_end = addr + PAGE_SIZE;
962 PAGE_KERNEL_LARGE); 1203 p_end = p + PAGE_SIZE;
963 set_pmd(pmd, __pmd(pte_val(entry)));
964
965 /* check to see if we have contiguous blocks */
966 if (p_end != p || node_start != node) {
967 if (p_start)
968 printk(KERN_DEBUG " [%lx-%lx] PMD -> [%p-%p] on node %d\n",
969 addr_start, addr_end-1, p_start, p_end-1, node_start);
970 addr_start = addr;
971 node_start = node;
972 p_start = p;
973 }
974 addr_end = addr + PMD_SIZE;
975 p_end = p + PMD_SIZE;
976 } else { 1204 } else {
977 vmemmap_verify((pte_t *)pmd, node, addr, next); 1205 next = pmd_addr_end(addr, end);
1206
1207 pmd = pmd_offset(pud, addr);
1208 if (pmd_none(*pmd)) {
1209 pte_t entry;
1210
1211 p = vmemmap_alloc_block(PMD_SIZE, node);
1212 if (!p)
1213 return -ENOMEM;
1214
1215 entry = pfn_pte(__pa(p) >> PAGE_SHIFT,
1216 PAGE_KERNEL_LARGE);
1217 set_pmd(pmd, __pmd(pte_val(entry)));
1218
1219 /* check to see if we have contiguous blocks */
1220 if (p_end != p || node_start != node) {
1221 if (p_start)
1222 printk(KERN_DEBUG " [%lx-%lx] PMD -> [%p-%p] on node %d\n",
1223 addr_start, addr_end-1, p_start, p_end-1, node_start);
1224 addr_start = addr;
1225 node_start = node;
1226 p_start = p;
1227 }
1228
1229 addr_end = addr + PMD_SIZE;
1230 p_end = p + PMD_SIZE;
1231 } else
1232 vmemmap_verify((pte_t *)pmd, node, addr, next);
978 } 1233 }
1234
979 } 1235 }
980 return 0; 1236 return 0;
981} 1237}
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index d1b867101e5f..24c1d3c30186 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -12,6 +12,7 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/vmalloc.h> 14#include <linux/vmalloc.h>
15#include <linux/mmiotrace.h>
15 16
16#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
17#include <asm/e820.h> 18#include <asm/e820.h>
@@ -122,10 +123,13 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
122{ 123{
123 unsigned long pfn, offset, vaddr; 124 unsigned long pfn, offset, vaddr;
124 resource_size_t last_addr; 125 resource_size_t last_addr;
126 const resource_size_t unaligned_phys_addr = phys_addr;
127 const unsigned long unaligned_size = size;
125 struct vm_struct *area; 128 struct vm_struct *area;
126 unsigned long new_prot_val; 129 unsigned long new_prot_val;
127 pgprot_t prot; 130 pgprot_t prot;
128 int retval; 131 int retval;
132 void __iomem *ret_addr;
129 133
130 /* Don't allow wraparound or zero size */ 134 /* Don't allow wraparound or zero size */
131 last_addr = phys_addr + size - 1; 135 last_addr = phys_addr + size - 1;
@@ -142,7 +146,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
142 /* 146 /*
143 * Don't remap the low PCI/ISA area, it's always mapped.. 147 * Don't remap the low PCI/ISA area, it's always mapped..
144 */ 148 */
145 if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS) 149 if (is_ISA_range(phys_addr, last_addr))
146 return (__force void __iomem *)phys_to_virt(phys_addr); 150 return (__force void __iomem *)phys_to_virt(phys_addr);
147 151
148 /* 152 /*
@@ -233,7 +237,10 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
233 return NULL; 237 return NULL;
234 } 238 }
235 239
236 return (void __iomem *) (vaddr + offset); 240 ret_addr = (void __iomem *) (vaddr + offset);
241 mmiotrace_ioremap(unaligned_phys_addr, unaligned_size, ret_addr);
242
243 return ret_addr;
237} 244}
238 245
239/** 246/**
@@ -261,7 +268,7 @@ void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size)
261{ 268{
262 /* 269 /*
263 * Ideally, this should be: 270 * Ideally, this should be:
264 * pat_wc_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS; 271 * pat_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS;
265 * 272 *
266 * Till we fix all X drivers to use ioremap_wc(), we will use 273 * Till we fix all X drivers to use ioremap_wc(), we will use
267 * UC MINUS. 274 * UC MINUS.
@@ -285,7 +292,7 @@ EXPORT_SYMBOL(ioremap_nocache);
285 */ 292 */
286void __iomem *ioremap_wc(unsigned long phys_addr, unsigned long size) 293void __iomem *ioremap_wc(unsigned long phys_addr, unsigned long size)
287{ 294{
288 if (pat_wc_enabled) 295 if (pat_enabled)
289 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC, 296 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC,
290 __builtin_return_address(0)); 297 __builtin_return_address(0));
291 else 298 else
@@ -341,13 +348,15 @@ void iounmap(volatile void __iomem *addr)
341 * vm_area and by simply returning an address into the kernel mapping 348 * vm_area and by simply returning an address into the kernel mapping
342 * of ISA space. So handle that here. 349 * of ISA space. So handle that here.
343 */ 350 */
344 if (addr >= phys_to_virt(ISA_START_ADDRESS) && 351 if ((void __force *)addr >= phys_to_virt(ISA_START_ADDRESS) &&
345 addr < phys_to_virt(ISA_END_ADDRESS)) 352 (void __force *)addr < phys_to_virt(ISA_END_ADDRESS))
346 return; 353 return;
347 354
348 addr = (volatile void __iomem *) 355 addr = (volatile void __iomem *)
349 (PAGE_MASK & (unsigned long __force)addr); 356 (PAGE_MASK & (unsigned long __force)addr);
350 357
358 mmiotrace_iounmap(addr);
359
351 /* Use the vm area unlocked, assuming the caller 360 /* Use the vm area unlocked, assuming the caller
352 ensures there isn't another iounmap for the same address 361 ensures there isn't another iounmap for the same address
353 in parallel. Reuse of the virtual address is prevented by 362 in parallel. Reuse of the virtual address is prevented by
@@ -355,7 +364,7 @@ void iounmap(volatile void __iomem *addr)
355 cpa takes care of the direct mappings. */ 364 cpa takes care of the direct mappings. */
356 read_lock(&vmlist_lock); 365 read_lock(&vmlist_lock);
357 for (p = vmlist; p; p = p->next) { 366 for (p = vmlist; p; p = p->next) {
358 if (p->addr == addr) 367 if (p->addr == (void __force *)addr)
359 break; 368 break;
360 } 369 }
361 read_unlock(&vmlist_lock); 370 read_unlock(&vmlist_lock);
@@ -369,7 +378,7 @@ void iounmap(volatile void __iomem *addr)
369 free_memtype(p->phys_addr, p->phys_addr + get_vm_area_size(p)); 378 free_memtype(p->phys_addr, p->phys_addr + get_vm_area_size(p));
370 379
371 /* Finally remove it */ 380 /* Finally remove it */
372 o = remove_vm_area((void *)addr); 381 o = remove_vm_area((void __force *)addr);
373 BUG_ON(p != o || o == NULL); 382 BUG_ON(p != o || o == NULL);
374 kfree(p); 383 kfree(p);
375} 384}
@@ -388,7 +397,7 @@ void *xlate_dev_mem_ptr(unsigned long phys)
388 if (page_is_ram(start >> PAGE_SHIFT)) 397 if (page_is_ram(start >> PAGE_SHIFT))
389 return __va(phys); 398 return __va(phys);
390 399
391 addr = (void *)ioremap_default(start, PAGE_SIZE); 400 addr = (void __force *)ioremap_default(start, PAGE_SIZE);
392 if (addr) 401 if (addr)
393 addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK)); 402 addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK));
394 403
@@ -404,8 +413,6 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr)
404 return; 413 return;
405} 414}
406 415
407#ifdef CONFIG_X86_32
408
409int __initdata early_ioremap_debug; 416int __initdata early_ioremap_debug;
410 417
411static int __init early_ioremap_debug_setup(char *str) 418static int __init early_ioremap_debug_setup(char *str)
@@ -417,8 +424,7 @@ static int __init early_ioremap_debug_setup(char *str)
417early_param("early_ioremap_debug", early_ioremap_debug_setup); 424early_param("early_ioremap_debug", early_ioremap_debug_setup);
418 425
419static __initdata int after_paging_init; 426static __initdata int after_paging_init;
420static pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)] 427static pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)] __page_aligned_bss;
421 __section(.bss.page_aligned);
422 428
423static inline pmd_t * __init early_ioremap_pmd(unsigned long addr) 429static inline pmd_t * __init early_ioremap_pmd(unsigned long addr)
424{ 430{
@@ -507,10 +513,11 @@ static void __init __early_set_fixmap(enum fixed_addresses idx,
507 return; 513 return;
508 } 514 }
509 pte = early_ioremap_pte(addr); 515 pte = early_ioremap_pte(addr);
516
510 if (pgprot_val(flags)) 517 if (pgprot_val(flags))
511 set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags)); 518 set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
512 else 519 else
513 pte_clear(NULL, addr, pte); 520 pte_clear(&init_mm, addr, pte);
514 __flush_tlb_one(addr); 521 __flush_tlb_one(addr);
515} 522}
516 523
@@ -648,5 +655,3 @@ void __this_fixmap_does_not_exist(void)
648{ 655{
649 WARN_ON(1); 656 WARN_ON(1);
650} 657}
651
652#endif /* CONFIG_X86_32 */
diff --git a/arch/x86/mm/k8topology_64.c b/arch/x86/mm/k8topology_64.c
index 1f476e477844..41f1b5c00a1d 100644
--- a/arch/x86/mm/k8topology_64.c
+++ b/arch/x86/mm/k8topology_64.c
@@ -22,6 +22,7 @@
22#include <asm/numa.h> 22#include <asm/numa.h>
23#include <asm/mpspec.h> 23#include <asm/mpspec.h>
24#include <asm/apic.h> 24#include <asm/apic.h>
25#include <asm/k8.h>
25 26
26static __init int find_northbridge(void) 27static __init int find_northbridge(void)
27{ 28{
@@ -56,34 +57,33 @@ static __init void early_get_boot_cpu_id(void)
56 /* 57 /*
57 * Find possible boot-time SMP configuration: 58 * Find possible boot-time SMP configuration:
58 */ 59 */
60#ifdef CONFIG_X86_MPPARSE
59 early_find_smp_config(); 61 early_find_smp_config();
62#endif
60#ifdef CONFIG_ACPI 63#ifdef CONFIG_ACPI
61 /* 64 /*
62 * Read APIC information from ACPI tables. 65 * Read APIC information from ACPI tables.
63 */ 66 */
64 early_acpi_boot_init(); 67 early_acpi_boot_init();
65#endif 68#endif
69#ifdef CONFIG_X86_MPPARSE
66 /* 70 /*
67 * get boot-time SMP configuration: 71 * get boot-time SMP configuration:
68 */ 72 */
69 if (smp_found_config) 73 if (smp_found_config)
70 early_get_smp_config(); 74 early_get_smp_config();
75#endif
71 early_init_lapic_mapping(); 76 early_init_lapic_mapping();
72} 77}
73 78
74int __init k8_scan_nodes(unsigned long start, unsigned long end) 79int __init k8_scan_nodes(unsigned long start, unsigned long end)
75{ 80{
81 unsigned numnodes, cores, bits, apicid_base;
76 unsigned long prevbase; 82 unsigned long prevbase;
77 struct bootnode nodes[8]; 83 struct bootnode nodes[8];
78 int nodeid, i, nb;
79 unsigned char nodeids[8]; 84 unsigned char nodeids[8];
80 int found = 0; 85 int i, j, nb, found = 0;
81 u32 reg; 86 u32 nodeid, reg;
82 unsigned numnodes;
83 unsigned cores;
84 unsigned bits;
85 int j;
86 unsigned apicid_base;
87 87
88 if (!early_pci_allowed()) 88 if (!early_pci_allowed())
89 return -1; 89 return -1;
@@ -105,7 +105,6 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
105 prevbase = 0; 105 prevbase = 0;
106 for (i = 0; i < 8; i++) { 106 for (i = 0; i < 8; i++) {
107 unsigned long base, limit; 107 unsigned long base, limit;
108 u32 nodeid;
109 108
110 base = read_pci_config(0, nb, 1, 0x40 + i*8); 109 base = read_pci_config(0, nb, 1, 0x40 + i*8);
111 limit = read_pci_config(0, nb, 1, 0x44 + i*8); 110 limit = read_pci_config(0, nb, 1, 0x44 + i*8);
@@ -144,8 +143,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
144 limit |= (1<<24)-1; 143 limit |= (1<<24)-1;
145 limit++; 144 limit++;
146 145
147 if (limit > end_pfn << PAGE_SHIFT) 146 if (limit > max_pfn << PAGE_SHIFT)
148 limit = end_pfn << PAGE_SHIFT; 147 limit = max_pfn << PAGE_SHIFT;
149 if (limit <= base) 148 if (limit <= base)
150 continue; 149 continue;
151 150
diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
new file mode 100644
index 000000000000..93d82038af4b
--- /dev/null
+++ b/arch/x86/mm/kmmio.c
@@ -0,0 +1,510 @@
1/* Support for MMIO probes.
2 * Benfit many code from kprobes
3 * (C) 2002 Louis Zhuang <louis.zhuang@intel.com>.
4 * 2007 Alexander Eichner
5 * 2008 Pekka Paalanen <pq@iki.fi>
6 */
7
8#include <linux/list.h>
9#include <linux/rculist.h>
10#include <linux/spinlock.h>
11#include <linux/hash.h>
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/uaccess.h>
16#include <linux/ptrace.h>
17#include <linux/preempt.h>
18#include <linux/percpu.h>
19#include <linux/kdebug.h>
20#include <linux/mutex.h>
21#include <linux/io.h>
22#include <asm/cacheflush.h>
23#include <asm/tlbflush.h>
24#include <linux/errno.h>
25#include <asm/debugreg.h>
26#include <linux/mmiotrace.h>
27
28#define KMMIO_PAGE_HASH_BITS 4
29#define KMMIO_PAGE_TABLE_SIZE (1 << KMMIO_PAGE_HASH_BITS)
30
31struct kmmio_fault_page {
32 struct list_head list;
33 struct kmmio_fault_page *release_next;
34 unsigned long page; /* location of the fault page */
35
36 /*
37 * Number of times this page has been registered as a part
38 * of a probe. If zero, page is disarmed and this may be freed.
39 * Used only by writers (RCU).
40 */
41 int count;
42};
43
44struct kmmio_delayed_release {
45 struct rcu_head rcu;
46 struct kmmio_fault_page *release_list;
47};
48
49struct kmmio_context {
50 struct kmmio_fault_page *fpage;
51 struct kmmio_probe *probe;
52 unsigned long saved_flags;
53 unsigned long addr;
54 int active;
55};
56
57static DEFINE_SPINLOCK(kmmio_lock);
58
59/* Protected by kmmio_lock */
60unsigned int kmmio_count;
61
62/* Read-protected by RCU, write-protected by kmmio_lock. */
63static struct list_head kmmio_page_table[KMMIO_PAGE_TABLE_SIZE];
64static LIST_HEAD(kmmio_probes);
65
66static struct list_head *kmmio_page_list(unsigned long page)
67{
68 return &kmmio_page_table[hash_long(page, KMMIO_PAGE_HASH_BITS)];
69}
70
71/* Accessed per-cpu */
72static DEFINE_PER_CPU(struct kmmio_context, kmmio_ctx);
73
74/*
75 * this is basically a dynamic stabbing problem:
76 * Could use the existing prio tree code or
77 * Possible better implementations:
78 * The Interval Skip List: A Data Structure for Finding All Intervals That
79 * Overlap a Point (might be simple)
80 * Space Efficient Dynamic Stabbing with Fast Queries - Mikkel Thorup
81 */
82/* Get the kmmio at this addr (if any). You must be holding RCU read lock. */
83static struct kmmio_probe *get_kmmio_probe(unsigned long addr)
84{
85 struct kmmio_probe *p;
86 list_for_each_entry_rcu(p, &kmmio_probes, list) {
87 if (addr >= p->addr && addr <= (p->addr + p->len))
88 return p;
89 }
90 return NULL;
91}
92
93/* You must be holding RCU read lock. */
94static struct kmmio_fault_page *get_kmmio_fault_page(unsigned long page)
95{
96 struct list_head *head;
97 struct kmmio_fault_page *p;
98
99 page &= PAGE_MASK;
100 head = kmmio_page_list(page);
101 list_for_each_entry_rcu(p, head, list) {
102 if (p->page == page)
103 return p;
104 }
105 return NULL;
106}
107
108static void set_page_present(unsigned long addr, bool present,
109 unsigned int *pglevel)
110{
111 pteval_t pteval;
112 pmdval_t pmdval;
113 unsigned int level;
114 pmd_t *pmd;
115 pte_t *pte = lookup_address(addr, &level);
116
117 if (!pte) {
118 pr_err("kmmio: no pte for page 0x%08lx\n", addr);
119 return;
120 }
121
122 if (pglevel)
123 *pglevel = level;
124
125 switch (level) {
126 case PG_LEVEL_2M:
127 pmd = (pmd_t *)pte;
128 pmdval = pmd_val(*pmd) & ~_PAGE_PRESENT;
129 if (present)
130 pmdval |= _PAGE_PRESENT;
131 set_pmd(pmd, __pmd(pmdval));
132 break;
133
134 case PG_LEVEL_4K:
135 pteval = pte_val(*pte) & ~_PAGE_PRESENT;
136 if (present)
137 pteval |= _PAGE_PRESENT;
138 set_pte_atomic(pte, __pte(pteval));
139 break;
140
141 default:
142 pr_err("kmmio: unexpected page level 0x%x.\n", level);
143 return;
144 }
145
146 __flush_tlb_one(addr);
147}
148
149/** Mark the given page as not present. Access to it will trigger a fault. */
150static void arm_kmmio_fault_page(unsigned long page, unsigned int *pglevel)
151{
152 set_page_present(page & PAGE_MASK, false, pglevel);
153}
154
155/** Mark the given page as present. */
156static void disarm_kmmio_fault_page(unsigned long page, unsigned int *pglevel)
157{
158 set_page_present(page & PAGE_MASK, true, pglevel);
159}
160
161/*
162 * This is being called from do_page_fault().
163 *
164 * We may be in an interrupt or a critical section. Also prefecthing may
165 * trigger a page fault. We may be in the middle of process switch.
166 * We cannot take any locks, because we could be executing especially
167 * within a kmmio critical section.
168 *
169 * Local interrupts are disabled, so preemption cannot happen.
170 * Do not enable interrupts, do not sleep, and watch out for other CPUs.
171 */
172/*
173 * Interrupts are disabled on entry as trap3 is an interrupt gate
174 * and they remain disabled thorough out this function.
175 */
176int kmmio_handler(struct pt_regs *regs, unsigned long addr)
177{
178 struct kmmio_context *ctx;
179 struct kmmio_fault_page *faultpage;
180 int ret = 0; /* default to fault not handled */
181
182 /*
183 * Preemption is now disabled to prevent process switch during
184 * single stepping. We can only handle one active kmmio trace
185 * per cpu, so ensure that we finish it before something else
186 * gets to run. We also hold the RCU read lock over single
187 * stepping to avoid looking up the probe and kmmio_fault_page
188 * again.
189 */
190 preempt_disable();
191 rcu_read_lock();
192
193 faultpage = get_kmmio_fault_page(addr);
194 if (!faultpage) {
195 /*
196 * Either this page fault is not caused by kmmio, or
197 * another CPU just pulled the kmmio probe from under
198 * our feet. The latter case should not be possible.
199 */
200 goto no_kmmio;
201 }
202
203 ctx = &get_cpu_var(kmmio_ctx);
204 if (ctx->active) {
205 disarm_kmmio_fault_page(faultpage->page, NULL);
206 if (addr == ctx->addr) {
207 /*
208 * On SMP we sometimes get recursive probe hits on the
209 * same address. Context is already saved, fall out.
210 */
211 pr_debug("kmmio: duplicate probe hit on CPU %d, for "
212 "address 0x%08lx.\n",
213 smp_processor_id(), addr);
214 ret = 1;
215 goto no_kmmio_ctx;
216 }
217 /*
218 * Prevent overwriting already in-flight context.
219 * This should not happen, let's hope disarming at least
220 * prevents a panic.
221 */
222 pr_emerg("kmmio: recursive probe hit on CPU %d, "
223 "for address 0x%08lx. Ignoring.\n",
224 smp_processor_id(), addr);
225 pr_emerg("kmmio: previous hit was at 0x%08lx.\n",
226 ctx->addr);
227 goto no_kmmio_ctx;
228 }
229 ctx->active++;
230
231 ctx->fpage = faultpage;
232 ctx->probe = get_kmmio_probe(addr);
233 ctx->saved_flags = (regs->flags & (X86_EFLAGS_TF | X86_EFLAGS_IF));
234 ctx->addr = addr;
235
236 if (ctx->probe && ctx->probe->pre_handler)
237 ctx->probe->pre_handler(ctx->probe, regs, addr);
238
239 /*
240 * Enable single-stepping and disable interrupts for the faulting
241 * context. Local interrupts must not get enabled during stepping.
242 */
243 regs->flags |= X86_EFLAGS_TF;
244 regs->flags &= ~X86_EFLAGS_IF;
245
246 /* Now we set present bit in PTE and single step. */
247 disarm_kmmio_fault_page(ctx->fpage->page, NULL);
248
249 /*
250 * If another cpu accesses the same page while we are stepping,
251 * the access will not be caught. It will simply succeed and the
252 * only downside is we lose the event. If this becomes a problem,
253 * the user should drop to single cpu before tracing.
254 */
255
256 put_cpu_var(kmmio_ctx);
257 return 1; /* fault handled */
258
259no_kmmio_ctx:
260 put_cpu_var(kmmio_ctx);
261no_kmmio:
262 rcu_read_unlock();
263 preempt_enable_no_resched();
264 return ret;
265}
266
267/*
268 * Interrupts are disabled on entry as trap1 is an interrupt gate
269 * and they remain disabled thorough out this function.
270 * This must always get called as the pair to kmmio_handler().
271 */
272static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
273{
274 int ret = 0;
275 struct kmmio_context *ctx = &get_cpu_var(kmmio_ctx);
276
277 if (!ctx->active) {
278 pr_debug("kmmio: spurious debug trap on CPU %d.\n",
279 smp_processor_id());
280 goto out;
281 }
282
283 if (ctx->probe && ctx->probe->post_handler)
284 ctx->probe->post_handler(ctx->probe, condition, regs);
285
286 arm_kmmio_fault_page(ctx->fpage->page, NULL);
287
288 regs->flags &= ~X86_EFLAGS_TF;
289 regs->flags |= ctx->saved_flags;
290
291 /* These were acquired in kmmio_handler(). */
292 ctx->active--;
293 BUG_ON(ctx->active);
294 rcu_read_unlock();
295 preempt_enable_no_resched();
296
297 /*
298 * if somebody else is singlestepping across a probe point, flags
299 * will have TF set, in which case, continue the remaining processing
300 * of do_debug, as if this is not a probe hit.
301 */
302 if (!(regs->flags & X86_EFLAGS_TF))
303 ret = 1;
304out:
305 put_cpu_var(kmmio_ctx);
306 return ret;
307}
308
309/* You must be holding kmmio_lock. */
310static int add_kmmio_fault_page(unsigned long page)
311{
312 struct kmmio_fault_page *f;
313
314 page &= PAGE_MASK;
315 f = get_kmmio_fault_page(page);
316 if (f) {
317 if (!f->count)
318 arm_kmmio_fault_page(f->page, NULL);
319 f->count++;
320 return 0;
321 }
322
323 f = kmalloc(sizeof(*f), GFP_ATOMIC);
324 if (!f)
325 return -1;
326
327 f->count = 1;
328 f->page = page;
329 list_add_rcu(&f->list, kmmio_page_list(f->page));
330
331 arm_kmmio_fault_page(f->page, NULL);
332
333 return 0;
334}
335
336/* You must be holding kmmio_lock. */
337static void release_kmmio_fault_page(unsigned long page,
338 struct kmmio_fault_page **release_list)
339{
340 struct kmmio_fault_page *f;
341
342 page &= PAGE_MASK;
343 f = get_kmmio_fault_page(page);
344 if (!f)
345 return;
346
347 f->count--;
348 BUG_ON(f->count < 0);
349 if (!f->count) {
350 disarm_kmmio_fault_page(f->page, NULL);
351 f->release_next = *release_list;
352 *release_list = f;
353 }
354}
355
356/*
357 * With page-unaligned ioremaps, one or two armed pages may contain
358 * addresses from outside the intended mapping. Events for these addresses
359 * are currently silently dropped. The events may result only from programming
360 * mistakes by accessing addresses before the beginning or past the end of a
361 * mapping.
362 */
363int register_kmmio_probe(struct kmmio_probe *p)
364{
365 unsigned long flags;
366 int ret = 0;
367 unsigned long size = 0;
368 const unsigned long size_lim = p->len + (p->addr & ~PAGE_MASK);
369
370 spin_lock_irqsave(&kmmio_lock, flags);
371 if (get_kmmio_probe(p->addr)) {
372 ret = -EEXIST;
373 goto out;
374 }
375 kmmio_count++;
376 list_add_rcu(&p->list, &kmmio_probes);
377 while (size < size_lim) {
378 if (add_kmmio_fault_page(p->addr + size))
379 pr_err("kmmio: Unable to set page fault.\n");
380 size += PAGE_SIZE;
381 }
382out:
383 spin_unlock_irqrestore(&kmmio_lock, flags);
384 /*
385 * XXX: What should I do here?
386 * Here was a call to global_flush_tlb(), but it does not exist
387 * anymore. It seems it's not needed after all.
388 */
389 return ret;
390}
391EXPORT_SYMBOL(register_kmmio_probe);
392
393static void rcu_free_kmmio_fault_pages(struct rcu_head *head)
394{
395 struct kmmio_delayed_release *dr = container_of(
396 head,
397 struct kmmio_delayed_release,
398 rcu);
399 struct kmmio_fault_page *p = dr->release_list;
400 while (p) {
401 struct kmmio_fault_page *next = p->release_next;
402 BUG_ON(p->count);
403 kfree(p);
404 p = next;
405 }
406 kfree(dr);
407}
408
409static void remove_kmmio_fault_pages(struct rcu_head *head)
410{
411 struct kmmio_delayed_release *dr = container_of(
412 head,
413 struct kmmio_delayed_release,
414 rcu);
415 struct kmmio_fault_page *p = dr->release_list;
416 struct kmmio_fault_page **prevp = &dr->release_list;
417 unsigned long flags;
418 spin_lock_irqsave(&kmmio_lock, flags);
419 while (p) {
420 if (!p->count)
421 list_del_rcu(&p->list);
422 else
423 *prevp = p->release_next;
424 prevp = &p->release_next;
425 p = p->release_next;
426 }
427 spin_unlock_irqrestore(&kmmio_lock, flags);
428 /* This is the real RCU destroy call. */
429 call_rcu(&dr->rcu, rcu_free_kmmio_fault_pages);
430}
431
432/*
433 * Remove a kmmio probe. You have to synchronize_rcu() before you can be
434 * sure that the callbacks will not be called anymore. Only after that
435 * you may actually release your struct kmmio_probe.
436 *
437 * Unregistering a kmmio fault page has three steps:
438 * 1. release_kmmio_fault_page()
439 * Disarm the page, wait a grace period to let all faults finish.
440 * 2. remove_kmmio_fault_pages()
441 * Remove the pages from kmmio_page_table.
442 * 3. rcu_free_kmmio_fault_pages()
443 * Actally free the kmmio_fault_page structs as with RCU.
444 */
445void unregister_kmmio_probe(struct kmmio_probe *p)
446{
447 unsigned long flags;
448 unsigned long size = 0;
449 const unsigned long size_lim = p->len + (p->addr & ~PAGE_MASK);
450 struct kmmio_fault_page *release_list = NULL;
451 struct kmmio_delayed_release *drelease;
452
453 spin_lock_irqsave(&kmmio_lock, flags);
454 while (size < size_lim) {
455 release_kmmio_fault_page(p->addr + size, &release_list);
456 size += PAGE_SIZE;
457 }
458 list_del_rcu(&p->list);
459 kmmio_count--;
460 spin_unlock_irqrestore(&kmmio_lock, flags);
461
462 drelease = kmalloc(sizeof(*drelease), GFP_ATOMIC);
463 if (!drelease) {
464 pr_crit("kmmio: leaking kmmio_fault_page objects.\n");
465 return;
466 }
467 drelease->release_list = release_list;
468
469 /*
470 * This is not really RCU here. We have just disarmed a set of
471 * pages so that they cannot trigger page faults anymore. However,
472 * we cannot remove the pages from kmmio_page_table,
473 * because a probe hit might be in flight on another CPU. The
474 * pages are collected into a list, and they will be removed from
475 * kmmio_page_table when it is certain that no probe hit related to
476 * these pages can be in flight. RCU grace period sounds like a
477 * good choice.
478 *
479 * If we removed the pages too early, kmmio page fault handler might
480 * not find the respective kmmio_fault_page and determine it's not
481 * a kmmio fault, when it actually is. This would lead to madness.
482 */
483 call_rcu(&drelease->rcu, remove_kmmio_fault_pages);
484}
485EXPORT_SYMBOL(unregister_kmmio_probe);
486
487static int kmmio_die_notifier(struct notifier_block *nb, unsigned long val,
488 void *args)
489{
490 struct die_args *arg = args;
491
492 if (val == DIE_DEBUG && (arg->err & DR_STEP))
493 if (post_kmmio_handler(arg->err, arg->regs) == 1)
494 return NOTIFY_STOP;
495
496 return NOTIFY_DONE;
497}
498
499static struct notifier_block nb_die = {
500 .notifier_call = kmmio_die_notifier
501};
502
503static int __init init_kmmio(void)
504{
505 int i;
506 for (i = 0; i < KMMIO_PAGE_TABLE_SIZE; i++)
507 INIT_LIST_HEAD(&kmmio_page_table[i]);
508 return register_die_notifier(&nb_die);
509}
510fs_initcall(init_kmmio); /* should be before device_initcall() */
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
new file mode 100644
index 000000000000..e7397e108beb
--- /dev/null
+++ b/arch/x86/mm/mmio-mod.c
@@ -0,0 +1,515 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) IBM Corporation, 2005
17 * Jeff Muizelaar, 2006, 2007
18 * Pekka Paalanen, 2008 <pq@iki.fi>
19 *
20 * Derived from the read-mod example from relay-examples by Tom Zanussi.
21 */
22#define DEBUG 1
23
24#include <linux/module.h>
25#include <linux/debugfs.h>
26#include <linux/uaccess.h>
27#include <linux/io.h>
28#include <linux/version.h>
29#include <linux/kallsyms.h>
30#include <asm/pgtable.h>
31#include <linux/mmiotrace.h>
32#include <asm/e820.h> /* for ISA_START_ADDRESS */
33#include <asm/atomic.h>
34#include <linux/percpu.h>
35#include <linux/cpu.h>
36
37#include "pf_in.h"
38
39#define NAME "mmiotrace: "
40
41struct trap_reason {
42 unsigned long addr;
43 unsigned long ip;
44 enum reason_type type;
45 int active_traces;
46};
47
48struct remap_trace {
49 struct list_head list;
50 struct kmmio_probe probe;
51 resource_size_t phys;
52 unsigned long id;
53};
54
55/* Accessed per-cpu. */
56static DEFINE_PER_CPU(struct trap_reason, pf_reason);
57static DEFINE_PER_CPU(struct mmiotrace_rw, cpu_trace);
58
59#if 0 /* XXX: no way gather this info anymore */
60/* Access to this is not per-cpu. */
61static DEFINE_PER_CPU(atomic_t, dropped);
62#endif
63
64static struct dentry *marker_file;
65
66static DEFINE_MUTEX(mmiotrace_mutex);
67static DEFINE_SPINLOCK(trace_lock);
68static atomic_t mmiotrace_enabled;
69static LIST_HEAD(trace_list); /* struct remap_trace */
70
71/*
72 * Locking in this file:
73 * - mmiotrace_mutex enforces enable/disable_mmiotrace() critical sections.
74 * - mmiotrace_enabled may be modified only when holding mmiotrace_mutex
75 * and trace_lock.
76 * - Routines depending on is_enabled() must take trace_lock.
77 * - trace_list users must hold trace_lock.
78 * - is_enabled() guarantees that mmio_trace_record is allowed.
79 * - pre/post callbacks assume the effect of is_enabled() being true.
80 */
81
82/* module parameters */
83static unsigned long filter_offset;
84static int nommiotrace;
85static int trace_pc;
86
87module_param(filter_offset, ulong, 0);
88module_param(nommiotrace, bool, 0);
89module_param(trace_pc, bool, 0);
90
91MODULE_PARM_DESC(filter_offset, "Start address of traced mappings.");
92MODULE_PARM_DESC(nommiotrace, "Disable actual MMIO tracing.");
93MODULE_PARM_DESC(trace_pc, "Record address of faulting instructions.");
94
95static bool is_enabled(void)
96{
97 return atomic_read(&mmiotrace_enabled);
98}
99
100#if 0 /* XXX: needs rewrite */
101/*
102 * Write callback for the debugfs entry:
103 * Read a marker and write it to the mmio trace log
104 */
105static ssize_t write_marker(struct file *file, const char __user *buffer,
106 size_t count, loff_t *ppos)
107{
108 char *event = NULL;
109 struct mm_io_header *headp;
110 ssize_t len = (count > 65535) ? 65535 : count;
111
112 event = kzalloc(sizeof(*headp) + len, GFP_KERNEL);
113 if (!event)
114 return -ENOMEM;
115
116 headp = (struct mm_io_header *)event;
117 headp->type = MMIO_MAGIC | (MMIO_MARKER << MMIO_OPCODE_SHIFT);
118 headp->data_len = len;
119
120 if (copy_from_user(event + sizeof(*headp), buffer, len)) {
121 kfree(event);
122 return -EFAULT;
123 }
124
125 spin_lock_irq(&trace_lock);
126#if 0 /* XXX: convert this to use tracing */
127 if (is_enabled())
128 relay_write(chan, event, sizeof(*headp) + len);
129 else
130#endif
131 len = -EINVAL;
132 spin_unlock_irq(&trace_lock);
133 kfree(event);
134 return len;
135}
136#endif
137
138static void print_pte(unsigned long address)
139{
140 unsigned int level;
141 pte_t *pte = lookup_address(address, &level);
142
143 if (!pte) {
144 pr_err(NAME "Error in %s: no pte for page 0x%08lx\n",
145 __func__, address);
146 return;
147 }
148
149 if (level == PG_LEVEL_2M) {
150 pr_emerg(NAME "4MB pages are not currently supported: "
151 "0x%08lx\n", address);
152 BUG();
153 }
154 pr_info(NAME "pte for 0x%lx: 0x%llx 0x%llx\n", address,
155 (unsigned long long)pte_val(*pte),
156 (unsigned long long)pte_val(*pte) & _PAGE_PRESENT);
157}
158
159/*
160 * For some reason the pre/post pairs have been called in an
161 * unmatched order. Report and die.
162 */
163static void die_kmmio_nesting_error(struct pt_regs *regs, unsigned long addr)
164{
165 const struct trap_reason *my_reason = &get_cpu_var(pf_reason);
166 pr_emerg(NAME "unexpected fault for address: 0x%08lx, "
167 "last fault for address: 0x%08lx\n",
168 addr, my_reason->addr);
169 print_pte(addr);
170 print_symbol(KERN_EMERG "faulting IP is at %s\n", regs->ip);
171 print_symbol(KERN_EMERG "last faulting IP was at %s\n", my_reason->ip);
172#ifdef __i386__
173 pr_emerg("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
174 regs->ax, regs->bx, regs->cx, regs->dx);
175 pr_emerg("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
176 regs->si, regs->di, regs->bp, regs->sp);
177#else
178 pr_emerg("rax: %016lx rcx: %016lx rdx: %016lx\n",
179 regs->ax, regs->cx, regs->dx);
180 pr_emerg("rsi: %016lx rdi: %016lx rbp: %016lx rsp: %016lx\n",
181 regs->si, regs->di, regs->bp, regs->sp);
182#endif
183 put_cpu_var(pf_reason);
184 BUG();
185}
186
187static void pre(struct kmmio_probe *p, struct pt_regs *regs,
188 unsigned long addr)
189{
190 struct trap_reason *my_reason = &get_cpu_var(pf_reason);
191 struct mmiotrace_rw *my_trace = &get_cpu_var(cpu_trace);
192 const unsigned long instptr = instruction_pointer(regs);
193 const enum reason_type type = get_ins_type(instptr);
194 struct remap_trace *trace = p->private;
195
196 /* it doesn't make sense to have more than one active trace per cpu */
197 if (my_reason->active_traces)
198 die_kmmio_nesting_error(regs, addr);
199 else
200 my_reason->active_traces++;
201
202 my_reason->type = type;
203 my_reason->addr = addr;
204 my_reason->ip = instptr;
205
206 my_trace->phys = addr - trace->probe.addr + trace->phys;
207 my_trace->map_id = trace->id;
208
209 /*
210 * Only record the program counter when requested.
211 * It may taint clean-room reverse engineering.
212 */
213 if (trace_pc)
214 my_trace->pc = instptr;
215 else
216 my_trace->pc = 0;
217
218 /*
219 * XXX: the timestamp recorded will be *after* the tracing has been
220 * done, not at the time we hit the instruction. SMP implications
221 * on event ordering?
222 */
223
224 switch (type) {
225 case REG_READ:
226 my_trace->opcode = MMIO_READ;
227 my_trace->width = get_ins_mem_width(instptr);
228 break;
229 case REG_WRITE:
230 my_trace->opcode = MMIO_WRITE;
231 my_trace->width = get_ins_mem_width(instptr);
232 my_trace->value = get_ins_reg_val(instptr, regs);
233 break;
234 case IMM_WRITE:
235 my_trace->opcode = MMIO_WRITE;
236 my_trace->width = get_ins_mem_width(instptr);
237 my_trace->value = get_ins_imm_val(instptr);
238 break;
239 default:
240 {
241 unsigned char *ip = (unsigned char *)instptr;
242 my_trace->opcode = MMIO_UNKNOWN_OP;
243 my_trace->width = 0;
244 my_trace->value = (*ip) << 16 | *(ip + 1) << 8 |
245 *(ip + 2);
246 }
247 }
248 put_cpu_var(cpu_trace);
249 put_cpu_var(pf_reason);
250}
251
252static void post(struct kmmio_probe *p, unsigned long condition,
253 struct pt_regs *regs)
254{
255 struct trap_reason *my_reason = &get_cpu_var(pf_reason);
256 struct mmiotrace_rw *my_trace = &get_cpu_var(cpu_trace);
257
258 /* this should always return the active_trace count to 0 */
259 my_reason->active_traces--;
260 if (my_reason->active_traces) {
261 pr_emerg(NAME "unexpected post handler");
262 BUG();
263 }
264
265 switch (my_reason->type) {
266 case REG_READ:
267 my_trace->value = get_ins_reg_val(my_reason->ip, regs);
268 break;
269 default:
270 break;
271 }
272
273 mmio_trace_rw(my_trace);
274 put_cpu_var(cpu_trace);
275 put_cpu_var(pf_reason);
276}
277
278static void ioremap_trace_core(resource_size_t offset, unsigned long size,
279 void __iomem *addr)
280{
281 static atomic_t next_id;
282 struct remap_trace *trace = kmalloc(sizeof(*trace), GFP_KERNEL);
283 /* These are page-unaligned. */
284 struct mmiotrace_map map = {
285 .phys = offset,
286 .virt = (unsigned long)addr,
287 .len = size,
288 .opcode = MMIO_PROBE
289 };
290
291 if (!trace) {
292 pr_err(NAME "kmalloc failed in ioremap\n");
293 return;
294 }
295
296 *trace = (struct remap_trace) {
297 .probe = {
298 .addr = (unsigned long)addr,
299 .len = size,
300 .pre_handler = pre,
301 .post_handler = post,
302 .private = trace
303 },
304 .phys = offset,
305 .id = atomic_inc_return(&next_id)
306 };
307 map.map_id = trace->id;
308
309 spin_lock_irq(&trace_lock);
310 if (!is_enabled())
311 goto not_enabled;
312
313 mmio_trace_mapping(&map);
314 list_add_tail(&trace->list, &trace_list);
315 if (!nommiotrace)
316 register_kmmio_probe(&trace->probe);
317
318not_enabled:
319 spin_unlock_irq(&trace_lock);
320}
321
322void mmiotrace_ioremap(resource_size_t offset, unsigned long size,
323 void __iomem *addr)
324{
325 if (!is_enabled()) /* recheck and proper locking in *_core() */
326 return;
327
328 pr_debug(NAME "ioremap_*(0x%llx, 0x%lx) = %p\n",
329 (unsigned long long)offset, size, addr);
330 if ((filter_offset) && (offset != filter_offset))
331 return;
332 ioremap_trace_core(offset, size, addr);
333}
334
335static void iounmap_trace_core(volatile void __iomem *addr)
336{
337 struct mmiotrace_map map = {
338 .phys = 0,
339 .virt = (unsigned long)addr,
340 .len = 0,
341 .opcode = MMIO_UNPROBE
342 };
343 struct remap_trace *trace;
344 struct remap_trace *tmp;
345 struct remap_trace *found_trace = NULL;
346
347 pr_debug(NAME "Unmapping %p.\n", addr);
348
349 spin_lock_irq(&trace_lock);
350 if (!is_enabled())
351 goto not_enabled;
352
353 list_for_each_entry_safe(trace, tmp, &trace_list, list) {
354 if ((unsigned long)addr == trace->probe.addr) {
355 if (!nommiotrace)
356 unregister_kmmio_probe(&trace->probe);
357 list_del(&trace->list);
358 found_trace = trace;
359 break;
360 }
361 }
362 map.map_id = (found_trace) ? found_trace->id : -1;
363 mmio_trace_mapping(&map);
364
365not_enabled:
366 spin_unlock_irq(&trace_lock);
367 if (found_trace) {
368 synchronize_rcu(); /* unregister_kmmio_probe() requirement */
369 kfree(found_trace);
370 }
371}
372
373void mmiotrace_iounmap(volatile void __iomem *addr)
374{
375 might_sleep();
376 if (is_enabled()) /* recheck and proper locking in *_core() */
377 iounmap_trace_core(addr);
378}
379
380static void clear_trace_list(void)
381{
382 struct remap_trace *trace;
383 struct remap_trace *tmp;
384
385 /*
386 * No locking required, because the caller ensures we are in a
387 * critical section via mutex, and is_enabled() is false,
388 * i.e. nothing can traverse or modify this list.
389 * Caller also ensures is_enabled() cannot change.
390 */
391 list_for_each_entry(trace, &trace_list, list) {
392 pr_notice(NAME "purging non-iounmapped "
393 "trace @0x%08lx, size 0x%lx.\n",
394 trace->probe.addr, trace->probe.len);
395 if (!nommiotrace)
396 unregister_kmmio_probe(&trace->probe);
397 }
398 synchronize_rcu(); /* unregister_kmmio_probe() requirement */
399
400 list_for_each_entry_safe(trace, tmp, &trace_list, list) {
401 list_del(&trace->list);
402 kfree(trace);
403 }
404}
405
406#ifdef CONFIG_HOTPLUG_CPU
407static cpumask_t downed_cpus;
408
409static void enter_uniprocessor(void)
410{
411 int cpu;
412 int err;
413
414 get_online_cpus();
415 downed_cpus = cpu_online_map;
416 cpu_clear(first_cpu(cpu_online_map), downed_cpus);
417 if (num_online_cpus() > 1)
418 pr_notice(NAME "Disabling non-boot CPUs...\n");
419 put_online_cpus();
420
421 for_each_cpu_mask(cpu, downed_cpus) {
422 err = cpu_down(cpu);
423 if (!err)
424 pr_info(NAME "CPU%d is down.\n", cpu);
425 else
426 pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err);
427 }
428 if (num_online_cpus() > 1)
429 pr_warning(NAME "multiple CPUs still online, "
430 "may miss events.\n");
431}
432
433static void leave_uniprocessor(void)
434{
435 int cpu;
436 int err;
437
438 if (cpus_weight(downed_cpus) == 0)
439 return;
440 pr_notice(NAME "Re-enabling CPUs...\n");
441 for_each_cpu_mask(cpu, downed_cpus) {
442 err = cpu_up(cpu);
443 if (!err)
444 pr_info(NAME "enabled CPU%d.\n", cpu);
445 else
446 pr_err(NAME "cannot re-enable CPU%d: %d\n", cpu, err);
447 }
448}
449
450#else /* !CONFIG_HOTPLUG_CPU */
451static void enter_uniprocessor(void)
452{
453 if (num_online_cpus() > 1)
454 pr_warning(NAME "multiple CPUs are online, may miss events. "
455 "Suggest booting with maxcpus=1 kernel argument.\n");
456}
457
458static void leave_uniprocessor(void)
459{
460}
461#endif
462
463#if 0 /* XXX: out of order */
464static struct file_operations fops_marker = {
465 .owner = THIS_MODULE,
466 .write = write_marker
467};
468#endif
469
470void enable_mmiotrace(void)
471{
472 mutex_lock(&mmiotrace_mutex);
473 if (is_enabled())
474 goto out;
475
476#if 0 /* XXX: tracing does not support text entries */
477 marker_file = debugfs_create_file("marker", 0660, dir, NULL,
478 &fops_marker);
479 if (!marker_file)
480 pr_err(NAME "marker file creation failed.\n");
481#endif
482
483 if (nommiotrace)
484 pr_info(NAME "MMIO tracing disabled.\n");
485 enter_uniprocessor();
486 spin_lock_irq(&trace_lock);
487 atomic_inc(&mmiotrace_enabled);
488 spin_unlock_irq(&trace_lock);
489 pr_info(NAME "enabled.\n");
490out:
491 mutex_unlock(&mmiotrace_mutex);
492}
493
494void disable_mmiotrace(void)
495{
496 mutex_lock(&mmiotrace_mutex);
497 if (!is_enabled())
498 goto out;
499
500 spin_lock_irq(&trace_lock);
501 atomic_dec(&mmiotrace_enabled);
502 BUG_ON(is_enabled());
503 spin_unlock_irq(&trace_lock);
504
505 clear_trace_list(); /* guarantees: no more kmmio callbacks */
506 leave_uniprocessor();
507 if (marker_file) {
508 debugfs_remove(marker_file);
509 marker_file = NULL;
510 }
511
512 pr_info(NAME "disabled.\n");
513out:
514 mutex_unlock(&mmiotrace_mutex);
515}
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index c5066d519e5d..b432d5781773 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -27,30 +27,17 @@
27struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; 27struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
28EXPORT_SYMBOL(node_data); 28EXPORT_SYMBOL(node_data);
29 29
30bootmem_data_t plat_node_bdata[MAX_NUMNODES]; 30static bootmem_data_t plat_node_bdata[MAX_NUMNODES];
31 31
32struct memnode memnode; 32struct memnode memnode;
33 33
34#ifdef CONFIG_SMP
35int x86_cpu_to_node_map_init[NR_CPUS] = {
36 [0 ... NR_CPUS-1] = NUMA_NO_NODE
37};
38void *x86_cpu_to_node_map_early_ptr;
39EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr);
40#endif
41DEFINE_PER_CPU(int, x86_cpu_to_node_map) = NUMA_NO_NODE;
42EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map);
43
44s16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { 34s16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
45 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE 35 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
46}; 36};
47 37
48cpumask_t node_to_cpumask_map[MAX_NUMNODES] __read_mostly;
49EXPORT_SYMBOL(node_to_cpumask_map);
50
51int numa_off __initdata; 38int numa_off __initdata;
52unsigned long __initdata nodemap_addr; 39static unsigned long __initdata nodemap_addr;
53unsigned long __initdata nodemap_size; 40static unsigned long __initdata nodemap_size;
54 41
55/* 42/*
56 * Given a shift value, try to populate memnodemap[] 43 * Given a shift value, try to populate memnodemap[]
@@ -99,7 +86,7 @@ static int __init allocate_cachealigned_memnodemap(void)
99 86
100 addr = 0x8000; 87 addr = 0x8000;
101 nodemap_size = round_up(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES); 88 nodemap_size = round_up(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES);
102 nodemap_addr = find_e820_area(addr, end_pfn<<PAGE_SHIFT, 89 nodemap_addr = find_e820_area(addr, max_pfn<<PAGE_SHIFT,
103 nodemap_size, L1_CACHE_BYTES); 90 nodemap_size, L1_CACHE_BYTES);
104 if (nodemap_addr == -1UL) { 91 if (nodemap_addr == -1UL) {
105 printk(KERN_ERR 92 printk(KERN_ERR
@@ -192,7 +179,7 @@ static void * __init early_node_mem(int nodeid, unsigned long start,
192void __init setup_node_bootmem(int nodeid, unsigned long start, 179void __init setup_node_bootmem(int nodeid, unsigned long start,
193 unsigned long end) 180 unsigned long end)
194{ 181{
195 unsigned long start_pfn, end_pfn, bootmap_pages, bootmap_size; 182 unsigned long start_pfn, last_pfn, bootmap_pages, bootmap_size;
196 unsigned long bootmap_start, nodedata_phys; 183 unsigned long bootmap_start, nodedata_phys;
197 void *bootmap; 184 void *bootmap;
198 const int pgdat_size = round_up(sizeof(pg_data_t), PAGE_SIZE); 185 const int pgdat_size = round_up(sizeof(pg_data_t), PAGE_SIZE);
@@ -204,7 +191,7 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
204 start, end); 191 start, end);
205 192
206 start_pfn = start >> PAGE_SHIFT; 193 start_pfn = start >> PAGE_SHIFT;
207 end_pfn = end >> PAGE_SHIFT; 194 last_pfn = end >> PAGE_SHIFT;
208 195
209 node_data[nodeid] = early_node_mem(nodeid, start, end, pgdat_size, 196 node_data[nodeid] = early_node_mem(nodeid, start, end, pgdat_size,
210 SMP_CACHE_BYTES); 197 SMP_CACHE_BYTES);
@@ -217,7 +204,7 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
217 memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t)); 204 memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t));
218 NODE_DATA(nodeid)->bdata = &plat_node_bdata[nodeid]; 205 NODE_DATA(nodeid)->bdata = &plat_node_bdata[nodeid];
219 NODE_DATA(nodeid)->node_start_pfn = start_pfn; 206 NODE_DATA(nodeid)->node_start_pfn = start_pfn;
220 NODE_DATA(nodeid)->node_spanned_pages = end_pfn - start_pfn; 207 NODE_DATA(nodeid)->node_spanned_pages = last_pfn - start_pfn;
221 208
222 /* 209 /*
223 * Find a place for the bootmem map 210 * Find a place for the bootmem map
@@ -226,14 +213,14 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
226 * early_node_mem will get that with find_e820_area instead 213 * early_node_mem will get that with find_e820_area instead
227 * of alloc_bootmem, that could clash with reserved range 214 * of alloc_bootmem, that could clash with reserved range
228 */ 215 */
229 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn); 216 bootmap_pages = bootmem_bootmap_pages(last_pfn - start_pfn);
230 nid = phys_to_nid(nodedata_phys); 217 nid = phys_to_nid(nodedata_phys);
231 if (nid == nodeid) 218 if (nid == nodeid)
232 bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE); 219 bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE);
233 else 220 else
234 bootmap_start = round_up(start, PAGE_SIZE); 221 bootmap_start = round_up(start, PAGE_SIZE);
235 /* 222 /*
236 * SMP_CAHCE_BYTES could be enough, but init_bootmem_node like 223 * SMP_CACHE_BYTES could be enough, but init_bootmem_node like
237 * to use that to align to PAGE_SIZE 224 * to use that to align to PAGE_SIZE
238 */ 225 */
239 bootmap = early_node_mem(nodeid, bootmap_start, end, 226 bootmap = early_node_mem(nodeid, bootmap_start, end,
@@ -248,7 +235,7 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
248 235
249 bootmap_size = init_bootmem_node(NODE_DATA(nodeid), 236 bootmap_size = init_bootmem_node(NODE_DATA(nodeid),
250 bootmap_start >> PAGE_SHIFT, 237 bootmap_start >> PAGE_SHIFT,
251 start_pfn, end_pfn); 238 start_pfn, last_pfn);
252 239
253 printk(KERN_INFO " bootmap [%016lx - %016lx] pages %lx\n", 240 printk(KERN_INFO " bootmap [%016lx - %016lx] pages %lx\n",
254 bootmap_start, bootmap_start + bootmap_size - 1, 241 bootmap_start, bootmap_start + bootmap_size - 1,
@@ -309,7 +296,7 @@ void __init numa_init_array(void)
309 296
310#ifdef CONFIG_NUMA_EMU 297#ifdef CONFIG_NUMA_EMU
311/* Numa emulation */ 298/* Numa emulation */
312char *cmdline __initdata; 299static char *cmdline __initdata;
313 300
314/* 301/*
315 * Setups up nid to range from addr to addr + size. If the end 302 * Setups up nid to range from addr to addr + size. If the end
@@ -413,15 +400,15 @@ static int __init split_nodes_by_size(struct bootnode *nodes, u64 *addr,
413} 400}
414 401
415/* 402/*
416 * Sets up the system RAM area from start_pfn to end_pfn according to the 403 * Sets up the system RAM area from start_pfn to last_pfn according to the
417 * numa=fake command-line option. 404 * numa=fake command-line option.
418 */ 405 */
419static struct bootnode nodes[MAX_NUMNODES] __initdata; 406static struct bootnode nodes[MAX_NUMNODES] __initdata;
420 407
421static int __init numa_emulation(unsigned long start_pfn, unsigned long end_pfn) 408static int __init numa_emulation(unsigned long start_pfn, unsigned long last_pfn)
422{ 409{
423 u64 size, addr = start_pfn << PAGE_SHIFT; 410 u64 size, addr = start_pfn << PAGE_SHIFT;
424 u64 max_addr = end_pfn << PAGE_SHIFT; 411 u64 max_addr = last_pfn << PAGE_SHIFT;
425 int num_nodes = 0, num = 0, coeff_flag, coeff = -1, i; 412 int num_nodes = 0, num = 0, coeff_flag, coeff = -1, i;
426 413
427 memset(&nodes, 0, sizeof(nodes)); 414 memset(&nodes, 0, sizeof(nodes));
@@ -527,7 +514,7 @@ out:
527} 514}
528#endif /* CONFIG_NUMA_EMU */ 515#endif /* CONFIG_NUMA_EMU */
529 516
530void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) 517void __init initmem_init(unsigned long start_pfn, unsigned long last_pfn)
531{ 518{
532 int i; 519 int i;
533 520
@@ -535,7 +522,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
535 nodes_clear(node_online_map); 522 nodes_clear(node_online_map);
536 523
537#ifdef CONFIG_NUMA_EMU 524#ifdef CONFIG_NUMA_EMU
538 if (cmdline && !numa_emulation(start_pfn, end_pfn)) 525 if (cmdline && !numa_emulation(start_pfn, last_pfn))
539 return; 526 return;
540 nodes_clear(node_possible_map); 527 nodes_clear(node_possible_map);
541 nodes_clear(node_online_map); 528 nodes_clear(node_online_map);
@@ -543,7 +530,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
543 530
544#ifdef CONFIG_ACPI_NUMA 531#ifdef CONFIG_ACPI_NUMA
545 if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT, 532 if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT,
546 end_pfn << PAGE_SHIFT)) 533 last_pfn << PAGE_SHIFT))
547 return; 534 return;
548 nodes_clear(node_possible_map); 535 nodes_clear(node_possible_map);
549 nodes_clear(node_online_map); 536 nodes_clear(node_online_map);
@@ -551,7 +538,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
551 538
552#ifdef CONFIG_K8_NUMA 539#ifdef CONFIG_K8_NUMA
553 if (!numa_off && !k8_scan_nodes(start_pfn<<PAGE_SHIFT, 540 if (!numa_off && !k8_scan_nodes(start_pfn<<PAGE_SHIFT,
554 end_pfn<<PAGE_SHIFT)) 541 last_pfn<<PAGE_SHIFT))
555 return; 542 return;
556 nodes_clear(node_possible_map); 543 nodes_clear(node_possible_map);
557 nodes_clear(node_online_map); 544 nodes_clear(node_online_map);
@@ -561,7 +548,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
561 548
562 printk(KERN_INFO "Faking a node at %016lx-%016lx\n", 549 printk(KERN_INFO "Faking a node at %016lx-%016lx\n",
563 start_pfn << PAGE_SHIFT, 550 start_pfn << PAGE_SHIFT,
564 end_pfn << PAGE_SHIFT); 551 last_pfn << PAGE_SHIFT);
565 /* setup dummy node covering all memory */ 552 /* setup dummy node covering all memory */
566 memnode_shift = 63; 553 memnode_shift = 63;
567 memnodemap = memnode.embedded_map; 554 memnodemap = memnode.embedded_map;
@@ -570,29 +557,8 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
570 node_set(0, node_possible_map); 557 node_set(0, node_possible_map);
571 for (i = 0; i < NR_CPUS; i++) 558 for (i = 0; i < NR_CPUS; i++)
572 numa_set_node(i, 0); 559 numa_set_node(i, 0);
573 /* cpumask_of_cpu() may not be available during early startup */ 560 e820_register_active_regions(0, start_pfn, last_pfn);
574 memset(&node_to_cpumask_map[0], 0, sizeof(node_to_cpumask_map[0])); 561 setup_node_bootmem(0, start_pfn << PAGE_SHIFT, last_pfn << PAGE_SHIFT);
575 cpu_set(0, node_to_cpumask_map[0]);
576 e820_register_active_regions(0, start_pfn, end_pfn);
577 setup_node_bootmem(0, start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT);
578}
579
580__cpuinit void numa_add_cpu(int cpu)
581{
582 set_bit(cpu,
583 (unsigned long *)&node_to_cpumask_map[early_cpu_to_node(cpu)]);
584}
585
586void __cpuinit numa_set_node(int cpu, int node)
587{
588 int *cpu_to_node_map = x86_cpu_to_node_map_early_ptr;
589
590 if(cpu_to_node_map)
591 cpu_to_node_map[cpu] = node;
592 else if(per_cpu_offset(cpu))
593 per_cpu(x86_cpu_to_node_map, cpu) = node;
594 else
595 Dprintk(KERN_INFO "Setting node for non-present cpu %d\n", cpu);
596} 562}
597 563
598unsigned long __init numa_free_all_bootmem(void) 564unsigned long __init numa_free_all_bootmem(void)
@@ -613,7 +579,7 @@ void __init paging_init(void)
613 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 579 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
614 max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; 580 max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
615 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; 581 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
616 max_zone_pfns[ZONE_NORMAL] = end_pfn; 582 max_zone_pfns[ZONE_NORMAL] = max_pfn;
617 583
618 sparse_memory_present_with_active_regions(MAX_NUMNODES); 584 sparse_memory_present_with_active_regions(MAX_NUMNODES);
619 sparse_init(); 585 sparse_init();
@@ -641,6 +607,7 @@ static __init int numa_setup(char *opt)
641} 607}
642early_param("numa", numa_setup); 608early_param("numa", numa_setup);
643 609
610#ifdef CONFIG_NUMA
644/* 611/*
645 * Setup early cpu_to_node. 612 * Setup early cpu_to_node.
646 * 613 *
@@ -652,14 +619,19 @@ early_param("numa", numa_setup);
652 * is already initialized in a round robin manner at numa_init_array, 619 * is already initialized in a round robin manner at numa_init_array,
653 * prior to this call, and this initialization is good enough 620 * prior to this call, and this initialization is good enough
654 * for the fake NUMA cases. 621 * for the fake NUMA cases.
622 *
623 * Called before the per_cpu areas are setup.
655 */ 624 */
656void __init init_cpu_to_node(void) 625void __init init_cpu_to_node(void)
657{ 626{
658 int i; 627 int cpu;
628 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
659 629
660 for (i = 0; i < NR_CPUS; i++) { 630 BUG_ON(cpu_to_apicid == NULL);
631
632 for_each_possible_cpu(cpu) {
661 int node; 633 int node;
662 u16 apicid = x86_cpu_to_apicid_init[i]; 634 u16 apicid = cpu_to_apicid[cpu];
663 635
664 if (apicid == BAD_APICID) 636 if (apicid == BAD_APICID)
665 continue; 637 continue;
@@ -668,8 +640,9 @@ void __init init_cpu_to_node(void)
668 continue; 640 continue;
669 if (!node_online(node)) 641 if (!node_online(node))
670 continue; 642 continue;
671 numa_set_node(i, node); 643 numa_set_node(cpu, node);
672 } 644 }
673} 645}
646#endif
674 647
675 648
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index 75f1b109aae8..0dcd42eb94e6 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * self test for change_page_attr. 2 * self test for change_page_attr.
3 * 3 *
4 * Clears the global bit on random pages in the direct mapping, then reverts 4 * Clears the a test pte bit on random pages in the direct mapping,
5 * and compares page tables forwards and afterwards. 5 * then reverts and compares page tables forwards and afterwards.
6 */ 6 */
7#include <linux/bootmem.h> 7#include <linux/bootmem.h>
8#include <linux/kthread.h> 8#include <linux/kthread.h>
@@ -32,6 +32,13 @@ enum {
32 GPS = (1<<30) 32 GPS = (1<<30)
33}; 33};
34 34
35#define PAGE_TESTBIT __pgprot(_PAGE_UNUSED1)
36
37static int pte_testbit(pte_t pte)
38{
39 return pte_flags(pte) & _PAGE_UNUSED1;
40}
41
35struct split_state { 42struct split_state {
36 long lpg, gpg, spg, exec; 43 long lpg, gpg, spg, exec;
37 long min_exec, max_exec; 44 long min_exec, max_exec;
@@ -165,15 +172,14 @@ static int pageattr_test(void)
165 continue; 172 continue;
166 } 173 }
167 174
168 err = change_page_attr_clear(addr[i], len[i], 175 err = change_page_attr_set(addr[i], len[i], PAGE_TESTBIT);
169 __pgprot(_PAGE_GLOBAL));
170 if (err < 0) { 176 if (err < 0) {
171 printk(KERN_ERR "CPA %d failed %d\n", i, err); 177 printk(KERN_ERR "CPA %d failed %d\n", i, err);
172 failed++; 178 failed++;
173 } 179 }
174 180
175 pte = lookup_address(addr[i], &level); 181 pte = lookup_address(addr[i], &level);
176 if (!pte || pte_global(*pte) || pte_huge(*pte)) { 182 if (!pte || !pte_testbit(*pte) || pte_huge(*pte)) {
177 printk(KERN_ERR "CPA %lx: bad pte %Lx\n", addr[i], 183 printk(KERN_ERR "CPA %lx: bad pte %Lx\n", addr[i],
178 pte ? (u64)pte_val(*pte) : 0ULL); 184 pte ? (u64)pte_val(*pte) : 0ULL);
179 failed++; 185 failed++;
@@ -198,14 +204,13 @@ static int pageattr_test(void)
198 failed++; 204 failed++;
199 continue; 205 continue;
200 } 206 }
201 err = change_page_attr_set(addr[i], len[i], 207 err = change_page_attr_clear(addr[i], len[i], PAGE_TESTBIT);
202 __pgprot(_PAGE_GLOBAL));
203 if (err < 0) { 208 if (err < 0) {
204 printk(KERN_ERR "CPA reverting failed: %d\n", err); 209 printk(KERN_ERR "CPA reverting failed: %d\n", err);
205 failed++; 210 failed++;
206 } 211 }
207 pte = lookup_address(addr[i], &level); 212 pte = lookup_address(addr[i], &level);
208 if (!pte || !pte_global(*pte)) { 213 if (!pte || pte_testbit(*pte)) {
209 printk(KERN_ERR "CPA %lx: bad pte after revert %Lx\n", 214 printk(KERN_ERR "CPA %lx: bad pte after revert %Lx\n",
210 addr[i], pte ? (u64)pte_val(*pte) : 0ULL); 215 addr[i], pte ? (u64)pte_val(*pte) : 0ULL);
211 failed++; 216 failed++;
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 60bcb5b6a37e..47f4e2e4a096 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -34,6 +34,41 @@ struct cpa_data {
34 unsigned force_split : 1; 34 unsigned force_split : 1;
35}; 35};
36 36
37#ifdef CONFIG_PROC_FS
38static unsigned long direct_pages_count[PG_LEVEL_NUM];
39
40void update_page_count(int level, unsigned long pages)
41{
42 unsigned long flags;
43
44 /* Protect against CPA */
45 spin_lock_irqsave(&pgd_lock, flags);
46 direct_pages_count[level] += pages;
47 spin_unlock_irqrestore(&pgd_lock, flags);
48}
49
50static void split_page_count(int level)
51{
52 direct_pages_count[level]--;
53 direct_pages_count[level - 1] += PTRS_PER_PTE;
54}
55
56int arch_report_meminfo(char *page)
57{
58 int n = sprintf(page, "DirectMap4k: %8lu\n"
59 "DirectMap2M: %8lu\n",
60 direct_pages_count[PG_LEVEL_4K],
61 direct_pages_count[PG_LEVEL_2M]);
62#ifdef CONFIG_X86_64
63 n += sprintf(page + n, "DirectMap1G: %8lu\n",
64 direct_pages_count[PG_LEVEL_1G]);
65#endif
66 return n;
67}
68#else
69static inline void split_page_count(int level) { }
70#endif
71
37#ifdef CONFIG_X86_64 72#ifdef CONFIG_X86_64
38 73
39static inline unsigned long highmap_start_pfn(void) 74static inline unsigned long highmap_start_pfn(void)
@@ -227,6 +262,7 @@ pte_t *lookup_address(unsigned long address, unsigned int *level)
227 262
228 return pte_offset_kernel(pmd, address); 263 return pte_offset_kernel(pmd, address);
229} 264}
265EXPORT_SYMBOL_GPL(lookup_address);
230 266
231/* 267/*
232 * Set the new pmd in all the pgds we know about: 268 * Set the new pmd in all the pgds we know about:
@@ -500,6 +536,16 @@ static int split_large_page(pte_t *kpte, unsigned long address)
500 for (i = 0; i < PTRS_PER_PTE; i++, pfn += pfninc) 536 for (i = 0; i < PTRS_PER_PTE; i++, pfn += pfninc)
501 set_pte(&pbase[i], pfn_pte(pfn, ref_prot)); 537 set_pte(&pbase[i], pfn_pte(pfn, ref_prot));
502 538
539 if (address >= (unsigned long)__va(0) &&
540 address < (unsigned long)__va(max_low_pfn_mapped << PAGE_SHIFT))
541 split_page_count(level);
542
543#ifdef CONFIG_X86_64
544 if (address >= (unsigned long)__va(1UL<<32) &&
545 address < (unsigned long)__va(max_pfn_mapped << PAGE_SHIFT))
546 split_page_count(level);
547#endif
548
503 /* 549 /*
504 * Install the new, split up pagetable. Important details here: 550 * Install the new, split up pagetable. Important details here:
505 * 551 *
@@ -613,15 +659,24 @@ static int cpa_process_alias(struct cpa_data *cpa)
613 struct cpa_data alias_cpa; 659 struct cpa_data alias_cpa;
614 int ret = 0; 660 int ret = 0;
615 661
616 if (cpa->pfn > max_pfn_mapped) 662 if (cpa->pfn >= max_pfn_mapped)
617 return 0; 663 return 0;
618 664
665#ifdef CONFIG_X86_64
666 if (cpa->pfn >= max_low_pfn_mapped && cpa->pfn < (1UL<<(32-PAGE_SHIFT)))
667 return 0;
668#endif
619 /* 669 /*
620 * No need to redo, when the primary call touched the direct 670 * No need to redo, when the primary call touched the direct
621 * mapping already: 671 * mapping already:
622 */ 672 */
623 if (!within(cpa->vaddr, PAGE_OFFSET, 673 if (!(within(cpa->vaddr, PAGE_OFFSET,
624 PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))) { 674 PAGE_OFFSET + (max_low_pfn_mapped << PAGE_SHIFT))
675#ifdef CONFIG_X86_64
676 || within(cpa->vaddr, PAGE_OFFSET + (1UL<<32),
677 PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))
678#endif
679 )) {
625 680
626 alias_cpa = *cpa; 681 alias_cpa = *cpa;
627 alias_cpa.vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT); 682 alias_cpa.vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT);
@@ -805,7 +860,7 @@ int _set_memory_wc(unsigned long addr, int numpages)
805 860
806int set_memory_wc(unsigned long addr, int numpages) 861int set_memory_wc(unsigned long addr, int numpages)
807{ 862{
808 if (!pat_wc_enabled) 863 if (!pat_enabled)
809 return set_memory_uc(addr, numpages); 864 return set_memory_uc(addr, numpages);
810 865
811 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, 866 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE,
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 06b7a1c90fb8..d4585077977a 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -26,11 +26,11 @@
26#include <asm/io.h> 26#include <asm/io.h>
27 27
28#ifdef CONFIG_X86_PAT 28#ifdef CONFIG_X86_PAT
29int __read_mostly pat_wc_enabled = 1; 29int __read_mostly pat_enabled = 1;
30 30
31void __cpuinit pat_disable(char *reason) 31void __cpuinit pat_disable(char *reason)
32{ 32{
33 pat_wc_enabled = 0; 33 pat_enabled = 0;
34 printk(KERN_INFO "%s\n", reason); 34 printk(KERN_INFO "%s\n", reason);
35} 35}
36 36
@@ -42,6 +42,19 @@ static int __init nopat(char *str)
42early_param("nopat", nopat); 42early_param("nopat", nopat);
43#endif 43#endif
44 44
45
46static int debug_enable;
47static int __init pat_debug_setup(char *str)
48{
49 debug_enable = 1;
50 return 0;
51}
52__setup("debugpat", pat_debug_setup);
53
54#define dprintk(fmt, arg...) \
55 do { if (debug_enable) printk(KERN_INFO fmt, ##arg); } while (0)
56
57
45static u64 __read_mostly boot_pat_state; 58static u64 __read_mostly boot_pat_state;
46 59
47enum { 60enum {
@@ -53,24 +66,25 @@ enum {
53 PAT_UC_MINUS = 7, /* UC, but can be overriden by MTRR */ 66 PAT_UC_MINUS = 7, /* UC, but can be overriden by MTRR */
54}; 67};
55 68
56#define PAT(x,y) ((u64)PAT_ ## y << ((x)*8)) 69#define PAT(x, y) ((u64)PAT_ ## y << ((x)*8))
57 70
58void pat_init(void) 71void pat_init(void)
59{ 72{
60 u64 pat; 73 u64 pat;
61 74
62 if (!pat_wc_enabled) 75 if (!pat_enabled)
63 return; 76 return;
64 77
65 /* Paranoia check. */ 78 /* Paranoia check. */
66 if (!cpu_has_pat) { 79 if (!cpu_has_pat && boot_pat_state) {
67 printk(KERN_ERR "PAT enabled, but CPU feature cleared\n");
68 /* 80 /*
69 * Panic if this happens on the secondary CPU, and we 81 * If this happens we are on a secondary CPU, but
70 * switched to PAT on the boot CPU. We have no way to 82 * switched to PAT on the boot CPU. We have no way to
71 * undo PAT. 83 * undo PAT.
72 */ 84 */
73 BUG_ON(boot_pat_state); 85 printk(KERN_ERR "PAT enabled, "
86 "but not supported by secondary CPU\n");
87 BUG();
74 } 88 }
75 89
76 /* Set PWT to Write-Combining. All other bits stay the same */ 90 /* Set PWT to Write-Combining. All other bits stay the same */
@@ -86,8 +100,8 @@ void pat_init(void)
86 * 011 UC _PAGE_CACHE_UC 100 * 011 UC _PAGE_CACHE_UC
87 * PAT bit unused 101 * PAT bit unused
88 */ 102 */
89 pat = PAT(0,WB) | PAT(1,WC) | PAT(2,UC_MINUS) | PAT(3,UC) | 103 pat = PAT(0, WB) | PAT(1, WC) | PAT(2, UC_MINUS) | PAT(3, UC) |
90 PAT(4,WB) | PAT(5,WC) | PAT(6,UC_MINUS) | PAT(7,UC); 104 PAT(4, WB) | PAT(5, WC) | PAT(6, UC_MINUS) | PAT(7, UC);
91 105
92 /* Boot CPU check */ 106 /* Boot CPU check */
93 if (!boot_pat_state) 107 if (!boot_pat_state)
@@ -103,11 +117,11 @@ void pat_init(void)
103static char *cattr_name(unsigned long flags) 117static char *cattr_name(unsigned long flags)
104{ 118{
105 switch (flags & _PAGE_CACHE_MASK) { 119 switch (flags & _PAGE_CACHE_MASK) {
106 case _PAGE_CACHE_UC: return "uncached"; 120 case _PAGE_CACHE_UC: return "uncached";
107 case _PAGE_CACHE_UC_MINUS: return "uncached-minus"; 121 case _PAGE_CACHE_UC_MINUS: return "uncached-minus";
108 case _PAGE_CACHE_WB: return "write-back"; 122 case _PAGE_CACHE_WB: return "write-back";
109 case _PAGE_CACHE_WC: return "write-combining"; 123 case _PAGE_CACHE_WC: return "write-combining";
110 default: return "broken"; 124 default: return "broken";
111 } 125 }
112} 126}
113 127
@@ -145,47 +159,50 @@ static DEFINE_SPINLOCK(memtype_lock); /* protects memtype list */
145 * The intersection is based on "Effective Memory Type" tables in IA-32 159 * The intersection is based on "Effective Memory Type" tables in IA-32
146 * SDM vol 3a 160 * SDM vol 3a
147 */ 161 */
148static int pat_x_mtrr_type(u64 start, u64 end, unsigned long prot, 162static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type)
149 unsigned long *ret_prot)
150{ 163{
151 unsigned long pat_type;
152 u8 mtrr_type;
153
154 pat_type = prot & _PAGE_CACHE_MASK;
155 prot &= (~_PAGE_CACHE_MASK);
156
157 /*
158 * We return the PAT request directly for types where PAT takes
159 * precedence with respect to MTRR and for UC_MINUS.
160 * Consistency checks with other PAT requests is done later
161 * while going through memtype list.
162 */
163 if (pat_type == _PAGE_CACHE_WC) {
164 *ret_prot = prot | _PAGE_CACHE_WC;
165 return 0;
166 } else if (pat_type == _PAGE_CACHE_UC_MINUS) {
167 *ret_prot = prot | _PAGE_CACHE_UC_MINUS;
168 return 0;
169 } else if (pat_type == _PAGE_CACHE_UC) {
170 *ret_prot = prot | _PAGE_CACHE_UC;
171 return 0;
172 }
173
174 /* 164 /*
175 * Look for MTRR hint to get the effective type in case where PAT 165 * Look for MTRR hint to get the effective type in case where PAT
176 * request is for WB. 166 * request is for WB.
177 */ 167 */
178 mtrr_type = mtrr_type_lookup(start, end); 168 if (req_type == _PAGE_CACHE_WB) {
169 u8 mtrr_type;
170
171 mtrr_type = mtrr_type_lookup(start, end);
172 if (mtrr_type == MTRR_TYPE_UNCACHABLE)
173 return _PAGE_CACHE_UC;
174 if (mtrr_type == MTRR_TYPE_WRCOMB)
175 return _PAGE_CACHE_WC;
176 }
179 177
180 if (mtrr_type == MTRR_TYPE_UNCACHABLE) { 178 return req_type;
181 *ret_prot = prot | _PAGE_CACHE_UC; 179}
182 } else if (mtrr_type == MTRR_TYPE_WRCOMB) { 180
183 *ret_prot = prot | _PAGE_CACHE_WC; 181static int chk_conflict(struct memtype *new, struct memtype *entry,
184 } else { 182 unsigned long *type)
185 *ret_prot = prot | _PAGE_CACHE_WB; 183{
184 if (new->type != entry->type) {
185 if (type) {
186 new->type = entry->type;
187 *type = entry->type;
188 } else
189 goto conflict;
186 } 190 }
187 191
192 /* check overlaps with more than one entry in the list */
193 list_for_each_entry_continue(entry, &memtype_list, nd) {
194 if (new->end <= entry->start)
195 break;
196 else if (new->type != entry->type)
197 goto conflict;
198 }
188 return 0; 199 return 0;
200
201 conflict:
202 printk(KERN_INFO "%s:%d conflicting memory types "
203 "%Lx-%Lx %s<->%s\n", current->comm, current->pid, new->start,
204 new->end, cattr_name(new->type), cattr_name(entry->type));
205 return -EBUSY;
189} 206}
190 207
191/* 208/*
@@ -198,37 +215,36 @@ static int pat_x_mtrr_type(u64 start, u64 end, unsigned long prot,
198 * req_type will have a special case value '-1', when requester want to inherit 215 * req_type will have a special case value '-1', when requester want to inherit
199 * the memory type from mtrr (if WB), existing PAT, defaulting to UC_MINUS. 216 * the memory type from mtrr (if WB), existing PAT, defaulting to UC_MINUS.
200 * 217 *
201 * If ret_type is NULL, function will return an error if it cannot reserve the 218 * If new_type is NULL, function will return an error if it cannot reserve the
202 * region with req_type. If ret_type is non-null, function will return 219 * region with req_type. If new_type is non-NULL, function will return
203 * available type in ret_type in case of no error. In case of any error 220 * available type in new_type in case of no error. In case of any error
204 * it will return a negative return value. 221 * it will return a negative return value.
205 */ 222 */
206int reserve_memtype(u64 start, u64 end, unsigned long req_type, 223int reserve_memtype(u64 start, u64 end, unsigned long req_type,
207 unsigned long *ret_type) 224 unsigned long *new_type)
208{ 225{
209 struct memtype *new_entry = NULL; 226 struct memtype *new, *entry;
210 struct memtype *parse;
211 unsigned long actual_type; 227 unsigned long actual_type;
228 struct list_head *where;
212 int err = 0; 229 int err = 0;
213 230
214 /* Only track when pat_wc_enabled */ 231 BUG_ON(start >= end); /* end is exclusive */
215 if (!pat_wc_enabled) { 232
233 if (!pat_enabled) {
216 /* This is identical to page table setting without PAT */ 234 /* This is identical to page table setting without PAT */
217 if (ret_type) { 235 if (new_type) {
218 if (req_type == -1) { 236 if (req_type == -1)
219 *ret_type = _PAGE_CACHE_WB; 237 *new_type = _PAGE_CACHE_WB;
220 } else { 238 else
221 *ret_type = req_type; 239 *new_type = req_type & _PAGE_CACHE_MASK;
222 }
223 } 240 }
224 return 0; 241 return 0;
225 } 242 }
226 243
227 /* Low ISA region is always mapped WB in page table. No need to track */ 244 /* Low ISA region is always mapped WB in page table. No need to track */
228 if (start >= ISA_START_ADDRESS && (end - 1) <= ISA_END_ADDRESS) { 245 if (is_ISA_range(start, end - 1)) {
229 if (ret_type) 246 if (new_type)
230 *ret_type = _PAGE_CACHE_WB; 247 *new_type = _PAGE_CACHE_WB;
231
232 return 0; 248 return 0;
233 } 249 }
234 250
@@ -241,206 +257,92 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
241 */ 257 */
242 u8 mtrr_type = mtrr_type_lookup(start, end); 258 u8 mtrr_type = mtrr_type_lookup(start, end);
243 259
244 if (mtrr_type == MTRR_TYPE_WRBACK) { 260 if (mtrr_type == MTRR_TYPE_WRBACK)
245 req_type = _PAGE_CACHE_WB;
246 actual_type = _PAGE_CACHE_WB; 261 actual_type = _PAGE_CACHE_WB;
247 } else { 262 else
248 req_type = _PAGE_CACHE_UC_MINUS;
249 actual_type = _PAGE_CACHE_UC_MINUS; 263 actual_type = _PAGE_CACHE_UC_MINUS;
250 } 264 } else
251 } else { 265 actual_type = pat_x_mtrr_type(start, end,
252 req_type &= _PAGE_CACHE_MASK; 266 req_type & _PAGE_CACHE_MASK);
253 err = pat_x_mtrr_type(start, end, req_type, &actual_type);
254 }
255
256 if (err) {
257 if (ret_type)
258 *ret_type = actual_type;
259
260 return -EINVAL;
261 }
262 267
263 new_entry = kmalloc(sizeof(struct memtype), GFP_KERNEL); 268 new = kmalloc(sizeof(struct memtype), GFP_KERNEL);
264 if (!new_entry) 269 if (!new)
265 return -ENOMEM; 270 return -ENOMEM;
266 271
267 new_entry->start = start; 272 new->start = start;
268 new_entry->end = end; 273 new->end = end;
269 new_entry->type = actual_type; 274 new->type = actual_type;
270 275
271 if (ret_type) 276 if (new_type)
272 *ret_type = actual_type; 277 *new_type = actual_type;
273 278
274 spin_lock(&memtype_lock); 279 spin_lock(&memtype_lock);
275 280
276 /* Search for existing mapping that overlaps the current range */ 281 /* Search for existing mapping that overlaps the current range */
277 list_for_each_entry(parse, &memtype_list, nd) { 282 where = NULL;
278 struct memtype *saved_ptr; 283 list_for_each_entry(entry, &memtype_list, nd) {
279 284 if (end <= entry->start) {
280 if (parse->start >= end) { 285 where = entry->nd.prev;
281 pr_debug("New Entry\n");
282 list_add(&new_entry->nd, parse->nd.prev);
283 new_entry = NULL;
284 break; 286 break;
285 } 287 } else if (start <= entry->start) { /* end > entry->start */
286 288 err = chk_conflict(new, entry, new_type);
287 if (start <= parse->start && end >= parse->start) { 289 if (!err) {
288 if (actual_type != parse->type && ret_type) { 290 dprintk("Overlap at 0x%Lx-0x%Lx\n",
289 actual_type = parse->type; 291 entry->start, entry->end);
290 *ret_type = actual_type; 292 where = entry->nd.prev;
291 new_entry->type = actual_type;
292 }
293
294 if (actual_type != parse->type) {
295 printk(
296 KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
297 current->comm, current->pid,
298 start, end,
299 cattr_name(actual_type),
300 cattr_name(parse->type));
301 err = -EBUSY;
302 break;
303 } 293 }
304
305 saved_ptr = parse;
306 /*
307 * Check to see whether the request overlaps more
308 * than one entry in the list
309 */
310 list_for_each_entry_continue(parse, &memtype_list, nd) {
311 if (end <= parse->start) {
312 break;
313 }
314
315 if (actual_type != parse->type) {
316 printk(
317 KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
318 current->comm, current->pid,
319 start, end,
320 cattr_name(actual_type),
321 cattr_name(parse->type));
322 err = -EBUSY;
323 break;
324 }
325 }
326
327 if (err) {
328 break;
329 }
330
331 pr_debug("Overlap at 0x%Lx-0x%Lx\n",
332 saved_ptr->start, saved_ptr->end);
333 /* No conflict. Go ahead and add this new entry */
334 list_add(&new_entry->nd, saved_ptr->nd.prev);
335 new_entry = NULL;
336 break; 294 break;
337 } 295 } else if (start < entry->end) { /* start > entry->start */
338 296 err = chk_conflict(new, entry, new_type);
339 if (start < parse->end) { 297 if (!err) {
340 if (actual_type != parse->type && ret_type) { 298 dprintk("Overlap at 0x%Lx-0x%Lx\n",
341 actual_type = parse->type; 299 entry->start, entry->end);
342 *ret_type = actual_type; 300 where = &entry->nd;
343 new_entry->type = actual_type;
344 }
345
346 if (actual_type != parse->type) {
347 printk(
348 KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
349 current->comm, current->pid,
350 start, end,
351 cattr_name(actual_type),
352 cattr_name(parse->type));
353 err = -EBUSY;
354 break;
355 }
356
357 saved_ptr = parse;
358 /*
359 * Check to see whether the request overlaps more
360 * than one entry in the list
361 */
362 list_for_each_entry_continue(parse, &memtype_list, nd) {
363 if (end <= parse->start) {
364 break;
365 }
366
367 if (actual_type != parse->type) {
368 printk(
369 KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
370 current->comm, current->pid,
371 start, end,
372 cattr_name(actual_type),
373 cattr_name(parse->type));
374 err = -EBUSY;
375 break;
376 }
377 }
378
379 if (err) {
380 break;
381 } 301 }
382
383 pr_debug(KERN_INFO "Overlap at 0x%Lx-0x%Lx\n",
384 saved_ptr->start, saved_ptr->end);
385 /* No conflict. Go ahead and add this new entry */
386 list_add(&new_entry->nd, &saved_ptr->nd);
387 new_entry = NULL;
388 break; 302 break;
389 } 303 }
390 } 304 }
391 305
392 if (err) { 306 if (err) {
393 printk(KERN_INFO 307 printk(KERN_INFO "reserve_memtype failed 0x%Lx-0x%Lx, "
394 "reserve_memtype failed 0x%Lx-0x%Lx, track %s, req %s\n", 308 "track %s, req %s\n",
395 start, end, cattr_name(new_entry->type), 309 start, end, cattr_name(new->type), cattr_name(req_type));
396 cattr_name(req_type)); 310 kfree(new);
397 kfree(new_entry);
398 spin_unlock(&memtype_lock); 311 spin_unlock(&memtype_lock);
399 return err; 312 return err;
400 } 313 }
401 314
402 if (new_entry) { 315 if (where)
403 /* No conflict. Not yet added to the list. Add to the tail */ 316 list_add(&new->nd, where);
404 list_add_tail(&new_entry->nd, &memtype_list); 317 else
405 pr_debug("New Entry\n"); 318 list_add_tail(&new->nd, &memtype_list);
406 }
407
408 if (ret_type) {
409 pr_debug(
410 "reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s, ret %s\n",
411 start, end, cattr_name(actual_type),
412 cattr_name(req_type), cattr_name(*ret_type));
413 } else {
414 pr_debug(
415 "reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s\n",
416 start, end, cattr_name(actual_type),
417 cattr_name(req_type));
418 }
419 319
420 spin_unlock(&memtype_lock); 320 spin_unlock(&memtype_lock);
321
322 dprintk("reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s, ret %s\n",
323 start, end, cattr_name(new->type), cattr_name(req_type),
324 new_type ? cattr_name(*new_type) : "-");
325
421 return err; 326 return err;
422} 327}
423 328
424int free_memtype(u64 start, u64 end) 329int free_memtype(u64 start, u64 end)
425{ 330{
426 struct memtype *ml; 331 struct memtype *entry;
427 int err = -EINVAL; 332 int err = -EINVAL;
428 333
429 /* Only track when pat_wc_enabled */ 334 if (!pat_enabled)
430 if (!pat_wc_enabled) {
431 return 0; 335 return 0;
432 }
433 336
434 /* Low ISA region is always mapped WB. No need to track */ 337 /* Low ISA region is always mapped WB. No need to track */
435 if (start >= ISA_START_ADDRESS && end <= ISA_END_ADDRESS) { 338 if (is_ISA_range(start, end - 1))
436 return 0; 339 return 0;
437 }
438 340
439 spin_lock(&memtype_lock); 341 spin_lock(&memtype_lock);
440 list_for_each_entry(ml, &memtype_list, nd) { 342 list_for_each_entry(entry, &memtype_list, nd) {
441 if (ml->start == start && ml->end == end) { 343 if (entry->start == start && entry->end == end) {
442 list_del(&ml->nd); 344 list_del(&entry->nd);
443 kfree(ml); 345 kfree(entry);
444 err = 0; 346 err = 0;
445 break; 347 break;
446 } 348 }
@@ -452,7 +354,7 @@ int free_memtype(u64 start, u64 end)
452 current->comm, current->pid, start, end); 354 current->comm, current->pid, start, end);
453 } 355 }
454 356
455 pr_debug("free_memtype request 0x%Lx-0x%Lx\n", start, end); 357 dprintk("free_memtype request 0x%Lx-0x%Lx\n", start, end);
456 return err; 358 return err;
457} 359}
458 360
@@ -521,12 +423,12 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
521 * caching for the high addresses through the KEN pin, but 423 * caching for the high addresses through the KEN pin, but
522 * we maintain the tradition of paranoia in this code. 424 * we maintain the tradition of paranoia in this code.
523 */ 425 */
524 if (!pat_wc_enabled && 426 if (!pat_enabled &&
525 ! ( test_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability) || 427 !(boot_cpu_has(X86_FEATURE_MTRR) ||
526 test_bit(X86_FEATURE_K6_MTRR, boot_cpu_data.x86_capability) || 428 boot_cpu_has(X86_FEATURE_K6_MTRR) ||
527 test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) || 429 boot_cpu_has(X86_FEATURE_CYRIX_ARR) ||
528 test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability)) && 430 boot_cpu_has(X86_FEATURE_CENTAUR_MCR)) &&
529 (pfn << PAGE_SHIFT) >= __pa(high_memory)) { 431 (pfn << PAGE_SHIFT) >= __pa(high_memory)) {
530 flags = _PAGE_CACHE_UC; 432 flags = _PAGE_CACHE_UC;
531 } 433 }
532#endif 434#endif
@@ -547,8 +449,9 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
547 if (retval < 0) 449 if (retval < 0)
548 return 0; 450 return 0;
549 451
550 if (pfn <= max_pfn_mapped && 452 if (((pfn < max_low_pfn_mapped) ||
551 ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) { 453 (pfn >= (1UL<<(32 - PAGE_SHIFT)) && pfn < max_pfn_mapped)) &&
454 ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) {
552 free_memtype(offset, offset + size); 455 free_memtype(offset, offset + size);
553 printk(KERN_INFO 456 printk(KERN_INFO
554 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n", 457 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n",
@@ -586,4 +489,3 @@ void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
586 489
587 free_memtype(addr, addr + size); 490 free_memtype(addr, addr + size);
588} 491}
589
diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
new file mode 100644
index 000000000000..efa1911e20ca
--- /dev/null
+++ b/arch/x86/mm/pf_in.c
@@ -0,0 +1,489 @@
1/*
2 * Fault Injection Test harness (FI)
3 * Copyright (C) Intel Crop.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (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,
18 * USA.
19 *
20 */
21
22/* Id: pf_in.c,v 1.1.1.1 2002/11/12 05:56:32 brlock Exp
23 * Copyright by Intel Crop., 2002
24 * Louis Zhuang (louis.zhuang@intel.com)
25 *
26 * Bjorn Steinbrink (B.Steinbrink@gmx.de), 2007
27 */
28
29#include <linux/module.h>
30#include <linux/ptrace.h> /* struct pt_regs */
31#include "pf_in.h"
32
33#ifdef __i386__
34/* IA32 Manual 3, 2-1 */
35static unsigned char prefix_codes[] = {
36 0xF0, 0xF2, 0xF3, 0x2E, 0x36, 0x3E, 0x26, 0x64,
37 0x65, 0x2E, 0x3E, 0x66, 0x67
38};
39/* IA32 Manual 3, 3-432*/
40static unsigned int reg_rop[] = {
41 0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
42};
43static unsigned int reg_wop[] = { 0x88, 0x89 };
44static unsigned int imm_wop[] = { 0xC6, 0xC7 };
45/* IA32 Manual 3, 3-432*/
46static unsigned int rw8[] = { 0x88, 0x8A, 0xC6 };
47static unsigned int rw32[] = {
48 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
49};
50static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F };
51static unsigned int mw16[] = { 0xB70F, 0xBF0F };
52static unsigned int mw32[] = { 0x89, 0x8B, 0xC7 };
53static unsigned int mw64[] = {};
54#else /* not __i386__ */
55static unsigned char prefix_codes[] = {
56 0x66, 0x67, 0x2E, 0x3E, 0x26, 0x64, 0x65, 0x36,
57 0xF0, 0xF3, 0xF2,
58 /* REX Prefixes */
59 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
60 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f
61};
62/* AMD64 Manual 3, Appendix A*/
63static unsigned int reg_rop[] = {
64 0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
65};
66static unsigned int reg_wop[] = { 0x88, 0x89 };
67static unsigned int imm_wop[] = { 0xC6, 0xC7 };
68static unsigned int rw8[] = { 0xC6, 0x88, 0x8A };
69static unsigned int rw32[] = {
70 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
71};
72/* 8 bit only */
73static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F };
74/* 16 bit only */
75static unsigned int mw16[] = { 0xB70F, 0xBF0F };
76/* 16 or 32 bit */
77static unsigned int mw32[] = { 0xC7 };
78/* 16, 32 or 64 bit */
79static unsigned int mw64[] = { 0x89, 0x8B };
80#endif /* not __i386__ */
81
82static int skip_prefix(unsigned char *addr, int *shorted, int *enlarged,
83 int *rexr)
84{
85 int i;
86 unsigned char *p = addr;
87 *shorted = 0;
88 *enlarged = 0;
89 *rexr = 0;
90
91restart:
92 for (i = 0; i < ARRAY_SIZE(prefix_codes); i++) {
93 if (*p == prefix_codes[i]) {
94 if (*p == 0x66)
95 *shorted = 1;
96#ifdef __amd64__
97 if ((*p & 0xf8) == 0x48)
98 *enlarged = 1;
99 if ((*p & 0xf4) == 0x44)
100 *rexr = 1;
101#endif
102 p++;
103 goto restart;
104 }
105 }
106
107 return (p - addr);
108}
109
110static int get_opcode(unsigned char *addr, unsigned int *opcode)
111{
112 int len;
113
114 if (*addr == 0x0F) {
115 /* 0x0F is extension instruction */
116 *opcode = *(unsigned short *)addr;
117 len = 2;
118 } else {
119 *opcode = *addr;
120 len = 1;
121 }
122
123 return len;
124}
125
126#define CHECK_OP_TYPE(opcode, array, type) \
127 for (i = 0; i < ARRAY_SIZE(array); i++) { \
128 if (array[i] == opcode) { \
129 rv = type; \
130 goto exit; \
131 } \
132 }
133
134enum reason_type get_ins_type(unsigned long ins_addr)
135{
136 unsigned int opcode;
137 unsigned char *p;
138 int shorted, enlarged, rexr;
139 int i;
140 enum reason_type rv = OTHERS;
141
142 p = (unsigned char *)ins_addr;
143 p += skip_prefix(p, &shorted, &enlarged, &rexr);
144 p += get_opcode(p, &opcode);
145
146 CHECK_OP_TYPE(opcode, reg_rop, REG_READ);
147 CHECK_OP_TYPE(opcode, reg_wop, REG_WRITE);
148 CHECK_OP_TYPE(opcode, imm_wop, IMM_WRITE);
149
150exit:
151 return rv;
152}
153#undef CHECK_OP_TYPE
154
155static unsigned int get_ins_reg_width(unsigned long ins_addr)
156{
157 unsigned int opcode;
158 unsigned char *p;
159 int i, shorted, enlarged, rexr;
160
161 p = (unsigned char *)ins_addr;
162 p += skip_prefix(p, &shorted, &enlarged, &rexr);
163 p += get_opcode(p, &opcode);
164
165 for (i = 0; i < ARRAY_SIZE(rw8); i++)
166 if (rw8[i] == opcode)
167 return 1;
168
169 for (i = 0; i < ARRAY_SIZE(rw32); i++)
170 if (rw32[i] == opcode)
171 return (shorted ? 2 : (enlarged ? 8 : 4));
172
173 printk(KERN_ERR "mmiotrace: Unknown opcode 0x%02x\n", opcode);
174 return 0;
175}
176
177unsigned int get_ins_mem_width(unsigned long ins_addr)
178{
179 unsigned int opcode;
180 unsigned char *p;
181 int i, shorted, enlarged, rexr;
182
183 p = (unsigned char *)ins_addr;
184 p += skip_prefix(p, &shorted, &enlarged, &rexr);
185 p += get_opcode(p, &opcode);
186
187 for (i = 0; i < ARRAY_SIZE(mw8); i++)
188 if (mw8[i] == opcode)
189 return 1;
190
191 for (i = 0; i < ARRAY_SIZE(mw16); i++)
192 if (mw16[i] == opcode)
193 return 2;
194
195 for (i = 0; i < ARRAY_SIZE(mw32); i++)
196 if (mw32[i] == opcode)
197 return shorted ? 2 : 4;
198
199 for (i = 0; i < ARRAY_SIZE(mw64); i++)
200 if (mw64[i] == opcode)
201 return shorted ? 2 : (enlarged ? 8 : 4);
202
203 printk(KERN_ERR "mmiotrace: Unknown opcode 0x%02x\n", opcode);
204 return 0;
205}
206
207/*
208 * Define register ident in mod/rm byte.
209 * Note: these are NOT the same as in ptrace-abi.h.
210 */
211enum {
212 arg_AL = 0,
213 arg_CL = 1,
214 arg_DL = 2,
215 arg_BL = 3,
216 arg_AH = 4,
217 arg_CH = 5,
218 arg_DH = 6,
219 arg_BH = 7,
220
221 arg_AX = 0,
222 arg_CX = 1,
223 arg_DX = 2,
224 arg_BX = 3,
225 arg_SP = 4,
226 arg_BP = 5,
227 arg_SI = 6,
228 arg_DI = 7,
229#ifdef __amd64__
230 arg_R8 = 8,
231 arg_R9 = 9,
232 arg_R10 = 10,
233 arg_R11 = 11,
234 arg_R12 = 12,
235 arg_R13 = 13,
236 arg_R14 = 14,
237 arg_R15 = 15
238#endif
239};
240
241static unsigned char *get_reg_w8(int no, struct pt_regs *regs)
242{
243 unsigned char *rv = NULL;
244
245 switch (no) {
246 case arg_AL:
247 rv = (unsigned char *)&regs->ax;
248 break;
249 case arg_BL:
250 rv = (unsigned char *)&regs->bx;
251 break;
252 case arg_CL:
253 rv = (unsigned char *)&regs->cx;
254 break;
255 case arg_DL:
256 rv = (unsigned char *)&regs->dx;
257 break;
258 case arg_AH:
259 rv = 1 + (unsigned char *)&regs->ax;
260 break;
261 case arg_BH:
262 rv = 1 + (unsigned char *)&regs->bx;
263 break;
264 case arg_CH:
265 rv = 1 + (unsigned char *)&regs->cx;
266 break;
267 case arg_DH:
268 rv = 1 + (unsigned char *)&regs->dx;
269 break;
270#ifdef __amd64__
271 case arg_R8:
272 rv = (unsigned char *)&regs->r8;
273 break;
274 case arg_R9:
275 rv = (unsigned char *)&regs->r9;
276 break;
277 case arg_R10:
278 rv = (unsigned char *)&regs->r10;
279 break;
280 case arg_R11:
281 rv = (unsigned char *)&regs->r11;
282 break;
283 case arg_R12:
284 rv = (unsigned char *)&regs->r12;
285 break;
286 case arg_R13:
287 rv = (unsigned char *)&regs->r13;
288 break;
289 case arg_R14:
290 rv = (unsigned char *)&regs->r14;
291 break;
292 case arg_R15:
293 rv = (unsigned char *)&regs->r15;
294 break;
295#endif
296 default:
297 printk(KERN_ERR "mmiotrace: Error reg no# %d\n", no);
298 break;
299 }
300 return rv;
301}
302
303static unsigned long *get_reg_w32(int no, struct pt_regs *regs)
304{
305 unsigned long *rv = NULL;
306
307 switch (no) {
308 case arg_AX:
309 rv = &regs->ax;
310 break;
311 case arg_BX:
312 rv = &regs->bx;
313 break;
314 case arg_CX:
315 rv = &regs->cx;
316 break;
317 case arg_DX:
318 rv = &regs->dx;
319 break;
320 case arg_SP:
321 rv = &regs->sp;
322 break;
323 case arg_BP:
324 rv = &regs->bp;
325 break;
326 case arg_SI:
327 rv = &regs->si;
328 break;
329 case arg_DI:
330 rv = &regs->di;
331 break;
332#ifdef __amd64__
333 case arg_R8:
334 rv = &regs->r8;
335 break;
336 case arg_R9:
337 rv = &regs->r9;
338 break;
339 case arg_R10:
340 rv = &regs->r10;
341 break;
342 case arg_R11:
343 rv = &regs->r11;
344 break;
345 case arg_R12:
346 rv = &regs->r12;
347 break;
348 case arg_R13:
349 rv = &regs->r13;
350 break;
351 case arg_R14:
352 rv = &regs->r14;
353 break;
354 case arg_R15:
355 rv = &regs->r15;
356 break;
357#endif
358 default:
359 printk(KERN_ERR "mmiotrace: Error reg no# %d\n", no);
360 }
361
362 return rv;
363}
364
365unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs)
366{
367 unsigned int opcode;
368 unsigned char mod_rm;
369 int reg;
370 unsigned char *p;
371 int i, shorted, enlarged, rexr;
372 unsigned long rv;
373
374 p = (unsigned char *)ins_addr;
375 p += skip_prefix(p, &shorted, &enlarged, &rexr);
376 p += get_opcode(p, &opcode);
377 for (i = 0; i < ARRAY_SIZE(reg_rop); i++)
378 if (reg_rop[i] == opcode) {
379 rv = REG_READ;
380 goto do_work;
381 }
382
383 for (i = 0; i < ARRAY_SIZE(reg_wop); i++)
384 if (reg_wop[i] == opcode) {
385 rv = REG_WRITE;
386 goto do_work;
387 }
388
389 printk(KERN_ERR "mmiotrace: Not a register instruction, opcode "
390 "0x%02x\n", opcode);
391 goto err;
392
393do_work:
394 mod_rm = *p;
395 reg = ((mod_rm >> 3) & 0x7) | (rexr << 3);
396 switch (get_ins_reg_width(ins_addr)) {
397 case 1:
398 return *get_reg_w8(reg, regs);
399
400 case 2:
401 return *(unsigned short *)get_reg_w32(reg, regs);
402
403 case 4:
404 return *(unsigned int *)get_reg_w32(reg, regs);
405
406#ifdef __amd64__
407 case 8:
408 return *(unsigned long *)get_reg_w32(reg, regs);
409#endif
410
411 default:
412 printk(KERN_ERR "mmiotrace: Error width# %d\n", reg);
413 }
414
415err:
416 return 0;
417}
418
419unsigned long get_ins_imm_val(unsigned long ins_addr)
420{
421 unsigned int opcode;
422 unsigned char mod_rm;
423 unsigned char mod;
424 unsigned char *p;
425 int i, shorted, enlarged, rexr;
426 unsigned long rv;
427
428 p = (unsigned char *)ins_addr;
429 p += skip_prefix(p, &shorted, &enlarged, &rexr);
430 p += get_opcode(p, &opcode);
431 for (i = 0; i < ARRAY_SIZE(imm_wop); i++)
432 if (imm_wop[i] == opcode) {
433 rv = IMM_WRITE;
434 goto do_work;
435 }
436
437 printk(KERN_ERR "mmiotrace: Not an immediate instruction, opcode "
438 "0x%02x\n", opcode);
439 goto err;
440
441do_work:
442 mod_rm = *p;
443 mod = mod_rm >> 6;
444 p++;
445 switch (mod) {
446 case 0:
447 /* if r/m is 5 we have a 32 disp (IA32 Manual 3, Table 2-2) */
448 /* AMD64: XXX Check for address size prefix? */
449 if ((mod_rm & 0x7) == 0x5)
450 p += 4;
451 break;
452
453 case 1:
454 p += 1;
455 break;
456
457 case 2:
458 p += 4;
459 break;
460
461 case 3:
462 default:
463 printk(KERN_ERR "mmiotrace: not a memory access instruction "
464 "at 0x%lx, rm_mod=0x%02x\n",
465 ins_addr, mod_rm);
466 }
467
468 switch (get_ins_reg_width(ins_addr)) {
469 case 1:
470 return *(unsigned char *)p;
471
472 case 2:
473 return *(unsigned short *)p;
474
475 case 4:
476 return *(unsigned int *)p;
477
478#ifdef __amd64__
479 case 8:
480 return *(unsigned long *)p;
481#endif
482
483 default:
484 printk(KERN_ERR "mmiotrace: Error: width.\n");
485 }
486
487err:
488 return 0;
489}
diff --git a/arch/x86/mm/pf_in.h b/arch/x86/mm/pf_in.h
new file mode 100644
index 000000000000..e05341a51a27
--- /dev/null
+++ b/arch/x86/mm/pf_in.h
@@ -0,0 +1,39 @@
1/*
2 * Fault Injection Test harness (FI)
3 * Copyright (C) Intel Crop.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (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,
18 * USA.
19 *
20 */
21
22#ifndef __PF_H_
23#define __PF_H_
24
25enum reason_type {
26 NOT_ME, /* page fault is not in regions */
27 NOTHING, /* access others point in regions */
28 REG_READ, /* read from addr to reg */
29 REG_WRITE, /* write from reg to addr */
30 IMM_WRITE, /* write from imm to addr */
31 OTHERS /* Other instructions can not intercept */
32};
33
34enum reason_type get_ins_type(unsigned long ins_addr);
35unsigned int get_ins_mem_width(unsigned long ins_addr);
36unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs);
37unsigned long get_ins_imm_val(unsigned long ins_addr);
38
39#endif /* __PF_H_ */
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 50159764f694..557b2abceef8 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -2,6 +2,7 @@
2#include <asm/pgalloc.h> 2#include <asm/pgalloc.h>
3#include <asm/pgtable.h> 3#include <asm/pgtable.h>
4#include <asm/tlb.h> 4#include <asm/tlb.h>
5#include <asm/fixmap.h>
5 6
6pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) 7pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
7{ 8{
@@ -65,12 +66,6 @@ static inline void pgd_list_del(pgd_t *pgd)
65static void pgd_ctor(void *p) 66static void pgd_ctor(void *p)
66{ 67{
67 pgd_t *pgd = p; 68 pgd_t *pgd = p;
68 unsigned long flags;
69
70 /* Clear usermode parts of PGD */
71 memset(pgd, 0, KERNEL_PGD_BOUNDARY*sizeof(pgd_t));
72
73 spin_lock_irqsave(&pgd_lock, flags);
74 69
75 /* If the pgd points to a shared pagetable level (either the 70 /* If the pgd points to a shared pagetable level (either the
76 ptes in non-PAE, or shared PMD in PAE), then just copy the 71 ptes in non-PAE, or shared PMD in PAE), then just copy the
@@ -90,8 +85,6 @@ static void pgd_ctor(void *p)
90 /* list required to sync kernel mapping updates */ 85 /* list required to sync kernel mapping updates */
91 if (!SHARED_KERNEL_PMD) 86 if (!SHARED_KERNEL_PMD)
92 pgd_list_add(pgd); 87 pgd_list_add(pgd);
93
94 spin_unlock_irqrestore(&pgd_lock, flags);
95} 88}
96 89
97static void pgd_dtor(void *pgd) 90static void pgd_dtor(void *pgd)
@@ -119,6 +112,72 @@ static void pgd_dtor(void *pgd)
119 112
120#ifdef CONFIG_X86_PAE 113#ifdef CONFIG_X86_PAE
121/* 114/*
115 * In PAE mode, we need to do a cr3 reload (=tlb flush) when
116 * updating the top-level pagetable entries to guarantee the
117 * processor notices the update. Since this is expensive, and
118 * all 4 top-level entries are used almost immediately in a
119 * new process's life, we just pre-populate them here.
120 *
121 * Also, if we're in a paravirt environment where the kernel pmd is
122 * not shared between pagetables (!SHARED_KERNEL_PMDS), we allocate
123 * and initialize the kernel pmds here.
124 */
125#define PREALLOCATED_PMDS UNSHARED_PTRS_PER_PGD
126
127void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
128{
129 paravirt_alloc_pmd(mm, __pa(pmd) >> PAGE_SHIFT);
130
131 /* Note: almost everything apart from _PAGE_PRESENT is
132 reserved at the pmd (PDPT) level. */
133 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT));
134
135 /*
136 * According to Intel App note "TLBs, Paging-Structure Caches,
137 * and Their Invalidation", April 2007, document 317080-001,
138 * section 8.1: in PAE mode we explicitly have to flush the
139 * TLB via cr3 if the top-level pgd is changed...
140 */
141 if (mm == current->active_mm)
142 write_cr3(read_cr3());
143}
144#else /* !CONFIG_X86_PAE */
145
146/* No need to prepopulate any pagetable entries in non-PAE modes. */
147#define PREALLOCATED_PMDS 0
148
149#endif /* CONFIG_X86_PAE */
150
151static void free_pmds(pmd_t *pmds[])
152{
153 int i;
154
155 for(i = 0; i < PREALLOCATED_PMDS; i++)
156 if (pmds[i])
157 free_page((unsigned long)pmds[i]);
158}
159
160static int preallocate_pmds(pmd_t *pmds[])
161{
162 int i;
163 bool failed = false;
164
165 for(i = 0; i < PREALLOCATED_PMDS; i++) {
166 pmd_t *pmd = (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
167 if (pmd == NULL)
168 failed = true;
169 pmds[i] = pmd;
170 }
171
172 if (failed) {
173 free_pmds(pmds);
174 return -ENOMEM;
175 }
176
177 return 0;
178}
179
180/*
122 * Mop up any pmd pages which may still be attached to the pgd. 181 * Mop up any pmd pages which may still be attached to the pgd.
123 * Normally they will be freed by munmap/exit_mmap, but any pmd we 182 * Normally they will be freed by munmap/exit_mmap, but any pmd we
124 * preallocate which never got a corresponding vma will need to be 183 * preallocate which never got a corresponding vma will need to be
@@ -128,7 +187,7 @@ static void pgd_mop_up_pmds(struct mm_struct *mm, pgd_t *pgdp)
128{ 187{
129 int i; 188 int i;
130 189
131 for(i = 0; i < UNSHARED_PTRS_PER_PGD; i++) { 190 for(i = 0; i < PREALLOCATED_PMDS; i++) {
132 pgd_t pgd = pgdp[i]; 191 pgd_t pgd = pgdp[i];
133 192
134 if (pgd_val(pgd) != 0) { 193 if (pgd_val(pgd) != 0) {
@@ -142,32 +201,17 @@ static void pgd_mop_up_pmds(struct mm_struct *mm, pgd_t *pgdp)
142 } 201 }
143} 202}
144 203
145/* 204static void pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmds[])
146 * In PAE mode, we need to do a cr3 reload (=tlb flush) when
147 * updating the top-level pagetable entries to guarantee the
148 * processor notices the update. Since this is expensive, and
149 * all 4 top-level entries are used almost immediately in a
150 * new process's life, we just pre-populate them here.
151 *
152 * Also, if we're in a paravirt environment where the kernel pmd is
153 * not shared between pagetables (!SHARED_KERNEL_PMDS), we allocate
154 * and initialize the kernel pmds here.
155 */
156static int pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd)
157{ 205{
158 pud_t *pud; 206 pud_t *pud;
159 unsigned long addr; 207 unsigned long addr;
160 int i; 208 int i;
161 209
162 pud = pud_offset(pgd, 0); 210 pud = pud_offset(pgd, 0);
163 for (addr = i = 0; i < UNSHARED_PTRS_PER_PGD;
164 i++, pud++, addr += PUD_SIZE) {
165 pmd_t *pmd = pmd_alloc_one(mm, addr);
166 211
167 if (!pmd) { 212 for (addr = i = 0; i < PREALLOCATED_PMDS;
168 pgd_mop_up_pmds(mm, pgd); 213 i++, pud++, addr += PUD_SIZE) {
169 return 0; 214 pmd_t *pmd = pmds[i];
170 }
171 215
172 if (i >= KERNEL_PGD_BOUNDARY) 216 if (i >= KERNEL_PGD_BOUNDARY)
173 memcpy(pmd, (pmd_t *)pgd_page_vaddr(swapper_pg_dir[i]), 217 memcpy(pmd, (pmd_t *)pgd_page_vaddr(swapper_pg_dir[i]),
@@ -175,61 +219,54 @@ static int pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd)
175 219
176 pud_populate(mm, pud, pmd); 220 pud_populate(mm, pud, pmd);
177 } 221 }
178
179 return 1;
180} 222}
181 223
182void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd) 224pgd_t *pgd_alloc(struct mm_struct *mm)
183{ 225{
184 paravirt_alloc_pmd(mm, __pa(pmd) >> PAGE_SHIFT); 226 pgd_t *pgd;
227 pmd_t *pmds[PREALLOCATED_PMDS];
228 unsigned long flags;
185 229
186 /* Note: almost everything apart from _PAGE_PRESENT is 230 pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
187 reserved at the pmd (PDPT) level. */
188 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT));
189 231
190 /* 232 if (pgd == NULL)
191 * According to Intel App note "TLBs, Paging-Structure Caches, 233 goto out;
192 * and Their Invalidation", April 2007, document 317080-001,
193 * section 8.1: in PAE mode we explicitly have to flush the
194 * TLB via cr3 if the top-level pgd is changed...
195 */
196 if (mm == current->active_mm)
197 write_cr3(read_cr3());
198}
199#else /* !CONFIG_X86_PAE */
200/* No need to prepopulate any pagetable entries in non-PAE modes. */
201static int pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd)
202{
203 return 1;
204}
205 234
206static void pgd_mop_up_pmds(struct mm_struct *mm, pgd_t *pgd) 235 mm->pgd = pgd;
207{
208}
209#endif /* CONFIG_X86_PAE */
210 236
211pgd_t *pgd_alloc(struct mm_struct *mm) 237 if (preallocate_pmds(pmds) != 0)
212{ 238 goto out_free_pgd;
213 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
214 239
215 /* so that alloc_pmd can use it */ 240 if (paravirt_pgd_alloc(mm) != 0)
216 mm->pgd = pgd; 241 goto out_free_pmds;
217 if (pgd)
218 pgd_ctor(pgd);
219 242
220 if (pgd && !pgd_prepopulate_pmd(mm, pgd)) { 243 /*
221 pgd_dtor(pgd); 244 * Make sure that pre-populating the pmds is atomic with
222 free_page((unsigned long)pgd); 245 * respect to anything walking the pgd_list, so that they
223 pgd = NULL; 246 * never see a partially populated pgd.
224 } 247 */
248 spin_lock_irqsave(&pgd_lock, flags);
249
250 pgd_ctor(pgd);
251 pgd_prepopulate_pmd(mm, pgd, pmds);
252
253 spin_unlock_irqrestore(&pgd_lock, flags);
225 254
226 return pgd; 255 return pgd;
256
257out_free_pmds:
258 free_pmds(pmds);
259out_free_pgd:
260 free_page((unsigned long)pgd);
261out:
262 return NULL;
227} 263}
228 264
229void pgd_free(struct mm_struct *mm, pgd_t *pgd) 265void pgd_free(struct mm_struct *mm, pgd_t *pgd)
230{ 266{
231 pgd_mop_up_pmds(mm, pgd); 267 pgd_mop_up_pmds(mm, pgd);
232 pgd_dtor(pgd); 268 pgd_dtor(pgd);
269 paravirt_pgd_free(mm, pgd);
233 free_page((unsigned long)pgd); 270 free_page((unsigned long)pgd);
234} 271}
235 272
@@ -255,7 +292,7 @@ int ptep_test_and_clear_young(struct vm_area_struct *vma,
255 292
256 if (pte_young(*ptep)) 293 if (pte_young(*ptep))
257 ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, 294 ret = test_and_clear_bit(_PAGE_BIT_ACCESSED,
258 &ptep->pte); 295 (unsigned long *) &ptep->pte);
259 296
260 if (ret) 297 if (ret)
261 pte_update(vma->vm_mm, addr, ptep); 298 pte_update(vma->vm_mm, addr, ptep);
@@ -274,3 +311,22 @@ int ptep_clear_flush_young(struct vm_area_struct *vma,
274 311
275 return young; 312 return young;
276} 313}
314
315int fixmaps_set;
316
317void __native_set_fixmap(enum fixed_addresses idx, pte_t pte)
318{
319 unsigned long address = __fix_to_virt(idx);
320
321 if (idx >= __end_of_fixed_addresses) {
322 BUG();
323 return;
324 }
325 set_pte_vaddr(address, pte);
326 fixmaps_set++;
327}
328
329void native_set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
330{
331 __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags));
332}
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 369cf065b6a4..b4becbf8c570 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -71,7 +71,7 @@ void show_mem(void)
71 * Associate a virtual page frame with a given physical page frame 71 * Associate a virtual page frame with a given physical page frame
72 * and protection flags for that frame. 72 * and protection flags for that frame.
73 */ 73 */
74static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) 74void set_pte_vaddr(unsigned long vaddr, pte_t pteval)
75{ 75{
76 pgd_t *pgd; 76 pgd_t *pgd;
77 pud_t *pud; 77 pud_t *pud;
@@ -94,8 +94,8 @@ static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
94 return; 94 return;
95 } 95 }
96 pte = pte_offset_kernel(pmd, vaddr); 96 pte = pte_offset_kernel(pmd, vaddr);
97 if (pgprot_val(flags)) 97 if (pte_val(pteval))
98 set_pte_present(&init_mm, vaddr, pte, pfn_pte(pfn, flags)); 98 set_pte_present(&init_mm, vaddr, pte, pteval);
99 else 99 else
100 pte_clear(&init_mm, vaddr, pte); 100 pte_clear(&init_mm, vaddr, pte);
101 101
@@ -141,22 +141,9 @@ void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
141 __flush_tlb_one(vaddr); 141 __flush_tlb_one(vaddr);
142} 142}
143 143
144static int fixmaps;
145unsigned long __FIXADDR_TOP = 0xfffff000; 144unsigned long __FIXADDR_TOP = 0xfffff000;
146EXPORT_SYMBOL(__FIXADDR_TOP); 145EXPORT_SYMBOL(__FIXADDR_TOP);
147 146
148void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
149{
150 unsigned long address = __fix_to_virt(idx);
151
152 if (idx >= __end_of_fixed_addresses) {
153 BUG();
154 return;
155 }
156 set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
157 fixmaps++;
158}
159
160/** 147/**
161 * reserve_top_address - reserves a hole in the top of kernel address space 148 * reserve_top_address - reserves a hole in the top of kernel address space
162 * @reserve - size of hole to reserve 149 * @reserve - size of hole to reserve
@@ -164,11 +151,44 @@ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
164 * Can be used to relocate the fixmap area and poke a hole in the top 151 * Can be used to relocate the fixmap area and poke a hole in the top
165 * of kernel address space to make room for a hypervisor. 152 * of kernel address space to make room for a hypervisor.
166 */ 153 */
167void reserve_top_address(unsigned long reserve) 154void __init reserve_top_address(unsigned long reserve)
168{ 155{
169 BUG_ON(fixmaps > 0); 156 BUG_ON(fixmaps_set > 0);
170 printk(KERN_INFO "Reserving virtual address space above 0x%08x\n", 157 printk(KERN_INFO "Reserving virtual address space above 0x%08x\n",
171 (int)-reserve); 158 (int)-reserve);
172 __FIXADDR_TOP = -reserve - PAGE_SIZE; 159 __FIXADDR_TOP = -reserve - PAGE_SIZE;
173 __VMALLOC_RESERVE += reserve; 160 __VMALLOC_RESERVE += reserve;
174} 161}
162
163/*
164 * vmalloc=size forces the vmalloc area to be exactly 'size'
165 * bytes. This can be used to increase (or decrease) the
166 * vmalloc area - the default is 128m.
167 */
168static int __init parse_vmalloc(char *arg)
169{
170 if (!arg)
171 return -EINVAL;
172
173 __VMALLOC_RESERVE = memparse(arg, &arg);
174 return 0;
175}
176early_param("vmalloc", parse_vmalloc);
177
178/*
179 * reservetop=size reserves a hole at the top of the kernel address space which
180 * a hypervisor can load into later. Needed for dynamically loaded hypervisors,
181 * so relocating the fixmap can be done before paging initialization.
182 */
183static int __init parse_reservetop(char *arg)
184{
185 unsigned long address;
186
187 if (!arg)
188 return -EINVAL;
189
190 address = memparse(arg, &arg);
191 reserve_top_address(address);
192 return 0;
193}
194early_param("reservetop", parse_reservetop);
diff --git a/arch/x86/kernel/srat_32.c b/arch/x86/mm/srat_32.c
index 70e4a374b4e8..f41d67f8f831 100644
--- a/arch/x86/kernel/srat_32.c
+++ b/arch/x86/mm/srat_32.c
@@ -31,6 +31,7 @@
31#include <asm/srat.h> 31#include <asm/srat.h>
32#include <asm/topology.h> 32#include <asm/topology.h>
33#include <asm/smp.h> 33#include <asm/smp.h>
34#include <asm/e820.h>
34 35
35/* 36/*
36 * proximity macros and definitions 37 * proximity macros and definitions
@@ -41,7 +42,7 @@
41#define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit))) 42#define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit)))
42/* bitmap length; _PXM is at most 255 */ 43/* bitmap length; _PXM is at most 255 */
43#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) 44#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8)
44static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */ 45static u8 __initdata pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */
45 46
46#define MAX_CHUNKS_PER_NODE 3 47#define MAX_CHUNKS_PER_NODE 3
47#define MAXCHUNKS (MAX_CHUNKS_PER_NODE * MAX_NUMNODES) 48#define MAXCHUNKS (MAX_CHUNKS_PER_NODE * MAX_NUMNODES)
@@ -52,16 +53,37 @@ struct node_memory_chunk_s {
52 u8 nid; // which cnode contains this chunk? 53 u8 nid; // which cnode contains this chunk?
53 u8 bank; // which mem bank on this node 54 u8 bank; // which mem bank on this node
54}; 55};
55static struct node_memory_chunk_s node_memory_chunk[MAXCHUNKS]; 56static struct node_memory_chunk_s __initdata node_memory_chunk[MAXCHUNKS];
56 57
57static int num_memory_chunks; /* total number of memory chunks */ 58static int __initdata num_memory_chunks; /* total number of memory chunks */
58static u8 __initdata apicid_to_pxm[MAX_APICID]; 59static u8 __initdata apicid_to_pxm[MAX_APICID];
59 60
61int numa_off __initdata;
62int acpi_numa __initdata;
63
64static __init void bad_srat(void)
65{
66 printk(KERN_ERR "SRAT: SRAT not used.\n");
67 acpi_numa = -1;
68 num_memory_chunks = 0;
69}
70
71static __init inline int srat_disabled(void)
72{
73 return numa_off || acpi_numa < 0;
74}
75
60/* Identify CPU proximity domains */ 76/* Identify CPU proximity domains */
61static void __init parse_cpu_affinity_structure(char *p) 77void __init
78acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *cpu_affinity)
62{ 79{
63 struct acpi_srat_cpu_affinity *cpu_affinity = 80 if (srat_disabled())
64 (struct acpi_srat_cpu_affinity *) p; 81 return;
82 if (cpu_affinity->header.length !=
83 sizeof(struct acpi_srat_cpu_affinity)) {
84 bad_srat();
85 return;
86 }
65 87
66 if ((cpu_affinity->flags & ACPI_SRAT_CPU_ENABLED) == 0) 88 if ((cpu_affinity->flags & ACPI_SRAT_CPU_ENABLED) == 0)
67 return; /* empty entry */ 89 return; /* empty entry */
@@ -71,7 +93,7 @@ static void __init parse_cpu_affinity_structure(char *p)
71 93
72 apicid_to_pxm[cpu_affinity->apic_id] = cpu_affinity->proximity_domain_lo; 94 apicid_to_pxm[cpu_affinity->apic_id] = cpu_affinity->proximity_domain_lo;
73 95
74 printk("CPU 0x%02X in proximity domain 0x%02X\n", 96 printk(KERN_DEBUG "CPU %02x in proximity domain %02x\n",
75 cpu_affinity->apic_id, cpu_affinity->proximity_domain_lo); 97 cpu_affinity->apic_id, cpu_affinity->proximity_domain_lo);
76} 98}
77 99
@@ -79,14 +101,21 @@ static void __init parse_cpu_affinity_structure(char *p)
79 * Identify memory proximity domains and hot-remove capabilities. 101 * Identify memory proximity domains and hot-remove capabilities.
80 * Fill node memory chunk list structure. 102 * Fill node memory chunk list structure.
81 */ 103 */
82static void __init parse_memory_affinity_structure (char *sratp) 104void __init
105acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *memory_affinity)
83{ 106{
84 unsigned long long paddr, size; 107 unsigned long long paddr, size;
85 unsigned long start_pfn, end_pfn; 108 unsigned long start_pfn, end_pfn;
86 u8 pxm; 109 u8 pxm;
87 struct node_memory_chunk_s *p, *q, *pend; 110 struct node_memory_chunk_s *p, *q, *pend;
88 struct acpi_srat_mem_affinity *memory_affinity = 111
89 (struct acpi_srat_mem_affinity *) sratp; 112 if (srat_disabled())
113 return;
114 if (memory_affinity->header.length !=
115 sizeof(struct acpi_srat_mem_affinity)) {
116 bad_srat();
117 return;
118 }
90 119
91 if ((memory_affinity->flags & ACPI_SRAT_MEM_ENABLED) == 0) 120 if ((memory_affinity->flags & ACPI_SRAT_MEM_ENABLED) == 0)
92 return; /* empty entry */ 121 return; /* empty entry */
@@ -105,7 +134,8 @@ static void __init parse_memory_affinity_structure (char *sratp)
105 134
106 135
107 if (num_memory_chunks >= MAXCHUNKS) { 136 if (num_memory_chunks >= MAXCHUNKS) {
108 printk("Too many mem chunks in SRAT. Ignoring %lld MBytes at %llx\n", 137 printk(KERN_WARNING "Too many mem chunks in SRAT."
138 " Ignoring %lld MBytes at %llx\n",
109 size/(1024*1024), paddr); 139 size/(1024*1024), paddr);
110 return; 140 return;
111 } 141 }
@@ -126,7 +156,8 @@ static void __init parse_memory_affinity_structure (char *sratp)
126 156
127 num_memory_chunks++; 157 num_memory_chunks++;
128 158
129 printk("Memory range 0x%lX to 0x%lX (type 0x%X) in proximity domain 0x%02X %s\n", 159 printk(KERN_DEBUG "Memory range %08lx to %08lx (type %x)"
160 " in proximity domain %02x %s\n",
130 start_pfn, end_pfn, 161 start_pfn, end_pfn,
131 memory_affinity->memory_type, 162 memory_affinity->memory_type,
132 pxm, 163 pxm,
@@ -134,6 +165,14 @@ static void __init parse_memory_affinity_structure (char *sratp)
134 "enabled and removable" : "enabled" ) ); 165 "enabled and removable" : "enabled" ) );
135} 166}
136 167
168/* Callback for SLIT parsing */
169void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
170{
171}
172
173void acpi_numa_arch_fixup(void)
174{
175}
137/* 176/*
138 * The SRAT table always lists ascending addresses, so can always 177 * The SRAT table always lists ascending addresses, so can always
139 * assume that the first "start" address that you see is the real 178 * assume that the first "start" address that you see is the real
@@ -149,7 +188,7 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c
149 * *possible* memory hotplug areas the same as normal RAM. 188 * *possible* memory hotplug areas the same as normal RAM.
150 */ 189 */
151 if (memory_chunk->start_pfn >= max_pfn) { 190 if (memory_chunk->start_pfn >= max_pfn) {
152 printk (KERN_INFO "Ignoring SRAT pfns: 0x%08lx -> %08lx\n", 191 printk(KERN_INFO "Ignoring SRAT pfns: %08lx - %08lx\n",
153 memory_chunk->start_pfn, memory_chunk->end_pfn); 192 memory_chunk->start_pfn, memory_chunk->end_pfn);
154 return; 193 return;
155 } 194 }
@@ -166,42 +205,17 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c
166 node_end_pfn[nid] = memory_chunk->end_pfn; 205 node_end_pfn[nid] = memory_chunk->end_pfn;
167} 206}
168 207
169/* Parse the ACPI Static Resource Affinity Table */ 208int __init get_memcfg_from_srat(void)
170static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
171{ 209{
172 u8 *start, *end, *p;
173 int i, j, nid; 210 int i, j, nid;
174 211
175 start = (u8 *)(&(sratp->reserved) + 1); /* skip header */
176 p = start;
177 end = (u8 *)sratp + sratp->header.length;
178 212
179 memset(pxm_bitmap, 0, sizeof(pxm_bitmap)); /* init proximity domain bitmap */ 213 if (srat_disabled())
180 memset(node_memory_chunk, 0, sizeof(node_memory_chunk)); 214 goto out_fail;
181
182 num_memory_chunks = 0;
183 while (p < end) {
184 switch (*p) {
185 case ACPI_SRAT_TYPE_CPU_AFFINITY:
186 parse_cpu_affinity_structure(p);
187 break;
188 case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
189 parse_memory_affinity_structure(p);
190 break;
191 default:
192 printk("ACPI 2.0 SRAT: unknown entry skipped: type=0x%02X, len=%d\n", p[0], p[1]);
193 break;
194 }
195 p += p[1];
196 if (p[1] == 0) {
197 printk("acpi20_parse_srat: Entry length value is zero;"
198 " can't parse any further!\n");
199 break;
200 }
201 }
202 215
203 if (num_memory_chunks == 0) { 216 if (num_memory_chunks == 0) {
204 printk("could not finy any ACPI SRAT memory areas.\n"); 217 printk(KERN_WARNING
218 "could not finy any ACPI SRAT memory areas.\n");
205 goto out_fail; 219 goto out_fail;
206 } 220 }
207 221
@@ -228,131 +242,39 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
228 for (i = 0; i < num_memory_chunks; i++) 242 for (i = 0; i < num_memory_chunks; i++)
229 node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm); 243 node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm);
230 244
231 printk("pxm bitmap: "); 245 printk(KERN_DEBUG "pxm bitmap: ");
232 for (i = 0; i < sizeof(pxm_bitmap); i++) { 246 for (i = 0; i < sizeof(pxm_bitmap); i++) {
233 printk("%02X ", pxm_bitmap[i]); 247 printk(KERN_CONT "%02x ", pxm_bitmap[i]);
234 } 248 }
235 printk("\n"); 249 printk(KERN_CONT "\n");
236 printk("Number of logical nodes in system = %d\n", num_online_nodes()); 250 printk(KERN_DEBUG "Number of logical nodes in system = %d\n",
237 printk("Number of memory chunks in system = %d\n", num_memory_chunks); 251 num_online_nodes());
252 printk(KERN_DEBUG "Number of memory chunks in system = %d\n",
253 num_memory_chunks);
238 254
239 for (i = 0; i < MAX_APICID; i++) 255 for (i = 0; i < MAX_APICID; i++)
240 apicid_2_node[i] = pxm_to_node(apicid_to_pxm[i]); 256 apicid_2_node[i] = pxm_to_node(apicid_to_pxm[i]);
241 257
242 for (j = 0; j < num_memory_chunks; j++){ 258 for (j = 0; j < num_memory_chunks; j++){
243 struct node_memory_chunk_s * chunk = &node_memory_chunk[j]; 259 struct node_memory_chunk_s * chunk = &node_memory_chunk[j];
244 printk("chunk %d nid %d start_pfn %08lx end_pfn %08lx\n", 260 printk(KERN_DEBUG
261 "chunk %d nid %d start_pfn %08lx end_pfn %08lx\n",
245 j, chunk->nid, chunk->start_pfn, chunk->end_pfn); 262 j, chunk->nid, chunk->start_pfn, chunk->end_pfn);
246 node_read_chunk(chunk->nid, chunk); 263 node_read_chunk(chunk->nid, chunk);
247 add_active_range(chunk->nid, chunk->start_pfn, chunk->end_pfn); 264 e820_register_active_regions(chunk->nid, chunk->start_pfn,
265 min(chunk->end_pfn, max_pfn));
248 } 266 }
249 267
250 for_each_online_node(nid) { 268 for_each_online_node(nid) {
251 unsigned long start = node_start_pfn[nid]; 269 unsigned long start = node_start_pfn[nid];
252 unsigned long end = node_end_pfn[nid]; 270 unsigned long end = min(node_end_pfn[nid], max_pfn);
253 271
254 memory_present(nid, start, end); 272 memory_present(nid, start, end);
255 node_remap_size[nid] = node_memmap_size_bytes(nid, start, end); 273 node_remap_size[nid] = node_memmap_size_bytes(nid, start, end);
256 } 274 }
257 return 1; 275 return 1;
258out_fail: 276out_fail:
259 return 0; 277 printk(KERN_ERR "failed to get NUMA memory information from SRAT"
260} 278 " table\n");
261
262struct acpi_static_rsdt {
263 struct acpi_table_rsdt table;
264 u32 padding[7]; /* Allow for 7 more table entries */
265};
266
267int __init get_memcfg_from_srat(void)
268{
269 struct acpi_table_header *header = NULL;
270 struct acpi_table_rsdp *rsdp = NULL;
271 struct acpi_table_rsdt *rsdt = NULL;
272 acpi_native_uint rsdp_address = 0;
273 struct acpi_static_rsdt saved_rsdt;
274 int tables = 0;
275 int i = 0;
276
277 rsdp_address = acpi_os_get_root_pointer();
278 if (!rsdp_address) {
279 printk("%s: System description tables not found\n",
280 __func__);
281 goto out_err;
282 }
283
284 printk("%s: assigning address to rsdp\n", __func__);
285 rsdp = (struct acpi_table_rsdp *)(u32)rsdp_address;
286 if (!rsdp) {
287 printk("%s: Didn't find ACPI root!\n", __func__);
288 goto out_err;
289 }
290
291 printk(KERN_INFO "%.8s v%d [%.6s]\n", rsdp->signature, rsdp->revision,
292 rsdp->oem_id);
293
294 if (strncmp(rsdp->signature, ACPI_SIG_RSDP,strlen(ACPI_SIG_RSDP))) {
295 printk(KERN_WARNING "%s: RSDP table signature incorrect\n", __func__);
296 goto out_err;
297 }
298
299 rsdt = (struct acpi_table_rsdt *)
300 early_ioremap(rsdp->rsdt_physical_address, sizeof(struct acpi_table_rsdt));
301
302 if (!rsdt) {
303 printk(KERN_WARNING
304 "%s: ACPI: Invalid root system description tables (RSDT)\n",
305 __func__);
306 goto out_err;
307 }
308
309 header = &rsdt->header;
310
311 if (strncmp(header->signature, ACPI_SIG_RSDT, strlen(ACPI_SIG_RSDT))) {
312 printk(KERN_WARNING "ACPI: RSDT signature incorrect\n");
313 goto out_err;
314 }
315
316 /*
317 * The number of tables is computed by taking the
318 * size of all entries (header size minus total
319 * size of RSDT) divided by the size of each entry
320 * (4-byte table pointers).
321 */
322 tables = (header->length - sizeof(struct acpi_table_header)) / 4;
323
324 if (!tables)
325 goto out_err;
326
327 memcpy(&saved_rsdt, rsdt, sizeof(saved_rsdt));
328
329 if (saved_rsdt.table.header.length > sizeof(saved_rsdt)) {
330 printk(KERN_WARNING "ACPI: Too big length in RSDT: %d\n",
331 saved_rsdt.table.header.length);
332 goto out_err;
333 }
334
335 printk("Begin SRAT table scan....\n");
336
337 for (i = 0; i < tables; i++) {
338 /* Map in header, then map in full table length. */
339 header = (struct acpi_table_header *)
340 early_ioremap(saved_rsdt.table.table_offset_entry[i], sizeof(struct acpi_table_header));
341 if (!header)
342 break;
343 header = (struct acpi_table_header *)
344 early_ioremap(saved_rsdt.table.table_offset_entry[i], header->length);
345 if (!header)
346 break;
347
348 if (strncmp((char *) &header->signature, ACPI_SIG_SRAT, 4))
349 continue;
350
351 /* we've found the srat table. don't need to look at any more tables */
352 return acpi20_parse_srat((struct acpi_table_srat *)header);
353 }
354out_err:
355 remove_all_active_ranges();
356 printk("failed to get NUMA memory information from SRAT table\n");
357 return 0; 279 return 0;
358} 280}
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 99649dccad28..1b4763e26ea9 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -100,7 +100,19 @@ static __init inline int srat_disabled(void)
100/* Callback for SLIT parsing */ 100/* Callback for SLIT parsing */
101void __init acpi_numa_slit_init(struct acpi_table_slit *slit) 101void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
102{ 102{
103 acpi_slit = slit; 103 unsigned length;
104 unsigned long phys;
105
106 length = slit->header.length;
107 phys = find_e820_area(0, max_pfn_mapped<<PAGE_SHIFT, length,
108 PAGE_SIZE);
109
110 if (phys == -1L)
111 panic(" Can not save slit!\n");
112
113 acpi_slit = __va(phys);
114 memcpy(acpi_slit, slit, length);
115 reserve_early(phys, phys + length, "ACPI SLIT");
104} 116}
105 117
106/* Callback for Proximity Domain -> LAPIC mapping */ 118/* Callback for Proximity Domain -> LAPIC mapping */
@@ -299,7 +311,7 @@ static int __init nodes_cover_memory(const struct bootnode *nodes)
299 pxmram = 0; 311 pxmram = 0;
300 } 312 }
301 313
302 e820ram = end_pfn - absent_pages_in_range(0, end_pfn); 314 e820ram = max_pfn - absent_pages_in_range(0, max_pfn);
303 /* We seem to lose 3 pages somewhere. Allow a bit of slack. */ 315 /* We seem to lose 3 pages somewhere. Allow a bit of slack. */
304 if ((long)(e820ram - pxmram) >= 1*1024*1024) { 316 if ((long)(e820ram - pxmram) >= 1*1024*1024) {
305 printk(KERN_ERR 317 printk(KERN_ERR
@@ -376,7 +388,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
376 if (node == NUMA_NO_NODE) 388 if (node == NUMA_NO_NODE)
377 continue; 389 continue;
378 if (!node_isset(node, node_possible_map)) 390 if (!node_isset(node, node_possible_map))
379 numa_set_node(i, NUMA_NO_NODE); 391 numa_clear_node(i);
380 } 392 }
381 numa_init_array(); 393 numa_init_array();
382 return 0; 394 return 0;
@@ -495,6 +507,7 @@ int __node_distance(int a, int b)
495 507
496EXPORT_SYMBOL(__node_distance); 508EXPORT_SYMBOL(__node_distance);
497 509
510#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) || defined(CONFIG_ACPI_HOTPLUG_MEMORY)
498int memory_add_physaddr_to_nid(u64 start) 511int memory_add_physaddr_to_nid(u64 start)
499{ 512{
500 int i, ret = 0; 513 int i, ret = 0;
@@ -506,4 +519,4 @@ int memory_add_physaddr_to_nid(u64 start)
506 return ret; 519 return ret;
507} 520}
508EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 521EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
509 522#endif
diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c
new file mode 100644
index 000000000000..d877c5b423ef
--- /dev/null
+++ b/arch/x86/mm/testmmiotrace.c
@@ -0,0 +1,71 @@
1/*
2 * Written by Pekka Paalanen, 2008 <pq@iki.fi>
3 */
4#include <linux/module.h>
5#include <linux/io.h>
6
7#define MODULE_NAME "testmmiotrace"
8
9static unsigned long mmio_address;
10module_param(mmio_address, ulong, 0);
11MODULE_PARM_DESC(mmio_address, "Start address of the mapping of 16 kB.");
12
13static void do_write_test(void __iomem *p)
14{
15 unsigned int i;
16 for (i = 0; i < 256; i++)
17 iowrite8(i, p + i);
18 for (i = 1024; i < (5 * 1024); i += 2)
19 iowrite16(i * 12 + 7, p + i);
20 for (i = (5 * 1024); i < (16 * 1024); i += 4)
21 iowrite32(i * 212371 + 13, p + i);
22}
23
24static void do_read_test(void __iomem *p)
25{
26 unsigned int i;
27 for (i = 0; i < 256; i++)
28 ioread8(p + i);
29 for (i = 1024; i < (5 * 1024); i += 2)
30 ioread16(p + i);
31 for (i = (5 * 1024); i < (16 * 1024); i += 4)
32 ioread32(p + i);
33}
34
35static void do_test(void)
36{
37 void __iomem *p = ioremap_nocache(mmio_address, 0x4000);
38 if (!p) {
39 pr_err(MODULE_NAME ": could not ioremap, aborting.\n");
40 return;
41 }
42 do_write_test(p);
43 do_read_test(p);
44 iounmap(p);
45}
46
47static int __init init(void)
48{
49 if (mmio_address == 0) {
50 pr_err(MODULE_NAME ": you have to use the module argument "
51 "mmio_address.\n");
52 pr_err(MODULE_NAME ": DO NOT LOAD THIS MODULE UNLESS"
53 " YOU REALLY KNOW WHAT YOU ARE DOING!\n");
54 return -ENXIO;
55 }
56
57 pr_warning(MODULE_NAME ": WARNING: mapping 16 kB @ 0x%08lx "
58 "in PCI address space, and writing "
59 "rubbish in there.\n", mmio_address);
60 do_test();
61 return 0;
62}
63
64static void __exit cleanup(void)
65{
66 pr_debug(MODULE_NAME ": unloaded.\n");
67}
68
69module_init(init);
70module_exit(cleanup);
71MODULE_LICENSE("GPL");
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index cc48d3fde545..2b6ad5b9f9d5 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -269,12 +269,13 @@ static void nmi_cpu_shutdown(void *dummy)
269 269
270static void nmi_shutdown(void) 270static void nmi_shutdown(void)
271{ 271{
272 struct op_msrs *msrs = &__get_cpu_var(cpu_msrs); 272 struct op_msrs *msrs = &get_cpu_var(cpu_msrs);
273 nmi_enabled = 0; 273 nmi_enabled = 0;
274 on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1); 274 on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1);
275 unregister_die_notifier(&profile_exceptions_nb); 275 unregister_die_notifier(&profile_exceptions_nb);
276 model->shutdown(msrs); 276 model->shutdown(msrs);
277 free_msrs(); 277 free_msrs();
278 put_cpu_var(cpu_msrs);
278} 279}
279 280
280static void nmi_cpu_start(void *dummy) 281static void nmi_cpu_start(void *dummy)
diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index c5c8e485fc44..e515e8db842a 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -1,5 +1,17 @@
1ifeq ($(CONFIG_X86_32),y) 1obj-y := i386.o init.o
2include ${srctree}/arch/x86/pci/Makefile_32 2
3else 3obj-$(CONFIG_PCI_BIOS) += pcbios.o
4include ${srctree}/arch/x86/pci/Makefile_64 4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$(BITS).o direct.o mmconfig-shared.o
5endif 5obj-$(CONFIG_PCI_DIRECT) += direct.o
6obj-$(CONFIG_PCI_OLPC) += olpc.o
7
8pci-y := fixup.o
9pci-$(CONFIG_ACPI) += acpi.o
10pci-y += legacy.o irq.o
11
12pci-$(CONFIG_X86_VISWS) += visws.o
13
14pci-$(CONFIG_X86_NUMAQ) += numa.o
15
16obj-y += $(pci-y) common.o early.o
17obj-y += amd_bus.o
diff --git a/arch/x86/pci/Makefile_32 b/arch/x86/pci/Makefile_32
deleted file mode 100644
index 89ec35d00efd..000000000000
--- a/arch/x86/pci/Makefile_32
+++ /dev/null
@@ -1,24 +0,0 @@
1obj-y := i386.o init.o
2
3obj-$(CONFIG_PCI_BIOS) += pcbios.o
4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_32.o direct.o mmconfig-shared.o
5obj-$(CONFIG_PCI_DIRECT) += direct.o
6obj-$(CONFIG_PCI_OLPC) += olpc.o
7
8pci-y := fixup.o
9
10# Do not change the ordering here. There is a nasty init function
11# ordering dependency which breaks when you move acpi.o below
12# legacy/irq.o
13pci-$(CONFIG_ACPI) += acpi.o
14pci-y += legacy.o irq.o
15
16# Careful: VISWS and NUMAQ overrule the pci-y above. The colons are
17# therefor correct. This needs a proper fix by distangling the code.
18pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
19pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o
20
21# Necessary for NUMAQ as well
22pci-$(CONFIG_NUMA) += mp_bus_to_node.o
23
24obj-y += $(pci-y) common.o early.o
diff --git a/arch/x86/pci/Makefile_64 b/arch/x86/pci/Makefile_64
deleted file mode 100644
index 8fbd19832cf6..000000000000
--- a/arch/x86/pci/Makefile_64
+++ /dev/null
@@ -1,17 +0,0 @@
1#
2# Makefile for X86_64 specific PCI routines
3#
4# Reuse the i386 PCI subsystem
5#
6EXTRA_CFLAGS += -Iarch/x86/pci
7
8obj-y := i386.o
9obj-$(CONFIG_PCI_DIRECT)+= direct.o
10obj-y += fixup.o init.o
11obj-$(CONFIG_ACPI) += acpi.o
12obj-y += legacy.o irq.o common.o early.o
13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
15
16obj-y += k8-bus_64.o
17
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index d95de2f199cd..19af06927fbc 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -171,8 +171,11 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
171 if (node != -1) 171 if (node != -1)
172 set_mp_bus_to_node(busnum, node); 172 set_mp_bus_to_node(busnum, node);
173 else 173 else
174 node = get_mp_bus_to_node(busnum);
175#endif 174#endif
175 node = get_mp_bus_to_node(busnum);
176
177 if (node != -1 && !node_online(node))
178 node = -1;
176 179
177 /* Allocate per-root-bus (not per bus) arch-specific data. 180 /* Allocate per-root-bus (not per bus) arch-specific data.
178 * TODO: leak; this memory is never freed. 181 * TODO: leak; this memory is never freed.
@@ -204,22 +207,23 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
204 if (!bus) 207 if (!bus)
205 kfree(sd); 208 kfree(sd);
206 209
210 if (bus && node != -1) {
207#ifdef CONFIG_ACPI_NUMA 211#ifdef CONFIG_ACPI_NUMA
208 if (bus) { 212 if (pxm >= 0)
209 if (pxm >= 0) {
210 printk(KERN_DEBUG "bus %02x -> pxm %d -> node %d\n", 213 printk(KERN_DEBUG "bus %02x -> pxm %d -> node %d\n",
211 busnum, pxm, pxm_to_node(pxm)); 214 busnum, pxm, node);
212 } 215#else
213 } 216 printk(KERN_DEBUG "bus %02x -> node %d\n",
217 busnum, node);
214#endif 218#endif
219 }
215 220
216 if (bus && (pci_probe & PCI_USE__CRS)) 221 if (bus && (pci_probe & PCI_USE__CRS))
217 get_current_resources(device, busnum, domain, bus); 222 get_current_resources(device, busnum, domain, bus);
218 return bus; 223 return bus;
219} 224}
220 225
221extern int pci_routeirq; 226int __init pci_acpi_init(void)
222static int __init pci_acpi_init(void)
223{ 227{
224 struct pci_dev *dev = NULL; 228 struct pci_dev *dev = NULL;
225 229
@@ -253,4 +257,3 @@ static int __init pci_acpi_init(void)
253 257
254 return 0; 258 return 0;
255} 259}
256subsys_initcall(pci_acpi_init);
diff --git a/arch/x86/pci/k8-bus_64.c b/arch/x86/pci/amd_bus.c
index 5c2799c20e47..a18141ae3f02 100644
--- a/arch/x86/pci/k8-bus_64.c
+++ b/arch/x86/pci/amd_bus.c
@@ -1,40 +1,25 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/pci.h> 2#include <linux/pci.h>
3#include <linux/topology.h>
4#include "pci.h"
5
6#ifdef CONFIG_X86_64
3#include <asm/pci-direct.h> 7#include <asm/pci-direct.h>
4#include <asm/mpspec.h> 8#include <asm/mpspec.h>
5#include <linux/cpumask.h> 9#include <linux/cpumask.h>
6#include <linux/topology.h> 10#endif
7 11
8/* 12/*
9 * This discovers the pcibus <-> node mapping on AMD K8. 13 * This discovers the pcibus <-> node mapping on AMD K8.
10 * also get peer root bus resource for io,mmio 14 * also get peer root bus resource for io,mmio
11 */ 15 */
12 16
13
14/*
15 * sub bus (transparent) will use entres from 3 to store extra from root,
16 * so need to make sure have enought slot there, increase PCI_BUS_NUM_RESOURCES?
17 */
18#define RES_NUM 16
19struct pci_root_info {
20 char name[12];
21 unsigned int res_num;
22 struct resource res[RES_NUM];
23 int bus_min;
24 int bus_max;
25 int node;
26 int link;
27};
28
29/* 4 at this time, it may become to 32 */
30#define PCI_ROOT_NR 4
31static int pci_root_num;
32static struct pci_root_info pci_root_info[PCI_ROOT_NR];
33
34#ifdef CONFIG_NUMA 17#ifdef CONFIG_NUMA
35 18
36#define BUS_NR 256 19#define BUS_NR 256
37 20
21#ifdef CONFIG_X86_64
22
38static int mp_bus_to_node[BUS_NR]; 23static int mp_bus_to_node[BUS_NR];
39 24
40void set_mp_bus_to_node(int busnum, int node) 25void set_mp_bus_to_node(int busnum, int node)
@@ -61,7 +46,52 @@ int get_mp_bus_to_node(int busnum)
61 46
62 return node; 47 return node;
63} 48}
64#endif 49
50#else /* CONFIG_X86_32 */
51
52static unsigned char mp_bus_to_node[BUS_NR];
53
54void set_mp_bus_to_node(int busnum, int node)
55{
56 if (busnum >= 0 && busnum < BUS_NR)
57 mp_bus_to_node[busnum] = (unsigned char) node;
58}
59
60int get_mp_bus_to_node(int busnum)
61{
62 int node;
63
64 if (busnum < 0 || busnum > (BUS_NR - 1))
65 return 0;
66 node = mp_bus_to_node[busnum];
67 return node;
68}
69
70#endif /* CONFIG_X86_32 */
71
72#endif /* CONFIG_NUMA */
73
74#ifdef CONFIG_X86_64
75
76/*
77 * sub bus (transparent) will use entres from 3 to store extra from root,
78 * so need to make sure have enought slot there, increase PCI_BUS_NUM_RESOURCES?
79 */
80#define RES_NUM 16
81struct pci_root_info {
82 char name[12];
83 unsigned int res_num;
84 struct resource res[RES_NUM];
85 int bus_min;
86 int bus_max;
87 int node;
88 int link;
89};
90
91/* 4 at this time, it may become to 32 */
92#define PCI_ROOT_NR 4
93static int pci_root_num;
94static struct pci_root_info pci_root_info[PCI_ROOT_NR];
65 95
66void set_pci_bus_resources_arch_default(struct pci_bus *b) 96void set_pci_bus_resources_arch_default(struct pci_bus *b)
67{ 97{
@@ -384,7 +414,7 @@ static int __init early_fill_mp_bus_info(void)
384 /* need to take out [0, TOM) for RAM*/ 414 /* need to take out [0, TOM) for RAM*/
385 address = MSR_K8_TOP_MEM1; 415 address = MSR_K8_TOP_MEM1;
386 rdmsrl(address, val); 416 rdmsrl(address, val);
387 end = (val & 0xffffff8000000ULL); 417 end = (val & 0xffffff800000ULL);
388 printk(KERN_INFO "TOM: %016lx aka %ldM\n", end, end>>20); 418 printk(KERN_INFO "TOM: %016lx aka %ldM\n", end, end>>20);
389 if (end < (1ULL<<32)) 419 if (end < (1ULL<<32))
390 update_range(range, 0, end - 1); 420 update_range(range, 0, end - 1);
@@ -478,7 +508,7 @@ static int __init early_fill_mp_bus_info(void)
478 /* TOP_MEM2 */ 508 /* TOP_MEM2 */
479 address = MSR_K8_TOP_MEM2; 509 address = MSR_K8_TOP_MEM2;
480 rdmsrl(address, val); 510 rdmsrl(address, val);
481 end = (val & 0xffffff8000000ULL); 511 end = (val & 0xffffff800000ULL);
482 printk(KERN_INFO "TOM2: %016lx aka %ldM\n", end, end>>20); 512 printk(KERN_INFO "TOM2: %016lx aka %ldM\n", end, end>>20);
483 update_range(range, 1ULL<<32, end - 1); 513 update_range(range, 1ULL<<32, end - 1);
484 } 514 }
@@ -526,3 +556,31 @@ static int __init early_fill_mp_bus_info(void)
526} 556}
527 557
528postcore_initcall(early_fill_mp_bus_info); 558postcore_initcall(early_fill_mp_bus_info);
559
560#endif
561
562/* common 32/64 bit code */
563
564#define ENABLE_CF8_EXT_CFG (1ULL << 46)
565
566static void enable_pci_io_ecs_per_cpu(void *unused)
567{
568 u64 reg;
569 rdmsrl(MSR_AMD64_NB_CFG, reg);
570 if (!(reg & ENABLE_CF8_EXT_CFG)) {
571 reg |= ENABLE_CF8_EXT_CFG;
572 wrmsrl(MSR_AMD64_NB_CFG, reg);
573 }
574}
575
576static int __init enable_pci_io_ecs(void)
577{
578 /* assume all cpus from fam10h have IO ECS */
579 if (boot_cpu_data.x86 < 0x10)
580 return 0;
581 on_each_cpu(enable_pci_io_ecs_per_cpu, NULL, 1, 1);
582 pci_probe |= PCI_HAS_IO_ECS;
583 return 0;
584}
585
586postcore_initcall(enable_pci_io_ecs);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 6e64aaf00d1d..20b9f59f95df 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -384,7 +384,7 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
384 384
385extern u8 pci_cache_line_size; 385extern u8 pci_cache_line_size;
386 386
387static int __init pcibios_init(void) 387int __init pcibios_init(void)
388{ 388{
389 struct cpuinfo_x86 *c = &boot_cpu_data; 389 struct cpuinfo_x86 *c = &boot_cpu_data;
390 390
@@ -411,8 +411,6 @@ static int __init pcibios_init(void)
411 return 0; 411 return 0;
412} 412}
413 413
414subsys_initcall(pcibios_init);
415
416char * __devinit pcibios_setup(char *str) 414char * __devinit pcibios_setup(char *str)
417{ 415{
418 if (!strcmp(str, "off")) { 416 if (!strcmp(str, "off")) {
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c
index 21d1e0e0d535..9915293500fb 100644
--- a/arch/x86/pci/direct.c
+++ b/arch/x86/pci/direct.c
@@ -8,18 +8,21 @@
8#include "pci.h" 8#include "pci.h"
9 9
10/* 10/*
11 * Functions for accessing PCI configuration space with type 1 accesses 11 * Functions for accessing PCI base (first 256 bytes) and extended
12 * (4096 bytes per PCI function) configuration space with type 1
13 * accesses.
12 */ 14 */
13 15
14#define PCI_CONF1_ADDRESS(bus, devfn, reg) \ 16#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
15 (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) 17 (0x80000000 | ((reg & 0xF00) << 16) | (bus << 16) \
18 | (devfn << 8) | (reg & 0xFC))
16 19
17static int pci_conf1_read(unsigned int seg, unsigned int bus, 20static int pci_conf1_read(unsigned int seg, unsigned int bus,
18 unsigned int devfn, int reg, int len, u32 *value) 21 unsigned int devfn, int reg, int len, u32 *value)
19{ 22{
20 unsigned long flags; 23 unsigned long flags;
21 24
22 if ((bus > 255) || (devfn > 255) || (reg > 255)) { 25 if ((bus > 255) || (devfn > 255) || (reg > 4095)) {
23 *value = -1; 26 *value = -1;
24 return -EINVAL; 27 return -EINVAL;
25 } 28 }
@@ -50,7 +53,7 @@ static int pci_conf1_write(unsigned int seg, unsigned int bus,
50{ 53{
51 unsigned long flags; 54 unsigned long flags;
52 55
53 if ((bus > 255) || (devfn > 255) || (reg > 255)) 56 if ((bus > 255) || (devfn > 255) || (reg > 4095))
54 return -EINVAL; 57 return -EINVAL;
55 58
56 spin_lock_irqsave(&pci_config_lock, flags); 59 spin_lock_irqsave(&pci_config_lock, flags);
@@ -260,10 +263,18 @@ void __init pci_direct_init(int type)
260 return; 263 return;
261 printk(KERN_INFO "PCI: Using configuration type %d for base access\n", 264 printk(KERN_INFO "PCI: Using configuration type %d for base access\n",
262 type); 265 type);
263 if (type == 1) 266 if (type == 1) {
264 raw_pci_ops = &pci_direct_conf1; 267 raw_pci_ops = &pci_direct_conf1;
265 else 268 if (raw_pci_ext_ops)
266 raw_pci_ops = &pci_direct_conf2; 269 return;
270 if (!(pci_probe & PCI_HAS_IO_ECS))
271 return;
272 printk(KERN_INFO "PCI: Using configuration type 1 "
273 "for extended access\n");
274 raw_pci_ext_ops = &pci_direct_conf1;
275 return;
276 }
277 raw_pci_ops = &pci_direct_conf2;
267} 278}
268 279
269int __init pci_direct_probe(void) 280int __init pci_direct_probe(void)
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 10fb308fded8..2aafb67dc5f1 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -299,9 +299,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
299 return -EINVAL; 299 return -EINVAL;
300 300
301 prot = pgprot_val(vma->vm_page_prot); 301 prot = pgprot_val(vma->vm_page_prot);
302 if (pat_wc_enabled && write_combine) 302 if (pat_enabled && write_combine)
303 prot |= _PAGE_CACHE_WC; 303 prot |= _PAGE_CACHE_WC;
304 else if (pat_wc_enabled || boot_cpu_data.x86 > 3) 304 else if (pat_enabled || boot_cpu_data.x86 > 3)
305 /* 305 /*
306 * ioremap() and ioremap_nocache() defaults to UC MINUS for now. 306 * ioremap() and ioremap_nocache() defaults to UC MINUS for now.
307 * To avoid attribute conflicts, request UC MINUS here 307 * To avoid attribute conflicts, request UC MINUS here
@@ -334,7 +334,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
334 flags = new_flags; 334 flags = new_flags;
335 } 335 }
336 336
337 if (vma->vm_pgoff <= max_pfn_mapped && 337 if (((vma->vm_pgoff < max_low_pfn_mapped) ||
338 (vma->vm_pgoff >= (1UL<<(32 - PAGE_SHIFT)) &&
339 vma->vm_pgoff < max_pfn_mapped)) &&
338 ioremap_change_attr((unsigned long)__va(addr), len, flags)) { 340 ioremap_change_attr((unsigned long)__va(addr), len, flags)) {
339 free_memtype(addr, addr + len); 341 free_memtype(addr, addr + len);
340 return -EINVAL; 342 return -EINVAL;
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
index b821f4462d99..d6c950f81858 100644
--- a/arch/x86/pci/init.c
+++ b/arch/x86/pci/init.c
@@ -4,7 +4,7 @@
4 4
5/* arch_initcall has too random ordering, so call the initializers 5/* arch_initcall has too random ordering, so call the initializers
6 in the right sequence from here. */ 6 in the right sequence from here. */
7static __init int pci_access_init(void) 7static __init int pci_arch_init(void)
8{ 8{
9#ifdef CONFIG_PCI_DIRECT 9#ifdef CONFIG_PCI_DIRECT
10 int type = 0; 10 int type = 0;
@@ -40,4 +40,4 @@ static __init int pci_access_init(void)
40 40
41 return 0; 41 return 0;
42} 42}
43arch_initcall(pci_access_init); 43arch_initcall(pci_arch_init);
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index ca8df9c260bc..dc568c6b83f8 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -11,8 +11,8 @@
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/dmi.h> 13#include <linux/dmi.h>
14#include <asm/io.h> 14#include <linux/io.h>
15#include <asm/smp.h> 15#include <linux/smp.h>
16#include <asm/io_apic.h> 16#include <asm/io_apic.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/acpi.h> 18#include <linux/acpi.h>
@@ -61,7 +61,7 @@ void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL;
61 * and perform checksum verification. 61 * and perform checksum verification.
62 */ 62 */
63 63
64static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr) 64static inline struct irq_routing_table *pirq_check_routing_table(u8 *addr)
65{ 65{
66 struct irq_routing_table *rt; 66 struct irq_routing_table *rt;
67 int i; 67 int i;
@@ -74,7 +74,7 @@ static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr)
74 rt->size < sizeof(struct irq_routing_table)) 74 rt->size < sizeof(struct irq_routing_table))
75 return NULL; 75 return NULL;
76 sum = 0; 76 sum = 0;
77 for (i=0; i < rt->size; i++) 77 for (i = 0; i < rt->size; i++)
78 sum += addr[i]; 78 sum += addr[i];
79 if (!sum) { 79 if (!sum) {
80 DBG(KERN_DEBUG "PCI: Interrupt Routing Table found at 0x%p\n", rt); 80 DBG(KERN_DEBUG "PCI: Interrupt Routing Table found at 0x%p\n", rt);
@@ -100,7 +100,7 @@ static struct irq_routing_table * __init pirq_find_routing_table(void)
100 return rt; 100 return rt;
101 printk(KERN_WARNING "PCI: PIRQ table NOT found at pirqaddr\n"); 101 printk(KERN_WARNING "PCI: PIRQ table NOT found at pirqaddr\n");
102 } 102 }
103 for(addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000); addr += 16) { 103 for (addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000); addr += 16) {
104 rt = pirq_check_routing_table(addr); 104 rt = pirq_check_routing_table(addr);
105 if (rt) 105 if (rt)
106 return rt; 106 return rt;
@@ -122,20 +122,20 @@ static void __init pirq_peer_trick(void)
122 struct irq_info *e; 122 struct irq_info *e;
123 123
124 memset(busmap, 0, sizeof(busmap)); 124 memset(busmap, 0, sizeof(busmap));
125 for(i=0; i < (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); i++) { 125 for (i = 0; i < (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); i++) {
126 e = &rt->slots[i]; 126 e = &rt->slots[i];
127#ifdef DEBUG 127#ifdef DEBUG
128 { 128 {
129 int j; 129 int j;
130 DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot); 130 DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot);
131 for(j=0; j<4; j++) 131 for (j = 0; j < 4; j++)
132 DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap); 132 DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap);
133 DBG("\n"); 133 DBG("\n");
134 } 134 }
135#endif 135#endif
136 busmap[e->bus] = 1; 136 busmap[e->bus] = 1;
137 } 137 }
138 for(i = 1; i < 256; i++) { 138 for (i = 1; i < 256; i++) {
139 int node; 139 int node;
140 if (!busmap[i] || pci_find_bus(0, i)) 140 if (!busmap[i] || pci_find_bus(0, i))
141 continue; 141 continue;
@@ -285,7 +285,7 @@ static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
285 static const unsigned char pirqmap[4] = { 1, 0, 2, 3 }; 285 static const unsigned char pirqmap[4] = { 1, 0, 2, 3 };
286 286
287 WARN_ON_ONCE(pirq > 4); 287 WARN_ON_ONCE(pirq > 4);
288 return read_config_nybble(router,0x43, pirqmap[pirq-1]); 288 return read_config_nybble(router, 0x43, pirqmap[pirq-1]);
289} 289}
290 290
291static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) 291static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
@@ -314,7 +314,7 @@ static int pirq_opti_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
314 314
315/* 315/*
316 * Cyrix: nibble offset 0x5C 316 * Cyrix: nibble offset 0x5C
317 * 0x5C bits 7:4 is INTB bits 3:0 is INTA 317 * 0x5C bits 7:4 is INTB bits 3:0 is INTA
318 * 0x5D bits 7:4 is INTD bits 3:0 is INTC 318 * 0x5D bits 7:4 is INTD bits 3:0 is INTC
319 */ 319 */
320static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq) 320static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
@@ -350,7 +350,7 @@ static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
350 * Apparently there are systems implementing PCI routing table using 350 * Apparently there are systems implementing PCI routing table using
351 * link values 0x01-0x04 and others using 0x41-0x44 for PCI INTA..D. 351 * link values 0x01-0x04 and others using 0x41-0x44 for PCI INTA..D.
352 * We try our best to handle both link mappings. 352 * We try our best to handle both link mappings.
353 * 353 *
354 * Currently (2003-05-21) it appears most SiS chipsets follow the 354 * Currently (2003-05-21) it appears most SiS chipsets follow the
355 * definition of routing registers from the SiS-5595 southbridge. 355 * definition of routing registers from the SiS-5595 southbridge.
356 * According to the SiS 5595 datasheets the revision id's of the 356 * According to the SiS 5595 datasheets the revision id's of the
@@ -370,7 +370,7 @@ static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
370 * 370 *
371 * 0x62: USBIRQ: 371 * 0x62: USBIRQ:
372 * bit 6 OHCI function disabled (0), enabled (1) 372 * bit 6 OHCI function disabled (0), enabled (1)
373 * 373 *
374 * 0x6a: ACPI/SCI IRQ: bits 4-6 reserved 374 * 0x6a: ACPI/SCI IRQ: bits 4-6 reserved
375 * 375 *
376 * 0x7e: Data Acq. Module IRQ - bits 4-6 reserved 376 * 0x7e: Data Acq. Module IRQ - bits 4-6 reserved
@@ -487,9 +487,7 @@ static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq
487 u8 irq; 487 u8 irq;
488 irq = 0; 488 irq = 0;
489 if (pirq <= 4) 489 if (pirq <= 4)
490 {
491 irq = read_config_nybble(router, 0x56, pirq - 1); 490 irq = read_config_nybble(router, 0x56, pirq - 1);
492 }
493 printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n", 491 printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n",
494 dev->vendor, dev->device, pirq, irq); 492 dev->vendor, dev->device, pirq, irq);
495 return irq; 493 return irq;
@@ -497,12 +495,10 @@ static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq
497 495
498static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) 496static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
499{ 497{
500 printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", 498 printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n",
501 dev->vendor, dev->device, pirq, irq); 499 dev->vendor, dev->device, pirq, irq);
502 if (pirq <= 4) 500 if (pirq <= 4)
503 {
504 write_config_nybble(router, 0x56, pirq - 1, irq); 501 write_config_nybble(router, 0x56, pirq - 1, irq);
505 }
506 return 1; 502 return 1;
507} 503}
508 504
@@ -549,50 +545,49 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
549 if (pci_dev_present(pirq_440gx)) 545 if (pci_dev_present(pirq_440gx))
550 return 0; 546 return 0;
551 547
552 switch(device) 548 switch (device) {
553 { 549 case PCI_DEVICE_ID_INTEL_82371FB_0:
554 case PCI_DEVICE_ID_INTEL_82371FB_0: 550 case PCI_DEVICE_ID_INTEL_82371SB_0:
555 case PCI_DEVICE_ID_INTEL_82371SB_0: 551 case PCI_DEVICE_ID_INTEL_82371AB_0:
556 case PCI_DEVICE_ID_INTEL_82371AB_0: 552 case PCI_DEVICE_ID_INTEL_82371MX:
557 case PCI_DEVICE_ID_INTEL_82371MX: 553 case PCI_DEVICE_ID_INTEL_82443MX_0:
558 case PCI_DEVICE_ID_INTEL_82443MX_0: 554 case PCI_DEVICE_ID_INTEL_82801AA_0:
559 case PCI_DEVICE_ID_INTEL_82801AA_0: 555 case PCI_DEVICE_ID_INTEL_82801AB_0:
560 case PCI_DEVICE_ID_INTEL_82801AB_0: 556 case PCI_DEVICE_ID_INTEL_82801BA_0:
561 case PCI_DEVICE_ID_INTEL_82801BA_0: 557 case PCI_DEVICE_ID_INTEL_82801BA_10:
562 case PCI_DEVICE_ID_INTEL_82801BA_10: 558 case PCI_DEVICE_ID_INTEL_82801CA_0:
563 case PCI_DEVICE_ID_INTEL_82801CA_0: 559 case PCI_DEVICE_ID_INTEL_82801CA_12:
564 case PCI_DEVICE_ID_INTEL_82801CA_12: 560 case PCI_DEVICE_ID_INTEL_82801DB_0:
565 case PCI_DEVICE_ID_INTEL_82801DB_0: 561 case PCI_DEVICE_ID_INTEL_82801E_0:
566 case PCI_DEVICE_ID_INTEL_82801E_0: 562 case PCI_DEVICE_ID_INTEL_82801EB_0:
567 case PCI_DEVICE_ID_INTEL_82801EB_0: 563 case PCI_DEVICE_ID_INTEL_ESB_1:
568 case PCI_DEVICE_ID_INTEL_ESB_1: 564 case PCI_DEVICE_ID_INTEL_ICH6_0:
569 case PCI_DEVICE_ID_INTEL_ICH6_0: 565 case PCI_DEVICE_ID_INTEL_ICH6_1:
570 case PCI_DEVICE_ID_INTEL_ICH6_1: 566 case PCI_DEVICE_ID_INTEL_ICH7_0:
571 case PCI_DEVICE_ID_INTEL_ICH7_0: 567 case PCI_DEVICE_ID_INTEL_ICH7_1:
572 case PCI_DEVICE_ID_INTEL_ICH7_1: 568 case PCI_DEVICE_ID_INTEL_ICH7_30:
573 case PCI_DEVICE_ID_INTEL_ICH7_30: 569 case PCI_DEVICE_ID_INTEL_ICH7_31:
574 case PCI_DEVICE_ID_INTEL_ICH7_31: 570 case PCI_DEVICE_ID_INTEL_ESB2_0:
575 case PCI_DEVICE_ID_INTEL_ESB2_0: 571 case PCI_DEVICE_ID_INTEL_ICH8_0:
576 case PCI_DEVICE_ID_INTEL_ICH8_0: 572 case PCI_DEVICE_ID_INTEL_ICH8_1:
577 case PCI_DEVICE_ID_INTEL_ICH8_1: 573 case PCI_DEVICE_ID_INTEL_ICH8_2:
578 case PCI_DEVICE_ID_INTEL_ICH8_2: 574 case PCI_DEVICE_ID_INTEL_ICH8_3:
579 case PCI_DEVICE_ID_INTEL_ICH8_3: 575 case PCI_DEVICE_ID_INTEL_ICH8_4:
580 case PCI_DEVICE_ID_INTEL_ICH8_4: 576 case PCI_DEVICE_ID_INTEL_ICH9_0:
581 case PCI_DEVICE_ID_INTEL_ICH9_0: 577 case PCI_DEVICE_ID_INTEL_ICH9_1:
582 case PCI_DEVICE_ID_INTEL_ICH9_1: 578 case PCI_DEVICE_ID_INTEL_ICH9_2:
583 case PCI_DEVICE_ID_INTEL_ICH9_2: 579 case PCI_DEVICE_ID_INTEL_ICH9_3:
584 case PCI_DEVICE_ID_INTEL_ICH9_3: 580 case PCI_DEVICE_ID_INTEL_ICH9_4:
585 case PCI_DEVICE_ID_INTEL_ICH9_4: 581 case PCI_DEVICE_ID_INTEL_ICH9_5:
586 case PCI_DEVICE_ID_INTEL_ICH9_5: 582 case PCI_DEVICE_ID_INTEL_TOLAPAI_0:
587 case PCI_DEVICE_ID_INTEL_TOLAPAI_0: 583 case PCI_DEVICE_ID_INTEL_ICH10_0:
588 case PCI_DEVICE_ID_INTEL_ICH10_0: 584 case PCI_DEVICE_ID_INTEL_ICH10_1:
589 case PCI_DEVICE_ID_INTEL_ICH10_1: 585 case PCI_DEVICE_ID_INTEL_ICH10_2:
590 case PCI_DEVICE_ID_INTEL_ICH10_2: 586 case PCI_DEVICE_ID_INTEL_ICH10_3:
591 case PCI_DEVICE_ID_INTEL_ICH10_3: 587 r->name = "PIIX/ICH";
592 r->name = "PIIX/ICH"; 588 r->get = pirq_piix_get;
593 r->get = pirq_piix_get; 589 r->set = pirq_piix_set;
594 r->set = pirq_piix_set; 590 return 1;
595 return 1;
596 } 591 }
597 return 0; 592 return 0;
598} 593}
@@ -606,7 +601,7 @@ static __init int via_router_probe(struct irq_router *r,
606 * workarounds for some buggy BIOSes 601 * workarounds for some buggy BIOSes
607 */ 602 */
608 if (device == PCI_DEVICE_ID_VIA_82C586_0) { 603 if (device == PCI_DEVICE_ID_VIA_82C586_0) {
609 switch(router->device) { 604 switch (router->device) {
610 case PCI_DEVICE_ID_VIA_82C686: 605 case PCI_DEVICE_ID_VIA_82C686:
611 /* 606 /*
612 * Asus k7m bios wrongly reports 82C686A 607 * Asus k7m bios wrongly reports 82C686A
@@ -631,7 +626,7 @@ static __init int via_router_probe(struct irq_router *r,
631 } 626 }
632 } 627 }
633 628
634 switch(device) { 629 switch (device) {
635 case PCI_DEVICE_ID_VIA_82C586_0: 630 case PCI_DEVICE_ID_VIA_82C586_0:
636 r->name = "VIA"; 631 r->name = "VIA";
637 r->get = pirq_via586_get; 632 r->get = pirq_via586_get;
@@ -654,13 +649,12 @@ static __init int via_router_probe(struct irq_router *r,
654 649
655static __init int vlsi_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 650static __init int vlsi_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
656{ 651{
657 switch(device) 652 switch (device) {
658 { 653 case PCI_DEVICE_ID_VLSI_82C534:
659 case PCI_DEVICE_ID_VLSI_82C534: 654 r->name = "VLSI 82C534";
660 r->name = "VLSI 82C534"; 655 r->get = pirq_vlsi_get;
661 r->get = pirq_vlsi_get; 656 r->set = pirq_vlsi_set;
662 r->set = pirq_vlsi_set; 657 return 1;
663 return 1;
664 } 658 }
665 return 0; 659 return 0;
666} 660}
@@ -668,14 +662,13 @@ static __init int vlsi_router_probe(struct irq_router *r, struct pci_dev *router
668 662
669static __init int serverworks_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 663static __init int serverworks_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
670{ 664{
671 switch(device) 665 switch (device) {
672 { 666 case PCI_DEVICE_ID_SERVERWORKS_OSB4:
673 case PCI_DEVICE_ID_SERVERWORKS_OSB4: 667 case PCI_DEVICE_ID_SERVERWORKS_CSB5:
674 case PCI_DEVICE_ID_SERVERWORKS_CSB5: 668 r->name = "ServerWorks";
675 r->name = "ServerWorks"; 669 r->get = pirq_serverworks_get;
676 r->get = pirq_serverworks_get; 670 r->set = pirq_serverworks_set;
677 r->set = pirq_serverworks_set; 671 return 1;
678 return 1;
679 } 672 }
680 return 0; 673 return 0;
681} 674}
@@ -684,7 +677,7 @@ static __init int sis_router_probe(struct irq_router *r, struct pci_dev *router,
684{ 677{
685 if (device != PCI_DEVICE_ID_SI_503) 678 if (device != PCI_DEVICE_ID_SI_503)
686 return 0; 679 return 0;
687 680
688 r->name = "SIS"; 681 r->name = "SIS";
689 r->get = pirq_sis_get; 682 r->get = pirq_sis_get;
690 r->set = pirq_sis_set; 683 r->set = pirq_sis_set;
@@ -693,47 +686,43 @@ static __init int sis_router_probe(struct irq_router *r, struct pci_dev *router,
693 686
694static __init int cyrix_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 687static __init int cyrix_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
695{ 688{
696 switch(device) 689 switch (device) {
697 { 690 case PCI_DEVICE_ID_CYRIX_5520:
698 case PCI_DEVICE_ID_CYRIX_5520: 691 r->name = "NatSemi";
699 r->name = "NatSemi"; 692 r->get = pirq_cyrix_get;
700 r->get = pirq_cyrix_get; 693 r->set = pirq_cyrix_set;
701 r->set = pirq_cyrix_set; 694 return 1;
702 return 1;
703 } 695 }
704 return 0; 696 return 0;
705} 697}
706 698
707static __init int opti_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 699static __init int opti_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
708{ 700{
709 switch(device) 701 switch (device) {
710 { 702 case PCI_DEVICE_ID_OPTI_82C700:
711 case PCI_DEVICE_ID_OPTI_82C700: 703 r->name = "OPTI";
712 r->name = "OPTI"; 704 r->get = pirq_opti_get;
713 r->get = pirq_opti_get; 705 r->set = pirq_opti_set;
714 r->set = pirq_opti_set; 706 return 1;
715 return 1;
716 } 707 }
717 return 0; 708 return 0;
718} 709}
719 710
720static __init int ite_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 711static __init int ite_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
721{ 712{
722 switch(device) 713 switch (device) {
723 { 714 case PCI_DEVICE_ID_ITE_IT8330G_0:
724 case PCI_DEVICE_ID_ITE_IT8330G_0: 715 r->name = "ITE";
725 r->name = "ITE"; 716 r->get = pirq_ite_get;
726 r->get = pirq_ite_get; 717 r->set = pirq_ite_set;
727 r->set = pirq_ite_set; 718 return 1;
728 return 1;
729 } 719 }
730 return 0; 720 return 0;
731} 721}
732 722
733static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 723static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
734{ 724{
735 switch(device) 725 switch (device) {
736 {
737 case PCI_DEVICE_ID_AL_M1533: 726 case PCI_DEVICE_ID_AL_M1533:
738 case PCI_DEVICE_ID_AL_M1563: 727 case PCI_DEVICE_ID_AL_M1563:
739 printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n"); 728 printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n");
@@ -747,25 +736,24 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router,
747 736
748static __init int amd_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 737static __init int amd_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
749{ 738{
750 switch(device) 739 switch (device) {
751 { 740 case PCI_DEVICE_ID_AMD_VIPER_740B:
752 case PCI_DEVICE_ID_AMD_VIPER_740B: 741 r->name = "AMD756";
753 r->name = "AMD756"; 742 break;
754 break; 743 case PCI_DEVICE_ID_AMD_VIPER_7413:
755 case PCI_DEVICE_ID_AMD_VIPER_7413: 744 r->name = "AMD766";
756 r->name = "AMD766"; 745 break;
757 break; 746 case PCI_DEVICE_ID_AMD_VIPER_7443:
758 case PCI_DEVICE_ID_AMD_VIPER_7443: 747 r->name = "AMD768";
759 r->name = "AMD768"; 748 break;
760 break; 749 default:
761 default: 750 return 0;
762 return 0;
763 } 751 }
764 r->get = pirq_amd756_get; 752 r->get = pirq_amd756_get;
765 r->set = pirq_amd756_set; 753 r->set = pirq_amd756_set;
766 return 1; 754 return 1;
767} 755}
768 756
769static __init int pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 757static __init int pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
770{ 758{
771 switch (device) { 759 switch (device) {
@@ -807,7 +795,7 @@ static struct pci_dev *pirq_router_dev;
807 * FIXME: should we have an option to say "generic for 795 * FIXME: should we have an option to say "generic for
808 * chipset" ? 796 * chipset" ?
809 */ 797 */
810 798
811static void __init pirq_find_router(struct irq_router *r) 799static void __init pirq_find_router(struct irq_router *r)
812{ 800{
813 struct irq_routing_table *rt = pirq_table; 801 struct irq_routing_table *rt = pirq_table;
@@ -826,7 +814,7 @@ static void __init pirq_find_router(struct irq_router *r)
826 r->name = "default"; 814 r->name = "default";
827 r->get = NULL; 815 r->get = NULL;
828 r->set = NULL; 816 r->set = NULL;
829 817
830 DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n", 818 DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n",
831 rt->rtr_vendor, rt->rtr_device); 819 rt->rtr_vendor, rt->rtr_device);
832 820
@@ -837,7 +825,7 @@ static void __init pirq_find_router(struct irq_router *r)
837 return; 825 return;
838 } 826 }
839 827
840 for( h = pirq_routers; h->vendor; h++) { 828 for (h = pirq_routers; h->vendor; h++) {
841 /* First look for a router match */ 829 /* First look for a router match */
842 if (rt->rtr_vendor == h->vendor && h->probe(r, pirq_router_dev, rt->rtr_device)) 830 if (rt->rtr_vendor == h->vendor && h->probe(r, pirq_router_dev, rt->rtr_device))
843 break; 831 break;
@@ -889,7 +877,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
889 877
890 if (!pirq_table) 878 if (!pirq_table)
891 return 0; 879 return 0;
892 880
893 DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin); 881 DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin);
894 info = pirq_get_info(dev); 882 info = pirq_get_info(dev);
895 if (!info) { 883 if (!info) {
@@ -928,8 +916,10 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
928 */ 916 */
929 newirq = dev->irq; 917 newirq = dev->irq;
930 if (newirq && !((1 << newirq) & mask)) { 918 if (newirq && !((1 << newirq) & mask)) {
931 if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0; 919 if (pci_probe & PCI_USE_PIRQ_MASK)
932 else printk("\n" KERN_WARNING 920 newirq = 0;
921 else
922 printk("\n" KERN_WARNING
933 "PCI: IRQ %i for device %s doesn't match PIRQ mask " 923 "PCI: IRQ %i for device %s doesn't match PIRQ mask "
934 "- try pci=usepirqmask\n" KERN_DEBUG, newirq, 924 "- try pci=usepirqmask\n" KERN_DEBUG, newirq,
935 pci_name(dev)); 925 pci_name(dev));
@@ -949,8 +939,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
949 irq = pirq & 0xf; 939 irq = pirq & 0xf;
950 DBG(" -> hardcoded IRQ %d\n", irq); 940 DBG(" -> hardcoded IRQ %d\n", irq);
951 msg = "Hardcoded"; 941 msg = "Hardcoded";
952 } else if ( r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \ 942 } else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \
953 ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask)) ) { 943 ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) {
954 DBG(" -> got IRQ %d\n", irq); 944 DBG(" -> got IRQ %d\n", irq);
955 msg = "Found"; 945 msg = "Found";
956 eisa_set_level_irq(irq); 946 eisa_set_level_irq(irq);
@@ -985,15 +975,15 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
985 continue; 975 continue;
986 if (info->irq[pin].link == pirq) { 976 if (info->irq[pin].link == pirq) {
987 /* We refuse to override the dev->irq information. Give a warning! */ 977 /* We refuse to override the dev->irq information. Give a warning! */
988 if ( dev2->irq && dev2->irq != irq && \ 978 if (dev2->irq && dev2->irq != irq && \
989 (!(pci_probe & PCI_USE_PIRQ_MASK) || \ 979 (!(pci_probe & PCI_USE_PIRQ_MASK) || \
990 ((1 << dev2->irq) & mask)) ) { 980 ((1 << dev2->irq) & mask))) {
991#ifndef CONFIG_PCI_MSI 981#ifndef CONFIG_PCI_MSI
992 printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n", 982 printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n",
993 pci_name(dev2), dev2->irq, irq); 983 pci_name(dev2), dev2->irq, irq);
994#endif 984#endif
995 continue; 985 continue;
996 } 986 }
997 dev2->irq = irq; 987 dev2->irq = irq;
998 pirq_penalty[irq]++; 988 pirq_penalty[irq]++;
999 if (dev != dev2) 989 if (dev != dev2)
@@ -1031,8 +1021,7 @@ static void __init pcibios_fixup_irqs(void)
1031 /* 1021 /*
1032 * Recalculate IRQ numbers if we use the I/O APIC. 1022 * Recalculate IRQ numbers if we use the I/O APIC.
1033 */ 1023 */
1034 if (io_apic_assign_pci_irqs) 1024 if (io_apic_assign_pci_irqs) {
1035 {
1036 int irq; 1025 int irq;
1037 1026
1038 if (pin) { 1027 if (pin) {
@@ -1045,10 +1034,10 @@ static void __init pcibios_fixup_irqs(void)
1045 * busses itself so we should get into this branch reliably. 1034 * busses itself so we should get into this branch reliably.
1046 */ 1035 */
1047 if (irq < 0 && dev->bus->parent) { /* go back to the bridge */ 1036 if (irq < 0 && dev->bus->parent) { /* go back to the bridge */
1048 struct pci_dev * bridge = dev->bus->self; 1037 struct pci_dev *bridge = dev->bus->self;
1049 1038
1050 pin = (pin + PCI_SLOT(dev->devfn)) % 4; 1039 pin = (pin + PCI_SLOT(dev->devfn)) % 4;
1051 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 1040 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
1052 PCI_SLOT(bridge->devfn), pin); 1041 PCI_SLOT(bridge->devfn), pin);
1053 if (irq >= 0) 1042 if (irq >= 0)
1054 printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", 1043 printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n",
@@ -1118,7 +1107,7 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = {
1118 { } 1107 { }
1119}; 1108};
1120 1109
1121static int __init pcibios_irq_init(void) 1110int __init pcibios_irq_init(void)
1122{ 1111{
1123 DBG(KERN_DEBUG "PCI: IRQ init\n"); 1112 DBG(KERN_DEBUG "PCI: IRQ init\n");
1124 1113
@@ -1138,7 +1127,7 @@ static int __init pcibios_irq_init(void)
1138 pirq_find_router(&pirq_router); 1127 pirq_find_router(&pirq_router);
1139 if (pirq_table->exclusive_irqs) { 1128 if (pirq_table->exclusive_irqs) {
1140 int i; 1129 int i;
1141 for (i=0; i<16; i++) 1130 for (i = 0; i < 16; i++)
1142 if (!(pirq_table->exclusive_irqs & (1 << i))) 1131 if (!(pirq_table->exclusive_irqs & (1 << i)))
1143 pirq_penalty[i] += 100; 1132 pirq_penalty[i] += 100;
1144 } 1133 }
@@ -1153,9 +1142,6 @@ static int __init pcibios_irq_init(void)
1153 return 0; 1142 return 0;
1154} 1143}
1155 1144
1156subsys_initcall(pcibios_irq_init);
1157
1158
1159static void pirq_penalize_isa_irq(int irq, int active) 1145static void pirq_penalize_isa_irq(int irq, int active)
1160{ 1146{
1161 /* 1147 /*
@@ -1203,10 +1189,10 @@ static int pirq_enable_irq(struct pci_dev *dev)
1203 */ 1189 */
1204 temp_dev = dev; 1190 temp_dev = dev;
1205 while (irq < 0 && dev->bus->parent) { /* go back to the bridge */ 1191 while (irq < 0 && dev->bus->parent) { /* go back to the bridge */
1206 struct pci_dev * bridge = dev->bus->self; 1192 struct pci_dev *bridge = dev->bus->self;
1207 1193
1208 pin = (pin + PCI_SLOT(dev->devfn)) % 4; 1194 pin = (pin + PCI_SLOT(dev->devfn)) % 4;
1209 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 1195 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
1210 PCI_SLOT(bridge->devfn), pin); 1196 PCI_SLOT(bridge->devfn), pin);
1211 if (irq >= 0) 1197 if (irq >= 0)
1212 printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", 1198 printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n",
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index a67921ce60af..132876cc6fca 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -55,4 +55,18 @@ static int __init pci_legacy_init(void)
55 return 0; 55 return 0;
56} 56}
57 57
58subsys_initcall(pci_legacy_init); 58int __init pci_subsys_init(void)
59{
60#ifdef CONFIG_ACPI
61 pci_acpi_init();
62#endif
63 pci_legacy_init();
64 pcibios_irq_init();
65#ifdef CONFIG_X86_NUMAQ
66 pci_numa_init();
67#endif
68 pcibios_init();
69
70 return 0;
71}
72subsys_initcall(pci_subsys_init);
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 0cfebecf2a8f..23faaa890ffc 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -374,7 +374,7 @@ reject:
374 374
375static int __initdata known_bridge; 375static int __initdata known_bridge;
376 376
377void __init __pci_mmcfg_init(int early) 377static void __init __pci_mmcfg_init(int early)
378{ 378{
379 /* MMCONFIG disabled */ 379 /* MMCONFIG disabled */
380 if ((pci_probe & PCI_PROBE_MMCONF) == 0) 380 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
diff --git a/arch/x86/pci/mp_bus_to_node.c b/arch/x86/pci/mp_bus_to_node.c
deleted file mode 100644
index 022943999b84..000000000000
--- a/arch/x86/pci/mp_bus_to_node.c
+++ /dev/null
@@ -1,23 +0,0 @@
1#include <linux/pci.h>
2#include <linux/init.h>
3#include <linux/topology.h>
4
5#define BUS_NR 256
6
7static unsigned char mp_bus_to_node[BUS_NR];
8
9void set_mp_bus_to_node(int busnum, int node)
10{
11 if (busnum >= 0 && busnum < BUS_NR)
12 mp_bus_to_node[busnum] = (unsigned char) node;
13}
14
15int get_mp_bus_to_node(int busnum)
16{
17 int node;
18
19 if (busnum < 0 || busnum > (BUS_NR - 1))
20 return 0;
21 node = mp_bus_to_node[busnum];
22 return node;
23}
diff --git a/arch/x86/pci/numa.c b/arch/x86/pci/numa.c
index d9afbae5092b..8b5ca1966731 100644
--- a/arch/x86/pci/numa.c
+++ b/arch/x86/pci/numa.c
@@ -6,45 +6,21 @@
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/nodemask.h> 7#include <linux/nodemask.h>
8#include <mach_apic.h> 8#include <mach_apic.h>
9#include <asm/mpspec.h>
9#include "pci.h" 10#include "pci.h"
10 11
11#define XQUAD_PORTIO_BASE 0xfe400000 12#define XQUAD_PORTIO_BASE 0xfe400000
12#define XQUAD_PORTIO_QUAD 0x40000 /* 256k per quad. */ 13#define XQUAD_PORTIO_QUAD 0x40000 /* 256k per quad. */
13 14
14int mp_bus_id_to_node[MAX_MP_BUSSES];
15#define BUS2QUAD(global) (mp_bus_id_to_node[global]) 15#define BUS2QUAD(global) (mp_bus_id_to_node[global])
16 16
17int mp_bus_id_to_local[MAX_MP_BUSSES];
18#define BUS2LOCAL(global) (mp_bus_id_to_local[global]) 17#define BUS2LOCAL(global) (mp_bus_id_to_local[global])
19 18
20void mpc_oem_bus_info(struct mpc_config_bus *m, char *name,
21 struct mpc_config_translation *translation)
22{
23 int quad = translation->trans_quad;
24 int local = translation->trans_local;
25
26 mp_bus_id_to_node[m->mpc_busid] = quad;
27 mp_bus_id_to_local[m->mpc_busid] = local;
28 printk(KERN_INFO "Bus #%d is %s (node %d)\n",
29 m->mpc_busid, name, quad);
30}
31
32int quad_local_to_mp_bus_id [NR_CPUS/4][4];
33#define QUADLOCAL2BUS(quad,local) (quad_local_to_mp_bus_id[quad][local]) 19#define QUADLOCAL2BUS(quad,local) (quad_local_to_mp_bus_id[quad][local])
34void mpc_oem_pci_bus(struct mpc_config_bus *m,
35 struct mpc_config_translation *translation)
36{
37 int quad = translation->trans_quad;
38 int local = translation->trans_local;
39
40 quad_local_to_mp_bus_id[quad][local] = m->mpc_busid;
41}
42 20
43/* Where the IO area was mapped on multiquad, always 0 otherwise */ 21/* Where the IO area was mapped on multiquad, always 0 otherwise */
44void *xquad_portio; 22void *xquad_portio;
45#ifdef CONFIG_X86_NUMAQ
46EXPORT_SYMBOL(xquad_portio); 23EXPORT_SYMBOL(xquad_portio);
47#endif
48 24
49#define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port) 25#define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port)
50 26
@@ -175,10 +151,13 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
175} 151}
176DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82451NX, pci_fixup_i450nx); 152DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82451NX, pci_fixup_i450nx);
177 153
178static int __init pci_numa_init(void) 154int __init pci_numa_init(void)
179{ 155{
180 int quad; 156 int quad;
181 157
158 if (!found_numaq)
159 return 0;
160
182 raw_pci_ops = &pci_direct_conf1_mq; 161 raw_pci_ops = &pci_direct_conf1_mq;
183 162
184 if (pcibios_scanned++) 163 if (pcibios_scanned++)
@@ -197,5 +176,3 @@ static int __init pci_numa_init(void)
197 } 176 }
198 return 0; 177 return 0;
199} 178}
200
201subsys_initcall(pci_numa_init);
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index 720c4c554534..b2270a55b0cf 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -27,6 +27,7 @@
27#define PCI_CAN_SKIP_ISA_ALIGN 0x8000 27#define PCI_CAN_SKIP_ISA_ALIGN 0x8000
28#define PCI_USE__CRS 0x10000 28#define PCI_USE__CRS 0x10000
29#define PCI_CHECK_ENABLE_AMD_MMCONF 0x20000 29#define PCI_CHECK_ENABLE_AMD_MMCONF 0x20000
30#define PCI_HAS_IO_ECS 0x40000
30 31
31extern unsigned int pci_probe; 32extern unsigned int pci_probe;
32extern unsigned long pirq_table_addr; 33extern unsigned long pirq_table_addr;
@@ -38,9 +39,6 @@ enum pci_bf_sort_state {
38 pci_dmi_bf, 39 pci_dmi_bf,
39}; 40};
40 41
41extern void __init dmi_check_pciprobe(void);
42extern void __init dmi_check_skip_isa_align(void);
43
44/* pci-i386.c */ 42/* pci-i386.c */
45 43
46extern unsigned int pcibios_max_latency; 44extern unsigned int pcibios_max_latency;
@@ -98,10 +96,19 @@ extern struct pci_raw_ops *raw_pci_ext_ops;
98 96
99extern struct pci_raw_ops pci_direct_conf1; 97extern struct pci_raw_ops pci_direct_conf1;
100 98
99/* arch_initcall level */
101extern int pci_direct_probe(void); 100extern int pci_direct_probe(void);
102extern void pci_direct_init(int type); 101extern void pci_direct_init(int type);
103extern void pci_pcbios_init(void); 102extern void pci_pcbios_init(void);
104extern int pci_olpc_init(void); 103extern int pci_olpc_init(void);
104extern void __init dmi_check_pciprobe(void);
105extern void __init dmi_check_skip_isa_align(void);
106
107/* some common used subsys_initcalls */
108extern int __init pci_acpi_init(void);
109extern int __init pcibios_irq_init(void);
110extern int __init pci_numa_init(void);
111extern int __init pcibios_init(void);
105 112
106/* pci-mmconfig.c */ 113/* pci-mmconfig.c */
107 114
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index c2df4e97eed6..1a7bed492bb1 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -8,18 +8,19 @@
8#include <linux/pci.h> 8#include <linux/pci.h>
9#include <linux/init.h> 9#include <linux/init.h>
10 10
11#include "cobalt.h" 11#include <asm/setup.h>
12#include "lithium.h" 12#include <asm/visws/cobalt.h>
13#include <asm/visws/lithium.h>
13 14
14#include "pci.h" 15#include "pci.h"
15 16
16static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } 17static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; }
17static void pci_visws_disable_irq(struct pci_dev *dev) { } 18static void pci_visws_disable_irq(struct pci_dev *dev) { }
18 19
19int (*pcibios_enable_irq)(struct pci_dev *dev) = &pci_visws_enable_irq; 20/* int (*pcibios_enable_irq)(struct pci_dev *dev) = &pci_visws_enable_irq; */
20void (*pcibios_disable_irq)(struct pci_dev *dev) = &pci_visws_disable_irq; 21/* void (*pcibios_disable_irq)(struct pci_dev *dev) = &pci_visws_disable_irq; */
21 22
22void __init pcibios_penalize_isa_irq(int irq, int active) {} 23/* void __init pcibios_penalize_isa_irq(int irq, int active) {} */
23 24
24 25
25unsigned int pci_bus0, pci_bus1; 26unsigned int pci_bus0, pci_bus1;
@@ -85,7 +86,7 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq)
85 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 86 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
86} 87}
87 88
88static int __init pcibios_init(void) 89static int __init pci_visws_init(void)
89{ 90{
90 /* The VISWS supports configuration access type 1 only */ 91 /* The VISWS supports configuration access type 1 only */
91 pci_probe = (pci_probe | PCI_PROBE_CONF1) & 92 pci_probe = (pci_probe | PCI_PROBE_CONF1) &
@@ -105,4 +106,17 @@ static int __init pcibios_init(void)
105 return 0; 106 return 0;
106} 107}
107 108
108subsys_initcall(pcibios_init); 109static __init int pci_subsys_init(void)
110{
111 if (!is_visws_box())
112 return -1;
113
114 pcibios_enable_irq = &pci_visws_enable_irq;
115 pcibios_disable_irq = &pci_visws_disable_irq;
116
117 pci_visws_init();
118 pcibios_init();
119
120 return 0;
121}
122subsys_initcall(pci_subsys_init);
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index b542355e0e34..6dd000dd7933 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -83,7 +83,7 @@ static int set_up_temporary_mappings(void)
83 83
84 /* Set up the direct mapping from scratch */ 84 /* Set up the direct mapping from scratch */
85 start = (unsigned long)pfn_to_kaddr(0); 85 start = (unsigned long)pfn_to_kaddr(0);
86 end = (unsigned long)pfn_to_kaddr(end_pfn); 86 end = (unsigned long)pfn_to_kaddr(max_pfn);
87 87
88 for (; start < end; start = next) { 88 for (; start < end; start = next) {
89 pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC); 89 pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC);
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index efa2ba7c6005..1ef0f90813d6 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -23,7 +23,7 @@
23 23
24#define gtod vdso_vsyscall_gtod_data 24#define gtod vdso_vsyscall_gtod_data
25 25
26static long vdso_fallback_gettime(long clock, struct timespec *ts) 26notrace static long vdso_fallback_gettime(long clock, struct timespec *ts)
27{ 27{
28 long ret; 28 long ret;
29 asm("syscall" : "=a" (ret) : 29 asm("syscall" : "=a" (ret) :
@@ -31,7 +31,7 @@ static long vdso_fallback_gettime(long clock, struct timespec *ts)
31 return ret; 31 return ret;
32} 32}
33 33
34static inline long vgetns(void) 34notrace static inline long vgetns(void)
35{ 35{
36 long v; 36 long v;
37 cycles_t (*vread)(void); 37 cycles_t (*vread)(void);
@@ -40,7 +40,7 @@ static inline long vgetns(void)
40 return (v * gtod->clock.mult) >> gtod->clock.shift; 40 return (v * gtod->clock.mult) >> gtod->clock.shift;
41} 41}
42 42
43static noinline int do_realtime(struct timespec *ts) 43notrace static noinline int do_realtime(struct timespec *ts)
44{ 44{
45 unsigned long seq, ns; 45 unsigned long seq, ns;
46 do { 46 do {
@@ -54,7 +54,8 @@ static noinline int do_realtime(struct timespec *ts)
54} 54}
55 55
56/* Copy of the version in kernel/time.c which we cannot directly access */ 56/* Copy of the version in kernel/time.c which we cannot directly access */
57static void vset_normalized_timespec(struct timespec *ts, long sec, long nsec) 57notrace static void
58vset_normalized_timespec(struct timespec *ts, long sec, long nsec)
58{ 59{
59 while (nsec >= NSEC_PER_SEC) { 60 while (nsec >= NSEC_PER_SEC) {
60 nsec -= NSEC_PER_SEC; 61 nsec -= NSEC_PER_SEC;
@@ -68,7 +69,7 @@ static void vset_normalized_timespec(struct timespec *ts, long sec, long nsec)
68 ts->tv_nsec = nsec; 69 ts->tv_nsec = nsec;
69} 70}
70 71
71static noinline int do_monotonic(struct timespec *ts) 72notrace static noinline int do_monotonic(struct timespec *ts)
72{ 73{
73 unsigned long seq, ns, secs; 74 unsigned long seq, ns, secs;
74 do { 75 do {
@@ -82,7 +83,7 @@ static noinline int do_monotonic(struct timespec *ts)
82 return 0; 83 return 0;
83} 84}
84 85
85int __vdso_clock_gettime(clockid_t clock, struct timespec *ts) 86notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
86{ 87{
87 if (likely(gtod->sysctl_enabled && gtod->clock.vread)) 88 if (likely(gtod->sysctl_enabled && gtod->clock.vread))
88 switch (clock) { 89 switch (clock) {
@@ -96,7 +97,7 @@ int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
96int clock_gettime(clockid_t, struct timespec *) 97int clock_gettime(clockid_t, struct timespec *)
97 __attribute__((weak, alias("__vdso_clock_gettime"))); 98 __attribute__((weak, alias("__vdso_clock_gettime")));
98 99
99int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 100notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
100{ 101{
101 long ret; 102 long ret;
102 if (likely(gtod->sysctl_enabled && gtod->clock.vread)) { 103 if (likely(gtod->sysctl_enabled && gtod->clock.vread)) {
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index cf058fecfcee..0bce5429a515 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -203,20 +203,11 @@ static struct page *vdso32_pages[1];
203 203
204#ifdef CONFIG_X86_64 204#ifdef CONFIG_X86_64
205 205
206static int use_sysenter __read_mostly = -1; 206#define vdso32_sysenter() (boot_cpu_has(X86_FEATURE_SYSENTER32))
207
208#define vdso32_sysenter() (use_sysenter > 0)
209 207
210/* May not be __init: called during resume */ 208/* May not be __init: called during resume */
211void syscall32_cpu_init(void) 209void syscall32_cpu_init(void)
212{ 210{
213 if (use_sysenter < 0) {
214 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
215 use_sysenter = 1;
216 if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR)
217 use_sysenter = 1;
218 }
219
220 /* Load these always in case some future AMD CPU supports 211 /* Load these always in case some future AMD CPU supports
221 SYSENTER from compat mode too. */ 212 SYSENTER from compat mode too. */
222 checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS); 213 checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c
index c8097f17f8a9..9fbc6b20026b 100644
--- a/arch/x86/vdso/vgetcpu.c
+++ b/arch/x86/vdso/vgetcpu.c
@@ -13,7 +13,8 @@
13#include <asm/vgtod.h> 13#include <asm/vgtod.h>
14#include "vextern.h" 14#include "vextern.h"
15 15
16long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) 16notrace long
17__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
17{ 18{
18 unsigned int p; 19 unsigned int p;
19 20
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 3fdd51497a83..19a6cfaf5db9 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -16,7 +16,7 @@
16#include "vextern.h" /* Just for VMAGIC. */ 16#include "vextern.h" /* Just for VMAGIC. */
17#undef VEXTERN 17#undef VEXTERN
18 18
19int vdso_enabled = 1; 19unsigned int __read_mostly vdso_enabled = 1;
20 20
21extern char vdso_start[], vdso_end[]; 21extern char vdso_start[], vdso_end[];
22extern unsigned short vdso_sync_cpuid; 22extern unsigned short vdso_sync_cpuid;
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 6c388e593bc8..c2cc99580871 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -12,3 +12,13 @@ config XEN
12 This is the Linux Xen port. Enabling this will allow the 12 This is the Linux Xen port. Enabling this will allow the
13 kernel to boot in a paravirtualized environment under the 13 kernel to boot in a paravirtualized environment under the
14 Xen hypervisor. 14 Xen hypervisor.
15
16config XEN_MAX_DOMAIN_MEMORY
17 int "Maximum allowed size of a domain in gigabytes"
18 default 8
19 depends on XEN
20 help
21 The pseudo-physical to machine address array is sized
22 according to the maximum possible memory size of a Xen
23 domain. This array uses 1 page per gigabyte, so there's no
24 need to be too stingy here. \ No newline at end of file
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index 3d8df981d5fd..2ba2d1649131 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -1,4 +1,4 @@
1obj-y := enlighten.o setup.o multicalls.o mmu.o \ 1obj-y := enlighten.o setup.o multicalls.o mmu.o \
2 time.o manage.o xen-asm.o grant-table.o 2 time.o xen-asm.o grant-table.o suspend.o
3 3
4obj-$(CONFIG_SMP) += smp.o 4obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f09c1c69c37a..dcd4e51f2f16 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -45,6 +45,7 @@
45#include <asm/pgtable.h> 45#include <asm/pgtable.h>
46#include <asm/tlbflush.h> 46#include <asm/tlbflush.h>
47#include <asm/reboot.h> 47#include <asm/reboot.h>
48#include <asm/pgalloc.h>
48 49
49#include "xen-ops.h" 50#include "xen-ops.h"
50#include "mmu.h" 51#include "mmu.h"
@@ -75,13 +76,13 @@ DEFINE_PER_CPU(unsigned long, xen_current_cr3); /* actual vcpu cr3 */
75struct start_info *xen_start_info; 76struct start_info *xen_start_info;
76EXPORT_SYMBOL_GPL(xen_start_info); 77EXPORT_SYMBOL_GPL(xen_start_info);
77 78
78static /* __initdata */ struct shared_info dummy_shared_info; 79struct shared_info xen_dummy_shared_info;
79 80
80/* 81/*
81 * Point at some empty memory to start with. We map the real shared_info 82 * Point at some empty memory to start with. We map the real shared_info
82 * page as soon as fixmap is up and running. 83 * page as soon as fixmap is up and running.
83 */ 84 */
84struct shared_info *HYPERVISOR_shared_info = (void *)&dummy_shared_info; 85struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info;
85 86
86/* 87/*
87 * Flag to determine whether vcpu info placement is available on all 88 * Flag to determine whether vcpu info placement is available on all
@@ -98,13 +99,13 @@ struct shared_info *HYPERVISOR_shared_info = (void *)&dummy_shared_info;
98 */ 99 */
99static int have_vcpu_info_placement = 1; 100static int have_vcpu_info_placement = 1;
100 101
101static void __init xen_vcpu_setup(int cpu) 102static void xen_vcpu_setup(int cpu)
102{ 103{
103 struct vcpu_register_vcpu_info info; 104 struct vcpu_register_vcpu_info info;
104 int err; 105 int err;
105 struct vcpu_info *vcpup; 106 struct vcpu_info *vcpup;
106 107
107 BUG_ON(HYPERVISOR_shared_info == &dummy_shared_info); 108 BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);
108 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; 109 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
109 110
110 if (!have_vcpu_info_placement) 111 if (!have_vcpu_info_placement)
@@ -136,11 +137,41 @@ static void __init xen_vcpu_setup(int cpu)
136 } 137 }
137} 138}
138 139
140/*
141 * On restore, set the vcpu placement up again.
142 * If it fails, then we're in a bad state, since
143 * we can't back out from using it...
144 */
145void xen_vcpu_restore(void)
146{
147 if (have_vcpu_info_placement) {
148 int cpu;
149
150 for_each_online_cpu(cpu) {
151 bool other_cpu = (cpu != smp_processor_id());
152
153 if (other_cpu &&
154 HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL))
155 BUG();
156
157 xen_vcpu_setup(cpu);
158
159 if (other_cpu &&
160 HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL))
161 BUG();
162 }
163
164 BUG_ON(!have_vcpu_info_placement);
165 }
166}
167
139static void __init xen_banner(void) 168static void __init xen_banner(void)
140{ 169{
141 printk(KERN_INFO "Booting paravirtualized kernel on %s\n", 170 printk(KERN_INFO "Booting paravirtualized kernel on %s\n",
142 pv_info.name); 171 pv_info.name);
143 printk(KERN_INFO "Hypervisor signature: %s\n", xen_start_info->magic); 172 printk(KERN_INFO "Hypervisor signature: %s%s\n",
173 xen_start_info->magic,
174 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
144} 175}
145 176
146static void xen_cpuid(unsigned int *ax, unsigned int *bx, 177static void xen_cpuid(unsigned int *ax, unsigned int *bx,
@@ -235,13 +266,13 @@ static void xen_irq_enable(void)
235{ 266{
236 struct vcpu_info *vcpu; 267 struct vcpu_info *vcpu;
237 268
238 /* There's a one instruction preempt window here. We need to 269 /* We don't need to worry about being preempted here, since
239 make sure we're don't switch CPUs between getting the vcpu 270 either a) interrupts are disabled, so no preemption, or b)
240 pointer and updating the mask. */ 271 the caller is confused and is trying to re-enable interrupts
241 preempt_disable(); 272 on an indeterminate processor. */
273
242 vcpu = x86_read_percpu(xen_vcpu); 274 vcpu = x86_read_percpu(xen_vcpu);
243 vcpu->evtchn_upcall_mask = 0; 275 vcpu->evtchn_upcall_mask = 0;
244 preempt_enable_no_resched();
245 276
246 /* Doesn't matter if we get preempted here, because any 277 /* Doesn't matter if we get preempted here, because any
247 pending event will get dealt with anyway. */ 278 pending event will get dealt with anyway. */
@@ -254,7 +285,7 @@ static void xen_irq_enable(void)
254static void xen_safe_halt(void) 285static void xen_safe_halt(void)
255{ 286{
256 /* Blocking includes an implicit local_irq_enable(). */ 287 /* Blocking includes an implicit local_irq_enable(). */
257 if (HYPERVISOR_sched_op(SCHEDOP_block, 0) != 0) 288 if (HYPERVISOR_sched_op(SCHEDOP_block, NULL) != 0)
258 BUG(); 289 BUG();
259} 290}
260 291
@@ -607,6 +638,30 @@ static void xen_flush_tlb_others(const cpumask_t *cpus, struct mm_struct *mm,
607 xen_mc_issue(PARAVIRT_LAZY_MMU); 638 xen_mc_issue(PARAVIRT_LAZY_MMU);
608} 639}
609 640
641static void xen_clts(void)
642{
643 struct multicall_space mcs;
644
645 mcs = xen_mc_entry(0);
646
647 MULTI_fpu_taskswitch(mcs.mc, 0);
648
649 xen_mc_issue(PARAVIRT_LAZY_CPU);
650}
651
652static void xen_write_cr0(unsigned long cr0)
653{
654 struct multicall_space mcs;
655
656 /* Only pay attention to cr0.TS; everything else is
657 ignored. */
658 mcs = xen_mc_entry(0);
659
660 MULTI_fpu_taskswitch(mcs.mc, (cr0 & X86_CR0_TS) != 0);
661
662 xen_mc_issue(PARAVIRT_LAZY_CPU);
663}
664
610static void xen_write_cr2(unsigned long cr2) 665static void xen_write_cr2(unsigned long cr2)
611{ 666{
612 x86_read_percpu(xen_vcpu)->arch.cr2 = cr2; 667 x86_read_percpu(xen_vcpu)->arch.cr2 = cr2;
@@ -624,8 +679,10 @@ static unsigned long xen_read_cr2_direct(void)
624 679
625static void xen_write_cr4(unsigned long cr4) 680static void xen_write_cr4(unsigned long cr4)
626{ 681{
627 /* Just ignore cr4 changes; Xen doesn't allow us to do 682 cr4 &= ~X86_CR4_PGE;
628 anything anyway. */ 683 cr4 &= ~X86_CR4_PSE;
684
685 native_write_cr4(cr4);
629} 686}
630 687
631static unsigned long xen_read_cr3(void) 688static unsigned long xen_read_cr3(void)
@@ -831,7 +888,7 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
831 PFN_DOWN(__pa(xen_start_info->pt_base))); 888 PFN_DOWN(__pa(xen_start_info->pt_base)));
832} 889}
833 890
834static __init void setup_shared_info(void) 891void xen_setup_shared_info(void)
835{ 892{
836 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 893 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
837 unsigned long addr = fix_to_virt(FIX_PARAVIRT_BOOTMAP); 894 unsigned long addr = fix_to_virt(FIX_PARAVIRT_BOOTMAP);
@@ -854,6 +911,8 @@ static __init void setup_shared_info(void)
854 /* In UP this is as good a place as any to set up shared info */ 911 /* In UP this is as good a place as any to set up shared info */
855 xen_setup_vcpu_info_placement(); 912 xen_setup_vcpu_info_placement();
856#endif 913#endif
914
915 xen_setup_mfn_list_list();
857} 916}
858 917
859static __init void xen_pagetable_setup_done(pgd_t *base) 918static __init void xen_pagetable_setup_done(pgd_t *base)
@@ -866,15 +925,23 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
866 pv_mmu_ops.release_pmd = xen_release_pmd; 925 pv_mmu_ops.release_pmd = xen_release_pmd;
867 pv_mmu_ops.set_pte = xen_set_pte; 926 pv_mmu_ops.set_pte = xen_set_pte;
868 927
869 setup_shared_info(); 928 xen_setup_shared_info();
870 929
871 /* Actually pin the pagetable down, but we can't set PG_pinned 930 /* Actually pin the pagetable down, but we can't set PG_pinned
872 yet because the page structures don't exist yet. */ 931 yet because the page structures don't exist yet. */
873 pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(base))); 932 pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(base)));
874} 933}
875 934
935static __init void xen_post_allocator_init(void)
936{
937 pv_mmu_ops.set_pmd = xen_set_pmd;
938 pv_mmu_ops.set_pud = xen_set_pud;
939
940 xen_mark_init_mm_pinned();
941}
942
876/* This is called once we have the cpu_possible_map */ 943/* This is called once we have the cpu_possible_map */
877void __init xen_setup_vcpu_info_placement(void) 944void xen_setup_vcpu_info_placement(void)
878{ 945{
879 int cpu; 946 int cpu;
880 947
@@ -947,6 +1014,33 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
947 return ret; 1014 return ret;
948} 1015}
949 1016
1017static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot)
1018{
1019 pte_t pte;
1020
1021 phys >>= PAGE_SHIFT;
1022
1023 switch (idx) {
1024 case FIX_BTMAP_END ... FIX_BTMAP_BEGIN:
1025#ifdef CONFIG_X86_F00F_BUG
1026 case FIX_F00F_IDT:
1027#endif
1028 case FIX_WP_TEST:
1029 case FIX_VDSO:
1030#ifdef CONFIG_X86_LOCAL_APIC
1031 case FIX_APIC_BASE: /* maps dummy local APIC */
1032#endif
1033 pte = pfn_pte(phys, prot);
1034 break;
1035
1036 default:
1037 pte = mfn_pte(phys, prot);
1038 break;
1039 }
1040
1041 __native_set_fixmap(idx, pte);
1042}
1043
950static const struct pv_info xen_info __initdata = { 1044static const struct pv_info xen_info __initdata = {
951 .paravirt_enabled = 1, 1045 .paravirt_enabled = 1,
952 .shared_kernel_pmd = 0, 1046 .shared_kernel_pmd = 0,
@@ -960,7 +1054,7 @@ static const struct pv_init_ops xen_init_ops __initdata = {
960 .banner = xen_banner, 1054 .banner = xen_banner,
961 .memory_setup = xen_memory_setup, 1055 .memory_setup = xen_memory_setup,
962 .arch_setup = xen_arch_setup, 1056 .arch_setup = xen_arch_setup,
963 .post_allocator_init = xen_mark_init_mm_pinned, 1057 .post_allocator_init = xen_post_allocator_init,
964}; 1058};
965 1059
966static const struct pv_time_ops xen_time_ops __initdata = { 1060static const struct pv_time_ops xen_time_ops __initdata = {
@@ -968,7 +1062,7 @@ static const struct pv_time_ops xen_time_ops __initdata = {
968 1062
969 .set_wallclock = xen_set_wallclock, 1063 .set_wallclock = xen_set_wallclock,
970 .get_wallclock = xen_get_wallclock, 1064 .get_wallclock = xen_get_wallclock,
971 .get_cpu_khz = xen_cpu_khz, 1065 .get_tsc_khz = xen_tsc_khz,
972 .sched_clock = xen_sched_clock, 1066 .sched_clock = xen_sched_clock,
973}; 1067};
974 1068
@@ -978,10 +1072,10 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
978 .set_debugreg = xen_set_debugreg, 1072 .set_debugreg = xen_set_debugreg,
979 .get_debugreg = xen_get_debugreg, 1073 .get_debugreg = xen_get_debugreg,
980 1074
981 .clts = native_clts, 1075 .clts = xen_clts,
982 1076
983 .read_cr0 = native_read_cr0, 1077 .read_cr0 = native_read_cr0,
984 .write_cr0 = native_write_cr0, 1078 .write_cr0 = xen_write_cr0,
985 1079
986 .read_cr4 = native_read_cr4, 1080 .read_cr4 = native_read_cr4,
987 .read_cr4_safe = native_read_cr4_safe, 1081 .read_cr4_safe = native_read_cr4_safe,
@@ -995,7 +1089,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
995 .read_pmc = native_read_pmc, 1089 .read_pmc = native_read_pmc,
996 1090
997 .iret = xen_iret, 1091 .iret = xen_iret,
998 .irq_enable_syscall_ret = xen_sysexit, 1092 .irq_enable_sysexit = xen_sysexit,
999 1093
1000 .load_tr_desc = paravirt_nop, 1094 .load_tr_desc = paravirt_nop,
1001 .set_ldt = xen_set_ldt, 1095 .set_ldt = xen_set_ldt,
@@ -1029,6 +1123,9 @@ static const struct pv_irq_ops xen_irq_ops __initdata = {
1029 .irq_enable = xen_irq_enable, 1123 .irq_enable = xen_irq_enable,
1030 .safe_halt = xen_safe_halt, 1124 .safe_halt = xen_safe_halt,
1031 .halt = xen_halt, 1125 .halt = xen_halt,
1126#ifdef CONFIG_X86_64
1127 .adjust_exception_frame = paravirt_nop,
1128#endif
1032}; 1129};
1033 1130
1034static const struct pv_apic_ops xen_apic_ops __initdata = { 1131static const struct pv_apic_ops xen_apic_ops __initdata = {
@@ -1060,6 +1157,9 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
1060 .pte_update = paravirt_nop, 1157 .pte_update = paravirt_nop,
1061 .pte_update_defer = paravirt_nop, 1158 .pte_update_defer = paravirt_nop,
1062 1159
1160 .pgd_alloc = __paravirt_pgd_alloc,
1161 .pgd_free = paravirt_nop,
1162
1063 .alloc_pte = xen_alloc_pte_init, 1163 .alloc_pte = xen_alloc_pte_init,
1064 .release_pte = xen_release_pte_init, 1164 .release_pte = xen_release_pte_init,
1065 .alloc_pmd = xen_alloc_pte_init, 1165 .alloc_pmd = xen_alloc_pte_init,
@@ -1072,9 +1172,13 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
1072 1172
1073 .set_pte = NULL, /* see xen_pagetable_setup_* */ 1173 .set_pte = NULL, /* see xen_pagetable_setup_* */
1074 .set_pte_at = xen_set_pte_at, 1174 .set_pte_at = xen_set_pte_at,
1075 .set_pmd = xen_set_pmd, 1175 .set_pmd = xen_set_pmd_hyper,
1176
1177 .ptep_modify_prot_start = __ptep_modify_prot_start,
1178 .ptep_modify_prot_commit = __ptep_modify_prot_commit,
1076 1179
1077 .pte_val = xen_pte_val, 1180 .pte_val = xen_pte_val,
1181 .pte_flags = native_pte_val,
1078 .pgd_val = xen_pgd_val, 1182 .pgd_val = xen_pgd_val,
1079 1183
1080 .make_pte = xen_make_pte, 1184 .make_pte = xen_make_pte,
@@ -1082,7 +1186,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
1082 1186
1083 .set_pte_atomic = xen_set_pte_atomic, 1187 .set_pte_atomic = xen_set_pte_atomic,
1084 .set_pte_present = xen_set_pte_at, 1188 .set_pte_present = xen_set_pte_at,
1085 .set_pud = xen_set_pud, 1189 .set_pud = xen_set_pud_hyper,
1086 .pte_clear = xen_pte_clear, 1190 .pte_clear = xen_pte_clear,
1087 .pmd_clear = xen_pmd_clear, 1191 .pmd_clear = xen_pmd_clear,
1088 1192
@@ -1097,6 +1201,8 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
1097 .enter = paravirt_enter_lazy_mmu, 1201 .enter = paravirt_enter_lazy_mmu,
1098 .leave = xen_leave_lazy, 1202 .leave = xen_leave_lazy,
1099 }, 1203 },
1204
1205 .set_fixmap = xen_set_fixmap,
1100}; 1206};
1101 1207
1102#ifdef CONFIG_SMP 1208#ifdef CONFIG_SMP
@@ -1114,11 +1220,13 @@ static const struct smp_ops xen_smp_ops __initdata = {
1114 1220
1115static void xen_reboot(int reason) 1221static void xen_reboot(int reason)
1116{ 1222{
1223 struct sched_shutdown r = { .reason = reason };
1224
1117#ifdef CONFIG_SMP 1225#ifdef CONFIG_SMP
1118 smp_send_stop(); 1226 smp_send_stop();
1119#endif 1227#endif
1120 1228
1121 if (HYPERVISOR_sched_op(SCHEDOP_shutdown, reason)) 1229 if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r))
1122 BUG(); 1230 BUG();
1123} 1231}
1124 1232
@@ -1173,6 +1281,8 @@ asmlinkage void __init xen_start_kernel(void)
1173 1281
1174 BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0); 1282 BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0);
1175 1283
1284 xen_setup_features();
1285
1176 /* Install Xen paravirt ops */ 1286 /* Install Xen paravirt ops */
1177 pv_info = xen_info; 1287 pv_info = xen_info;
1178 pv_init_ops = xen_init_ops; 1288 pv_init_ops = xen_init_ops;
@@ -1182,21 +1292,26 @@ asmlinkage void __init xen_start_kernel(void)
1182 pv_apic_ops = xen_apic_ops; 1292 pv_apic_ops = xen_apic_ops;
1183 pv_mmu_ops = xen_mmu_ops; 1293 pv_mmu_ops = xen_mmu_ops;
1184 1294
1295 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
1296 pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start;
1297 pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit;
1298 }
1299
1185 machine_ops = xen_machine_ops; 1300 machine_ops = xen_machine_ops;
1186 1301
1187#ifdef CONFIG_SMP 1302#ifdef CONFIG_SMP
1188 smp_ops = xen_smp_ops; 1303 smp_ops = xen_smp_ops;
1189#endif 1304#endif
1190 1305
1191 xen_setup_features();
1192
1193 /* Get mfn list */ 1306 /* Get mfn list */
1194 if (!xen_feature(XENFEAT_auto_translated_physmap)) 1307 if (!xen_feature(XENFEAT_auto_translated_physmap))
1195 phys_to_machine_mapping = (unsigned long *)xen_start_info->mfn_list; 1308 xen_build_dynamic_phys_to_machine();
1196 1309
1197 pgd = (pgd_t *)xen_start_info->pt_base; 1310 pgd = (pgd_t *)xen_start_info->pt_base;
1198 1311
1312 init_pg_tables_start = __pa(pgd);
1199 init_pg_tables_end = __pa(pgd) + xen_start_info->nr_pt_frames*PAGE_SIZE; 1313 init_pg_tables_end = __pa(pgd) + xen_start_info->nr_pt_frames*PAGE_SIZE;
1314 max_pfn_mapped = (init_pg_tables_end + 512*1024) >> PAGE_SHIFT;
1200 1315
1201 init_mm.pgd = pgd; /* use the Xen pagetables to start */ 1316 init_mm.pgd = pgd; /* use the Xen pagetables to start */
1202 1317
@@ -1232,9 +1347,12 @@ asmlinkage void __init xen_start_kernel(void)
1232 ? __pa(xen_start_info->mod_start) : 0; 1347 ? __pa(xen_start_info->mod_start) : 0;
1233 boot_params.hdr.ramdisk_size = xen_start_info->mod_len; 1348 boot_params.hdr.ramdisk_size = xen_start_info->mod_len;
1234 1349
1235 if (!is_initial_xendomain()) 1350 if (!is_initial_xendomain()) {
1351 add_preferred_console("xenboot", 0, NULL);
1352 add_preferred_console("tty", 0, NULL);
1236 add_preferred_console("hvc", 0, NULL); 1353 add_preferred_console("hvc", 0, NULL);
1354 }
1237 1355
1238 /* Start the world */ 1356 /* Start the world */
1239 start_kernel(); 1357 i386_start_kernel();
1240} 1358}
diff --git a/arch/x86/xen/manage.c b/arch/x86/xen/manage.c
deleted file mode 100644
index aa7af9e6abc0..000000000000
--- a/arch/x86/xen/manage.c
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * Handle extern requests for shutdown, reboot and sysrq
3 */
4#include <linux/kernel.h>
5#include <linux/err.h>
6#include <linux/reboot.h>
7#include <linux/sysrq.h>
8
9#include <xen/xenbus.h>
10
11#define SHUTDOWN_INVALID -1
12#define SHUTDOWN_POWEROFF 0
13#define SHUTDOWN_SUSPEND 2
14/* Code 3 is SHUTDOWN_CRASH, which we don't use because the domain can only
15 * report a crash, not be instructed to crash!
16 * HALT is the same as POWEROFF, as far as we're concerned. The tools use
17 * the distinction when we return the reason code to them.
18 */
19#define SHUTDOWN_HALT 4
20
21/* Ignore multiple shutdown requests. */
22static int shutting_down = SHUTDOWN_INVALID;
23
24static void shutdown_handler(struct xenbus_watch *watch,
25 const char **vec, unsigned int len)
26{
27 char *str;
28 struct xenbus_transaction xbt;
29 int err;
30
31 if (shutting_down != SHUTDOWN_INVALID)
32 return;
33
34 again:
35 err = xenbus_transaction_start(&xbt);
36 if (err)
37 return;
38
39 str = (char *)xenbus_read(xbt, "control", "shutdown", NULL);
40 /* Ignore read errors and empty reads. */
41 if (XENBUS_IS_ERR_READ(str)) {
42 xenbus_transaction_end(xbt, 1);
43 return;
44 }
45
46 xenbus_write(xbt, "control", "shutdown", "");
47
48 err = xenbus_transaction_end(xbt, 0);
49 if (err == -EAGAIN) {
50 kfree(str);
51 goto again;
52 }
53
54 if (strcmp(str, "poweroff") == 0 ||
55 strcmp(str, "halt") == 0)
56 orderly_poweroff(false);
57 else if (strcmp(str, "reboot") == 0)
58 ctrl_alt_del();
59 else {
60 printk(KERN_INFO "Ignoring shutdown request: %s\n", str);
61 shutting_down = SHUTDOWN_INVALID;
62 }
63
64 kfree(str);
65}
66
67static void sysrq_handler(struct xenbus_watch *watch, const char **vec,
68 unsigned int len)
69{
70 char sysrq_key = '\0';
71 struct xenbus_transaction xbt;
72 int err;
73
74 again:
75 err = xenbus_transaction_start(&xbt);
76 if (err)
77 return;
78 if (!xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key)) {
79 printk(KERN_ERR "Unable to read sysrq code in "
80 "control/sysrq\n");
81 xenbus_transaction_end(xbt, 1);
82 return;
83 }
84
85 if (sysrq_key != '\0')
86 xenbus_printf(xbt, "control", "sysrq", "%c", '\0');
87
88 err = xenbus_transaction_end(xbt, 0);
89 if (err == -EAGAIN)
90 goto again;
91
92 if (sysrq_key != '\0')
93 handle_sysrq(sysrq_key, NULL);
94}
95
96static struct xenbus_watch shutdown_watch = {
97 .node = "control/shutdown",
98 .callback = shutdown_handler
99};
100
101static struct xenbus_watch sysrq_watch = {
102 .node = "control/sysrq",
103 .callback = sysrq_handler
104};
105
106static int setup_shutdown_watcher(void)
107{
108 int err;
109
110 err = register_xenbus_watch(&shutdown_watch);
111 if (err) {
112 printk(KERN_ERR "Failed to set shutdown watcher\n");
113 return err;
114 }
115
116 err = register_xenbus_watch(&sysrq_watch);
117 if (err) {
118 printk(KERN_ERR "Failed to set sysrq watcher\n");
119 return err;
120 }
121
122 return 0;
123}
124
125static int shutdown_event(struct notifier_block *notifier,
126 unsigned long event,
127 void *data)
128{
129 setup_shutdown_watcher();
130 return NOTIFY_DONE;
131}
132
133static int __init setup_shutdown_event(void)
134{
135 static struct notifier_block xenstore_notifier = {
136 .notifier_call = shutdown_event
137 };
138 register_xenstore_notifier(&xenstore_notifier);
139
140 return 0;
141}
142
143subsys_initcall(setup_shutdown_event);
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 4e527e7893a8..42b3b9ed641d 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -56,6 +56,131 @@
56#include "multicalls.h" 56#include "multicalls.h"
57#include "mmu.h" 57#include "mmu.h"
58 58
59#define P2M_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(unsigned long))
60#define TOP_ENTRIES (MAX_DOMAIN_PAGES / P2M_ENTRIES_PER_PAGE)
61
62/* Placeholder for holes in the address space */
63static unsigned long p2m_missing[P2M_ENTRIES_PER_PAGE]
64 __attribute__((section(".data.page_aligned"))) =
65 { [ 0 ... P2M_ENTRIES_PER_PAGE-1 ] = ~0UL };
66
67 /* Array of pointers to pages containing p2m entries */
68static unsigned long *p2m_top[TOP_ENTRIES]
69 __attribute__((section(".data.page_aligned"))) =
70 { [ 0 ... TOP_ENTRIES - 1] = &p2m_missing[0] };
71
72/* Arrays of p2m arrays expressed in mfns used for save/restore */
73static unsigned long p2m_top_mfn[TOP_ENTRIES]
74 __attribute__((section(".bss.page_aligned")));
75
76static unsigned long p2m_top_mfn_list[
77 PAGE_ALIGN(TOP_ENTRIES / P2M_ENTRIES_PER_PAGE)]
78 __attribute__((section(".bss.page_aligned")));
79
80static inline unsigned p2m_top_index(unsigned long pfn)
81{
82 BUG_ON(pfn >= MAX_DOMAIN_PAGES);
83 return pfn / P2M_ENTRIES_PER_PAGE;
84}
85
86static inline unsigned p2m_index(unsigned long pfn)
87{
88 return pfn % P2M_ENTRIES_PER_PAGE;
89}
90
91/* Build the parallel p2m_top_mfn structures */
92void xen_setup_mfn_list_list(void)
93{
94 unsigned pfn, idx;
95
96 for(pfn = 0; pfn < MAX_DOMAIN_PAGES; pfn += P2M_ENTRIES_PER_PAGE) {
97 unsigned topidx = p2m_top_index(pfn);
98
99 p2m_top_mfn[topidx] = virt_to_mfn(p2m_top[topidx]);
100 }
101
102 for(idx = 0; idx < ARRAY_SIZE(p2m_top_mfn_list); idx++) {
103 unsigned topidx = idx * P2M_ENTRIES_PER_PAGE;
104 p2m_top_mfn_list[idx] = virt_to_mfn(&p2m_top_mfn[topidx]);
105 }
106
107 BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);
108
109 HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
110 virt_to_mfn(p2m_top_mfn_list);
111 HYPERVISOR_shared_info->arch.max_pfn = xen_start_info->nr_pages;
112}
113
114/* Set up p2m_top to point to the domain-builder provided p2m pages */
115void __init xen_build_dynamic_phys_to_machine(void)
116{
117 unsigned long *mfn_list = (unsigned long *)xen_start_info->mfn_list;
118 unsigned long max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages);
119 unsigned pfn;
120
121 for(pfn = 0; pfn < max_pfn; pfn += P2M_ENTRIES_PER_PAGE) {
122 unsigned topidx = p2m_top_index(pfn);
123
124 p2m_top[topidx] = &mfn_list[pfn];
125 }
126}
127
128unsigned long get_phys_to_machine(unsigned long pfn)
129{
130 unsigned topidx, idx;
131
132 if (unlikely(pfn >= MAX_DOMAIN_PAGES))
133 return INVALID_P2M_ENTRY;
134
135 topidx = p2m_top_index(pfn);
136 idx = p2m_index(pfn);
137 return p2m_top[topidx][idx];
138}
139EXPORT_SYMBOL_GPL(get_phys_to_machine);
140
141static void alloc_p2m(unsigned long **pp, unsigned long *mfnp)
142{
143 unsigned long *p;
144 unsigned i;
145
146 p = (void *)__get_free_page(GFP_KERNEL | __GFP_NOFAIL);
147 BUG_ON(p == NULL);
148
149 for(i = 0; i < P2M_ENTRIES_PER_PAGE; i++)
150 p[i] = INVALID_P2M_ENTRY;
151
152 if (cmpxchg(pp, p2m_missing, p) != p2m_missing)
153 free_page((unsigned long)p);
154 else
155 *mfnp = virt_to_mfn(p);
156}
157
158void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
159{
160 unsigned topidx, idx;
161
162 if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) {
163 BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
164 return;
165 }
166
167 if (unlikely(pfn >= MAX_DOMAIN_PAGES)) {
168 BUG_ON(mfn != INVALID_P2M_ENTRY);
169 return;
170 }
171
172 topidx = p2m_top_index(pfn);
173 if (p2m_top[topidx] == p2m_missing) {
174 /* no need to allocate a page to store an invalid entry */
175 if (mfn == INVALID_P2M_ENTRY)
176 return;
177 alloc_p2m(&p2m_top[topidx], &p2m_top_mfn[topidx]);
178 }
179
180 idx = p2m_index(pfn);
181 p2m_top[topidx][idx] = mfn;
182}
183
59xmaddr_t arbitrary_virt_to_machine(unsigned long address) 184xmaddr_t arbitrary_virt_to_machine(unsigned long address)
60{ 185{
61 unsigned int level; 186 unsigned int level;
@@ -98,24 +223,60 @@ void make_lowmem_page_readwrite(void *vaddr)
98} 223}
99 224
100 225
101void xen_set_pmd(pmd_t *ptr, pmd_t val) 226static bool page_pinned(void *ptr)
227{
228 struct page *page = virt_to_page(ptr);
229
230 return PagePinned(page);
231}
232
233static void extend_mmu_update(const struct mmu_update *update)
102{ 234{
103 struct multicall_space mcs; 235 struct multicall_space mcs;
104 struct mmu_update *u; 236 struct mmu_update *u;
105 237
106 preempt_disable(); 238 mcs = xen_mc_extend_args(__HYPERVISOR_mmu_update, sizeof(*u));
239
240 if (mcs.mc != NULL)
241 mcs.mc->args[1]++;
242 else {
243 mcs = __xen_mc_entry(sizeof(*u));
244 MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, DOMID_SELF);
245 }
107 246
108 mcs = xen_mc_entry(sizeof(*u));
109 u = mcs.args; 247 u = mcs.args;
110 u->ptr = virt_to_machine(ptr).maddr; 248 *u = *update;
111 u->val = pmd_val_ma(val); 249}
112 MULTI_mmu_update(mcs.mc, u, 1, NULL, DOMID_SELF); 250
251void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
252{
253 struct mmu_update u;
254
255 preempt_disable();
256
257 xen_mc_batch();
258
259 u.ptr = virt_to_machine(ptr).maddr;
260 u.val = pmd_val_ma(val);
261 extend_mmu_update(&u);
113 262
114 xen_mc_issue(PARAVIRT_LAZY_MMU); 263 xen_mc_issue(PARAVIRT_LAZY_MMU);
115 264
116 preempt_enable(); 265 preempt_enable();
117} 266}
118 267
268void xen_set_pmd(pmd_t *ptr, pmd_t val)
269{
270 /* If page is not pinned, we can just update the entry
271 directly */
272 if (!page_pinned(ptr)) {
273 *ptr = val;
274 return;
275 }
276
277 xen_set_pmd_hyper(ptr, val);
278}
279
119/* 280/*
120 * Associate a virtual page frame with a given physical page frame 281 * Associate a virtual page frame with a given physical page frame
121 * and protection flags for that frame. 282 * and protection flags for that frame.
@@ -179,6 +340,26 @@ out:
179 preempt_enable(); 340 preempt_enable();
180} 341}
181 342
343pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
344{
345 /* Just return the pte as-is. We preserve the bits on commit */
346 return *ptep;
347}
348
349void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
350 pte_t *ptep, pte_t pte)
351{
352 struct mmu_update u;
353
354 xen_mc_batch();
355
356 u.ptr = virt_to_machine(ptep).maddr | MMU_PT_UPDATE_PRESERVE_AD;
357 u.val = pte_val_ma(pte);
358 extend_mmu_update(&u);
359
360 xen_mc_issue(PARAVIRT_LAZY_MMU);
361}
362
182/* Assume pteval_t is equivalent to all the other *val_t types. */ 363/* Assume pteval_t is equivalent to all the other *val_t types. */
183static pteval_t pte_mfn_to_pfn(pteval_t val) 364static pteval_t pte_mfn_to_pfn(pteval_t val)
184{ 365{
@@ -229,24 +410,35 @@ pmdval_t xen_pmd_val(pmd_t pmd)
229 return pte_mfn_to_pfn(pmd.pmd); 410 return pte_mfn_to_pfn(pmd.pmd);
230} 411}
231 412
232void xen_set_pud(pud_t *ptr, pud_t val) 413void xen_set_pud_hyper(pud_t *ptr, pud_t val)
233{ 414{
234 struct multicall_space mcs; 415 struct mmu_update u;
235 struct mmu_update *u;
236 416
237 preempt_disable(); 417 preempt_disable();
238 418
239 mcs = xen_mc_entry(sizeof(*u)); 419 xen_mc_batch();
240 u = mcs.args; 420
241 u->ptr = virt_to_machine(ptr).maddr; 421 u.ptr = virt_to_machine(ptr).maddr;
242 u->val = pud_val_ma(val); 422 u.val = pud_val_ma(val);
243 MULTI_mmu_update(mcs.mc, u, 1, NULL, DOMID_SELF); 423 extend_mmu_update(&u);
244 424
245 xen_mc_issue(PARAVIRT_LAZY_MMU); 425 xen_mc_issue(PARAVIRT_LAZY_MMU);
246 426
247 preempt_enable(); 427 preempt_enable();
248} 428}
249 429
430void xen_set_pud(pud_t *ptr, pud_t val)
431{
432 /* If page is not pinned, we can just update the entry
433 directly */
434 if (!page_pinned(ptr)) {
435 *ptr = val;
436 return;
437 }
438
439 xen_set_pud_hyper(ptr, val);
440}
441
250void xen_set_pte(pte_t *ptep, pte_t pte) 442void xen_set_pte(pte_t *ptep, pte_t pte)
251{ 443{
252 ptep->pte_high = pte.pte_high; 444 ptep->pte_high = pte.pte_high;
@@ -268,7 +460,7 @@ void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
268 460
269void xen_pmd_clear(pmd_t *pmdp) 461void xen_pmd_clear(pmd_t *pmdp)
270{ 462{
271 xen_set_pmd(pmdp, __pmd(0)); 463 set_pmd(pmdp, __pmd(0));
272} 464}
273 465
274pmd_t xen_make_pmd(pmdval_t pmd) 466pmd_t xen_make_pmd(pmdval_t pmd)
@@ -441,6 +633,29 @@ void xen_pgd_pin(pgd_t *pgd)
441 xen_mc_issue(0); 633 xen_mc_issue(0);
442} 634}
443 635
636/*
637 * On save, we need to pin all pagetables to make sure they get their
638 * mfns turned into pfns. Search the list for any unpinned pgds and pin
639 * them (unpinned pgds are not currently in use, probably because the
640 * process is under construction or destruction).
641 */
642void xen_mm_pin_all(void)
643{
644 unsigned long flags;
645 struct page *page;
646
647 spin_lock_irqsave(&pgd_lock, flags);
648
649 list_for_each_entry(page, &pgd_list, lru) {
650 if (!PagePinned(page)) {
651 xen_pgd_pin((pgd_t *)page_address(page));
652 SetPageSavePinned(page);
653 }
654 }
655
656 spin_unlock_irqrestore(&pgd_lock, flags);
657}
658
444/* The init_mm pagetable is really pinned as soon as its created, but 659/* The init_mm pagetable is really pinned as soon as its created, but
445 that's before we have page structures to store the bits. So do all 660 that's before we have page structures to store the bits. So do all
446 the book-keeping now. */ 661 the book-keeping now. */
@@ -498,6 +713,29 @@ static void xen_pgd_unpin(pgd_t *pgd)
498 xen_mc_issue(0); 713 xen_mc_issue(0);
499} 714}
500 715
716/*
717 * On resume, undo any pinning done at save, so that the rest of the
718 * kernel doesn't see any unexpected pinned pagetables.
719 */
720void xen_mm_unpin_all(void)
721{
722 unsigned long flags;
723 struct page *page;
724
725 spin_lock_irqsave(&pgd_lock, flags);
726
727 list_for_each_entry(page, &pgd_list, lru) {
728 if (PageSavePinned(page)) {
729 BUG_ON(!PagePinned(page));
730 printk("unpinning pinned %p\n", page_address(page));
731 xen_pgd_unpin((pgd_t *)page_address(page));
732 ClearPageSavePinned(page);
733 }
734 }
735
736 spin_unlock_irqrestore(&pgd_lock, flags);
737}
738
501void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next) 739void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next)
502{ 740{
503 spin_lock(&next->page_table_lock); 741 spin_lock(&next->page_table_lock);
@@ -591,7 +829,7 @@ void xen_exit_mmap(struct mm_struct *mm)
591 spin_lock(&mm->page_table_lock); 829 spin_lock(&mm->page_table_lock);
592 830
593 /* pgd may not be pinned in the error exit path of execve */ 831 /* pgd may not be pinned in the error exit path of execve */
594 if (PagePinned(virt_to_page(mm->pgd))) 832 if (page_pinned(mm->pgd))
595 xen_pgd_unpin(mm->pgd); 833 xen_pgd_unpin(mm->pgd);
596 834
597 spin_unlock(&mm->page_table_lock); 835 spin_unlock(&mm->page_table_lock);
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index 5fe961caffd4..297bf9f5b8bc 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -25,10 +25,6 @@ enum pt_level {
25 25
26void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags); 26void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
27 27
28void xen_set_pte(pte_t *ptep, pte_t pteval);
29void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
30 pte_t *ptep, pte_t pteval);
31void xen_set_pmd(pmd_t *pmdp, pmd_t pmdval);
32 28
33void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next); 29void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next);
34void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm); 30void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
@@ -45,11 +41,19 @@ pte_t xen_make_pte(pteval_t);
45pmd_t xen_make_pmd(pmdval_t); 41pmd_t xen_make_pmd(pmdval_t);
46pgd_t xen_make_pgd(pgdval_t); 42pgd_t xen_make_pgd(pgdval_t);
47 43
44void xen_set_pte(pte_t *ptep, pte_t pteval);
48void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, 45void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
49 pte_t *ptep, pte_t pteval); 46 pte_t *ptep, pte_t pteval);
50void xen_set_pte_atomic(pte_t *ptep, pte_t pte); 47void xen_set_pte_atomic(pte_t *ptep, pte_t pte);
48void xen_set_pmd(pmd_t *pmdp, pmd_t pmdval);
51void xen_set_pud(pud_t *ptr, pud_t val); 49void xen_set_pud(pud_t *ptr, pud_t val);
50void xen_set_pmd_hyper(pmd_t *pmdp, pmd_t pmdval);
51void xen_set_pud_hyper(pud_t *ptr, pud_t val);
52void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 52void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
53void xen_pmd_clear(pmd_t *pmdp); 53void xen_pmd_clear(pmd_t *pmdp);
54 54
55pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
56void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
57 pte_t *ptep, pte_t pte);
58
55#endif /* _XEN_MMU_H */ 59#endif /* _XEN_MMU_H */
diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c
index 5791eb2e3750..3c63c4da7ed1 100644
--- a/arch/x86/xen/multicalls.c
+++ b/arch/x86/xen/multicalls.c
@@ -29,14 +29,14 @@
29#define MC_DEBUG 1 29#define MC_DEBUG 1
30 30
31#define MC_BATCH 32 31#define MC_BATCH 32
32#define MC_ARGS (MC_BATCH * 16 / sizeof(u64)) 32#define MC_ARGS (MC_BATCH * 16)
33 33
34struct mc_buffer { 34struct mc_buffer {
35 struct multicall_entry entries[MC_BATCH]; 35 struct multicall_entry entries[MC_BATCH];
36#if MC_DEBUG 36#if MC_DEBUG
37 struct multicall_entry debug[MC_BATCH]; 37 struct multicall_entry debug[MC_BATCH];
38#endif 38#endif
39 u64 args[MC_ARGS]; 39 unsigned char args[MC_ARGS];
40 struct callback { 40 struct callback {
41 void (*fn)(void *); 41 void (*fn)(void *);
42 void *data; 42 void *data;
@@ -107,20 +107,48 @@ struct multicall_space __xen_mc_entry(size_t args)
107{ 107{
108 struct mc_buffer *b = &__get_cpu_var(mc_buffer); 108 struct mc_buffer *b = &__get_cpu_var(mc_buffer);
109 struct multicall_space ret; 109 struct multicall_space ret;
110 unsigned argspace = (args + sizeof(u64) - 1) / sizeof(u64); 110 unsigned argidx = roundup(b->argidx, sizeof(u64));
111 111
112 BUG_ON(preemptible()); 112 BUG_ON(preemptible());
113 BUG_ON(argspace > MC_ARGS); 113 BUG_ON(b->argidx > MC_ARGS);
114 114
115 if (b->mcidx == MC_BATCH || 115 if (b->mcidx == MC_BATCH ||
116 (b->argidx + argspace) > MC_ARGS) 116 (argidx + args) > MC_ARGS) {
117 xen_mc_flush(); 117 xen_mc_flush();
118 argidx = roundup(b->argidx, sizeof(u64));
119 }
118 120
119 ret.mc = &b->entries[b->mcidx]; 121 ret.mc = &b->entries[b->mcidx];
120 b->mcidx++; 122 b->mcidx++;
123 ret.args = &b->args[argidx];
124 b->argidx = argidx + args;
125
126 BUG_ON(b->argidx > MC_ARGS);
127 return ret;
128}
129
130struct multicall_space xen_mc_extend_args(unsigned long op, size_t size)
131{
132 struct mc_buffer *b = &__get_cpu_var(mc_buffer);
133 struct multicall_space ret = { NULL, NULL };
134
135 BUG_ON(preemptible());
136 BUG_ON(b->argidx > MC_ARGS);
137
138 if (b->mcidx == 0)
139 return ret;
140
141 if (b->entries[b->mcidx - 1].op != op)
142 return ret;
143
144 if ((b->argidx + size) > MC_ARGS)
145 return ret;
146
147 ret.mc = &b->entries[b->mcidx - 1];
121 ret.args = &b->args[b->argidx]; 148 ret.args = &b->args[b->argidx];
122 b->argidx += argspace; 149 b->argidx += size;
123 150
151 BUG_ON(b->argidx > MC_ARGS);
124 return ret; 152 return ret;
125} 153}
126 154
diff --git a/arch/x86/xen/multicalls.h b/arch/x86/xen/multicalls.h
index 8bae996d99a3..858938241616 100644
--- a/arch/x86/xen/multicalls.h
+++ b/arch/x86/xen/multicalls.h
@@ -45,4 +45,16 @@ static inline void xen_mc_issue(unsigned mode)
45/* Set up a callback to be called when the current batch is flushed */ 45/* Set up a callback to be called when the current batch is flushed */
46void xen_mc_callback(void (*fn)(void *), void *data); 46void xen_mc_callback(void (*fn)(void *), void *data);
47 47
48/*
49 * Try to extend the arguments of the previous multicall command. The
50 * previous command's op must match. If it does, then it attempts to
51 * extend the argument space allocated to the multicall entry by
52 * arg_size bytes.
53 *
54 * The returned multicall_space will return with mc pointing to the
55 * command on success, or NULL on failure, and args pointing to the
56 * newly allocated space.
57 */
58struct multicall_space xen_mc_extend_args(unsigned long op, size_t arg_size);
59
48#endif /* _XEN_MULTICALLS_H */ 60#endif /* _XEN_MULTICALLS_H */
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 82517e4a752a..e0a39595bde3 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -13,9 +13,11 @@
13#include <asm/vdso.h> 13#include <asm/vdso.h>
14#include <asm/e820.h> 14#include <asm/e820.h>
15#include <asm/setup.h> 15#include <asm/setup.h>
16#include <asm/acpi.h>
16#include <asm/xen/hypervisor.h> 17#include <asm/xen/hypervisor.h>
17#include <asm/xen/hypercall.h> 18#include <asm/xen/hypercall.h>
18 19
20#include <xen/page.h>
19#include <xen/interface/callback.h> 21#include <xen/interface/callback.h>
20#include <xen/interface/physdev.h> 22#include <xen/interface/physdev.h>
21#include <xen/features.h> 23#include <xen/features.h>
@@ -27,8 +29,6 @@
27extern const char xen_hypervisor_callback[]; 29extern const char xen_hypervisor_callback[];
28extern const char xen_failsafe_callback[]; 30extern const char xen_failsafe_callback[];
29 31
30unsigned long *phys_to_machine_mapping;
31EXPORT_SYMBOL(phys_to_machine_mapping);
32 32
33/** 33/**
34 * machine_specific_memory_setup - Hook for machine specific memory setup. 34 * machine_specific_memory_setup - Hook for machine specific memory setup.
@@ -38,9 +38,31 @@ char * __init xen_memory_setup(void)
38{ 38{
39 unsigned long max_pfn = xen_start_info->nr_pages; 39 unsigned long max_pfn = xen_start_info->nr_pages;
40 40
41 max_pfn = min(MAX_DOMAIN_PAGES, max_pfn);
42
41 e820.nr_map = 0; 43 e820.nr_map = 0;
42 add_memory_region(0, LOWMEMSIZE(), E820_RAM); 44
43 add_memory_region(HIGH_MEMORY, PFN_PHYS(max_pfn)-HIGH_MEMORY, E820_RAM); 45 e820_add_region(0, PFN_PHYS(max_pfn), E820_RAM);
46
47 /*
48 * Even though this is normal, usable memory under Xen, reserve
49 * ISA memory anyway because too many things think they can poke
50 * about in there.
51 */
52 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
53 E820_RESERVED);
54
55 /*
56 * Reserve Xen bits:
57 * - mfn_list
58 * - xen_start_info
59 * See comment above "struct start_info" in <xen/interface/xen.h>
60 */
61 e820_add_region(__pa(xen_start_info->mfn_list),
62 xen_start_info->pt_base - xen_start_info->mfn_list,
63 E820_RESERVED);
64
65 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
44 66
45 return "Xen"; 67 return "Xen";
46} 68}
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 94e69000f982..d2e3c20127d7 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -35,7 +35,7 @@
35#include "xen-ops.h" 35#include "xen-ops.h"
36#include "mmu.h" 36#include "mmu.h"
37 37
38static cpumask_t xen_cpu_initialized_map; 38cpumask_t xen_cpu_initialized_map;
39static DEFINE_PER_CPU(int, resched_irq) = -1; 39static DEFINE_PER_CPU(int, resched_irq) = -1;
40static DEFINE_PER_CPU(int, callfunc_irq) = -1; 40static DEFINE_PER_CPU(int, callfunc_irq) = -1;
41static DEFINE_PER_CPU(int, debug_irq) = -1; 41static DEFINE_PER_CPU(int, debug_irq) = -1;
@@ -65,6 +65,12 @@ static struct call_data_struct *call_data;
65 */ 65 */
66static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id) 66static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id)
67{ 67{
68#ifdef CONFIG_X86_32
69 __get_cpu_var(irq_stat).irq_resched_count++;
70#else
71 add_pda(irq_resched_count, 1);
72#endif
73
68 return IRQ_HANDLED; 74 return IRQ_HANDLED;
69} 75}
70 76
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
new file mode 100644
index 000000000000..251669a932d4
--- /dev/null
+++ b/arch/x86/xen/suspend.c
@@ -0,0 +1,45 @@
1#include <linux/types.h>
2
3#include <xen/interface/xen.h>
4#include <xen/grant_table.h>
5#include <xen/events.h>
6
7#include <asm/xen/hypercall.h>
8#include <asm/xen/page.h>
9
10#include "xen-ops.h"
11#include "mmu.h"
12
13void xen_pre_suspend(void)
14{
15 xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
16 xen_start_info->console.domU.mfn =
17 mfn_to_pfn(xen_start_info->console.domU.mfn);
18
19 BUG_ON(!irqs_disabled());
20
21 HYPERVISOR_shared_info = &xen_dummy_shared_info;
22 if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_PARAVIRT_BOOTMAP),
23 __pte_ma(0), 0))
24 BUG();
25}
26
27void xen_post_suspend(int suspend_cancelled)
28{
29 xen_setup_shared_info();
30
31 if (suspend_cancelled) {
32 xen_start_info->store_mfn =
33 pfn_to_mfn(xen_start_info->store_mfn);
34 xen_start_info->console.domU.mfn =
35 pfn_to_mfn(xen_start_info->console.domU.mfn);
36 } else {
37#ifdef CONFIG_SMP
38 xen_cpu_initialized_map = cpu_online_map;
39#endif
40 xen_vcpu_restore();
41 xen_timer_resume();
42 }
43
44}
45
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 41e217503c96..685b77470fc3 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -197,8 +197,8 @@ unsigned long long xen_sched_clock(void)
197} 197}
198 198
199 199
200/* Get the CPU speed from Xen */ 200/* Get the TSC speed from Xen */
201unsigned long xen_cpu_khz(void) 201unsigned long xen_tsc_khz(void)
202{ 202{
203 u64 xen_khz = 1000000ULL << 32; 203 u64 xen_khz = 1000000ULL << 32;
204 const struct pvclock_vcpu_time_info *info = 204 const struct pvclock_vcpu_time_info *info =
@@ -459,6 +459,19 @@ void xen_setup_cpu_clockevents(void)
459 clockevents_register_device(&__get_cpu_var(xen_clock_events)); 459 clockevents_register_device(&__get_cpu_var(xen_clock_events));
460} 460}
461 461
462void xen_timer_resume(void)
463{
464 int cpu;
465
466 if (xen_clockevent != &xen_vcpuop_clockevent)
467 return;
468
469 for_each_online_cpu(cpu) {
470 if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL))
471 BUG();
472 }
473}
474
462__init void xen_time_init(void) 475__init void xen_time_init(void)
463{ 476{
464 int cpu = smp_processor_id(); 477 int cpu = smp_processor_id();
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 6ec3b4f7719b..7c0cf6320a0a 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -7,6 +7,7 @@
7#include <linux/init.h> 7#include <linux/init.h>
8#include <asm/boot.h> 8#include <asm/boot.h>
9#include <xen/interface/elfnote.h> 9#include <xen/interface/elfnote.h>
10#include <asm/xen/interface.h>
10 11
11 __INIT 12 __INIT
12ENTRY(startup_xen) 13ENTRY(startup_xen)
@@ -32,5 +33,9 @@ ENTRY(hypercall_page)
32 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "!writable_page_tables|pae_pgdir_above_4gb") 33 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "!writable_page_tables|pae_pgdir_above_4gb")
33 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") 34 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes")
34 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") 35 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
36 ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,
37 .quad _PAGE_PRESENT; .quad _PAGE_PRESENT)
38 ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
39 ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long __HYPERVISOR_VIRT_START)
35 40
36#endif /*CONFIG_XEN */ 41#endif /*CONFIG_XEN */
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index f1063ae08037..d852ddbb3448 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -9,26 +9,35 @@
9extern const char xen_hypervisor_callback[]; 9extern const char xen_hypervisor_callback[];
10extern const char xen_failsafe_callback[]; 10extern const char xen_failsafe_callback[];
11 11
12struct trap_info;
12void xen_copy_trap_info(struct trap_info *traps); 13void xen_copy_trap_info(struct trap_info *traps);
13 14
14DECLARE_PER_CPU(unsigned long, xen_cr3); 15DECLARE_PER_CPU(unsigned long, xen_cr3);
15DECLARE_PER_CPU(unsigned long, xen_current_cr3); 16DECLARE_PER_CPU(unsigned long, xen_current_cr3);
16 17
17extern struct start_info *xen_start_info; 18extern struct start_info *xen_start_info;
19extern struct shared_info xen_dummy_shared_info;
18extern struct shared_info *HYPERVISOR_shared_info; 20extern struct shared_info *HYPERVISOR_shared_info;
19 21
22void xen_setup_mfn_list_list(void);
23void xen_setup_shared_info(void);
24
20char * __init xen_memory_setup(void); 25char * __init xen_memory_setup(void);
21void __init xen_arch_setup(void); 26void __init xen_arch_setup(void);
22void __init xen_init_IRQ(void); 27void __init xen_init_IRQ(void);
23void xen_enable_sysenter(void); 28void xen_enable_sysenter(void);
29void xen_vcpu_restore(void);
30
31void __init xen_build_dynamic_phys_to_machine(void);
24 32
25void xen_setup_timer(int cpu); 33void xen_setup_timer(int cpu);
26void xen_setup_cpu_clockevents(void); 34void xen_setup_cpu_clockevents(void);
27unsigned long xen_cpu_khz(void); 35unsigned long xen_tsc_khz(void);
28void __init xen_time_init(void); 36void __init xen_time_init(void);
29unsigned long xen_get_wallclock(void); 37unsigned long xen_get_wallclock(void);
30int xen_set_wallclock(unsigned long time); 38int xen_set_wallclock(unsigned long time);
31unsigned long long xen_sched_clock(void); 39unsigned long long xen_sched_clock(void);
40void xen_timer_resume(void);
32 41
33irqreturn_t xen_debug_interrupt(int irq, void *dev_id); 42irqreturn_t xen_debug_interrupt(int irq, void *dev_id);
34 43
@@ -54,6 +63,8 @@ int xen_smp_call_function_single(int cpu, void (*func) (void *info), void *info,
54int xen_smp_call_function_mask(cpumask_t mask, void (*func)(void *), 63int xen_smp_call_function_mask(cpumask_t mask, void (*func)(void *),
55 void *info, int wait); 64 void *info, int wait);
56 65
66extern cpumask_t xen_cpu_initialized_map;
67
57 68
58/* Declare an asm function, along with symbols needed to make it 69/* Declare an asm function, along with symbols needed to make it
59 inlineable */ 70 inlineable */